跳到主要內容

發表文章

目前顯示的是 7月, 2024的文章

自動化簡體轉繁體

 最近項目是台灣這邊的, 但使用到的是之前大陸製作的source, 一直沒處理, 這邊製作了 python 進行簡體轉繁體處理 import os import glob import zhconv root_path = r"g:/OlgCase/bbm/source/Web/" subdir = ["application"] def getSubFileonFolder(path): count = 0 for path, subdirs, files in os.walk(path): for name in files: fn = os.path.join(path, name) if fn.endswith(".js"): print('[js]fn:' + fn) count+=1 testWriteFile(fn) elif fn.endswith(".php"): print('[php]fn:' + fn) count+=1 testWriteFile(fn) print("檔案數",count) def testWriteFile(path): fn = path f = open(path, mode='r') content = f.read() f.close() content2 = zhconv.convert(content, 'zh-tw') with open(fn, "w", encoding="UTF-8", newline='\n') as file: file.write(content2) ...

Execution failed for task ':launcher:processDebugResources'.

 最近為了處理 Google Play 升級問題, 遇到了奇怪的情況, 記錄下來, GP 要求 app 需要升級 android 版本跟支付庫版本 應用程式必須指定 Android 14 (API 級別 34) 以上版本 應用程式必須使用 Google Play 帳款服務程式庫 6.0.1 以上版本 升級上沒多想就把 unity 的版本選擇了  運行 As 最後執行 Make Project 出現錯誤 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':launcher:processDebugResources'. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade    > AAPT2 aapt2-4.0.1-6197926-windows Daemon #0: Unexpected error during link, attempting to stop daemon.      This should not happen under normal circumstances, please file an issue if it does. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':unityLibr...

INSTALL_PARSE_FAILED_MANIFEST_MALFORMED 錯誤

在 AS 連機執行 Play 出現錯誤  INSTALL_PARSE_FAILED_MANIFEST_MALFORMED 可能是 manifest 問題, 但 AS 沒提示哪邊有錯誤, 索性打包 aab 丟到 Google play 看看 上船完成後提示 您上傳的 APK 或 Android App Bundle 內含活動、活動別名、服務或廣播接收器,這些項目含有意圖篩選器,但沒有「android:exported」設定屬性。您無法在 Android 12 以上版本上安裝這個檔案。詳情請參閱:developer.android.com/about/versions/12/behavior-changes-12#exported AndroidManifest.xml 缺少 export 屬性, 加入屬性到 <activity 底下就可以 android :exported ="true"

關閉送審 google play billing 功能

上傳 google play 提交版本時出現錯誤 您的應用程式目前採用第 3.0.3 版 play 帳款服務程式庫,但至少須更新至第 5.2.1 版,才能使用 google play 的最新營利功能 這是因為上傳 aab 裡面使用到了 billing 是 3.0.3 版本的, 發現項目並沒有使用 billing 功能索性就刪除掉了 unityLibrary/build.grade implementation(name: 'billing-3.0.3', ext:'aar') // 刪除 unityLibrary/src/main/AndroidManifest.xml <uses-permission android:name="com.android.vending.BILLING" />    // 刪除   

解決 buildToolsVersion34.0.0 出錯 Android Installed Build Tools revision 34.0.0 is corrupted. Remove

 今天打包時 AS 出現錯誤 Android Installed Build Tools revision 34.0.0 is corrupted. Remove and install again using the SDK 切換到  \Android-SDK\build-tools\33.0.0\  將d8.bat改成dx.bat,  切換到   \Android-SDK\build-tools\33.0.0\lib   將d8.jar改成dx.jar  再回去 AS, build / Make Project 可以運行了

打包pc版本, 運行錯誤 Linq.Groupby 無法在 ILRuntime 下使用

