跳到主要內容

發表文章

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

This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

 今天在同步本地sql到gcp mysql時發生了這個錯誤 [ERR] 1> 1418 - This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) 切換到 gcp sql  選擇編輯設定, 在下面新增flag 新增對應flag,  log_bin_trust_function_creators 確認後保存。 最後在執行一次同步, 可以了。

搭建 LM Studio (一)

前往官網下載 windows 版本 https://lmstudio.ai/ 安裝後執行, 切換到 Search, 搜索後出現 network error 切換到安裝目錄下, 搜索  HuggingFace.co  替換成 hf-mirror.com https://hf-mirror.com/ 重啟 Lm Studio 搜索 TAIDE-LX-7B-Chat 出現結果了 點下載 TAIDE-LX-78-Chat.Q2_K.gguf 另外, 我把下載 model 修改掉了, 具體切換到 My Models 分頁, 點 Change 修改目錄 可以看到已經在下載了

Optional Chaining problem

 把 cocos creator 2.4 項目 export 到目前項目發現 cocos creator 開啟就卡在讀取中 2024-05-28T18:22:26.151Z - success: wechatgame loaded 2024-05-28T18:22:26.168Z - success: xiaomi-runtime loaded 2024-05-28T18:22:26.572Z - success: im-plugin loaded 2024-05-28T18:22:27.776Z - info: Cocos Service load base data! 2024-05-28T18:22:28.381Z - normal: Initializing Cocos2d 2024-05-28T18:22:28.794Z - normal: Initializing engine extends 項目開啟卡在 extends, 之前有遇過就是腳本問題, 分批把資源跟腳本分開匯入發現是腳本問題 //typescript 3.7 support this.level = data?.level || 1 //改成這個寫法就好了 this.level = data?data.level || 1:undefined https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html Optional Chaining 在3.7版本的說明 從 Cocos Creator 論壇看到功能在 3.0 才支持, 不知道為什麼原始項目卻能跑

c# 接入StackExchange.Redis

使用 nuget 安裝 StackExchange.Redis 套件 連線方式 ConfigurationOptions options = new ConfigurationOptions { EndPoints = { { "127.0.0.1", 6379 } }, }; ConnectionMultiplexer muxer = ConnectionMultiplexer.Connect(options); IDatabase conn = muxer.GetDatabase(1); 設定string數據 conn.StringSet("name", "chung chen"); string name = conn.StringGet("name"); //get value async var pending = conn.StringGetAsync("name"); string value2 = conn.Wait(pending); HashSet var list = new List<User>{      new User { Index = 1, Name = "立白" },      new User { Index = 2, Name = "妄为" },      new User { Index = 3, Name = "毒妇" }      }; foreach (var item in list){      var hashEntries = new HashEntry[] {           new HashEntry("ID", item.Index),           new HashEntry("Name", item.Name)      };      conn.HashSet("User_" + item.Index.ToString(), hashEntrie...

add canvas cause button click not work

 在使用 Canvas 將物件層級提高後出現一個問題, 被提高層級的物件跟底下的 Button Click 全都失效了, 查了 google 說是在添加 Canvas 同時必須增加 Graphic Raycaster, 如下, 這樣就能解決問題了

新手引導UI設計

 最近在做新手引導系統, 遇到了些問題, 先說說新手引導的設計吧 一、新手引導UI 預設作法如下, 去看了下以前的做法似乎有些問題需要解決, 以前用 NGUI 做這塊, 需要將目標 UI 顯示層級提上來, 當時我的作法是把目標 Button parent 換成教學 UI Panel, 這樣就能保證要點擊目標一定會在最上層 現在項目使用 UGUI, UGUI 顯示層級是看 UI 順序的, 不然就是修改 Sorting Layer 或 Order in Layer [Sorting Layer] Sorting Layer 可以想像是一個大類, 在這個列表下渲染是按照這個清單順序的, 譬如 A物件    Sorting layer:  UI    Order in Layer: 10 B物件    Sorting layer: Fx    Order in Layer: 1 就算你設定比較高的 Order in Layer, A物件也不可能比B物件層級高, 這是因為在 Sorting Layer 就已經決定誰高誰低了 Order in Layer 在同一個 Sorting Layer 下你可以藉由 Order in Layer 決定先後, 值越大層級越高 在 Sprite Renderer 可以設定這兩個值 Spine 用的 Mesh Renderer 雖然沒有, 但其實都是繼承 render, 可以直接調用修改 mSpine_Teacher.GetComponent<MeshRenderer>().sortingLayerID = SortingLayer.NameToID("Spine"); mSpine_Teacher.GetComponent<MeshRenderer>().sortingOrder = 1; 最後呈現出來的效果是這樣

