diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 10f3f89..ccbf76d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -7,8 +7,10 @@ - - + + + + diff --git a/笔记文件/2.笔记/协程管理器.md b/笔记文件/2.笔记/协程管理器.md new file mode 100644 index 0000000..952314d --- /dev/null +++ b/笔记文件/2.笔记/协程管理器.md @@ -0,0 +1,95 @@ +#unity/日常积累 + +首先是是抽象出来的接口 + +![[Pasted image 20250416142333.png]] + +然后,是对于接口的,具体逻辑实现: +先是单例的处理,然后用哈希表,去存储协程相关,参考[[HashSet]] + +![[Pasted image 20250416142501.png]] + +再然后,就是管理相关协程的,具体实现了; + +## CoroutineManager + +``` cs +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +/// +/// 协程管理器 +/// +public interface ICoroutineManager +{ + /// + /// 启动受管理的协程 + /// + Coroutine StartManagedCoroutine(IEnumerator routine); + + /// + /// 停止指定协程 + /// + void StopManagedCoroutine(Coroutine coroutine); + + /// + /// 停止所有协程 + /// + void StopAllManagedCoroutines(); +} + +public class CoroutineManager : MonoBehaviour, ICoroutineManager +{ + private static CoroutineManager _instance; + private readonly HashSet _activeCoroutines = new HashSet(); + + public static ICoroutineManager Instance + { + get + { + if (_instance == null) + { + var go = new GameObject("CoroutineManager"); + DontDestroyOnLoad(go); + _instance = go.AddComponent(); + } + return _instance; + } + } + + public Coroutine StartManagedCoroutine(IEnumerator routine) + { + var coroutine = StartCoroutine(WrappedCoroutine(routine)); + _activeCoroutines.Add(coroutine); + return coroutine; + } + + public void StopManagedCoroutine(Coroutine coroutine) + { + if (coroutine != null && _activeCoroutines.Contains(coroutine)) + { + StopCoroutine(coroutine); + _activeCoroutines.Remove(coroutine); + } + } + + public void StopAllManagedCoroutines() + { + foreach (var coroutine in _activeCoroutines) + { + if (coroutine != null) + { + StopCoroutine(coroutine); + } + } + _activeCoroutines.Clear(); + } + + private IEnumerator WrappedCoroutine(IEnumerator routine) + { + yield return routine; + _activeCoroutines.Remove(StartCoroutine(routine)); + } +} +``` \ No newline at end of file diff --git a/笔记文件/2.笔记/安卓aar生成后,导入Unity注意事项.md b/笔记文件/2.笔记/安卓aar生成后,导入Unity注意事项.md new file mode 100644 index 0000000..d474d44 --- /dev/null +++ b/笔记文件/2.笔记/安卓aar生成后,导入Unity注意事项.md @@ -0,0 +1,20 @@ +#unity/日常积累 +#安卓 + +例如,已经有一个安卓的aar,导入到unity了,它的package名字是`com.cgbu.api` + +![[Pasted image 20250416135441.png]] + +这时,如果有另一个aar也生成了,要导入到unity; +如果还是使用相同的package名,打安卓包,就会报错提示,有重复冲突; + +可以选中package文件夹后,直接重命名 + +![[Pasted image 20250416135734.png]] + +![[Pasted image 20250416135717.png]] + +再导入unity引用,就不会有报错相关了; +需要稍微注意的是,引用相关的命名,也是要同步修改 + +![[Pasted image 20250416135925.png]] \ No newline at end of file diff --git a/笔记文件/2.笔记/瀑布 新项目 临时记录.md b/笔记文件/2.笔记/瀑布 新项目 临时记录.md index 54a1b84..df09ff4 100644 --- a/笔记文件/2.笔记/瀑布 新项目 临时记录.md +++ b/笔记文件/2.笔记/瀑布 新项目 临时记录.md @@ -1,4 +1,5 @@ #灵感 + ![[Pasted image 20250115163753.png]] ![[Pasted image 20250115163705.png]] diff --git a/笔记文件/2.笔记/震动插件 问题.md b/笔记文件/2.笔记/震动插件 问题.md index 4aee674..b87f45e 100644 --- a/笔记文件/2.笔记/震动插件 问题.md +++ b/笔记文件/2.笔记/震动插件 问题.md @@ -48,4 +48,6 @@ overlayJsonClip = JsonSerializer.SerializeToUtf8Bytes(currentHapticConfig, optio 震动 三消 项目组 外部调用: -![[Pasted image 20250327141412.png]] \ No newline at end of file +![[Pasted image 20250327141412.png]] + +![[img_v3_02kg_f50ceda0-d544-42d9-ac26-66d94aeb69hu.jpg]] \ No newline at end of file diff --git a/笔记文件/日记/2025_04_04_星期五.md b/笔记文件/日记/2025_04_04_星期五.md index 9a6d27a..2cb51c2 100644 --- a/笔记文件/日记/2025_04_04_星期五.md +++ b/笔记文件/日记/2025_04_04_星期五.md @@ -26,7 +26,6 @@ - [x] 买一下鸡胸肉冻干 - [x] 记得拍身份证照片 预约 护照办理 - [x] 记得买沐浴露 -- [ ] 写一个灵动平台的测试用例,放到测试手机上跑 - [ ] vue入门和进阶 --- diff --git a/笔记文件/日记/2025_04_15_星期二.md b/笔记文件/日记/2025_04_15_星期二.md index bf09e09..3eb30ed 100644 --- a/笔记文件/日记/2025_04_15_星期二.md +++ b/笔记文件/日记/2025_04_15_星期二.md @@ -23,7 +23,7 @@ - [x] 记得今天要去拿 咖啡快递 - [x] 申请一下 PerfSight 试用 -- [ ] 彻底解决,震动插件Unable to seek的问题 +- [x] 彻底解决,震动插件Unable to seek的问题 - [x] 添加一下 Adjust的发包还有回包log打印,确定符合设计预期 - [x] 重新生成一下,安卓aar相关,去掉多余的引用和代码逻辑 - [x] 服务器逻辑,创建一个,新的数据库,存放新的表 diff --git a/笔记文件/日记/2025_04_16_星期三.md b/笔记文件/日记/2025_04_16_星期三.md index bd03aaa..4386d8f 100644 --- a/笔记文件/日记/2025_04_16_星期三.md +++ b/笔记文件/日记/2025_04_16_星期三.md @@ -22,6 +22,9 @@ # 今日任务 - [ ] 买多一套 四件套 备用 +- [ ] 基于sqlite的机制和逻辑,添加结构,完善一下 临时id和真实id,匹配的机制 +- [ ] 写一个灵动平台的测试用例,放到测试手机上跑,需要包含发送基础消息的机制,登录和删号和重新登录的机制 --- - +[[安卓aar生成后,导入Unity注意事项]] +[[协程管理器]] # Journal diff --git a/笔记文件/附件/Pasted image 20250416135441.png b/笔记文件/附件/Pasted image 20250416135441.png new file mode 100644 index 0000000..6b6a890 Binary files /dev/null and b/笔记文件/附件/Pasted image 20250416135441.png differ diff --git a/笔记文件/附件/Pasted image 20250416135717.png b/笔记文件/附件/Pasted image 20250416135717.png new file mode 100644 index 0000000..0a8c673 Binary files /dev/null and b/笔记文件/附件/Pasted image 20250416135717.png differ diff --git a/笔记文件/附件/Pasted image 20250416135734.png b/笔记文件/附件/Pasted image 20250416135734.png new file mode 100644 index 0000000..e6c67a2 Binary files /dev/null and b/笔记文件/附件/Pasted image 20250416135734.png differ diff --git a/笔记文件/附件/Pasted image 20250416135925.png b/笔记文件/附件/Pasted image 20250416135925.png new file mode 100644 index 0000000..90083a2 Binary files /dev/null and b/笔记文件/附件/Pasted image 20250416135925.png differ diff --git a/笔记文件/附件/Pasted image 20250416142333.png b/笔记文件/附件/Pasted image 20250416142333.png new file mode 100644 index 0000000..ef5b294 Binary files /dev/null and b/笔记文件/附件/Pasted image 20250416142333.png differ diff --git a/笔记文件/附件/Pasted image 20250416142501.png b/笔记文件/附件/Pasted image 20250416142501.png new file mode 100644 index 0000000..f8d1bef Binary files /dev/null and b/笔记文件/附件/Pasted image 20250416142501.png differ diff --git a/笔记文件/附件/img_v3_02kg_f50ceda0-d544-42d9-ac26-66d94aeb69hu.jpg b/笔记文件/附件/img_v3_02kg_f50ceda0-d544-42d9-ac26-66d94aeb69hu.jpg new file mode 100644 index 0000000..4a058f9 Binary files /dev/null and b/笔记文件/附件/img_v3_02kg_f50ceda0-d544-42d9-ac26-66d94aeb69hu.jpg differ