IL_0066: call System.Collections.Generic.IEnumerable`1<System.Linq.IGrouping`2<!!1,!!0>> System.Linq.Enumerable::GroupBy<System.Int32,System.Int32>(System.Collections.Generic.IEnumerable`1<!!0>,System.Func`2<!!0,!!1>)  打包了pc版本, 運行時出現錯誤, 查了下 ILRuntime 官方, 總覺得 Linq 似乎沒法用 RegisterFunctionDelegate 解決, 查了網上說的的確只能自己改寫功能 private List<int> getUniqNumList(List<int> nums) { List<int> ret = new List<int>(); Dictionary<int, int> groupCounts = new Dictionary<int, int>(); foreach (int num in nums) { if (!groupCounts.TryGetValue(num, out int oNum)) groupCounts[num] = 1; else groupCounts[num]++; } foreach(int k in groupCounts.Keys) { if (groupCounts[k] == 1) ret.Add(k); } return ret; } #if ILRuntime List<int> guess_one = this.getUniqNumList(guess_list); #else List<int> guess_one = guess_list.GroupBy(x => x).Where(x => x.Count() == 1).Select(x => x.Key).ToList(); #endif

PC打包問題 error: Could not set up a toolchain for Architecture x64.

打包PC版本 error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details: Internal build system error. BuildProgram exited with code -2146233088. error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed: * Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended) * Visual Studio 2019 with C++ compilers and Windows 10 SDK * Visual Studio 2017 with C++ compilers and Windows 10 SDK * Visual Studio 2015 with C++ compilers and Windows 10 SDK Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables. Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as wel...

opencv 安裝失敗

 $ pip install opencv-python 出現錯誤, python setup.py egg_info 需要升级 pip 版本 $ pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ 安裝失敗, 後來去官網下載安裝檔升級 安裝 opencv 老是失敗, 應該是被牆了, 但掛了vpn還是無效 $ pip install opencv-python -i https://mirrors.aliyun.com/pypi/simple/ 直接到網上下載檔案安裝, windows 選擇 win_amd64 格式 https://pypi.tuna.tsinghua.edu.cn/simple/opencv-python/ 安裝檔案 $ pip install opencv_python-4.5.5.64-cp36-abi3-win_amd64.whl 查看安裝清單 $ pip list

Sprite Renderer 使用

將轟炸超人從 gui 系統改成使用 sprite rendere 過程中遇到不少問題, 圖片 PPU 設定為 100 Camera size設定為3.6,原本是在 1280x720比例下製作, Camera 場景Y軸高度預設為 11~12 個 Chunk , Camera size 代表著 Y軸高度的一半, 所以設計為 0.5 x 720 = 360, 因為PPU為100, 所以 Camera.size = 360/100 = 3.6 編輯器下結果 遊戲執行出來的效果 場景裝飾物件調整位置, 這張背景圖大小 1440 x 960, 所以物件位置在 0.5 x 1440 = 720 / 100 = 7.2 另外 sprite renderer 的 width、height 沒有效果的, 所以改為 (0, 0), 另外把 ugui tiled 模式改成 Continuous 模式, Height 設定為 4.8, 因為 scale = 5 所以 tiled 高度為 0.5 x 960 = 480 / 100 = 4.8。 另外 sprite render 顯示層級是依靠 position.z 決定的, 值越小顯示層級越高, 在地圖邊緣用了兩個插件物件, 樹木跟樹葉底, 這時候就要設定posZ值了, 將樹木 posZ 設定為 -1 在編輯器裡面有很多非常大的框, 這是文字的 transform 沒有對應修改, 把 width, height 改成(0.6, 0)

使用spine經驗

 使用spine二進制格式, 勾選導出二進制並勾選紋理打包 將 .skel 改為 .skel.bytes, .atlas 改為 .atlas.txt 複製到 unity unity會生成對應 SkeletonData  導入unity之前需要安裝 spine-unity runtime, 下載地址如下 https://zh.esotericsoftware.com/spine-unity-download ※ 如果 spine 導出 json 格式, 只要把 .atlas 改成 .atlas.txt 就行了 QA1. 導入spine資源出現白邊 點 S_Character_01_Material 將 Straight Alpha Texture 打勾就好了 測試了 spine 導出 Premultiplied Alpha (PMA) 效果 pma效果會有明顯的外邊, 但有的看起來會奇怪 ※ Texture 打包器启用 Premultiply alpha  Unity Texture 设置中禁用 sRGB (Color Texture) 和 Alpha Is Transparency , Unity Material 参数中禁用 Straight Alpha Texture  ※Texture 打包器禁用 Premultiply alpha , 启用 Bleed  Unity Texture 设置启用 sRGB (Color Texture) 和 Alpha Is Transparency , Unity Material 参数中启用 Straight Alpha Texture