'Activator.CreateInstance(type)' threw an exception of type 'System.MissingMethodException'

服務端跑起來發現出現了很多警告,  警告內容是註冊消息 OpCode = 0, 警告如下 消息opcode为0: C2S_BomberGame_QueryFrameMessage 順著流程查看 L ist<Type> types = Game.EventSystem.GetTypes(typeof(MessageAttribute)); foreach (Type type in types) {      object[] attrs = type.GetCustomAttributes(typeof(MessageAttribute), false);      if (attrs.Length == 0){           continue;      }      MessageAttribute messageAttribute = attrs[0] as MessageAttribute;      if (messageAttribute == null){           continue;      this.typeMessages.Add(messageAttribute.Opcode, Activator.CreateInstance(type));      this.opcodeTypes.Add(messageAttribute.Opcode, type); } public ushort GetOpcode(Type type) {     return this.opcodeTypes.GetKeyByValue(type); } 發現 opcodeTypes 跑到一半就crash了, 這個框架一直有個致命的問題就是流程上有exception部會跳出提示, 有時候就需要下來下斷點查看....有空真的必須好好看看這個問題怎麼解決 發現  Activa...

Chloe Procedure 使用

在開發好友系統時, 做了個功能叫做推薦名單, 也就是將最近對戰的玩家記錄到數據表上, 再推給客戶端, 但在獲取數據時發現必須過濾掉已經添加的清單, 索性在表格上添加了一個字段來紀錄是否有效 後來發現Chloe處理這段很麻煩, 沒查到官方有 replace 的功能, 所以自己用了 procedure 來處理, 有點久沒用研究了下 Chole 怎麼調用 官方文檔說明 https://github.com/shuxinqin/Chloe/wiki/Oracle-procedure 兩個寫法不一樣,  dbContext . SqlQuery < Person > 是直接獲取 Procedure 返回數據的, 就譬如 procedure 最後面寫了 select * from user limit 1; 可以透過這個方式獲取返回的 user 資料, 而  ExecuteNonQuery ( " Proc_GetPersonName " , CommandType . StoredProcedure , id , outputName ) 則是透過 Procedure 的 out 獲取數據 我們在更新 recent 表格同時也要獲取 recent 數據, 作法如果 DbParam iUserId = new DbParam("@iUserId", userId); DbParam iRUserId = new DbParam("@iRUserId", recentUserId); DbParam iState = new DbParam("@iState", 1); dbContext.SqlQuery<Tbl_Recent>("proc_update_recent", CommandType.StoredProcedure, iUserId, iRUserId, iState); 這是一個沒有 return 的 procedure 調用方式, Procedure 如下 CREATE DEFINER=`root`@`127.0.0.1` PROCEDURE `proc_update_recent`( IN `iUserId` int, IN `...

AssetStudioGUI 使用

 AssetStudioGUI 可以用來查看 Unity 包體內容, 可以多看看其他優質產品的資源內容怎麼做的 首先開啟 AssetStudioGUI  將 unity 的包給解壓, 用來測試的是之前上傳 Google Play 的 RummyGo aab包 AssetStudioGUI  點擊 文件->加載目錄, 選擇解壓目錄 切換到資源列表, 並點類型排序 可以直接查看包體內容

IL_00af: call System.Int32& System.Int32[0...,0...]::Address

 打包app執行轟炸超人發現遊戲開局就crash了.... 在pc上複查發現這個錯誤 最後發現是這邊出錯, int[,]在查詢數據時 address 不知道為什麼出錯了 for (int j = 0; j < map.MapConfig.ChunkH; j++){ strm += "["; for (int i = 0; i < map.MapConfig.ChunkW; i++){                 //這邊出錯 strm += matrixData[j, i] + ","; } strm += "],"; } strm += "]"; 詳細錯誤如下 IL_00af: call System.Int32& System.Int32[0...,0...]::Address(System.Int32,System.Int32) at ETHotfix.AIPlayer.calcNonPath(System.Int32 depth) (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AIPlayer.cs:366) at ETHotfix.AIPlayer.calcPath() (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AIPlayer.cs:200) at ETHotfix.AIPlayer.V_Think() (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AIPlayer.cs:86) at ETHotfix.AIPlayer.think() (at G:/OlgCase/bbm/source/Unity/Assets/Hotfix/GameGather/Bomber/AI/AIPlayer.cs:79) at ETHotfix.AILogic.UpdateLogic() (at G:/OlgCase/bbm/source/Unity...