├── .gitignore ├── README.md ├── RedDotSystem ├── .vscode │ ├── extensions.json │ ├── launch.json │ └── settings.json ├── .vsconfig ├── Assembly-CSharp-Editor.csproj ├── Assembly-CSharp.csproj ├── Assets │ ├── Resources.meta │ ├── Resources │ │ ├── Prefabs.meta │ │ └── Prefabs │ │ │ ├── UI.meta │ │ │ ├── UI │ │ │ ├── BackpackUI.prefab │ │ │ ├── BackpackUI.prefab.meta │ │ │ ├── EquipUI.prefab │ │ │ ├── EquipUI.prefab.meta │ │ │ ├── MailUI.prefab │ │ │ ├── MailUI.prefab.meta │ │ │ ├── MainUI.prefab │ │ │ └── MainUI.prefab.meta │ │ │ ├── Widget.meta │ │ │ └── Widget │ │ │ ├── RedDotWidget.prefab │ │ │ └── RedDotWidget.prefab.meta │ ├── Scenes.meta │ ├── Scenes │ │ ├── SampleScene.unity │ │ └── SampleScene.unity.meta │ ├── Scripts.meta │ └── Scripts │ │ ├── Core.meta │ │ ├── Core │ │ ├── Pool.meta │ │ ├── Pool │ │ │ ├── ObjectPool.cs │ │ │ └── ObjectPool.cs.meta │ │ ├── Singleton.meta │ │ └── Singleton │ │ │ ├── SingletonTemplate.cs │ │ │ └── SingletonTemplate.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── AssetProcesserHook.meta │ │ ├── AssetProcesserHook │ │ │ ├── ScriptAutoProcess.meta │ │ │ └── ScriptAutoProcess │ │ │ │ ├── ScriptKeywordProcesser.cs │ │ │ │ └── ScriptKeywordProcesser.cs.meta │ │ ├── RedDotSystem.meta │ │ ├── RedDotSystem │ │ │ ├── RedDotEditorWindow.cs │ │ │ ├── RedDotEditorWindow.cs.meta │ │ │ ├── RedDotStyles.cs │ │ │ └── RedDotStyles.cs.meta │ │ ├── TrieEditorWindow.meta │ │ └── TrieEditorWindow │ │ │ ├── TrieEditorWindow.cs │ │ │ └── TrieEditorWindow.cs.meta │ │ ├── GameLauncher.cs │ │ ├── GameLauncher.cs.meta │ │ ├── GameLogic.meta │ │ ├── GameLogic │ │ ├── GameModel.cs │ │ ├── GameModel.cs.meta │ │ ├── RedDotSystem.meta │ │ ├── RedDotSystem │ │ │ ├── RedDotInfo.cs │ │ │ ├── RedDotInfo.cs.meta │ │ │ ├── RedDotManager.cs │ │ │ ├── RedDotManager.cs.meta │ │ │ ├── RedDotModel.cs │ │ │ ├── RedDotModel.cs.meta │ │ │ ├── RedDotNames.cs │ │ │ ├── RedDotNames.cs.meta │ │ │ ├── RedDotType.cs │ │ │ ├── RedDotType.cs.meta │ │ │ ├── RedDotUnit.cs │ │ │ ├── RedDotUnit.cs.meta │ │ │ ├── RedDotUnitInfo.cs │ │ │ ├── RedDotUnitInfo.cs.meta │ │ │ ├── RedDotUtilities.cs │ │ │ └── RedDotUtilities.cs.meta │ │ ├── UI.meta │ │ ├── UI │ │ │ ├── BackpackUI.cs │ │ │ ├── BackpackUI.cs.meta │ │ │ ├── EquipUI.cs │ │ │ ├── EquipUI.cs.meta │ │ │ ├── MailDetailUI.cs │ │ │ ├── MailDetailUI.cs.meta │ │ │ ├── MailUI.cs │ │ │ ├── MailUI.cs.meta │ │ │ ├── MainUI.cs │ │ │ └── MainUI.cs.meta │ │ ├── Widget.meta │ │ └── Widget │ │ │ ├── RedDotWidget.cs │ │ │ └── RedDotWidget.cs.meta │ │ ├── Trie.meta │ │ └── Trie │ │ ├── Trie.cs │ │ ├── Trie.cs.meta │ │ ├── TrieNode.cs │ │ └── TrieNode.cs.meta ├── Packages │ ├── manifest.json │ └── packages-lock.json ├── ProjectSettings │ ├── AudioManager.asset │ ├── AutoStreamingSettings.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── PackageManagerSettings.asset │ ├── Physics2DSettings.asset │ ├── PresetManager.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityConnectSettings.asset │ ├── VFXManager.asset │ ├── VersionControlSettings.asset │ └── XRSettings.asset ├── RedDotSystem.sln └── UserSettings │ ├── EditorUserSettings.asset │ ├── Layouts │ └── default-2021.dwlt │ └── Search.settings └── img └── RedDotSystem ├── AllRedDotUnitInfoPreview.PNG ├── BackpackUIOperation.PNG ├── BackpackUIOperationAfterReduce.PNG ├── MainUIAfterBackpackOperation.PNG ├── RedDotDetailAfterBackpackOperation.PNG ├── RedDotTrieAfterBackpackUIOperation.PNG ├── RedDotTriePreiview.PNG ├── RedDotTriePreiviewAfterMarkFunc1New.PNG └── RedDotTriePreviewAfterBackpackReduce.PNG /.gitignore: -------------------------------------------------------------------------------- 1 | # 文件以及目录过滤 2 | # 过滤library目录 3 | RedDotSystem/Library/ 4 | # 过滤.vs目录 5 | RedDotSystem/.vs/ 6 | # 过滤Temp目录 7 | RedDotSystem/Temp/ 8 | # 过滤obj目录 9 | RedDotSystem/obj/ 10 | # 过滤Log目录 11 | RedDotSystem/Logs/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RedDotSystem 2 | ## 红点系统需求 3 | 4 | 在开始设计和编写我们需要的红点系统前,让我们先理清下红点的需求: 5 | 6 | 1. **单个红点可能受多个游戏逻辑因素影响** 7 | 2. **内层红点可以影响外层红点可以不影响外层红点** 8 | 3. **红点显示逻辑会受功能解锁和游戏数据流程影响** 9 | 4. **红点样式多种多样(e.g. 1. 纯红点 2. 纯数字红点 3. 新红点 4. 混合红点等)** 10 | 5. **红点结果计算的数据来源可以是客户端计算红点也可以是服务器已经算好的红点结论(有时候为了优化数据通信量,有些功能的详情会按需请求导致客户端无法直接计算红点,采取后端直接通知红点的方式)** 11 | 6. **红点分静态红点(界面上固定存在的)和动态红点(列表里数量繁多的)** 12 | 7. **数据变化会触发红点频繁逻辑运算(有时候还会触发重复运算)导致GC和时间占用** 13 | 8. **红点影响因素比较多,查询的时候缺乏可视化高效的查询手段** 14 | 15 | ## 红点系统设计 16 | 17 | 针对上面的红点需求,我通过以下设计来一一解决: 18 | 19 | 1. **采用前缀树数据结构,从红点命名上解决红点父子定义关联问题** 20 | 2. **红点运算单元采用最小单元化定义,采用组合定义方式组装红点影响因素,从而实现高度自由的红点运算逻辑组装** 21 | 3. **红点运算单元作为红点影响显示的最小单元,每一个都会对应逻辑层面的一个计算代码,从而实现和逻辑层关联实现自定义解锁和计算方式** 22 | 4. **红点运算结果按红点运算单元为单位,采用标脏加延迟计算的方式避免重复运算和结果缓存** 23 | 5. **红点运算单元支持多种显示类型定义(e.g. 1. 纯红点 2. 纯数字红点 3. 新红点 4. 混合红点等),红点最终显示类型由所有影响他的红点运算单元计算结果组合而成(e.g. 红点运算单元1(新红点类型)+红点运算单元2(数字红点类型)=新红点类型)** 24 | 6. **除了滚动列表里数量过多的红点采用界面上自行计算的方式,其他红点全部采用静态红点预定义的方式,全部提前定义好红点名以及红点运算单元组成和父子关系等数据** 25 | 7. **编写自定义EditorWindow实现红点数据全面可视化提升红点系统可维护性** 26 | 27 | ## 红点系统类说明 28 | 29 | 1. RedDotName.cs -- 红点名定义(通过前缀树表达父子关系,所有静态红点都一开始定义在这里) 30 | 2. RedDotInfo.cs -- 红点信息类 31 | 3. RedDotUnit.cs -- 红点运算单元枚举定义(所有静态红点需要参与运算的最小单元都定义在这里) 32 | 4. RedDotUnitInfo.cs -- 红点运算单元类 33 | 5. RedDotType.cs -- 红点类型(用于支持上层各类复杂的红点显示方式 e.g. 纯红点,纯数字,新红点等) 34 | 6. RedDotModel.cs -- 红点数据层(所有的红点名信息和红点运算单元信息全部在这一层初始化) 35 | 7. RedDotManager.cs -- 红点单例管理类(提供统一的红点管理,红点运算单元计算结果缓存,红点绑定回调等流程) 36 | 8. RedDotUtilities.cs -- 红点辅助类(一些通用方法还有逻辑层的红点运算方法定义在这里) 37 | 9. GameModel.cs -- 逻辑数据层存储模拟 38 | 10. RedDotEditorWindow.cs -- 红点系统可视化窗口(方便快速可视化查看红点运行状态和相关信息) 39 | 11. RedDotStyles.cs -- 红点Editor显示Style定义 40 | 12. Trie.cs -- 前缀树(用于红点名通过字符串的形式表达出层级关系) 41 | 13. TrieNode.cs -- 前缀树节点 42 | 43 | ## 实战 44 | 45 | 由于代码部分比较多,这里就不放源代码了,直接看实战效果图,源码直接下载Github源码即可。 46 | 47 | 初始化后的红点前缀树状态: 48 | 49 | ![RedDotTriePreiview](/img/RedDotSystem/RedDotTriePreiview.PNG) 50 | 51 | 点击标记功能1新按钮后: 52 | 53 | ![RedDotTriePreiviewAfterMarkFunc1New](/img/RedDotSystem/RedDotTriePreiviewAfterMarkFunc1New.PNG) 54 | 55 | 点击菜单->背包->点击增加1个当前页签的新道具,切换页签并点击操作数据增加: 56 | 57 | ![BackpackUIOperation](/img/RedDotSystem/BackpackUIOperation.PNG) 58 | 59 | 背包操作完后,主界面状态: 60 | 61 | ![MainUIAfterBackpackOperation](/img/RedDotSystem/MainUIAfterBackpackOperation.PNG) 62 | 63 | 背包操作完后,红点可视化前缀树: 64 | 65 | ![RedDotTrieAfterBackpackUIOperation](/img/RedDotSystem/RedDotTrieAfterBackpackUIOperation.PNG) 66 | 67 | 背包增加操作后,MAIN_UI_MENU红点名的红点可视化详情: 68 | 69 | ![RedDotDetailAfterBackpackOperation](/img/RedDotSystem/RedDotDetailAfterBackpackOperation.PNG) 70 | 71 | 所有红点运算单元详情: 72 | 73 | ![AllRedDotUnitInfoPreview0](/img/RedDotSystem/AllRedDotUnitInfoPreview.PNG) 74 | 75 | 通过菜单->背包->点击减少1个当前页签的新道具,切换页签点击并操作数据减少: 76 | 77 | ![BackpackUIOperationAfterReduce](/img/RedDotSystem/BackpackUIOperationAfterReduce.PNG) 78 | 79 | 背包减少操作后,红点可视化前缀树: 80 | 81 | ![RedDotTriePreviewAfterBackpackReduce](/img/RedDotSystem/RedDotTriePreviewAfterBackpackReduce.PNG) 82 | 83 | 从上面的测试可以看到,我们通过定义红点名,红点运算单元相关数据,成功的分析出了红点层级关系(利用前缀树)以及红点名与红点运算单元的组合关系。 84 | 85 | 通过编写RedDotEditorWindow成功将红点数据详情可视化的显示在了调试窗口上,通过调试窗口我们可以快速的查看所有红点名和红点运算单元的相关数据,从而实现快速的调试和查看功能。 86 | 87 | 上层逻辑只需关心红点名和红点运算单元的定义以及红点名在逻辑层的绑定刷新即可。 88 | 89 | 代码比较多,这里只展示红点定义刷新的几个基本流程,详情自行查看下源码。 90 | 91 | ### 红点定义流程 92 | 93 | 1. **红点系统初始化** 94 | 95 | ```CS 96 | RedDotModel.Singleton.Init(); 97 | RedDotManager.Singleton.Init(); 98 | // 所有数据初始化完成后触发一次红点运算单元计算 99 | RedDotManager.Singleton.DoAllRedDotUnitCaculate(); 100 | ``` 101 | 102 | 2. **定义红点运算单元并初始化** 103 | 104 | ```CS 105 | AddRedDotUnitInfo(RedDotUnit.NEW_FUNC1, "动态新功能1解锁", RedDotUtilities.CaculateNewFunc1, RedDotType.NEW); 106 | ****** 107 | ``` 108 | 109 | 3. **定义红点名以及对应红点运算单元组成并初始化** 110 | 111 | ```CS 112 | RedDotInfo redDotInfo; 113 | redDotInfo = AddRedDotInfo(RedDotNames.MAIN_UI_NEW_FUNC1, "主界面新功能1红点"); 114 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_FUNC1); 115 | ******* 116 | ``` 117 | 118 | 4. **上层逻辑编写新红点运算单元的逻辑计算回调** 119 | 120 | ```CS 121 | /// 122 | /// 计算主界面动态新功能1解锁 123 | /// 124 | /// 125 | public static int CaculateNewFunc1() 126 | { 127 | return GameModel.Singleton.NewFunc1 ? 1 : 0; 128 | } 129 | ``` 130 | 131 | 5. **上层逻辑绑定红点名刷新** 132 | 133 | ```CS 134 | 135 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIN_UI_NEW_FUNC1, OnRedDotRefresh); 136 | 137 | /// 138 | /// 响应红点刷新 139 | /// 140 | /// 141 | /// 142 | /// 143 | private void OnRedDotRefresh(string redDotName, int result, RedDotType redDotType) 144 | { 145 | var resultText = RedDotUtilities.GetRedDotResultText(result, redDotType); 146 | if (string.Equals(redDotName, RedDotNames.MAIN_UI_MENU)) 147 | { 148 | MenuRedDot.SetActive(result > 0); 149 | MenuRedDot.SetRedDotTxt(resultText); 150 | } 151 | else if (string.Equals(redDotName, RedDotNames.MAIN_UI_NEW_FUNC1)) 152 | { 153 | DynamicFunc1RedDot.SetActive(result > 0); 154 | DynamicFunc1RedDot.SetRedDotTxt(resultText); 155 | } 156 | ****** 157 | } 158 | ``` 159 | 160 | 6. **上层逻辑首次初始化红点数据** 161 | 162 | ```CS 163 | (int result, RedDotType redDotType) redDotNameResult; 164 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIN_UI_MENU); 165 | OnRedDotRefresh(RedDotNames.MAIN_UI_MENU, redDotNameResult.result, redDotNameResult.redDotType); 166 | ``` 167 | 168 | 7. **上层逻辑触发红点名或红点运算单元标脏后,等待红点系统统一触发计算并回调** 169 | 170 | ```CS 171 | /// 172 | /// 设置主界面动态新功能1是否解锁 173 | /// 174 | /// 175 | public void SetNewFunc1(bool newFunc1) 176 | { 177 | if(NewFunc1 != newFunc1) 178 | { 179 | NewFunc1 = newFunc1; 180 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_FUNC1); 181 | } 182 | } 183 | ``` 184 | 185 | ## 博客 186 | 187 | [红点系统](http://tonytang1990.github.io/2022/08/12/%E7%BA%A2%E7%82%B9%E7%B3%BB%E7%BB%9F/) -------------------------------------------------------------------------------- /RedDotSystem/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "visualstudiotoolsforunity.vstuc" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /RedDotSystem/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Attach to Unity", 6 | "type": "vstuc", 7 | "request": "attach" 8 | } 9 | ] 10 | } -------------------------------------------------------------------------------- /RedDotSystem/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.DS_Store": true, 4 | "**/.git": true, 5 | "**/.vs": true, 6 | "**/.gitmodules": true, 7 | "**/.vsconfig": true, 8 | "**/*.booproj": true, 9 | "**/*.pidb": true, 10 | "**/*.suo": true, 11 | "**/*.user": true, 12 | "**/*.userprefs": true, 13 | "**/*.unityproj": true, 14 | "**/*.dll": true, 15 | "**/*.exe": true, 16 | "**/*.pdf": true, 17 | "**/*.mid": true, 18 | "**/*.midi": true, 19 | "**/*.wav": true, 20 | "**/*.gif": true, 21 | "**/*.ico": true, 22 | "**/*.jpg": true, 23 | "**/*.jpeg": true, 24 | "**/*.png": true, 25 | "**/*.psd": true, 26 | "**/*.tga": true, 27 | "**/*.tif": true, 28 | "**/*.tiff": true, 29 | "**/*.3ds": true, 30 | "**/*.3DS": true, 31 | "**/*.fbx": true, 32 | "**/*.FBX": true, 33 | "**/*.lxo": true, 34 | "**/*.LXO": true, 35 | "**/*.ma": true, 36 | "**/*.MA": true, 37 | "**/*.obj": true, 38 | "**/*.OBJ": true, 39 | "**/*.asset": true, 40 | "**/*.cubemap": true, 41 | "**/*.flare": true, 42 | "**/*.mat": true, 43 | "**/*.meta": true, 44 | "**/*.prefab": true, 45 | "**/*.unity": true, 46 | "build/": true, 47 | "Build/": true, 48 | "Library/": true, 49 | "library/": true, 50 | "obj/": true, 51 | "Obj/": true, 52 | "Logs/": true, 53 | "logs/": true, 54 | "ProjectSettings/": true, 55 | "UserSettings/": true, 56 | "temp/": true, 57 | "Temp/": true 58 | }, 59 | "dotnet.defaultSolution": "RedDotSystem.sln" 60 | } -------------------------------------------------------------------------------- /RedDotSystem/.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedGame" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 108683904a938b147b69ae0332648110 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17c14aeeeca72e04990a0b208239d630 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15ebc75a2da261746a865440d226f98c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs/UI/BackpackUI.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae055556298a5684ca4bcc5bc99323ad 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs/UI/EquipUI.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b03f36b3fc09ecb43a0b9a129c118203 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs/UI/MailUI.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9df3521d1fe15e47b2b979489557758 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs/UI/MainUI.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09700cac4a727e8458a0af02c5e4dabe 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs/Widget.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0512990e020f6b74aba82637b89bc438 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs/Widget/RedDotWidget.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &4470523339197050719 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 4470523339197050718} 12 | - component: {fileID: 409525804378097940} 13 | m_Layer: 5 14 | m_Name: RedDotWidget 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!224 &4470523339197050718 21 | RectTransform: 22 | m_ObjectHideFlags: 0 23 | m_CorrespondingSourceObject: {fileID: 0} 24 | m_PrefabInstance: {fileID: 0} 25 | m_PrefabAsset: {fileID: 0} 26 | m_GameObject: {fileID: 4470523339197050719} 27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 28 | m_LocalPosition: {x: 0, y: 0, z: 0} 29 | m_LocalScale: {x: 1, y: 1, z: 1} 30 | m_Children: 31 | - {fileID: 4470523341116396857} 32 | - {fileID: 4470523340965475670} 33 | m_Father: {fileID: 0} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | m_AnchorMin: {x: 1, y: 1} 37 | m_AnchorMax: {x: 1, y: 1} 38 | m_AnchoredPosition: {x: 0, y: 0} 39 | m_SizeDelta: {x: 60, y: 30} 40 | m_Pivot: {x: 0.5, y: 0.5} 41 | --- !u!114 &409525804378097940 42 | MonoBehaviour: 43 | m_ObjectHideFlags: 0 44 | m_CorrespondingSourceObject: {fileID: 0} 45 | m_PrefabInstance: {fileID: 0} 46 | m_PrefabAsset: {fileID: 0} 47 | m_GameObject: {fileID: 4470523339197050719} 48 | m_Enabled: 1 49 | m_EditorHideFlags: 0 50 | m_Script: {fileID: 11500000, guid: 3a9a32cc14fa2f248b312d7a0bfae923, type: 3} 51 | m_Name: 52 | m_EditorClassIdentifier: 53 | ImgRedDot: {fileID: 4470523341116396856} 54 | TxtRedDotDes: {fileID: 4470523340965475669} 55 | --- !u!1 &4470523340965475671 56 | GameObject: 57 | m_ObjectHideFlags: 0 58 | m_CorrespondingSourceObject: {fileID: 0} 59 | m_PrefabInstance: {fileID: 0} 60 | m_PrefabAsset: {fileID: 0} 61 | serializedVersion: 6 62 | m_Component: 63 | - component: {fileID: 4470523340965475670} 64 | - component: {fileID: 4470523340965475668} 65 | - component: {fileID: 4470523340965475669} 66 | m_Layer: 5 67 | m_Name: txtRedDotDes 68 | m_TagString: Untagged 69 | m_Icon: {fileID: 0} 70 | m_NavMeshLayer: 0 71 | m_StaticEditorFlags: 0 72 | m_IsActive: 1 73 | --- !u!224 &4470523340965475670 74 | RectTransform: 75 | m_ObjectHideFlags: 0 76 | m_CorrespondingSourceObject: {fileID: 0} 77 | m_PrefabInstance: {fileID: 0} 78 | m_PrefabAsset: {fileID: 0} 79 | m_GameObject: {fileID: 4470523340965475671} 80 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 81 | m_LocalPosition: {x: 0, y: 0, z: 0} 82 | m_LocalScale: {x: 1, y: 1, z: 1} 83 | m_Children: [] 84 | m_Father: {fileID: 4470523339197050718} 85 | m_RootOrder: 1 86 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 87 | m_AnchorMin: {x: 0, y: 0} 88 | m_AnchorMax: {x: 1, y: 1} 89 | m_AnchoredPosition: {x: 0, y: 0} 90 | m_SizeDelta: {x: 0, y: 0} 91 | m_Pivot: {x: 0.5, y: 0.5} 92 | --- !u!222 &4470523340965475668 93 | CanvasRenderer: 94 | m_ObjectHideFlags: 0 95 | m_CorrespondingSourceObject: {fileID: 0} 96 | m_PrefabInstance: {fileID: 0} 97 | m_PrefabAsset: {fileID: 0} 98 | m_GameObject: {fileID: 4470523340965475671} 99 | m_CullTransparentMesh: 1 100 | --- !u!114 &4470523340965475669 101 | MonoBehaviour: 102 | m_ObjectHideFlags: 0 103 | m_CorrespondingSourceObject: {fileID: 0} 104 | m_PrefabInstance: {fileID: 0} 105 | m_PrefabAsset: {fileID: 0} 106 | m_GameObject: {fileID: 4470523340965475671} 107 | m_Enabled: 1 108 | m_EditorHideFlags: 0 109 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 110 | m_Name: 111 | m_EditorClassIdentifier: 112 | m_Material: {fileID: 0} 113 | m_Color: {r: 1, g: 1, b: 1, a: 1} 114 | m_RaycastTarget: 1 115 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 116 | m_Maskable: 1 117 | m_OnCullStateChanged: 118 | m_PersistentCalls: 119 | m_Calls: [] 120 | m_FontData: 121 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 122 | m_FontSize: 20 123 | m_FontStyle: 0 124 | m_BestFit: 0 125 | m_MinSize: 2 126 | m_MaxSize: 40 127 | m_Alignment: 4 128 | m_AlignByGeometry: 0 129 | m_RichText: 1 130 | m_HorizontalOverflow: 0 131 | m_VerticalOverflow: 0 132 | m_LineSpacing: 1 133 | m_Text: New Text 134 | --- !u!1 &4470523341116396858 135 | GameObject: 136 | m_ObjectHideFlags: 0 137 | m_CorrespondingSourceObject: {fileID: 0} 138 | m_PrefabInstance: {fileID: 0} 139 | m_PrefabAsset: {fileID: 0} 140 | serializedVersion: 6 141 | m_Component: 142 | - component: {fileID: 4470523341116396857} 143 | - component: {fileID: 4470523341116396863} 144 | - component: {fileID: 4470523341116396856} 145 | m_Layer: 5 146 | m_Name: imgRedDot 147 | m_TagString: Untagged 148 | m_Icon: {fileID: 0} 149 | m_NavMeshLayer: 0 150 | m_StaticEditorFlags: 0 151 | m_IsActive: 1 152 | --- !u!224 &4470523341116396857 153 | RectTransform: 154 | m_ObjectHideFlags: 0 155 | m_CorrespondingSourceObject: {fileID: 0} 156 | m_PrefabInstance: {fileID: 0} 157 | m_PrefabAsset: {fileID: 0} 158 | m_GameObject: {fileID: 4470523341116396858} 159 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 160 | m_LocalPosition: {x: 0, y: 0, z: 0} 161 | m_LocalScale: {x: 1, y: 1, z: 1} 162 | m_Children: [] 163 | m_Father: {fileID: 4470523339197050718} 164 | m_RootOrder: 0 165 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 166 | m_AnchorMin: {x: 0, y: 0} 167 | m_AnchorMax: {x: 1, y: 1} 168 | m_AnchoredPosition: {x: 0, y: 0} 169 | m_SizeDelta: {x: 0, y: 0} 170 | m_Pivot: {x: 0.5, y: 0.5} 171 | --- !u!222 &4470523341116396863 172 | CanvasRenderer: 173 | m_ObjectHideFlags: 0 174 | m_CorrespondingSourceObject: {fileID: 0} 175 | m_PrefabInstance: {fileID: 0} 176 | m_PrefabAsset: {fileID: 0} 177 | m_GameObject: {fileID: 4470523341116396858} 178 | m_CullTransparentMesh: 1 179 | --- !u!114 &4470523341116396856 180 | MonoBehaviour: 181 | m_ObjectHideFlags: 0 182 | m_CorrespondingSourceObject: {fileID: 0} 183 | m_PrefabInstance: {fileID: 0} 184 | m_PrefabAsset: {fileID: 0} 185 | m_GameObject: {fileID: 4470523341116396858} 186 | m_Enabled: 1 187 | m_EditorHideFlags: 0 188 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 189 | m_Name: 190 | m_EditorClassIdentifier: 191 | m_Material: {fileID: 0} 192 | m_Color: {r: 1, g: 0, b: 0, a: 1} 193 | m_RaycastTarget: 1 194 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 195 | m_Maskable: 1 196 | m_OnCullStateChanged: 197 | m_PersistentCalls: 198 | m_Calls: [] 199 | m_Sprite: {fileID: 0} 200 | m_Type: 0 201 | m_PreserveAspect: 0 202 | m_FillCenter: 1 203 | m_FillMethod: 4 204 | m_FillAmount: 1 205 | m_FillClockwise: 1 206 | m_FillOrigin: 0 207 | m_UseSpriteMesh: 0 208 | m_PixelsPerUnitMultiplier: 1 209 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Resources/Prefabs/Widget/RedDotWidget.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25eded326bf45434286f437dfac18009 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ffeab8c6000b9434b89bd18e85ab03c2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c924846efc9f3c40ba808e4fa47710d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87fa9793d0b5eb64199ec0c1c2cec17f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Core/Pool.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f173b682fb09684ba1977dba7b3daec 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Core/Pool/ObjectPool.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: ObjectPool.cs 3 | * Author: TonyTang 4 | * Create Date: 2019/09/01 5 | */ 6 | 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using UnityEngine; 11 | 12 | /// 13 | /// 对象可回收接口设计 14 | /// 15 | public interface IRecycle 16 | { 17 | /// 18 | /// 创建时调用接口 19 | /// 20 | void OnCreate(); 21 | 22 | /// 23 | /// 回收时调用接口 24 | /// 25 | void OnDispose(); 26 | } 27 | 28 | /// 29 | /// ObjectPool.cs 30 | /// Object对象池 31 | /// Note: 32 | /// 用于替代ObejectFactory,相比ObjectFactory, 33 | /// ObjectPool面向接口设计,同时把对象放在全局唯一的Pool里管理,避免创建多个类型的Factory文件 34 | /// 35 | public class ObjectPool 36 | { 37 | /// 38 | /// 单例管理池 39 | /// 40 | public readonly static ObjectPool Singleton = new ObjectPool(); 41 | 42 | /// 43 | /// 对象管理池 44 | /// 45 | private Dictionary> ObjectPoolMap; 46 | 47 | /// 48 | /// IRecycle类型 49 | /// 50 | private Type mIRecycleType; 51 | 52 | private ObjectPool() 53 | { 54 | ObjectPoolMap = new Dictionary>(); 55 | mIRecycleType = typeof(IRecycle); 56 | } 57 | 58 | /// 59 | /// 初始化指定数量的指定对象 60 | /// 61 | /// 62 | /// 63 | public void initialize(int number) where T : IRecycle 64 | { 65 | for(int i = 0; i < number; i++) 66 | { 67 | var obj = Activator.CreateInstance(); 68 | push(obj); 69 | } 70 | var hashcode = typeof(T).GetHashCode(); 71 | //Debug.Log(string.Format("初始化类型:{0}的剩余数量:{1}", typeof(T).Name, ObjectPoolMap[hashcode].Count)); 72 | } 73 | 74 | /// 75 | /// 初始化指定数量的指定对象 76 | /// 77 | /// 78 | /// 79 | public void initialize(Type type, int number) where T : IRecycle 80 | { 81 | if (mIRecycleType.IsAssignableFrom(type)) 82 | { 83 | for (int i = 0; i < number; i++) 84 | { 85 | var obj = Activator.CreateInstance(type); 86 | push((T)obj); 87 | } 88 | var hashcode = typeof(T).GetHashCode(); 89 | //Debug.Log(string.Format("初始化类型:{0}的剩余数量:{1}", typeof(T).Name, ObjectPoolMap[hashcode].Count)); 90 | } 91 | else 92 | { 93 | Debug.LogError($"传入的类型:{type.Name}不符合类型where T:{mIRecycleType.Name}要求,初始化池对象失败!"); 94 | } 95 | } 96 | 97 | /// 98 | /// 指定对象进池 99 | /// 100 | /// 101 | /// 102 | public void push(T obj) where T : IRecycle 103 | { 104 | obj.OnDispose(); 105 | var hashcode = obj.GetType().GetHashCode(); 106 | if (!ObjectPoolMap.ContainsKey(hashcode)) 107 | { 108 | ObjectPoolMap.Add(hashcode, new Stack()); 109 | } 110 | ObjectPoolMap[hashcode].Push(obj); 111 | //Debug.Log(string.Format("类型:{0}进对象池!",typeof(T).Name)); 112 | //Debug.Log(string.Format("池里类型:{0}的剩余数量:{1}", typeof(T).Name, ObjectPoolMap[hashcode].Count)); 113 | } 114 | 115 | /// 116 | /// 指定对象进池 117 | /// 118 | /// 119 | /// 120 | public void pushAsObj(IRecycle obj) 121 | { 122 | if (mIRecycleType.IsAssignableFrom(obj.GetType())) 123 | { 124 | var realobj = (IRecycle)obj; 125 | realobj.OnDispose(); 126 | var hashcode = obj.GetType().GetHashCode(); 127 | if (!ObjectPoolMap.ContainsKey(hashcode)) 128 | { 129 | ObjectPoolMap.Add(hashcode, new Stack()); 130 | } 131 | ObjectPoolMap[hashcode].Push(realobj); 132 | //Debug.Log(string.Format("类型:{0}进对象池!",typeof(T).Name)); 133 | //Debug.Log(string.Format("池里类型:{0}的剩余数量:{1}", typeof(T).Name, ObjectPoolMap[hashcode].Count)); 134 | } 135 | else 136 | { 137 | Debug.LogError($"传入的类型:{obj.GetType().Name}不符合类型T:{mIRecycleType.Name}要求,初始化池对象失败!"); 138 | } 139 | } 140 | 141 | /// 142 | /// 弹出可用指定对象 143 | /// 144 | /// 145 | /// 146 | public T pop() where T : IRecycle 147 | { 148 | var hashcode = typeof(T).GetHashCode(); 149 | if (ObjectPoolMap.ContainsKey(hashcode)) 150 | { 151 | var instance = ObjectPoolMap[hashcode].Pop(); 152 | instance.OnCreate(); 153 | //Debug.Log(string.Format("类型:{0}出对象池!", typeof(T).Name)); 154 | //Debug.Log(string.Format("池里类型:{0}的剩余数量:{1}", typeof(T).Name, ObjectPoolMap[hashcode].Count)); 155 | if (ObjectPoolMap[hashcode].Count == 0) 156 | { 157 | clear(); 158 | } 159 | return (T)instance; 160 | } 161 | else 162 | { 163 | //Debug.Log(string.Format("类型:{0}构建新的对象!", typeof(T).Name)); 164 | // 默认池里没有反射创建,尽量避免反射创建, 165 | // 可以考虑调用Initialize初始化一定数量进池 166 | var instance = Activator.CreateInstance(); 167 | instance.OnCreate(); 168 | return instance; 169 | } 170 | } 171 | 172 | /// 173 | /// 弹出可用指定类型对象 174 | /// 175 | /// 176 | /// 177 | public IRecycle popWithType(Type type) 178 | { 179 | if (mIRecycleType.IsAssignableFrom(type)) 180 | { 181 | var hashcode = type.GetHashCode(); 182 | if (ObjectPoolMap.ContainsKey(hashcode)) 183 | { 184 | var instance = ObjectPoolMap[hashcode].Pop(); 185 | instance.OnCreate(); 186 | //Debug.Log(string.Format("类型:{0}出对象池!", typeof(T).Name)); 187 | //Debug.Log(string.Format("池里类型:{0}的剩余数量:{1}", typeof(T).Name, ObjectPoolMap[hashcode].Count)); 188 | if (ObjectPoolMap[hashcode].Count == 0) 189 | { 190 | clearWithType(type); 191 | } 192 | return (IRecycle)instance; 193 | } 194 | else 195 | { 196 | //Debug.Log(string.Format("类型:{0}构建新的对象!", typeof(T).Name)); 197 | // 默认池里没有反射创建,尽量避免反射创建, 198 | // 可以考虑调用Initialize初始化一定数量进池 199 | var instance = (IRecycle)Activator.CreateInstance(type); 200 | instance.OnCreate(); 201 | return instance; 202 | } 203 | } 204 | else 205 | { 206 | Debug.LogError($"传入的类型:{type.Name}不符合类型T:{mIRecycleType.Name}要求,出对象池失败!"); 207 | return null; 208 | } 209 | } 210 | 211 | /// 212 | /// 清除指定类型的对象缓存 213 | /// 214 | /// 215 | /// 216 | public bool clear() where T : IRecycle 217 | { 218 | var hashcode = typeof(T).GetHashCode(); 219 | if(ObjectPoolMap.ContainsKey(hashcode)) 220 | { 221 | //Debug.Log(string.Format("清除对象池里的类型:{0}", typeof(T).Name)); 222 | foreach (var obj in ObjectPoolMap[hashcode]) 223 | { 224 | obj.OnDispose(); 225 | } 226 | ObjectPoolMap.Remove(hashcode); 227 | return true; 228 | } 229 | else 230 | { 231 | return false; 232 | } 233 | } 234 | 235 | /// 236 | /// 清除指定类型的对象缓存 237 | /// 238 | /// 239 | /// 240 | public bool clearWithType(Type type) 241 | { 242 | if (mIRecycleType.IsAssignableFrom(type)) 243 | { 244 | var hashcode = type.GetHashCode(); 245 | if (ObjectPoolMap.ContainsKey(hashcode)) 246 | { 247 | //Debug.Log(string.Format("清除对象池里的类型:{0}", typeof(T).Name)); 248 | foreach (var obj in ObjectPoolMap[hashcode]) 249 | { 250 | obj.OnDispose(); 251 | } 252 | ObjectPoolMap.Remove(hashcode); 253 | return true; 254 | } 255 | else 256 | { 257 | return false; 258 | } 259 | } 260 | else 261 | { 262 | Debug.LogError($"传入的类型:{type.Name}不符合类型T:{mIRecycleType.Name}要求,清理对象池失败!"); 263 | return false; 264 | } 265 | } 266 | 267 | /// 268 | /// 清除所有对象缓存 269 | /// 270 | public void clearAll() 271 | { 272 | var objhascodearray = new int[ObjectPoolMap.Keys.Count]; 273 | ObjectPoolMap.Keys.CopyTo(objhascodearray, 0); 274 | foreach (var objhashcode in objhascodearray) 275 | { 276 | clear(objhashcode); 277 | } 278 | ObjectPoolMap.Clear(); 279 | } 280 | 281 | /// 282 | /// 清除指定类型的对象缓存 283 | /// 284 | /// 285 | /// 286 | private bool clear(int hashcode) 287 | { 288 | if (ObjectPoolMap.ContainsKey(hashcode)) 289 | { 290 | //Debug.Log(string.Format("清除对象池里的类型:{0}", typeof(T).Name)); 291 | foreach (var obj in ObjectPoolMap[hashcode]) 292 | { 293 | obj.OnDispose(); 294 | } 295 | ObjectPoolMap.Remove(hashcode); 296 | return true; 297 | } 298 | else 299 | { 300 | return false; 301 | } 302 | } 303 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Core/Pool/ObjectPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5a763ed1643c1c4a826e1fa231939fd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Core/Singleton.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92603f156914ba346963299390ce3b95 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Core/Singleton/SingletonTemplate.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | /// 5 | /// 模板单例 6 | /// 7 | /// 8 | public class SingletonTemplate where T : class, new() 9 | { 10 | public static T Singleton 11 | { 12 | get 13 | { 14 | if(mSingleton == null) 15 | { 16 | mSingleton = new T(); 17 | } 18 | return mSingleton; 19 | } 20 | } 21 | protected static T mSingleton = null; 22 | 23 | protected SingletonTemplate() 24 | { 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Core/Singleton/SingletonTemplate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a80126b05e25b241a9c3b4cb968c393 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d82b62413892398438d204a6621d100a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/AssetProcesserHook.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 47844b386000556418eb857e9247cb41 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/AssetProcesserHook/ScriptAutoProcess.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 984fcc856d176a0468786352c723d0a0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/AssetProcesserHook/ScriptAutoProcess/ScriptKeywordProcesser.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: 脚本模板自定义Keyword处理脚本 3 | * Author: tanghuan 4 | * Create Date: 2018/04/01 5 | */ 6 | 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using System.IO; 11 | using System.Security.Principal; 12 | using System.Text; 13 | using UnityEditor; 14 | using UnityEngine; 15 | 16 | /// 17 | /// 脚本模板自定义Keyword处理脚本 18 | /// 19 | public class ScriptKeywordProcesser : UnityEditor.AssetModificationProcessor { 20 | 21 | /// 22 | /// 非用户导入的Asset创建回调(e.g. .meta文件) 23 | /// 24 | /// 25 | public static void OnWillCreateAsset(string assetpath) 26 | { 27 | assetpath = assetpath.Replace(".meta", string.Empty); 28 | int index = assetpath.LastIndexOf("."); 29 | if(index <= 0) 30 | { 31 | return; 32 | } 33 | //判定是否是cs脚本 34 | string filepostfix = assetpath.Substring(index); 35 | if(!filepostfix.Equals(".cs")) 36 | { 37 | return; 38 | } 39 | //判定脚本文件是否存在 40 | index = Application.dataPath.LastIndexOf("Assets"); 41 | assetpath = Application.dataPath.Substring(0, index) + assetpath; 42 | if(!File.Exists(assetpath)) 43 | { 44 | return; 45 | } 46 | 47 | var filecontent = File.ReadAllText(assetpath); 48 | filecontent = replaceKeywords(filecontent); 49 | File.WriteAllText(assetpath, filecontent, Encoding.UTF8); 50 | AssetDatabase.Refresh(); 51 | } 52 | 53 | /// 54 | /// 替换文本Keyword 55 | /// Note: 56 | /// 自定义Keyword替换规则写在这里 57 | /// 58 | /// 59 | /// 60 | private static string replaceKeywords(string filecontent) 61 | { 62 | string author = WindowsIdentity.GetCurrent().Name; 63 | // 只取最终用户名 64 | var splashindex = author.IndexOf("\\"); 65 | if(splashindex > 0) 66 | { 67 | author = author.Substring(0, splashindex); 68 | } 69 | 70 | filecontent = filecontent.Replace("#AUTHOR#", author); 71 | filecontent = filecontent.Replace("#CREATEDATE#", DateTime.Now.ToString("yyyy/MM/dd")); 72 | return filecontent; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/AssetProcesserHook/ScriptAutoProcess/ScriptKeywordProcesser.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af8c7f8e0738c3c428370c26d7ed78ce 3 | timeCreated: 1522558760 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/RedDotSystem.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ead3d415172b6e40a9005d5d03a5c8f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/RedDotSystem/RedDotEditorWindow.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotEditorWindow.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using UnityEditor; 11 | using UnityEditor.IMGUI.Controls; 12 | using UnityEngine; 13 | 14 | /// 15 | /// RedDotEditorWindow.cs 16 | /// 红点系统可视化窗口 17 | /// 18 | public class RedDotEditorWindow : EditorWindow 19 | { 20 | /// 21 | /// 红点系统页签类型 22 | /// 23 | public enum RedDotSystemTag 24 | { 25 | RED_DOT_TREE = 0, // 红点数页签类型 26 | RED_DOT_UNITS, // 红点运算单元页签类型 27 | RED_DOT_DETAIL, // 红点详情页签类型 28 | } 29 | 30 | /// 31 | /// 红点系统页签名字 32 | /// 33 | private string[] mRedDotTagNames = new string[3] { "红点树", "红点运算单元", "红点名详情" }; 34 | 35 | /// 36 | /// 当前页签选择索引 37 | /// 38 | private int mSelectedTagIndex = 0; 39 | 40 | /// 41 | /// 当前选择节点 42 | /// 43 | private TrieNode mSelectedTrieNode; 44 | 45 | /// 46 | /// 当前滚动位置 47 | /// 48 | private Vector2 mCurrentScrollPos; 49 | 50 | /// 51 | /// 红点名展开信息Map<红点名, 是否展开> 52 | /// 53 | private Dictionary mRedDotNameUnfoldMap = new Dictionary(); 54 | 55 | /// 56 | /// 红点名列表(缓存红点名列表避免内存开销) 57 | /// 58 | private List mRedDotNameList; 59 | 60 | /// 61 | /// 红点运算单元搜索栏 62 | /// 63 | private SearchField mRedDotUnitSearchField; 64 | 65 | /// 66 | /// 红点运算单元搜索文本 67 | /// 68 | private string mRedDotUnitSearchText; 69 | 70 | /// 71 | /// 打开红点系统可视化窗口 72 | /// 73 | [MenuItem("ToolsWindow/红点系统可视化窗口")] 74 | public static void Open() 75 | { 76 | RedDotEditorWindow redDotEditorWindow = (RedDotEditorWindow)EditorWindow.GetWindow(false, "红点系统可视化窗口"); 77 | redDotEditorWindow.Show(); 78 | } 79 | 80 | /// 81 | /// 绘制 82 | /// 83 | private void OnGUI() 84 | { 85 | if(EditorApplication.isPlaying) 86 | { 87 | if(RedDotModel.Singleton.IsInitCompelte) 88 | { 89 | if(mRedDotUnitSearchField == null) 90 | { 91 | mRedDotUnitSearchField = new SearchField(); 92 | } 93 | DrawRedDotTagArea(); 94 | mCurrentScrollPos = EditorGUILayout.BeginScrollView(mCurrentScrollPos); 95 | DrawRedDotContentArea(); 96 | EditorGUILayout.EndScrollView(); 97 | } 98 | else 99 | { 100 | EditorGUILayout.LabelField($"等待红点系统数据初始化完成!"); 101 | } 102 | } 103 | else 104 | { 105 | EditorGUILayout.LabelField($"只支持运行时模式查看!"); 106 | } 107 | } 108 | 109 | /// 110 | /// 绘制红点系统页签区域 111 | /// 112 | private void DrawRedDotTagArea() 113 | { 114 | mSelectedTagIndex = GUILayout.SelectionGrid(mSelectedTagIndex, mRedDotTagNames, mRedDotTagNames.Length); 115 | } 116 | 117 | /// 118 | /// 绘制红点区域内容区域 119 | /// 120 | private void DrawRedDotContentArea() 121 | { 122 | if (mSelectedTagIndex == (int)RedDotSystemTag.RED_DOT_TREE) 123 | { 124 | DrawRedDotTreeArea(); 125 | } 126 | else if(mSelectedTagIndex == (int)RedDotSystemTag.RED_DOT_UNITS) 127 | { 128 | DrawRedDotUnitsArea(); 129 | } 130 | else if(mSelectedTagIndex == (int)RedDotSystemTag.RED_DOT_DETAIL) 131 | { 132 | DrawRedDotDetailArea(); 133 | } 134 | } 135 | 136 | /// 137 | /// 绘制红点树区域 138 | /// 139 | private void DrawRedDotTreeArea() 140 | { 141 | var preColor = GUI.color; 142 | GUI.color = Color.green; 143 | if (GUILayout.Button("全部折叠", GUILayout.ExpandWidth(true))) 144 | { 145 | FoldAllTrieNode(false); 146 | } 147 | if (GUILayout.Button("全部展开", GUILayout.ExpandWidth(true))) 148 | { 149 | FoldAllTrieNode(true); 150 | } 151 | GUI.color = preColor; 152 | var redDotTrie = RedDotModel.Singleton.RedDotTrie; 153 | DrawTrieNode(redDotTrie.RootNode); 154 | } 155 | 156 | /// 157 | /// 折叠或展开所有前缀树节点 158 | /// 159 | /// 是否展开 160 | private void FoldAllTrieNode(bool isUnfold) 161 | { 162 | mRedDotNameList = mRedDotNameUnfoldMap.Keys.ToList(); 163 | foreach(var redDotName in mRedDotNameList) 164 | { 165 | mRedDotNameUnfoldMap[redDotName] = isUnfold; 166 | } 167 | } 168 | 169 | /// 170 | /// 绘制一个前缀树节点 171 | /// 172 | /// 173 | private void DrawTrieNode(TrieNode trieNode) 174 | { 175 | var redDotName = trieNode.GetFullWord(); 176 | if(!mRedDotNameUnfoldMap.ContainsKey(redDotName)) 177 | { 178 | mRedDotNameUnfoldMap.Add(redDotName, true); 179 | } 180 | EditorGUILayout.BeginHorizontal("box"); 181 | GUILayout.Space(trieNode.Depth * 20); 182 | var redDotDisplayName = $"{trieNode.NodeValue}"; 183 | var isRoot = trieNode.IsRoot; 184 | var isTail = trieNode.IsTail; 185 | var redDotNodeResult = 0; 186 | if(isTail) 187 | { 188 | var redDotInfo = RedDotModel.Singleton.GetRedDotInfoByName(redDotName); 189 | redDotNodeResult = RedDotManager.Singleton.GetRedDotResult(redDotName); 190 | redDotDisplayName = $"{redDotDisplayName}({redDotInfo.RedDotDes})({redDotNodeResult})"; 191 | } 192 | var preColor = GUI.color; 193 | if (redDotNodeResult > 0) 194 | { 195 | GUI.color = Color.yellow; 196 | } 197 | if (trieNode.ChildCount > 0) 198 | { 199 | mRedDotNameUnfoldMap[redDotName] = EditorGUILayout.Foldout(mRedDotNameUnfoldMap[redDotName], redDotDisplayName); 200 | GUI.color = preColor; 201 | } 202 | else 203 | { 204 | EditorGUILayout.LabelField(redDotDisplayName); 205 | GUI.color = preColor; 206 | } 207 | if (!isRoot && isTail) 208 | { 209 | DrawTrieNodeJumpUI(trieNode); 210 | } 211 | EditorGUILayout.EndHorizontal(); 212 | if (mRedDotNameUnfoldMap[redDotName]) 213 | { 214 | foreach (var childNode in trieNode.ChildNodesMap) 215 | { 216 | DrawTrieNode(childNode.Value); 217 | } 218 | } 219 | } 220 | 221 | /// 222 | /// 绘制前缀树节点跳转UI 223 | /// 224 | /// 225 | private void DrawTrieNodeJumpUI(TrieNode trieNode) 226 | { 227 | var preColor = GUI.color; 228 | GUI.color = Color.green; 229 | if(GUILayout.Button("红点名详情", GUILayout.Width(120f))) 230 | { 231 | JumpToTrieNodeDetail(trieNode); 232 | } 233 | GUI.color = preColor; 234 | } 235 | 236 | /// 237 | /// 绘制红点名运算单元区域 238 | /// 239 | private void DrawRedDotUnitsArea() 240 | { 241 | DrawRedDotUnitSearchArea(); 242 | DrawRedDotUnitTile(); 243 | var redDotUnitInfoMap = RedDotModel.Singleton.GetRedDotUnitInfoMap(); 244 | foreach(var redDotUnitInfo in redDotUnitInfoMap) 245 | { 246 | if(string.IsNullOrEmpty(mRedDotUnitSearchText) || redDotUnitInfo.Key.ToString().StartsWith(mRedDotUnitSearchText, System.StringComparison.OrdinalIgnoreCase)) 247 | { 248 | DrawRedDotUnitInfo(redDotUnitInfo.Value); 249 | } 250 | } 251 | } 252 | 253 | /// 254 | /// 绘制红点运算单元搜索区域 255 | /// 256 | private void DrawRedDotUnitSearchArea() 257 | { 258 | mRedDotUnitSearchText = mRedDotUnitSearchField.OnGUI(mRedDotUnitSearchText, GUILayout.ExpandWidth(true)); 259 | } 260 | 261 | /// 262 | /// 绘制红点运算单元标题 263 | /// 264 | private void DrawRedDotUnitTile() 265 | { 266 | EditorGUILayout.BeginHorizontal("box"); 267 | EditorGUILayout.LabelField("红点运算单元类型", RedDotStyles.ButtonMidStyle, GUILayout.Width(200f), GUILayout.Height(20f)); 268 | EditorGUILayout.LabelField("红点运算单元描述", RedDotStyles.ButtonMidStyle, GUILayout.Width(200f), GUILayout.Height(20f)); 269 | EditorGUILayout.LabelField("红点类型", RedDotStyles.ButtonMidStyle, GUILayout.Width(120f), GUILayout.Height(20f)); 270 | EditorGUILayout.LabelField("红点运算单元值", RedDotStyles.ButtonMidStyle, GUILayout.Width(120f), GUILayout.Height(20f)); 271 | EditorGUILayout.LabelField("影响红点名", RedDotStyles.ButtonMidStyle, GUILayout.ExpandWidth(true), GUILayout.Height(20f)); 272 | EditorGUILayout.EndHorizontal(); 273 | } 274 | 275 | /// 276 | /// 绘制红点运算单元信息 277 | /// 278 | /// 279 | private void DrawRedDotUnitInfo(RedDotUnitInfo redDotUnitInfo) 280 | { 281 | EditorGUILayout.BeginHorizontal(); 282 | EditorGUILayout.LabelField(redDotUnitInfo.RedDotUnit.ToString(), RedDotStyles.ButtonMidStyle, GUILayout.Width(200f), GUILayout.Height(20f)); 283 | EditorGUILayout.LabelField(redDotUnitInfo.RedDotUnitDes, RedDotStyles.ButtonMidStyle, GUILayout.Width(200f), GUILayout.Height(20f)); 284 | EditorGUILayout.LabelField(redDotUnitInfo.RedDotType.ToString(), RedDotStyles.ButtonMidStyle, GUILayout.Width(120f), GUILayout.Height(20f)); 285 | var redDotUnitResult = RedDotModel.Singleton.GetRedDotUnitResult(redDotUnitInfo.RedDotUnit); 286 | var preColor = GUI.color; 287 | if(redDotUnitResult > 0) 288 | { 289 | GUI.color = Color.yellow; 290 | } 291 | EditorGUILayout.LabelField(redDotUnitResult.ToString(), RedDotStyles.ButtonMidStyle, GUILayout.Width(120f), GUILayout.Height(20f)); 292 | GUI.color = preColor; 293 | var redDotNames = RedDotModel.Singleton.GetRedDotNamesByUnit(redDotUnitInfo.RedDotUnit); 294 | foreach(var redDotName in redDotNames) 295 | { 296 | preColor = GUI.color; 297 | GUI.color = Color.green; 298 | if(GUILayout.Button(redDotName, GUILayout.ExpandWidth(true), GUILayout.Height(20f))) 299 | { 300 | var trieNode = RedDotModel.Singleton.RedDotTrie.GetWordNode(redDotName); 301 | JumpToTrieNodeDetail(trieNode); 302 | } 303 | GUI.color = preColor; 304 | } 305 | EditorGUILayout.EndHorizontal(); 306 | } 307 | 308 | /// 309 | /// 绘制红点名详情区域 310 | /// 311 | private void DrawRedDotDetailArea() 312 | { 313 | if(mSelectedTrieNode != null) 314 | { 315 | var redDotName = mSelectedTrieNode.GetFullWord(); 316 | if (mSelectedTrieNode.IsTail) 317 | { 318 | var redDotInfo = RedDotModel.Singleton.GetRedDotInfoByName(redDotName); 319 | DrawRedDotInfo(redDotInfo); 320 | } 321 | else 322 | { 323 | EditorGUILayout.LabelField($"选中红点名:{redDotName}不是单词节点!", RedDotStyles.ButtonMidStyle); 324 | } 325 | } 326 | else 327 | { 328 | EditorGUILayout.LabelField($"未选中有效红点名!", RedDotStyles.ButtonMidStyle); 329 | } 330 | } 331 | 332 | /// 333 | /// 绘制红点信息 334 | /// 335 | /// 336 | private void DrawRedDotInfo(RedDotInfo redDotInfo) 337 | { 338 | EditorGUILayout.LabelField($"当前选择红点", RedDotStyles.ButtonMidStyle, GUILayout.ExpandWidth(true), GUILayout.Height(20f)); 339 | var redDotNameResult = RedDotManager.Singleton.GetRedDotResult(redDotInfo.RedDotName); 340 | EditorGUILayout.LabelField($"{redDotInfo.RedDotName}({redDotInfo.RedDotDes})({redDotNameResult})", RedDotStyles.ButtonMidStyle, GUILayout.ExpandWidth(true), GUILayout.Height(20f)); 341 | EditorGUILayout.BeginVertical("box"); 342 | EditorGUILayout.LabelField($"红点运算单元组合", RedDotStyles.ButtonMidStyle, GUILayout.ExpandWidth(true), GUILayout.Height(20f)); 343 | DrawRedDotUnitTile(); 344 | var redDotUnitList = RedDotModel.Singleton.GetRedDotUnitsByName(redDotInfo.RedDotName); 345 | foreach(var redDotUnit in redDotUnitList) 346 | { 347 | var redDotUnitInfo = RedDotModel.Singleton.GetRedDotUnitInfo(redDotUnit); 348 | DrawRedDotUnitInfo(redDotUnitInfo); 349 | } 350 | EditorGUILayout.EndVertical(); 351 | } 352 | 353 | /// 354 | /// 跳转指定树节点红点名详情 355 | /// 356 | /// 357 | private void JumpToTrieNodeDetail(TrieNode trieNode) 358 | { 359 | mSelectedTagIndex = (int)RedDotSystemTag.RED_DOT_DETAIL; 360 | mSelectedTrieNode = trieNode; 361 | } 362 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/RedDotSystem/RedDotEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1f6dce869b25f2468f26f1a06b38824 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/RedDotSystem/RedDotStyles.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotStyles.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/18 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// RedDotStyles.cs 13 | /// 红点GUIStyles定义 14 | /// 15 | public static class RedDotStyles 16 | { 17 | /// 18 | /// 居中Button GUI Style 19 | /// 20 | public static GUIStyle ButtonMidStyle = new GUIStyle("ButtonMid"); 21 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/RedDotSystem/RedDotStyles.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1e859d10ac8e534cb9c603a32943d74 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/TrieEditorWindow.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6ee9821c098e1f4089fa09eb311f4e8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/TrieEditorWindow/TrieEditorWindow.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: TrieEditorWindow.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/12 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using UnityEditor; 11 | using UnityEngine; 12 | 13 | /// 14 | /// TrieEditorWindow.cs 15 | /// 前缀树窗口 16 | /// 17 | public class TrieEditorWindow : EditorWindow 18 | { 19 | /// 20 | /// 居中Button GUI Style 21 | /// 22 | private GUIStyle mButtonMidStyle; 23 | 24 | /// 25 | /// 前缀树 26 | /// 27 | private Trie mTrie; 28 | 29 | /// 30 | /// 当前滚动位置 31 | /// 32 | private Vector2 mCurrentScrollPos; 33 | 34 | /// 35 | /// 输入单词 36 | /// 37 | private string mInputWord; 38 | 39 | /// 40 | /// 节点展开Map<节点单词全名, 是否展开> 41 | /// 42 | private Dictionary mTrieNodeUnfoldMap = new Dictionary(); 43 | 44 | /// 45 | /// 前缀树单词列表 46 | /// 47 | private List mTrieWordList; 48 | 49 | [MenuItem("Tools/前缀树测试窗口")] 50 | static void Init() 51 | { 52 | TrieEditorWindow window = (TrieEditorWindow)EditorWindow.GetWindow(typeof(TrieEditorWindow), false, "前缀树测试窗口"); 53 | window.Show(); 54 | } 55 | 56 | void OnGUI() 57 | { 58 | InitGUIStyle(); 59 | InitData(); 60 | mCurrentScrollPos = EditorGUILayout.BeginScrollView(mCurrentScrollPos); 61 | EditorGUILayout.BeginVertical(); 62 | DisplayTrieOperationArea(); 63 | DisplayTrieContentArea(); 64 | DisplayTrieWordsArea(); 65 | EditorGUILayout.EndVertical(); 66 | EditorGUILayout.EndScrollView(); 67 | } 68 | 69 | /// 70 | /// 初始化GUIStyle 71 | /// 72 | private void InitGUIStyle() 73 | { 74 | if(mButtonMidStyle == null) 75 | { 76 | mButtonMidStyle = new GUIStyle("ButtonMid"); 77 | } 78 | } 79 | 80 | /// 81 | /// 初始化数据 82 | /// 83 | private void InitData() 84 | { 85 | if (mTrie == null) 86 | { 87 | mTrie = new Trie(); 88 | mTrieWordList = null; 89 | } 90 | } 91 | 92 | /// 93 | /// 更新前缀树单词列表 94 | /// 95 | private void UpdateTrieWordList() 96 | { 97 | mTrieWordList = mTrie.GetWordList(); 98 | } 99 | 100 | /// 101 | /// 显示前缀树操作区域 102 | /// 103 | private void DisplayTrieOperationArea() 104 | { 105 | EditorGUILayout.BeginHorizontal("box"); 106 | EditorGUILayout.LabelField("单词:", GUILayout.Width(40f), GUILayout.Height(20f)); 107 | mInputWord = EditorGUILayout.TextField(mInputWord, GUILayout.ExpandWidth(true), GUILayout.Height(20f)); 108 | if(GUILayout.Button("添加", GUILayout.Width(120f), GUILayout.Height(20f))) 109 | { 110 | if (string.IsNullOrEmpty(mInputWord)) 111 | { 112 | Debug.LogError($"不能允许添加空单词!"); 113 | } 114 | else 115 | { 116 | mTrie.AddWord(mInputWord); 117 | UpdateTrieWordList(); 118 | } 119 | } 120 | if (GUILayout.Button("删除", GUILayout.Width(120f), GUILayout.Height(20f))) 121 | { 122 | if(string.IsNullOrEmpty(mInputWord)) 123 | { 124 | Debug.LogError($"不能允许删除空单词!"); 125 | } 126 | else 127 | { 128 | mTrie.RemoveWord(mInputWord); 129 | } 130 | } 131 | EditorGUILayout.EndHorizontal(); 132 | } 133 | 134 | /// 135 | /// 绘制前缀树内容 136 | /// 137 | private void DisplayTrieContentArea() 138 | { 139 | EditorGUILayout.BeginVertical("box"); 140 | EditorGUILayout.LabelField("前缀树节点信息", mButtonMidStyle, GUILayout.ExpandWidth(true), GUILayout.Height(20f)); 141 | DisplayTrieNode(mTrie.RootNode); 142 | EditorGUILayout.EndVertical(); 143 | } 144 | 145 | /// 146 | /// 显示一个节点 147 | /// 148 | /// 149 | private void DisplayTrieNode(TrieNode trieNode) 150 | { 151 | var nodeFullWord = trieNode.GetFullWord(); 152 | if(!mTrieNodeUnfoldMap.ContainsKey(nodeFullWord)) 153 | { 154 | mTrieNodeUnfoldMap.Add(nodeFullWord, true); 155 | } 156 | EditorGUILayout.BeginHorizontal("box"); 157 | GUILayout.Space(trieNode.Depth * 20); 158 | var displayName = $"{trieNode.NodeValue}({trieNode.Depth})"; 159 | if (trieNode.ChildCount > 0) 160 | { 161 | mTrieNodeUnfoldMap[nodeFullWord] = EditorGUILayout.Foldout(mTrieNodeUnfoldMap[nodeFullWord], displayName); 162 | } 163 | else 164 | { 165 | EditorGUILayout.LabelField(displayName); 166 | } 167 | EditorGUILayout.EndHorizontal(); 168 | if(mTrieNodeUnfoldMap[nodeFullWord] && trieNode.ChildCount > 0) 169 | { 170 | var childNodeValueList = trieNode.ChildNodesMap.Keys.ToList(); 171 | foreach(var childNodeValue in childNodeValueList) 172 | { 173 | var childNode = trieNode.GetChildNode(childNodeValue); 174 | DisplayTrieNode(childNode); 175 | } 176 | } 177 | } 178 | 179 | /// 180 | /// 显示前缀树单词区域 181 | /// 182 | private void DisplayTrieWordsArea() 183 | { 184 | EditorGUILayout.BeginVertical("box"); 185 | EditorGUILayout.LabelField("前缀树单词信息", mButtonMidStyle, GUILayout.ExpandWidth(true), GUILayout.Height(20f)); 186 | if(mTrieWordList != null) 187 | { 188 | foreach (var word in mTrieWordList) 189 | { 190 | EditorGUILayout.LabelField(word, GUILayout.ExpandWidth(true), GUILayout.Height(20f)); 191 | } 192 | } 193 | EditorGUILayout.EndVertical(); 194 | } 195 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Editor/TrieEditorWindow/TrieEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78fb27fe37c2a634aa1f15021eb587f0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLauncher.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: GameLauncher.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/10 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// GameLauncher.cs 13 | /// 游戏启动器 14 | /// 15 | public class GameLauncher : MonoBehaviour 16 | { 17 | /// 18 | /// 单例对象 19 | /// 20 | public static GameLauncher Singleton 21 | { 22 | get 23 | { 24 | return mSingleton; 25 | } 26 | } 27 | private static GameLauncher mSingleton; 28 | 29 | /// 30 | /// 主界面 31 | /// 32 | [Header("主界面")] 33 | public MainUI MainUI; 34 | 35 | /// 36 | /// 背包界面 37 | /// 38 | [Header("背包界面")] 39 | public BackpackUI BackpackUI; 40 | 41 | /// 42 | /// 装备界面 43 | /// 44 | [Header("装备界面")] 45 | public EquipUI EquipUI; 46 | 47 | /// 48 | /// 邮件界面 49 | /// 50 | [Header("邮件界面")] 51 | public MailUI MailUI; 52 | 53 | private void Awake() 54 | { 55 | mSingleton = this; 56 | RedDotModel.Singleton.Init(); 57 | RedDotManager.Singleton.Init(); 58 | // 所有数据初始化完成后触发一次红点运算单元计算 59 | RedDotManager.Singleton.DoAllRedDotUnitCaculate(); 60 | } 61 | 62 | private void Start() 63 | { 64 | MainUI.OnOpen(); 65 | } 66 | 67 | public void Update() 68 | { 69 | RedDotManager.Singleton.Update(); 70 | } 71 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLauncher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c7a38528ada94643b5f98bee3c35ab7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cfced5e7a94508d44b9e137eac10e44b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/GameModel.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: GameModel.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/21 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// GameModel.cs 13 | /// 游戏数据层(用于测试红点数据保存和修改) 14 | /// 15 | public class GameModel : SingletonTemplate 16 | { 17 | #region 主界面部分 18 | /// 19 | /// 主界面动态新功能1是否解锁 20 | /// 21 | public bool NewFunc1 22 | { 23 | get; 24 | private set; 25 | } 26 | 27 | /// 28 | /// 主界面动态新功能2是否解锁 29 | /// 30 | public bool NewFunc2 31 | { 32 | get; 33 | private set; 34 | } 35 | 36 | /// 37 | /// 设置主界面动态新功能1是否解锁 38 | /// 39 | /// 40 | public void SetNewFunc1(bool newFunc1) 41 | { 42 | if(NewFunc1 != newFunc1) 43 | { 44 | NewFunc1 = newFunc1; 45 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_FUNC1); 46 | } 47 | } 48 | 49 | /// 50 | /// 设置主界面动态新功能2是否解锁 51 | /// 52 | /// 53 | public void SetNewFunc2(bool newFunc2) 54 | { 55 | if (NewFunc2 != newFunc2) 56 | { 57 | NewFunc2 = newFunc2; 58 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_FUNC2); 59 | } 60 | } 61 | #endregion 62 | 63 | #region 背包界面部分 64 | /// 65 | /// 新道具数 66 | /// 67 | public int NewItemNum 68 | { 69 | get; 70 | private set; 71 | } 72 | 73 | /// 74 | /// 新资源数 75 | /// 76 | public int NewResourceNum 77 | { 78 | get; 79 | private set; 80 | } 81 | 82 | /// 83 | /// 新装备数 84 | /// 85 | public int NewEquipNum 86 | { 87 | get; 88 | private set; 89 | } 90 | 91 | /// 92 | /// 设置新道具数 93 | /// 94 | /// 95 | public void SetNewItemNum(int newItemNum) 96 | { 97 | newItemNum = Mathf.Clamp(newItemNum, 0, newItemNum); 98 | if (NewItemNum != newItemNum) 99 | { 100 | NewItemNum = newItemNum; 101 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_ITEM_NUM); 102 | } 103 | } 104 | 105 | /// 106 | /// 设置新资源数 107 | /// 108 | /// 109 | public void SetNewResourceNum(int newResourceNum) 110 | { 111 | newResourceNum = Mathf.Clamp(newResourceNum, 0, newResourceNum); 112 | if (NewResourceNum != newResourceNum) 113 | { 114 | NewResourceNum = newResourceNum; 115 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_RESOURCE_NUM); 116 | } 117 | } 118 | 119 | /// 120 | /// 设置新装备数 121 | /// 122 | /// 123 | public void SetmNewEquipNum(int newEquipNum) 124 | { 125 | newEquipNum = Mathf.Clamp(newEquipNum, 0, newEquipNum); 126 | if (NewEquipNum != newEquipNum) 127 | { 128 | NewEquipNum = newEquipNum; 129 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_EQUIP_NUM); 130 | } 131 | } 132 | #endregion 133 | 134 | #region 邮件界面部分 135 | /// 136 | /// 新公共邮件数 137 | /// 138 | public int NewPublicMailNum 139 | { 140 | get; 141 | private set; 142 | } 143 | 144 | /// 145 | /// 新战斗邮件数 146 | /// 147 | public int NewBattleMailNum 148 | { 149 | get; 150 | private set; 151 | } 152 | 153 | /// 154 | /// 新其他邮件数 155 | /// 156 | public int NewOtherMailNum 157 | { 158 | get; 159 | private set; 160 | } 161 | 162 | /// 163 | /// 公共邮件可领奖数 164 | /// 165 | public int NewPublicMailRewardNum 166 | { 167 | get; 168 | private set; 169 | } 170 | 171 | /// 172 | /// 战斗邮件可领奖数 173 | /// 174 | public int NewBattleMailRewardNum 175 | { 176 | get; 177 | private set; 178 | } 179 | 180 | /// 181 | /// 设置新公共邮件数 182 | /// 183 | /// 184 | public void SetNewPublicMailNum(int newPublicMailNum) 185 | { 186 | newPublicMailNum = Mathf.Clamp(newPublicMailNum, 0, newPublicMailNum); 187 | if (NewPublicMailNum != newPublicMailNum) 188 | { 189 | NewPublicMailNum = newPublicMailNum; 190 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_PUBLIC_MAIL_NUM); 191 | } 192 | } 193 | 194 | /// 195 | /// 设置新战斗邮件数 196 | /// 197 | /// 198 | public void SetNewBattleMailNum(int newBattleMailNum) 199 | { 200 | newBattleMailNum = Mathf.Clamp(newBattleMailNum, 0, newBattleMailNum); 201 | if (NewBattleMailNum != newBattleMailNum) 202 | { 203 | NewBattleMailNum = newBattleMailNum; 204 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_BATTLE_MAIL_NUM); 205 | } 206 | } 207 | 208 | /// 209 | /// 设置新其他邮件数 210 | /// 211 | /// 212 | public void SetmNewOtherMailNum(int newOtherMailNum) 213 | { 214 | newOtherMailNum = Mathf.Clamp(newOtherMailNum, 0, newOtherMailNum); 215 | if (NewOtherMailNum != newOtherMailNum) 216 | { 217 | NewOtherMailNum = newOtherMailNum; 218 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.NEW_OTHER_MAIL_NUM); 219 | } 220 | } 221 | 222 | /// 223 | /// 设置公共邮件可领奖数 224 | /// 225 | /// 226 | public void SetPublicMailRewardNum(int publicMailRewardNum) 227 | { 228 | publicMailRewardNum = Mathf.Clamp(publicMailRewardNum, 0, publicMailRewardNum); 229 | if (NewPublicMailRewardNum != publicMailRewardNum) 230 | { 231 | NewPublicMailRewardNum = publicMailRewardNum; 232 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.PUBLIC_MAIL_REWARD_NUM); 233 | } 234 | } 235 | 236 | /// 237 | /// 设置战斗邮件可领奖数 238 | /// 239 | /// 240 | public void SetBattleMailRewardNum(int publicBattleRewardNum) 241 | { 242 | publicBattleRewardNum = Mathf.Clamp(publicBattleRewardNum, 0, publicBattleRewardNum); 243 | if (NewBattleMailRewardNum != publicBattleRewardNum) 244 | { 245 | NewBattleMailRewardNum = publicBattleRewardNum; 246 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.BATTLE_MAIL_REWARD_NUM); 247 | } 248 | } 249 | #endregion 250 | 251 | #region 装备界面部分 252 | /// 253 | /// 可穿戴装备数 254 | /// 255 | public int WearableEquipNum 256 | { 257 | get; 258 | private set; 259 | } 260 | 261 | /// 262 | /// 可升级装备数 263 | /// 264 | public int UpgradeableEquipNum 265 | { 266 | get; 267 | private set; 268 | } 269 | 270 | /// 271 | /// 设置可穿戴装备数 272 | /// 273 | /// 274 | public void SetWearableEquipNum(int newWearableEquipNum) 275 | { 276 | newWearableEquipNum = Mathf.Clamp(newWearableEquipNum, 0, newWearableEquipNum); 277 | if (WearableEquipNum != newWearableEquipNum) 278 | { 279 | WearableEquipNum = newWearableEquipNum; 280 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.WEARABLE_EQUIP_NUM); 281 | } 282 | } 283 | 284 | /// 285 | /// 设置可升级装备数 286 | /// 287 | /// 288 | public void SetUpgradeableEquipNum(int newUpgradeableEquipNum) 289 | { 290 | newUpgradeableEquipNum = Mathf.Clamp(newUpgradeableEquipNum, 0, newUpgradeableEquipNum); 291 | if (UpgradeableEquipNum != newUpgradeableEquipNum) 292 | { 293 | UpgradeableEquipNum = newUpgradeableEquipNum; 294 | RedDotManager.Singleton.MarkRedDotUnitDirty(RedDotUnit.UPGRADEABLE_EQUIP_NUM); 295 | } 296 | } 297 | #endregion 298 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/GameModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27b6172796ae447498535be053305c1e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56b7c174e1dc90e4c8534ec5ce01a7d7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotInfo.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using UnityEngine; 11 | 12 | /// 13 | /// RedDotInfo.cs 14 | /// 红点信息类 15 | /// 16 | public class RedDotInfo 17 | { 18 | /// 19 | /// 红点名 20 | /// 21 | public string RedDotName 22 | { 23 | get; 24 | private set; 25 | } 26 | 27 | /// 28 | /// 所有影响此红点的红点单元列表 29 | /// 30 | public List RedDotUnitList 31 | { 32 | get; 33 | private set; 34 | } 35 | 36 | /// 37 | /// 红点描述 38 | /// 39 | public string RedDotDes 40 | { 41 | get; 42 | private set; 43 | } 44 | 45 | /// 46 | /// 红点刷新委托(一般只会绑定一个回调) 47 | /// 48 | public Action RefreshDelegate 49 | { 50 | get; 51 | private set; 52 | } 53 | 54 | private RedDotInfo() 55 | { 56 | RedDotUnitList = new List(); 57 | } 58 | 59 | /// 60 | /// 构造函数 61 | /// 62 | /// 63 | /// 64 | public RedDotInfo(string redDotName, string redDotDes) 65 | { 66 | RedDotName = redDotName; 67 | RedDotDes = redDotDes; 68 | RedDotUnitList = new List(); 69 | } 70 | 71 | /// 72 | /// 红点对象刷新绑定 73 | /// 74 | /// 75 | public bool Bind(Action refreshDelegate) 76 | { 77 | if(refreshDelegate == null) 78 | { 79 | Debug.LogError($"红点名:{RedDotName}不允许绑定空刷新回调!"); 80 | return false; 81 | } 82 | RefreshDelegate += refreshDelegate; 83 | return true; 84 | } 85 | 86 | /// 87 | /// 红点对象解绑定 88 | /// 89 | /// 90 | public void UnBind(Action refreshDelegate) 91 | { 92 | RefreshDelegate -= refreshDelegate; 93 | } 94 | 95 | /// 96 | /// 触发刷新结果 97 | /// 98 | /// 99 | /// 100 | public void TriggerUpdate(int result, RedDotType redDotType) 101 | { 102 | if(RefreshDelegate != null) 103 | { 104 | RefreshDelegate.Invoke(RedDotName, result, redDotType); 105 | } 106 | } 107 | 108 | /// 109 | /// 添加影响的红点运算单元 110 | /// 111 | /// 112 | /// 113 | public bool AddRedDotUnit(RedDotUnit redDotUnit) 114 | { 115 | if (RedDotUnitList.Contains(redDotUnit)) 116 | { 117 | Debug.LogError($"红点名:{RedDotName}重复添加影响红点运算单元:{redDotUnit.ToString()},添加失败!"); 118 | return false; 119 | } 120 | RedDotUnitList.Add(redDotUnit); 121 | return true; 122 | } 123 | 124 | /// 125 | /// 移除影响的红点运算单元 126 | /// 127 | /// 128 | /// 129 | public bool RemoveRedDotUnit(RedDotUnit redDotUnit) 130 | { 131 | if (!RedDotUnitList.Contains(redDotUnit)) 132 | { 133 | Debug.LogError($"红点名:{RedDotName}未添加影响红点运算单元:{redDotUnit.ToString()},移除失败!"); 134 | return false; 135 | } 136 | return RedDotUnitList.Remove(redDotUnit); 137 | } 138 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8dd46f7489716ff44b369d52951356bf 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotManager.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotManager.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using UnityEngine; 11 | 12 | /// 13 | /// RedDotManager.cs 14 | /// 红点管理单例类 15 | /// 16 | public class RedDotManager : SingletonTemplate 17 | { 18 | /// 19 | /// 标脏的红点运算单元Map<红点运算单元, 红点运算单元> 20 | /// 21 | private Dictionary mDirtyRedDotUnitMap; 22 | 23 | /// 24 | /// 结果变化的红点名数据Map<红点名, 红点名> 25 | /// 26 | private Dictionary mResultChangedRedDotNameMap; 27 | 28 | /// 29 | /// 已经计算过的红点运算单元和结果是否变化Map<红点运算单元,结果是否变化> 30 | /// Note: 31 | /// 优化单个红点运算单元重复计算的问题 32 | /// 33 | private Dictionary mCaculatedRedDotUnitResultChangeMap; 34 | 35 | /// 36 | /// 标脏检测更新帧率 37 | /// 38 | private const int DIRTY_UPDATE_INTERVAL_FRAME = 10; 39 | 40 | /// 41 | /// 经历的帧数 42 | /// 43 | private int mFramePassed; 44 | 45 | public RedDotManager() 46 | { 47 | mFramePassed = 0; 48 | } 49 | 50 | /// 51 | /// 初始化 52 | /// 53 | public void Init() 54 | { 55 | InitRedDotData(); 56 | } 57 | 58 | /// 59 | /// 初始化红点数据 60 | /// 61 | private void InitRedDotData() 62 | { 63 | mDirtyRedDotUnitMap = new Dictionary(); 64 | mCaculatedRedDotUnitResultChangeMap = new Dictionary(); 65 | mResultChangedRedDotNameMap = new Dictionary(); 66 | } 67 | 68 | /// 69 | /// 执行所有红点名运算单元运算 70 | /// Note: 71 | /// 进入游戏后获取完相关数据后触发一次,确保第一次运算结果缓存 72 | /// 73 | public void DoAllRedDotUnitCaculate() 74 | { 75 | var redDotUnitInfoMap = RedDotModel.Singleton.GetRedDotUnitInfoMap(); 76 | foreach(var redDotUnitInfo in redDotUnitInfoMap) 77 | { 78 | DoRedDotUnitCaculate(redDotUnitInfo.Key); 79 | } 80 | } 81 | 82 | /// 83 | /// 触发红点名刷新回调 84 | /// 85 | /// 86 | public bool TriggerRedDotNameUpdate(string redDotName) 87 | { 88 | var redDotInfo = RedDotModel.Singleton.GetRedDotInfoByName(redDotName); 89 | if(redDotInfo == null) 90 | { 91 | Debug.LogError($"触发红点名:{redDotName}刷新回调失败!"); 92 | return false; 93 | } 94 | var redDotNameResult = GetRedDotNameResult(redDotName); 95 | redDotInfo.TriggerUpdate(redDotNameResult.result, redDotNameResult.redDotType); 96 | return true; 97 | } 98 | 99 | /// 100 | /// 获取指定红点名的结果数据 101 | /// 102 | /// 103 | /// 104 | public (int result, RedDotType redDotType) GetRedDotNameResult(string redDotName) 105 | { 106 | (int result, RedDotType redDotType) redDotNameResult = (0, RedDotType.NONE); 107 | var redDotUnitList = RedDotModel.Singleton.GetRedDotUnitsByName(redDotName); 108 | if (redDotUnitList != null) 109 | { 110 | var result = 0; 111 | var redDotType = RedDotType.NONE; 112 | foreach (var redDotUnit in redDotUnitList) 113 | { 114 | var redDotUnitResult = RedDotModel.Singleton.GetRedDotUnitResult(redDotUnit); 115 | if (redDotUnitResult > 0) 116 | { 117 | var redDotType2 = RedDotModel.Singleton.GetRedDotUnitRedType(redDotUnit); 118 | redDotType = redDotType | redDotType2; 119 | } 120 | result += redDotUnitResult; 121 | } 122 | redDotNameResult.result = result; 123 | redDotNameResult.redDotType = redDotType; 124 | } 125 | return redDotNameResult; 126 | } 127 | 128 | /// 129 | /// 绑定指定红点名刷新回调 130 | /// 131 | /// 132 | /// 133 | /// 134 | public void BindRedDotName(string redDotName, Action refreshDelegate) 135 | { 136 | var redDotInfo = RedDotModel.Singleton.GetRedDotInfoByName(redDotName); 137 | if(redDotInfo == null) 138 | { 139 | Debug.LogError($"找不到红点名:{redDotName}红点信息,绑定刷新失败!"); 140 | return; 141 | } 142 | redDotInfo.Bind(refreshDelegate); 143 | } 144 | 145 | /// 146 | /// 解绑定指定红点名 147 | /// 148 | /// 149 | /// 150 | /// 151 | public void UnbindRedDotName(string redDotName, Action refreshDelegate) 152 | { 153 | var redDotInfo = RedDotModel.Singleton.GetRedDotInfoByName(redDotName); 154 | if (redDotInfo == null) 155 | { 156 | Debug.LogError($"找不到红点名:{redDotName}红点信息,解绑定失败!"); 157 | return; 158 | } 159 | redDotInfo.UnBind(refreshDelegate); 160 | } 161 | 162 | /// 163 | /// 获取指定红点名结果 164 | /// 165 | /// 166 | /// 167 | public int GetRedDotResult(string redDotName) 168 | { 169 | var redDotUnitList = RedDotModel.Singleton.GetRedDotUnitsByName(redDotName); 170 | if(redDotUnitList == null) 171 | { 172 | return 0; 173 | } 174 | var result = 0; 175 | foreach(var redDotUnit in redDotUnitList) 176 | { 177 | var redDotUnitResult = RedDotModel.Singleton.GetRedDotUnitResult(redDotUnit); 178 | result += redDotUnitResult; 179 | } 180 | return result; 181 | } 182 | 183 | /// 184 | /// 更新 185 | /// 186 | public void Update() 187 | { 188 | mFramePassed++; 189 | if(mFramePassed >= DIRTY_UPDATE_INTERVAL_FRAME) 190 | { 191 | CheckDirtyRedDotUnit(); 192 | mFramePassed = 0; 193 | } 194 | } 195 | 196 | /// 197 | /// 标记指定红点名脏 198 | /// 199 | /// 200 | public void MarkRedDotNameDirty(string redDotName) 201 | { 202 | var redDotUnitList = RedDotModel.Singleton.GetRedDotUnitsByName(redDotName); 203 | if (redDotUnitList != null) 204 | { 205 | foreach (var redDotUnit in redDotUnitList) 206 | { 207 | MarkRedDotUnitDirty(redDotUnit); 208 | } 209 | } 210 | } 211 | 212 | /// 213 | /// 标记指定红点运算类型脏 214 | /// 215 | /// 216 | public void MarkRedDotUnitDirty(RedDotUnit redDotUnit) 217 | { 218 | if (!mDirtyRedDotUnitMap.ContainsKey(redDotUnit)) 219 | { 220 | mDirtyRedDotUnitMap.Add(redDotUnit, redDotUnit); 221 | } 222 | } 223 | 224 | /// 225 | /// 检查标脏红点运算单元 226 | /// 227 | private void CheckDirtyRedDotUnit() 228 | { 229 | if(!RedDotModel.Singleton.IsInitCompelte) 230 | { 231 | return; 232 | } 233 | if(mDirtyRedDotUnitMap.Count == 0) 234 | { 235 | return; 236 | } 237 | // 部分红点单元单纯是影响因素,不会决定最终红点数量 238 | // 所以这里要把标脏的红点单元影响到的红点名所有红点单元都触发计算看是否有相关结论变化 239 | // 有相关红点单元的结果变化的红点名才需要通知上层逻辑回调刷新 240 | mCaculatedRedDotUnitResultChangeMap.Clear(); 241 | mResultChangedRedDotNameMap.Clear(); 242 | foreach(var dirtyRedDotUnit in mDirtyRedDotUnitMap) 243 | { 244 | var realRedDotUnit = dirtyRedDotUnit.Key; 245 | var redDotNameList = RedDotModel.Singleton.GetRedDotNamesByUnit(realRedDotUnit); 246 | if(redDotNameList == null || redDotNameList.Count == 0) 247 | { 248 | continue; 249 | } 250 | foreach (var redDotName in redDotNameList) 251 | { 252 | var redDotUnitList = RedDotModel.Singleton.GetRedDotUnitsByName(redDotName); 253 | if(redDotUnitList == null || redDotUnitList.Count == 0) 254 | { 255 | continue; 256 | } 257 | foreach(var redDotUnit in redDotUnitList) 258 | { 259 | bool resultChange = false; 260 | if(!mCaculatedRedDotUnitResultChangeMap.TryGetValue(redDotUnit, out resultChange)) 261 | { 262 | resultChange = DoRedDotUnitCaculate(redDotUnit); 263 | mCaculatedRedDotUnitResultChangeMap.Add(redDotUnit, resultChange); 264 | } 265 | if(!resultChange) 266 | { 267 | continue; 268 | } 269 | if(!mResultChangedRedDotNameMap.ContainsKey(redDotName)) 270 | { 271 | mResultChangedRedDotNameMap.Add(redDotName, redDotName); 272 | } 273 | } 274 | } 275 | } 276 | mDirtyRedDotUnitMap.Clear(); 277 | // 通过每个红点所有影响的红点运算单元得出红点显示结论并通知更新 278 | foreach (var resultChangedRedDotName in mResultChangedRedDotNameMap) 279 | { 280 | TriggerRedDotNameUpdate(resultChangedRedDotName.Key); 281 | } 282 | mResultChangedRedDotNameMap.Clear(); 283 | } 284 | 285 | /// 286 | /// 执行指定红点运算单元计算 287 | /// 288 | /// 289 | /// 290 | private bool DoRedDotUnitCaculate(RedDotUnit redDotUnit) 291 | { 292 | var preResult = RedDotModel.Singleton.GetRedDotUnitResult(redDotUnit); 293 | var redDotUnitFunc = RedDotModel.Singleton.GetRedDotUnitFunc(redDotUnit); 294 | var result = 0; 295 | if(redDotUnitFunc != null) 296 | { 297 | result = redDotUnitFunc(); 298 | } 299 | else 300 | { 301 | //Debug.LogError($"红点运算单元:{redDotUnit.ToString()}未绑定有效计算方法!"); 302 | } 303 | RedDotModel.Singleton.SetRedDotUnitResult(redDotUnit, result); 304 | return preResult != result; 305 | } 306 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 298e968e864e1fb4cac9309751ae7b38 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotModel.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotModel.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using UnityEngine; 11 | 12 | /// 13 | /// RedDotModel.cs 14 | /// 红点数据单例类 15 | /// 16 | public class RedDotModel : SingletonTemplate 17 | { 18 | /// 19 | /// 红点运算单元信息Map<红点运算单元名, 红点运算单元信息> 20 | /// 21 | private Dictionary mRedDotUnitInfoMap; 22 | 23 | /// 24 | /// 红点运算单元结果值Map<红点运算单元, 红点运算单元结果值> 25 | /// 26 | private Dictionary mRedDotUnitResultMap; 27 | 28 | /// 29 | /// 红点名和红点信息Map<红点名, 红点信息> 30 | /// 31 | private Dictionary mRedDotInfoMap; 32 | 33 | /// 34 | /// 红点单元和红点名列表Map 35 | /// 36 | private Dictionary> mRedDotUnitNameMap; 37 | 38 | /// 39 | /// 红点前缀树 40 | /// 41 | public Trie RedDotTrie 42 | { 43 | get; 44 | private set; 45 | } 46 | 47 | /// 48 | /// 初始化是否完成 49 | /// 50 | public bool IsInitCompelte 51 | { 52 | get; 53 | private set; 54 | } 55 | 56 | /// 57 | /// 构造函数 58 | /// 59 | public RedDotModel() 60 | { 61 | mRedDotUnitInfoMap = new Dictionary(); 62 | mRedDotUnitResultMap = new Dictionary(); 63 | mRedDotInfoMap = new Dictionary(); 64 | mRedDotUnitNameMap = new Dictionary>(); 65 | IsInitCompelte = false; 66 | } 67 | 68 | /// 69 | /// 初始化 70 | /// 71 | public void Init() 72 | { 73 | if (IsInitCompelte) 74 | { 75 | Debug.LogError($"请勿重复初始化!"); 76 | return; 77 | } 78 | // 优先初始化红点单元,现在改成通过红点名正向配置红点单元组成,而非反向红点单元定义影响红点名组成 79 | InitRedDotUnitInfo(); 80 | InitRedDotInfo(); 81 | InitRedDotTree(); 82 | // InitRedDotUnitNameMap必须在InitRedDotInfo之后调用,因为用到了前面的数据 83 | UpdateRedDotUnitNameMap(); 84 | IsInitCompelte = true; 85 | } 86 | 87 | /// 88 | /// 初始化红点运算单元信息 89 | /// 90 | private void InitRedDotUnitInfo() 91 | { 92 | // 构建添加所有游戏里的红点运算单元信息 93 | AddRedDotUnitInfo(RedDotUnit.NEW_FUNC1, "动态新功能1解锁", RedDotUtilities.CaculateNewFunc1, RedDotType.NEW); 94 | AddRedDotUnitInfo(RedDotUnit.NEW_FUNC2, "动态新功能2解锁", RedDotUtilities.CaculateNewFunc2, RedDotType.NEW); 95 | AddRedDotUnitInfo(RedDotUnit.NEW_ITEM_NUM, "新道具数", RedDotUtilities.CaculateNewItemNum, RedDotType.NUMBER); 96 | AddRedDotUnitInfo(RedDotUnit.NEW_RESOURCE_NUM, "新资源数", RedDotUtilities.CaculateNewResourceNum, RedDotType.NUMBER); 97 | AddRedDotUnitInfo(RedDotUnit.NEW_EQUIP_NUM, "新装备数", RedDotUtilities.CaculateNewEquipNum, RedDotType.NUMBER); 98 | AddRedDotUnitInfo(RedDotUnit.NEW_PUBLIC_MAIL_NUM, "新公共邮件数", RedDotUtilities.CaculateNewPublicMailNum, RedDotType.NUMBER); 99 | AddRedDotUnitInfo(RedDotUnit.NEW_BATTLE_MAIL_NUM, "新战斗邮件数", RedDotUtilities.CaculateNewBattleMailNum, RedDotType.NUMBER); 100 | AddRedDotUnitInfo(RedDotUnit.NEW_OTHER_MAIL_NUM, "新其他邮件数", RedDotUtilities.CaculateNewOtherMailNum, RedDotType.NUMBER); 101 | AddRedDotUnitInfo(RedDotUnit.PUBLIC_MAIL_REWARD_NUM, "公共邮件可领奖数", RedDotUtilities.CaculateNewPublicMailRewardNum, RedDotType.NUMBER); 102 | AddRedDotUnitInfo(RedDotUnit.BATTLE_MAIL_REWARD_NUM, "战斗邮件可领奖数", RedDotUtilities.CaculateNewBattleMailRewardNum, RedDotType.NUMBER); 103 | AddRedDotUnitInfo(RedDotUnit.WEARABLE_EQUIP_NUM, "可穿戴装备数", RedDotUtilities.CaculateWearableEquipNum, RedDotType.NUMBER); 104 | AddRedDotUnitInfo(RedDotUnit.UPGRADEABLE_EQUIP_NUM, "可升级装备数", RedDotUtilities.CaculateUpgradeableEquipNum, RedDotType.NUMBER); 105 | } 106 | 107 | /// 108 | /// 初始化红点信息 109 | /// 110 | private void InitRedDotInfo() 111 | { 112 | /// Note: 113 | /// 穷举的好处是足够灵活 114 | /// 缺点是删除最里层红点运算单元需要把外层所有影响到的红点名相关红点运算单元配置删除 115 | /// 调用AddRedDotInfo添加游戏所有静态红点信息 116 | InitMainUIRedDotInfo(); 117 | InitBackpackUIRedDotInfo(); 118 | InitMailUIRedDotInfo(); 119 | InitEquipUIRedDotInfo(); 120 | } 121 | 122 | /// 123 | /// 初始化主界面红点信息 124 | /// 125 | private void InitMainUIRedDotInfo() 126 | { 127 | RedDotInfo redDotInfo; 128 | redDotInfo = AddRedDotInfo(RedDotNames.MAIN_UI_NEW_FUNC1, "主界面新功能1红点"); 129 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_FUNC1); 130 | 131 | redDotInfo = AddRedDotInfo(RedDotNames.MAIN_UI_NEW_FUNC2, "主界面新功能2红点"); 132 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_FUNC2); 133 | 134 | redDotInfo = AddRedDotInfo(RedDotNames.MAIN_UI_MENU, "主界面菜单红点"); 135 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_ITEM_NUM); 136 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_RESOURCE_NUM); 137 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_EQUIP_NUM); 138 | 139 | redDotInfo = AddRedDotInfo(RedDotNames.MAIN_UI_MAIL, "主界面邮件红点"); 140 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_PUBLIC_MAIL_NUM); 141 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_BATTLE_MAIL_NUM); 142 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_OTHER_MAIL_NUM); 143 | redDotInfo.AddRedDotUnit(RedDotUnit.PUBLIC_MAIL_REWARD_NUM); 144 | 145 | redDotInfo = AddRedDotInfo(RedDotNames.MAIN_UI_MENU_EQUIP, "主界面菜单装备红点"); 146 | redDotInfo.AddRedDotUnit(RedDotUnit.WEARABLE_EQUIP_NUM); 147 | redDotInfo.AddRedDotUnit(RedDotUnit.UPGRADEABLE_EQUIP_NUM); 148 | 149 | redDotInfo = AddRedDotInfo(RedDotNames.MAIN_UI_MENU_BACKPACK, "主界面菜单背包红点"); 150 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_ITEM_NUM); 151 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_RESOURCE_NUM); 152 | } 153 | 154 | /// 155 | /// 初始化背包界面红点信息 156 | /// 157 | private void InitBackpackUIRedDotInfo() 158 | { 159 | RedDotInfo redDotInfo; 160 | redDotInfo = AddRedDotInfo(RedDotNames.BACKPACK_UI_ITEM_TAG, "背包界面道具页签红点"); 161 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_ITEM_NUM); 162 | 163 | redDotInfo = AddRedDotInfo(RedDotNames.BACKPACK_UI_RESOURCE_TAG, "背包界面资源页签红点"); 164 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_RESOURCE_NUM); 165 | 166 | redDotInfo = AddRedDotInfo(RedDotNames.BACKPACK_UI_EQUIP_TAG, "背包界面装备页签红点"); 167 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_EQUIP_NUM); 168 | } 169 | 170 | /// 171 | /// 初始化邮件界面红点信息 172 | /// 173 | private void InitMailUIRedDotInfo() 174 | { 175 | RedDotInfo redDotInfo; 176 | redDotInfo = AddRedDotInfo(RedDotNames.MAIL_UI_PUBLIC_MAIL, "邮件界面公共邮件红点"); 177 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_PUBLIC_MAIL_NUM); 178 | redDotInfo.AddRedDotUnit(RedDotUnit.PUBLIC_MAIL_REWARD_NUM); 179 | 180 | redDotInfo = AddRedDotInfo(RedDotNames.MAIL_UI_BATTLE_MAIL, "邮件界面战斗邮件红点"); 181 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_BATTLE_MAIL_NUM); 182 | redDotInfo.AddRedDotUnit(RedDotUnit.BATTLE_MAIL_REWARD_NUM); 183 | 184 | redDotInfo = AddRedDotInfo(RedDotNames.MAIL_UI_OTHER_MAIL, "邮件界面其他邮件红点"); 185 | redDotInfo.AddRedDotUnit(RedDotUnit.NEW_OTHER_MAIL_NUM); 186 | } 187 | 188 | /// 189 | /// 初始化装备界面红点信息 190 | /// 191 | private void InitEquipUIRedDotInfo() 192 | { 193 | RedDotInfo redDotInfo; 194 | redDotInfo = AddRedDotInfo(RedDotNames.EQUIP_UI_WEARABLE, "装备界面可穿戴红点"); 195 | redDotInfo.AddRedDotUnit(RedDotUnit.WEARABLE_EQUIP_NUM); 196 | 197 | redDotInfo = AddRedDotInfo(RedDotNames.EQUIP_UI_UPGRADABLE, "装备界面可升级红点"); 198 | redDotInfo.AddRedDotUnit(RedDotUnit.UPGRADEABLE_EQUIP_NUM); 199 | } 200 | 201 | /// 202 | /// 添加红点信息 203 | /// 204 | /// 205 | /// 206 | private RedDotInfo AddRedDotInfo(string redDotName, string redDotDes) 207 | { 208 | if (mRedDotInfoMap.ContainsKey(redDotName)) 209 | { 210 | Debug.LogError($"重复添加红点名:{redDotName}信息,添加失败!"); 211 | return null; 212 | } 213 | var redDotInfo = new RedDotInfo(redDotName, redDotDes); 214 | mRedDotInfoMap.Add(redDotName, redDotInfo); 215 | return redDotInfo; 216 | } 217 | 218 | /// 219 | /// 构建红点前缀树 220 | /// 221 | private void InitRedDotTree() 222 | { 223 | RedDotTrie = new Trie(); 224 | foreach (var redDotInfo in mRedDotInfoMap) 225 | { 226 | RedDotTrie.AddWord(redDotInfo.Key); 227 | } 228 | } 229 | 230 | /// 231 | /// 根据mRedDotInfoMap反向构建mRedDotNameUnitMap 232 | /// 233 | private void UpdateRedDotUnitNameMap() 234 | { 235 | mRedDotUnitNameMap.Clear(); 236 | foreach (var redDotInfo in mRedDotInfoMap) 237 | { 238 | foreach (var redDotUnit in redDotInfo.Value.RedDotUnitList) 239 | { 240 | if (!mRedDotUnitNameMap.ContainsKey(redDotUnit)) 241 | { 242 | mRedDotUnitNameMap.Add(redDotUnit, new List()); 243 | } 244 | if (!mRedDotUnitNameMap[redDotUnit].Contains(redDotInfo.Key)) 245 | { 246 | mRedDotUnitNameMap[redDotUnit].Add(redDotInfo.Value.RedDotName); 247 | } 248 | } 249 | } 250 | } 251 | 252 | /// 253 | /// 添加红点运算单元信息 254 | /// 255 | /// 256 | /// 257 | /// 258 | /// 259 | /// 260 | private RedDotUnitInfo AddRedDotUnitInfo(RedDotUnit redDotUnit, string redDotUnitDes, Func caculateFunc, RedDotType redDotType = RedDotType.NUMBER) 261 | { 262 | RedDotUnitInfo redDotUnitInfo; 263 | if(mRedDotUnitInfoMap.TryGetValue(redDotUnit, out redDotUnitInfo)) 264 | { 265 | Debug.LogError($"已添加红点运算单元:{redDotUnit.ToString()}的红点运算单元信息,请勿重复添加,添加失败!"); 266 | return redDotUnitInfo; 267 | } 268 | redDotUnitInfo = new RedDotUnitInfo(redDotUnit, redDotUnitDes, caculateFunc, redDotType); 269 | mRedDotUnitInfoMap.Add(redDotUnit, redDotUnitInfo); 270 | return redDotUnitInfo; 271 | } 272 | 273 | /// 274 | /// 获取红点名和红点信息Map<红点名, 红点信息> 275 | /// 276 | /// 277 | public Dictionary GetRedDotInfoMap() 278 | { 279 | return mRedDotInfoMap; 280 | } 281 | 282 | /// 283 | /// 获取红点运算单元信息Map<红点运算单元门, 红点运算单元信息> 284 | /// 285 | /// 286 | public Dictionary GetRedDotUnitInfoMap() 287 | { 288 | return mRedDotUnitInfoMap; 289 | } 290 | 291 | /// 292 | /// 获取指定红点名的红点信息 293 | /// 294 | /// 295 | /// 296 | public RedDotInfo GetRedDotInfoByName(string redDotName) 297 | { 298 | RedDotInfo redDotInfo; 299 | if(!mRedDotInfoMap.TryGetValue(redDotName, out redDotInfo)) 300 | { 301 | Debug.LogError($"找不到红点名:{redDotName}的红点信息!"); 302 | } 303 | return redDotInfo; 304 | } 305 | 306 | /// 307 | /// 获取指定红点运算单元的红点运算单元信息 308 | /// 309 | /// 310 | /// 311 | public RedDotUnitInfo GetRedDotUnitInfo(RedDotUnit redDotUnit) 312 | { 313 | RedDotUnitInfo redDotUnitInfo; 314 | if(!mRedDotUnitInfoMap.TryGetValue(redDotUnit, out redDotUnitInfo)) 315 | { 316 | Debug.LogError($"找不到红点运算单元:{redDotUnit.ToString()}的信息!"); 317 | } 318 | return redDotUnitInfo; 319 | } 320 | 321 | /// 322 | /// 获取指定红点运算单元的计算委托 323 | /// 324 | /// 325 | /// 326 | public Func GetRedDotUnitFunc(RedDotUnit redDotUnit) 327 | { 328 | RedDotUnitInfo redDotUnitInfo = GetRedDotUnitInfo(redDotUnit); 329 | return redDotUnitInfo?.RedDotUnitCalculateFunc; 330 | } 331 | 332 | /// 333 | /// 获取指定红点运算单元的红点类型 334 | /// 335 | /// 336 | /// 337 | public RedDotType GetRedDotUnitRedType(RedDotUnit redDotUnit) 338 | { 339 | RedDotUnitInfo redDotUnitInfo = GetRedDotUnitInfo(redDotUnit); 340 | if(redDotUnitInfo != null) 341 | { 342 | return redDotUnitInfo.RedDotType; 343 | } 344 | Debug.LogError($"获取红点运算单元:{redDotUnit}的红点类型失败!"); 345 | return RedDotType.NONE; 346 | } 347 | 348 | /// 349 | /// 获取指定红点名的所有红点运算单元列表 350 | /// 351 | /// 352 | /// 353 | public List GetRedDotUnitsByName(string redDotName) 354 | { 355 | var redDotInfo = GetRedDotInfoByName(redDotName); 356 | return redDotInfo != null ? redDotInfo.RedDotUnitList : null; 357 | } 358 | 359 | /// 360 | /// 获取指定红点运算单元影响的所有红点名列表 361 | /// 362 | /// 363 | /// 364 | public List GetRedDotNamesByUnit(RedDotUnit redDotUnit) 365 | { 366 | List redDotNames; 367 | if(!mRedDotUnitNameMap.TryGetValue(redDotUnit, out redDotNames)) 368 | { 369 | Debug.LogError($"找不到红点运算单元:{redDotUnit.ToString()}的影响红点名信息,获取失败!"); 370 | } 371 | return redDotNames; 372 | } 373 | 374 | /// 375 | /// 获取指定红点运算单元的运算结果 376 | /// 377 | /// 378 | /// 379 | public int GetRedDotUnitResult(RedDotUnit redDotUnit) 380 | { 381 | int result = 0; 382 | if(!mRedDotUnitResultMap.TryGetValue(redDotUnit, out result)) 383 | { 384 | } 385 | return result; 386 | } 387 | 388 | /// 389 | /// 设置指定红点运算单元的运算结果 390 | /// 391 | /// 392 | /// 393 | /// 394 | public bool SetRedDotUnitResult(RedDotUnit redDotUnit, int result) 395 | { 396 | if(!mRedDotUnitResultMap.ContainsKey(redDotUnit)) 397 | { 398 | mRedDotUnitResultMap.Add(redDotUnit, result); 399 | return true; 400 | } 401 | mRedDotUnitResultMap[redDotUnit] = result; 402 | return true; 403 | } 404 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17b382fd9b2dca54596b64793048e239 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotNames.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotNames.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// RedDotNames.cs 13 | /// 红点名 14 | /// Note: 15 | /// 红点名采用前缀树风格定义父子关系(采用|分割父子关系) 16 | /// 所有游戏里的单个静态红点都在这里一一定义对应 17 | /// 18 | public static class RedDotNames 19 | { 20 | #region 主界面红点部分 21 | /// 22 | /// 主界面新功能1红点 23 | /// 24 | public const string MAIN_UI_NEW_FUNC1 = "MAIN_UI_NEW_FUNC1"; 25 | 26 | /// 27 | /// 主界面新功能2红点 28 | /// 29 | public const string MAIN_UI_NEW_FUNC2 = "MAIN_UI_NEW_FUNC2"; 30 | 31 | /// 32 | /// 主界面菜单红点 33 | /// 34 | public const string MAIN_UI_MENU = "MAIN_UI_MENU"; 35 | 36 | /// 37 | /// 主界面邮件红点 38 | /// 39 | public const string MAIN_UI_MAIL = "MAIN_UI_MAIL"; 40 | 41 | /// 42 | /// 主界面菜单装备红点 43 | /// 44 | public const string MAIN_UI_MENU_EQUIP = "MAIN_UI_MENU|EQUIP"; 45 | 46 | /// 47 | /// 主界面菜单背包红点 48 | /// 49 | public const string MAIN_UI_MENU_BACKPACK = "MAIN_UI_MENU|BACKPACK"; 50 | #endregion 51 | 52 | #region 背包界面红点部分 53 | /// 54 | /// 背包界面道具页签红点 55 | /// 56 | public const string BACKPACK_UI_ITEM_TAG = "MAIN_UI_MENU|BACKPACK|ITEM_TAG"; 57 | 58 | /// 59 | /// 背包界面资源页签红点 60 | /// 61 | public const string BACKPACK_UI_RESOURCE_TAG = "MAIN_UI_MENU|BACKPACK|RESOURCE_TAG"; 62 | 63 | /// 64 | /// 背包界面装备页签红点 65 | /// 66 | public const string BACKPACK_UI_EQUIP_TAG = "MAIN_UI_MENU|BACKPACK|EQUIP_TAG"; 67 | #endregion 68 | 69 | #region 邮件界面红点部分 70 | /// 71 | /// 邮件界面公共邮件红点 72 | /// 73 | public const string MAIL_UI_PUBLIC_MAIL = "MAIN_UI_MAIL|PUBLIC_MAIL"; 74 | 75 | /// 76 | /// 邮件界面战斗邮件红点 77 | /// 78 | public const string MAIL_UI_BATTLE_MAIL = "MAIN_UI_MAIL|BATTLE_MAIL"; 79 | 80 | /// 81 | /// 邮件界面其他邮件红点 82 | /// 83 | public const string MAIL_UI_OTHER_MAIL = "MAIN_UI_MAIL|OTHER_MAIL"; 84 | #endregion 85 | 86 | #region 装备界面红点部分 87 | /// 88 | /// 装备界面可穿戴红点 89 | /// 90 | public const string EQUIP_UI_WEARABLE = "MAIN_UI_MENU|EQUIP|WEARABLE"; 91 | 92 | /// 93 | /// 装备界面可升级红点 94 | /// 95 | public const string EQUIP_UI_UPGRADABLE = "MAIN_UI_MENU|EQUIP|UPGRADABLE"; 96 | #endregion 97 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotNames.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 683080a6fd0553a43a04ad6b4428837c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotType.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using UnityEngine; 11 | 12 | /// 13 | /// RedDotType.cs 14 | /// 红点类型 15 | /// 16 | [Flags] 17 | public enum RedDotType 18 | { 19 | NONE = 0, // 无 20 | RED = 0x0001, // 纯红点 21 | NUMBER = 0x0002, // 数字红点 22 | NEW = 0x0004, // 新红点 23 | RED_NUMBER = RedDotType.RED | RedDotType.NUMBER, // 纯+数字红点 24 | RED_NEW = RedDotType.RED | RedDotType.NEW, // 纯+新红点 25 | NUMBER_NEW = RedDotType.NUMBER | RedDotType.NEW, // 数字+新红点 26 | RED_NUMBER_NEW = RedDotType.RED | RedDotType.NUMBER | RedDotType.NEW, // 纯+数字+新红点 27 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3da0b29f75b49ef4aa69f908269cb272 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotUnit.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotUnit.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// RedDotUnit.cs 13 | /// 红点运算单元枚举 14 | /// Note: 15 | /// 游戏里的红点运算单元按最小单位定义,所有红点的影响因素通过红点运算单元组装而成 16 | /// 17 | public enum RedDotUnit 18 | { 19 | INVALIDE = 0, // 无效类型 20 | #region 主UI部分 21 | NEW_FUNC1, // 动态新功能1解锁 22 | NEW_FUNC2, // 动态新功能2解锁 23 | #endregion 24 | #region 背包部分 25 | NEW_ITEM_NUM, // 新道具数 26 | NEW_RESOURCE_NUM, // 新资源数 27 | NEW_EQUIP_NUM, // 新装备数 28 | #endregion 29 | #region 邮件部分 30 | NEW_PUBLIC_MAIL_NUM, // 新公共邮件数 31 | NEW_BATTLE_MAIL_NUM, // 新战斗邮件数 32 | NEW_OTHER_MAIL_NUM, // 新其他邮件数 33 | PUBLIC_MAIL_REWARD_NUM, // 公共邮件可领奖数 34 | BATTLE_MAIL_REWARD_NUM, // 战斗邮件可领奖数 35 | #endregion 36 | #region 装备部分 37 | WEARABLE_EQUIP_NUM, // 可穿戴装备数 38 | UPGRADEABLE_EQUIP_NUM, // 可升级装备数 39 | #endregion 40 | } 41 | 42 | /// 43 | /// 重写RedDotUnit比较相关接口函数,避免RedDotUnit作为Dictionary Key时, 44 | /// 底层调用默认Equals(object obj)和DefaultCompare.GetHashCode()导致额外的堆内存分配 45 | /// 参考: 46 | /// http://gad.qq.com/program/translateview/7194373 47 | /// 48 | public class ResourceLoadTypeComparer : IEqualityComparer 49 | { 50 | public bool Equals(RedDotUnit x, RedDotUnit y) 51 | { 52 | return x == y; 53 | } 54 | 55 | public int GetHashCode(RedDotUnit x) 56 | { 57 | return (int)x; 58 | } 59 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotUnit.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5235812509983714b88c5f6efc855fab 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotUnitInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotUnitInfo.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System; 8 | using System.Collections; 9 | using System.Collections.Generic; 10 | using UnityEngine; 11 | 12 | /// 13 | /// RedDotUnitInfo.cs 14 | /// 红点运算单元信息类 15 | /// 16 | public class RedDotUnitInfo 17 | { 18 | /// 19 | /// 红点运算单元类型 20 | /// 21 | public RedDotUnit RedDotUnit 22 | { 23 | get; 24 | private set; 25 | } 26 | 27 | /// 28 | /// 红点运算单元描述 29 | /// 30 | public string RedDotUnitDes 31 | { 32 | get; 33 | private set; 34 | } 35 | 36 | /// 37 | /// 红点运算单元对应显示的红点类型 38 | /// 39 | public RedDotType RedDotType 40 | { 41 | get; 42 | private set; 43 | } 44 | 45 | /// 46 | /// 红点运算单元对应红点计算回调 47 | /// 48 | public Func RedDotUnitCalculateFunc 49 | { 50 | get; 51 | private set; 52 | } 53 | 54 | /// 55 | /// 构造函数 56 | /// 57 | private RedDotUnitInfo() 58 | { 59 | 60 | } 61 | 62 | /// 63 | /// 构造函数 64 | /// 65 | /// 红点运算单元类型 66 | /// 红点运算单元描述 67 | /// 红点运算单元计算方法 68 | /// 红点显示类型 69 | public RedDotUnitInfo(RedDotUnit redDotUnit, string redDotUnitDes, Func redDotUnitCalculateFunc, RedDotType redDotType) 70 | { 71 | RedDotUnit = redDotUnit; 72 | RedDotUnitDes = redDotUnitDes; 73 | RedDotUnitCalculateFunc = redDotUnitCalculateFunc; 74 | RedDotType = redDotType; 75 | } 76 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotUnitInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db1dc89c790de3e4291bd896c0d8a788 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotUtilities.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotUtilities.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// RedDotUtilities.cs 13 | /// 红点工具类 14 | /// 15 | public static class RedDotUtilities 16 | { 17 | #region 红点辅助方法部分 18 | /// 19 | /// 获取指定红点数量和类型的文本显示 20 | /// Note: 21 | /// 红点显示类型优先级: 22 | /// 新 > 纯数字 > 纯红点 23 | /// 24 | /// 25 | /// 26 | /// 27 | public static string GetRedDotResultText(int result, RedDotType redDotType) 28 | { 29 | if(result <= 0) 30 | { 31 | return string.Empty; 32 | } 33 | var redDotText = string.Empty; 34 | if((redDotType & RedDotType.NEW) != RedDotType.NONE) 35 | { 36 | redDotText = "新"; 37 | } 38 | else if((redDotType & RedDotType.NUMBER) != RedDotType.NONE) 39 | { 40 | redDotText = result.ToString(); 41 | } 42 | return redDotText; 43 | } 44 | #endregion 45 | 46 | #region 红点数据以及逻辑运算部分 47 | #region 主界面部分 48 | /// 49 | /// 计算主界面动态新功能1解锁 50 | /// 51 | /// 52 | public static int CaculateNewFunc1() 53 | { 54 | return GameModel.Singleton.NewFunc1 ? 1 : 0; 55 | } 56 | 57 | /// 58 | /// 计算主界面动态新功能2解锁 59 | /// 60 | /// 61 | public static int CaculateNewFunc2() 62 | { 63 | return GameModel.Singleton.NewFunc2 ? 1 : 0; 64 | } 65 | #endregion 66 | 67 | #region 背包界面部分 68 | /// 69 | /// 计算新道具数 70 | /// 71 | /// 72 | public static int CaculateNewItemNum() 73 | { 74 | return GameModel.Singleton.NewItemNum; 75 | } 76 | 77 | /// 78 | /// 计算新资源数 79 | /// 80 | /// 81 | public static int CaculateNewResourceNum() 82 | { 83 | return GameModel.Singleton.NewResourceNum; 84 | } 85 | 86 | /// 87 | /// 计算新装备数 88 | /// 89 | /// 90 | public static int CaculateNewEquipNum() 91 | { 92 | return GameModel.Singleton.NewEquipNum; 93 | } 94 | #endregion 95 | 96 | #region 邮件界面部分 97 | /// 98 | /// 计算新公共邮件数 99 | /// 100 | /// 101 | public static int CaculateNewPublicMailNum() 102 | { 103 | return GameModel.Singleton.NewPublicMailNum; 104 | } 105 | 106 | /// 107 | /// 计算新战斗邮件数 108 | /// 109 | /// 110 | public static int CaculateNewBattleMailNum() 111 | { 112 | return GameModel.Singleton.NewBattleMailNum; 113 | } 114 | 115 | /// 116 | /// 计算新其他邮件数 117 | /// 118 | /// 119 | public static int CaculateNewOtherMailNum() 120 | { 121 | return GameModel.Singleton.NewOtherMailNum; 122 | } 123 | 124 | /// 125 | /// 计算公共邮件可领奖数 126 | /// 127 | /// 128 | public static int CaculateNewPublicMailRewardNum() 129 | { 130 | return GameModel.Singleton.NewPublicMailRewardNum; 131 | } 132 | 133 | /// 134 | /// 计算战斗邮件可领奖数 135 | /// 136 | /// 137 | public static int CaculateNewBattleMailRewardNum() 138 | { 139 | return GameModel.Singleton.NewBattleMailRewardNum; 140 | } 141 | #endregion 142 | 143 | #region 装备界面部分 144 | /// 145 | /// 计算可穿戴装备数 146 | /// 147 | /// 148 | public static int CaculateWearableEquipNum() 149 | { 150 | return GameModel.Singleton.WearableEquipNum; 151 | } 152 | 153 | /// 154 | /// 计算可升级装备数 155 | /// 156 | /// 157 | public static int CaculateUpgradeableEquipNum() 158 | { 159 | return GameModel.Singleton.UpgradeableEquipNum; 160 | } 161 | #endregion 162 | #endregion 163 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/RedDotSystem/RedDotUtilities.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21b68f13170b6b646acac69dfc83d87f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef9f34824e333644d85e904418f6382f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/BackpackUI.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: BackpackUI.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | using UnityEngine.UI; 11 | 12 | /// 13 | /// BackpackUI.cs 14 | /// 背包UI 15 | /// 16 | public class BackpackUI : MonoBehaviour 17 | { 18 | /// 19 | /// 关闭按钮 20 | /// 21 | [Header("关闭按钮")] 22 | public Button BtnClose; 23 | 24 | /// 25 | /// 道具页签按钮 26 | /// 27 | [Header("道具页签按钮")] 28 | public Button BtnItemTag; 29 | 30 | /// 31 | /// 道具页签红点 32 | /// 33 | [Header("道具页签红点")] 34 | public RedDotWidget ItemTagRedDot; 35 | 36 | /// 37 | /// 资源页签按钮 38 | /// 39 | [Header("资源页签按钮")] 40 | public Button BtnResourceTag; 41 | 42 | /// 43 | /// 资源页签红点 44 | /// 45 | [Header("资源页签红点")] 46 | public RedDotWidget ResourceTagRedDot; 47 | 48 | /// 49 | /// 装备页签按钮 50 | /// 51 | [Header("装备页签按钮")] 52 | public Button BtnEquipTag; 53 | 54 | /// 55 | /// 装备页签红点 56 | /// 57 | [Header("装备页签红点")] 58 | public RedDotWidget EquipTagRedDot; 59 | 60 | /// 61 | /// 增加新道具1按钮 62 | /// 63 | [Header("增加新道具1按钮")] 64 | public Button BtnAddNewItem; 65 | 66 | /// 67 | /// 减少新道具1按钮 68 | /// 69 | [Header("减少新道具1按钮")] 70 | public Button BtnMinusNewItem; 71 | 72 | /// 73 | /// 当前选中页签索引文本 74 | /// 75 | [Header("当前选中页签索引文本")] 76 | public Text TxtSelectedTagIndex; 77 | 78 | /// 79 | /// 当前选择页签索引 80 | /// 81 | private int mSelectedTagIndex; 82 | 83 | /// 84 | /// 响应打开 85 | /// 86 | public void OnOpen() 87 | { 88 | gameObject.SetActive(true); 89 | mSelectedTagIndex = 1; 90 | AddAllListeners(); 91 | BindAllRedDotNames(); 92 | RefreshView(); 93 | } 94 | 95 | /// 96 | /// 添加所有监听 97 | /// 98 | private void AddAllListeners() 99 | { 100 | BtnClose.onClick.AddListener(OnBtnCloseClick); 101 | BtnItemTag.onClick.AddListener(OnBtnItemTagClick); 102 | BtnResourceTag.onClick.AddListener(OnBtnResourceTagClick); 103 | BtnEquipTag.onClick.AddListener(OnBtnEquipTagClick); 104 | BtnAddNewItem.onClick.AddListener(OnBtnAddNewItemClick); 105 | BtnMinusNewItem.onClick.AddListener(OnBtnMinusNewItemClick); 106 | } 107 | 108 | /// 109 | /// 绑定所有红点名 110 | /// 111 | private void BindAllRedDotNames() 112 | { 113 | RedDotManager.Singleton.BindRedDotName(RedDotNames.BACKPACK_UI_ITEM_TAG, OnRedDotRefresh); 114 | RedDotManager.Singleton.BindRedDotName(RedDotNames.BACKPACK_UI_RESOURCE_TAG, OnRedDotRefresh); 115 | RedDotManager.Singleton.BindRedDotName(RedDotNames.BACKPACK_UI_EQUIP_TAG, OnRedDotRefresh); 116 | } 117 | 118 | /// 119 | /// 刷新显示 120 | /// 121 | private void RefreshView() 122 | { 123 | RefreshTagRedDotView(); 124 | RefreshSelectedTagTextView(); 125 | } 126 | 127 | /// 128 | /// 刷新页签红点显示 129 | /// 130 | private void RefreshTagRedDotView() 131 | { 132 | (int result, RedDotType redDotType) redDotNameResult; 133 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.BACKPACK_UI_ITEM_TAG); 134 | OnRedDotRefresh(RedDotNames.BACKPACK_UI_ITEM_TAG, redDotNameResult.result, redDotNameResult.redDotType); 135 | 136 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.BACKPACK_UI_RESOURCE_TAG); 137 | OnRedDotRefresh(RedDotNames.BACKPACK_UI_RESOURCE_TAG, redDotNameResult.result, redDotNameResult.redDotType); 138 | 139 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.BACKPACK_UI_EQUIP_TAG); 140 | OnRedDotRefresh(RedDotNames.BACKPACK_UI_EQUIP_TAG, redDotNameResult.result, redDotNameResult.redDotType); 141 | } 142 | 143 | /// 144 | /// 刷新选中页签文本显示 145 | /// 146 | private void RefreshSelectedTagTextView() 147 | { 148 | TxtSelectedTagIndex.text = $"当前选择页签索引:{mSelectedTagIndex}"; 149 | } 150 | 151 | /// 152 | /// 响应红点刷新 153 | /// 154 | /// 155 | /// 156 | /// 157 | private void OnRedDotRefresh(string redDotName, int result, RedDotType redDotType) 158 | { 159 | var resultText = RedDotUtilities.GetRedDotResultText(result, redDotType); 160 | if (string.Equals(redDotName, RedDotNames.BACKPACK_UI_ITEM_TAG)) 161 | { 162 | ItemTagRedDot.SetActive(result > 0); 163 | ItemTagRedDot.SetRedDotTxt(resultText); 164 | } 165 | else if(string.Equals(redDotName, RedDotNames.BACKPACK_UI_RESOURCE_TAG)) 166 | { 167 | ResourceTagRedDot.SetActive(result > 0); 168 | ResourceTagRedDot.SetRedDotTxt(resultText); 169 | } 170 | else if(string.Equals(redDotName, RedDotNames.BACKPACK_UI_EQUIP_TAG)) 171 | { 172 | EquipTagRedDot.SetActive(result > 0); 173 | EquipTagRedDot.SetRedDotTxt(resultText); 174 | } 175 | } 176 | 177 | /// 178 | /// 响应关闭按钮点击 179 | /// 180 | private void OnBtnCloseClick() 181 | { 182 | OnClose(); 183 | } 184 | 185 | /// 186 | /// 响应道具页签按钮点击 187 | /// 188 | private void OnBtnItemTagClick() 189 | { 190 | mSelectedTagIndex = 1; 191 | RefreshSelectedTagTextView(); 192 | } 193 | 194 | /// 195 | /// 响应资源页签按钮点击 196 | /// 197 | private void OnBtnResourceTagClick() 198 | { 199 | mSelectedTagIndex = 2; 200 | RefreshSelectedTagTextView(); 201 | } 202 | 203 | /// 204 | /// 响应装备页签按钮点击 205 | /// 206 | private void OnBtnEquipTagClick() 207 | { 208 | mSelectedTagIndex = 3; 209 | RefreshSelectedTagTextView(); 210 | } 211 | 212 | /// 213 | /// 响应增加新道具1按钮点击 214 | /// 215 | private void OnBtnAddNewItemClick() 216 | { 217 | if(mSelectedTagIndex == 1) 218 | { 219 | var newItemNum = GameModel.Singleton.NewItemNum + 1; 220 | GameModel.Singleton.SetNewItemNum(newItemNum); 221 | } 222 | else if(mSelectedTagIndex == 2) 223 | { 224 | var newResourceNum = GameModel.Singleton.NewResourceNum + 1; 225 | GameModel.Singleton.SetNewResourceNum(newResourceNum); 226 | } 227 | else if(mSelectedTagIndex == 3) 228 | { 229 | var newEquipNum = GameModel.Singleton.NewEquipNum + 1; 230 | GameModel.Singleton.SetmNewEquipNum(newEquipNum); 231 | } 232 | } 233 | 234 | /// 235 | /// 响应减少新道具1按钮点击 236 | /// 237 | private void OnBtnMinusNewItemClick() 238 | { 239 | if (mSelectedTagIndex == 1) 240 | { 241 | var newItemNum = GameModel.Singleton.NewItemNum - 1; 242 | GameModel.Singleton.SetNewItemNum(newItemNum); 243 | } 244 | else if (mSelectedTagIndex == 2) 245 | { 246 | var newResourceNum = GameModel.Singleton.NewResourceNum - 1; 247 | GameModel.Singleton.SetNewResourceNum(newResourceNum); 248 | } 249 | else if (mSelectedTagIndex == 3) 250 | { 251 | var newEquipNum = GameModel.Singleton.NewEquipNum - 1; 252 | GameModel.Singleton.SetmNewEquipNum(newEquipNum); 253 | } 254 | } 255 | 256 | /// 257 | /// 解绑所有红点名 258 | /// 259 | private void UnbindAllRedDotNames() 260 | { 261 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.BACKPACK_UI_ITEM_TAG, OnRedDotRefresh); 262 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.BACKPACK_UI_RESOURCE_TAG, OnRedDotRefresh); 263 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.BACKPACK_UI_EQUIP_TAG, OnRedDotRefresh); 264 | } 265 | 266 | /// 267 | /// 移除所有监听 268 | /// 269 | private void RemoveAllListeners() 270 | { 271 | BtnClose.onClick.RemoveListener(OnBtnCloseClick); 272 | BtnItemTag.onClick.RemoveListener(OnBtnItemTagClick); 273 | BtnResourceTag.onClick.RemoveListener(OnBtnResourceTagClick); 274 | BtnEquipTag.onClick.RemoveListener(OnBtnEquipTagClick); 275 | BtnAddNewItem.onClick.RemoveListener(OnBtnAddNewItemClick); 276 | BtnMinusNewItem.onClick.RemoveListener(OnBtnMinusNewItemClick); 277 | } 278 | 279 | /// 280 | /// 响应关闭 281 | /// 282 | public void OnClose() 283 | { 284 | gameObject.SetActive(false); 285 | UnbindAllRedDotNames(); 286 | RemoveAllListeners(); 287 | } 288 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/BackpackUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e174e9529c6eee4097af249e1ed70ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/EquipUI.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: EquipUI.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | using UnityEngine.UI; 11 | 12 | /// 13 | /// EquipUI.cs 14 | /// 装备UI 15 | /// 16 | public class EquipUI : MonoBehaviour 17 | { 18 | /// 19 | /// 关闭按钮 20 | /// 21 | [Header("关闭按钮")] 22 | public Button BtnClose; 23 | 24 | /// 25 | /// 增加可穿戴装备1按钮 26 | /// 27 | [Header("增加可穿戴装备1按钮")] 28 | public Button BtnAddWearableEquip; 29 | 30 | /// 31 | /// 减少可穿戴装备1按钮 32 | /// 33 | [Header("减少可穿戴装备1按钮")] 34 | public Button BtnMinusWearableEquip; 35 | 36 | /// 37 | /// 可穿戴装备红点 38 | /// 39 | [Header("可穿戴装备红点")] 40 | public RedDotWidget WearableEquipRedDot; 41 | 42 | /// 43 | /// 增加可升级装备1按钮 44 | /// 45 | [Header("增加可升级装备1按钮")] 46 | public Button BtnAddUpgradableEquip; 47 | 48 | /// 49 | /// 减少可升级装备1按钮 50 | /// 51 | [Header("减少可升级装备1按钮")] 52 | public Button BtnMinusUpgradableEquip; 53 | 54 | /// 55 | /// 可升级装备红点 56 | /// 57 | [Header("可升级装备红点")] 58 | public RedDotWidget UpgradableEquipRedDot; 59 | 60 | /// 61 | /// 响应打开 62 | /// 63 | public void OnOpen() 64 | { 65 | gameObject.SetActive(true); 66 | AddAllListeners(); 67 | BindAllRedDotNames(); 68 | RefreshView(); 69 | } 70 | 71 | /// 72 | /// 添加所有监听 73 | /// 74 | private void AddAllListeners() 75 | { 76 | BtnClose.onClick.AddListener(OnBtnCloseClick); 77 | BtnAddWearableEquip.onClick.AddListener(OnBtnAddWearableEquipClick); 78 | BtnMinusWearableEquip.onClick.AddListener(OnBtnMinusWearableEquipClick); 79 | BtnAddUpgradableEquip.onClick.AddListener(OnBtnAddUpgradableEquipClick); 80 | BtnMinusUpgradableEquip.onClick.AddListener(OnBtnMinusUpgradableEquipClick); 81 | } 82 | 83 | /// 84 | /// 绑定所有红点名 85 | /// 86 | private void BindAllRedDotNames() 87 | { 88 | RedDotManager.Singleton.BindRedDotName(RedDotNames.EQUIP_UI_WEARABLE, OnRedDotRefresh); 89 | RedDotManager.Singleton.BindRedDotName(RedDotNames.EQUIP_UI_UPGRADABLE, OnRedDotRefresh); 90 | } 91 | 92 | /// 93 | /// 刷新显示 94 | /// 95 | private void RefreshView() 96 | { 97 | RefreshRedDotView(); 98 | } 99 | 100 | /// 101 | /// 刷新红点显示 102 | /// 103 | private void RefreshRedDotView() 104 | { 105 | (int result, RedDotType redDotType) redDotNameResult; 106 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.EQUIP_UI_WEARABLE); 107 | OnRedDotRefresh(RedDotNames.EQUIP_UI_WEARABLE, redDotNameResult.result, redDotNameResult.redDotType); 108 | 109 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.EQUIP_UI_UPGRADABLE); 110 | OnRedDotRefresh(RedDotNames.EQUIP_UI_UPGRADABLE, redDotNameResult.result, redDotNameResult.redDotType); 111 | } 112 | 113 | /// 114 | /// 响应红点刷新 115 | /// 116 | /// 117 | /// 118 | /// 119 | private void OnRedDotRefresh(string redDotName, int result, RedDotType redDotType) 120 | { 121 | var resultText = RedDotUtilities.GetRedDotResultText(result, redDotType); 122 | if (string.Equals(redDotName, RedDotNames.EQUIP_UI_WEARABLE)) 123 | { 124 | WearableEquipRedDot.SetActive(result > 0); 125 | WearableEquipRedDot.SetRedDotTxt(resultText); 126 | } 127 | else if (string.Equals(redDotName, RedDotNames.EQUIP_UI_UPGRADABLE)) 128 | { 129 | UpgradableEquipRedDot.SetActive(result > 0); 130 | UpgradableEquipRedDot.SetRedDotTxt(resultText); 131 | } 132 | } 133 | 134 | /// 135 | /// 响应关闭按钮点击 136 | /// 137 | private void OnBtnCloseClick() 138 | { 139 | OnClose(); 140 | } 141 | 142 | /// 143 | /// 响应增加可穿戴装备1按钮点击 144 | /// 145 | private void OnBtnAddWearableEquipClick() 146 | { 147 | var newWearableEquipNum = GameModel.Singleton.WearableEquipNum + 1; 148 | GameModel.Singleton.SetWearableEquipNum(newWearableEquipNum); 149 | } 150 | 151 | /// 152 | /// 响应减少可穿戴装备1按钮点击 153 | /// 154 | private void OnBtnMinusWearableEquipClick() 155 | { 156 | var newWearableEquipNum = GameModel.Singleton.WearableEquipNum - 1; 157 | GameModel.Singleton.SetWearableEquipNum(newWearableEquipNum); 158 | } 159 | 160 | /// 161 | /// 响应增加可升级装备1按钮点击 162 | /// 163 | private void OnBtnAddUpgradableEquipClick() 164 | { 165 | var newUpgradeableEquipNum = GameModel.Singleton.UpgradeableEquipNum + 1; 166 | GameModel.Singleton.SetUpgradeableEquipNum(newUpgradeableEquipNum); 167 | } 168 | 169 | /// 170 | /// 响应减少可升级装备1按钮点击 171 | /// 172 | private void OnBtnMinusUpgradableEquipClick() 173 | { 174 | var newUpgradeableEquipNum = GameModel.Singleton.UpgradeableEquipNum - 1; 175 | GameModel.Singleton.SetUpgradeableEquipNum(newUpgradeableEquipNum); 176 | } 177 | 178 | /// 179 | /// 解绑所有红点名 180 | /// 181 | private void UnbindAllRedDotNames() 182 | { 183 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.EQUIP_UI_WEARABLE, OnRedDotRefresh); 184 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.EQUIP_UI_UPGRADABLE, OnRedDotRefresh); 185 | } 186 | 187 | /// 188 | /// 移除所有监听 189 | /// 190 | private void RemoveAllListeners() 191 | { 192 | BtnClose.onClick.RemoveListener(OnBtnCloseClick); 193 | BtnAddWearableEquip.onClick.RemoveListener(OnBtnAddWearableEquipClick); 194 | BtnMinusWearableEquip.onClick.RemoveListener(OnBtnMinusWearableEquipClick); 195 | BtnAddUpgradableEquip.onClick.RemoveListener(OnBtnAddUpgradableEquipClick); 196 | BtnMinusUpgradableEquip.onClick.RemoveListener(OnBtnMinusUpgradableEquipClick); 197 | } 198 | 199 | /// 200 | /// 响应关闭 201 | /// 202 | public void OnClose() 203 | { 204 | gameObject.SetActive(false); 205 | UnbindAllRedDotNames(); 206 | RemoveAllListeners(); 207 | } 208 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/EquipUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d107ba1d5eb696c4f93aede1988a865d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/MailDetailUI.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: MailDetailUI.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// MailDetailUI.cs 13 | /// 14 | public class MailDetailUI : MonoBehaviour { 15 | 16 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/MailDetailUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5c5922355202f94e83c1a6a5f527b6d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/MailUI.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: MailUI.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | using UnityEngine.UI; 11 | 12 | /// 13 | /// MailUI.cs 14 | /// 邮件UI 15 | /// 16 | public class MailUI : MonoBehaviour 17 | { 18 | /// 19 | /// 关闭按钮 20 | /// 21 | [Header("关闭按钮")] 22 | public Button BtnClose; 23 | 24 | /// 25 | /// 增加公共邮件已读1按钮 26 | /// 27 | [Header("增加公共邮件已读1按钮")] 28 | public Button BtnAddReadPublicMail; 29 | 30 | /// 31 | /// 减少公共邮件已读1按钮 32 | /// 33 | [Header("减少公共邮件已读1按钮")] 34 | public Button BtnMinusReadPublicMail; 35 | 36 | /// 37 | /// 增加公共邮件可领奖1按钮 38 | /// 39 | [Header("增加公共邮件可领奖1按钮")] 40 | public Button BtnAddClaimPublicMail; 41 | 42 | /// 43 | /// 减少公共邮件可领奖1按钮 44 | /// 45 | [Header("减少公共邮件可领奖1按钮")] 46 | public Button BtnMinusClaimPublicMail; 47 | 48 | /// 49 | /// 公共邮件红点 50 | /// 51 | [Header("公共邮件红点")] 52 | public RedDotWidget PublicMailRedDot; 53 | 54 | /// 55 | /// 增加战斗邮件已读1按钮 56 | /// 57 | [Header("增加战斗邮件已读1按钮")] 58 | public Button BtnAddReadBattleMail; 59 | 60 | /// 61 | /// 减少战斗邮件已读1按钮 62 | /// 63 | [Header("减少战斗邮件已读1按钮")] 64 | public Button BtnMinusReadBattleMail; 65 | 66 | /// 67 | /// 增加战斗邮件可领奖1按钮 68 | /// 69 | [Header("增加战斗邮件可领奖1按钮")] 70 | public Button BtnAddClaimBattleMail; 71 | 72 | /// 73 | /// 减少战斗邮件可领奖1按钮 74 | /// 75 | [Header("减少战斗邮件可领奖1按钮")] 76 | public Button BtnMinusClaimBattleMail; 77 | 78 | /// 79 | /// 战斗邮件红点 80 | /// 81 | [Header("战斗邮件红点")] 82 | public RedDotWidget BattleMailRedDot; 83 | 84 | /// 85 | /// 增加其他邮件已读1按钮 86 | /// 87 | [Header("增加其他邮件已读1按钮")] 88 | public Button BtnAddReadOtherMail; 89 | 90 | /// 91 | /// 减少其他邮件已读1按钮 92 | /// 93 | [Header("减少其他邮件已读1按钮")] 94 | public Button BtnMinusReadOtherMail; 95 | 96 | /// 97 | /// 其他邮件红点 98 | /// 99 | [Header("其他邮件红点")] 100 | public RedDotWidget OtherMailRedDot; 101 | 102 | /// 103 | /// 响应打开 104 | /// 105 | public void OnOpen() 106 | { 107 | gameObject.SetActive(true); 108 | AddAllListeners(); 109 | BindAllRedDotNames(); 110 | RefreshView(); 111 | } 112 | 113 | /// 114 | /// 添加所有监听 115 | /// 116 | private void AddAllListeners() 117 | { 118 | BtnClose.onClick.AddListener(OnBtnCloseClick); 119 | BtnAddReadPublicMail.onClick.AddListener(OnBtnAddReadPublicMailClick); 120 | BtnMinusReadPublicMail.onClick.AddListener(OnBtnMinusReadPublicMailClick); 121 | BtnAddClaimPublicMail.onClick.AddListener(OnBtnAddClaimPublicMailClick); 122 | BtnMinusClaimPublicMail.onClick.AddListener(OnBtnMinusClaimPublicMailClick); 123 | BtnAddReadBattleMail.onClick.AddListener(OnBtnAddReadBattleMailClick); 124 | BtnMinusReadBattleMail.onClick.AddListener(OnBtnMinusReadBattleMailClick); 125 | BtnAddClaimBattleMail.onClick.AddListener(OnBtnAddClaimBattleMailClick); 126 | BtnMinusClaimBattleMail.onClick.AddListener(OnBtnMinusClaimBattleMailClick); 127 | BtnAddReadOtherMail.onClick.AddListener(OnBtnAddReadOtherMailClick); 128 | BtnMinusReadOtherMail.onClick.AddListener(OnBtnMinusReadOtherMailClick); 129 | } 130 | 131 | /// 132 | /// 绑定所有红点名 133 | /// 134 | private void BindAllRedDotNames() 135 | { 136 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIL_UI_PUBLIC_MAIL, OnRedDotRefresh); 137 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIL_UI_BATTLE_MAIL, OnRedDotRefresh); 138 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIL_UI_OTHER_MAIL, OnRedDotRefresh); 139 | } 140 | 141 | /// 142 | /// 刷新显示 143 | /// 144 | private void RefreshView() 145 | { 146 | RefreshRedDotView(); 147 | } 148 | 149 | /// 150 | /// 刷新红点显示 151 | /// 152 | private void RefreshRedDotView() 153 | { 154 | (int result, RedDotType redDotType) redDotNameResult; 155 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIL_UI_PUBLIC_MAIL); 156 | OnRedDotRefresh(RedDotNames.MAIL_UI_PUBLIC_MAIL, redDotNameResult.result, redDotNameResult.redDotType); 157 | 158 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIL_UI_BATTLE_MAIL); 159 | OnRedDotRefresh(RedDotNames.MAIL_UI_BATTLE_MAIL, redDotNameResult.result, redDotNameResult.redDotType); 160 | 161 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIL_UI_OTHER_MAIL); 162 | OnRedDotRefresh(RedDotNames.MAIL_UI_OTHER_MAIL, redDotNameResult.result, redDotNameResult.redDotType); 163 | } 164 | 165 | /// 166 | /// 响应红点刷新 167 | /// 168 | /// 169 | /// 170 | /// 171 | private void OnRedDotRefresh(string redDotName, int result, RedDotType redDotType) 172 | { 173 | var resultText = RedDotUtilities.GetRedDotResultText(result, redDotType); 174 | if (string.Equals(redDotName, RedDotNames.MAIL_UI_PUBLIC_MAIL)) 175 | { 176 | PublicMailRedDot.SetActive(result > 0); 177 | PublicMailRedDot.SetRedDotTxt(resultText); 178 | } 179 | else if (string.Equals(redDotName, RedDotNames.MAIL_UI_BATTLE_MAIL)) 180 | { 181 | BattleMailRedDot.SetActive(result > 0); 182 | BattleMailRedDot.SetRedDotTxt(resultText); 183 | } 184 | else if (string.Equals(redDotName, RedDotNames.MAIL_UI_OTHER_MAIL)) 185 | { 186 | OtherMailRedDot.SetActive(result > 0); 187 | OtherMailRedDot.SetRedDotTxt(resultText); 188 | } 189 | } 190 | 191 | /// 192 | /// 解绑所有红点名 193 | /// 194 | private void UnbindAllRedDotNames() 195 | { 196 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIL_UI_PUBLIC_MAIL, OnRedDotRefresh); 197 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIL_UI_BATTLE_MAIL, OnRedDotRefresh); 198 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIL_UI_OTHER_MAIL, OnRedDotRefresh); 199 | } 200 | 201 | /// 202 | /// 响应关闭按钮点击 203 | /// 204 | private void OnBtnCloseClick() 205 | { 206 | OnClose(); 207 | } 208 | 209 | /// 210 | /// 响应增加公共邮件已读1按钮点击 211 | /// 212 | private void OnBtnAddReadPublicMailClick() 213 | { 214 | var newPublicMailNum = GameModel.Singleton.NewPublicMailNum + 1; 215 | GameModel.Singleton.SetNewPublicMailNum(newPublicMailNum); 216 | } 217 | 218 | /// 219 | /// 响应减少公共邮件已读1按钮点击 220 | /// 221 | private void OnBtnMinusReadPublicMailClick() 222 | { 223 | var newPublicMailNum = GameModel.Singleton.NewPublicMailNum - 1; 224 | GameModel.Singleton.SetNewPublicMailNum(newPublicMailNum); 225 | } 226 | 227 | /// 228 | /// 响应增加公共邮件可领奖1按钮点击 229 | /// 230 | private void OnBtnAddClaimPublicMailClick() 231 | { 232 | var newPublicMailRewardNum = GameModel.Singleton.NewPublicMailRewardNum + 1; 233 | GameModel.Singleton.SetPublicMailRewardNum(newPublicMailRewardNum); 234 | } 235 | 236 | /// 237 | /// 响应减少公共邮件可领奖1按钮点击 238 | /// 239 | private void OnBtnMinusClaimPublicMailClick() 240 | { 241 | var newPublicMailRewardNum = GameModel.Singleton.NewPublicMailRewardNum - 1; 242 | GameModel.Singleton.SetPublicMailRewardNum(newPublicMailRewardNum); 243 | } 244 | 245 | /// 246 | /// 响应增加战斗邮件已读1按钮点击 247 | /// 248 | private void OnBtnAddReadBattleMailClick() 249 | { 250 | var newBattleMailNum = GameModel.Singleton.NewBattleMailNum + 1; 251 | GameModel.Singleton.SetNewBattleMailNum(newBattleMailNum); 252 | } 253 | 254 | /// 255 | /// 响应减少战斗邮件已读1按钮点击 256 | /// 257 | private void OnBtnMinusReadBattleMailClick() 258 | { 259 | var newBattleMailNum = GameModel.Singleton.NewBattleMailNum - 1; 260 | GameModel.Singleton.SetNewBattleMailNum(newBattleMailNum); 261 | } 262 | 263 | /// 264 | /// 响应增加战斗邮件可领奖1按钮点击 265 | /// 266 | private void OnBtnAddClaimBattleMailClick() 267 | { 268 | var newBattleMailRewardNum = GameModel.Singleton.NewBattleMailRewardNum + 1; 269 | GameModel.Singleton.SetBattleMailRewardNum(newBattleMailRewardNum); 270 | } 271 | 272 | /// 273 | /// 响应减少战斗邮件可领奖1按钮点击 274 | /// 275 | private void OnBtnMinusClaimBattleMailClick() 276 | { 277 | var newBattleMailRewardNum = GameModel.Singleton.NewBattleMailRewardNum - 1; 278 | GameModel.Singleton.SetBattleMailRewardNum(newBattleMailRewardNum); 279 | } 280 | 281 | /// 282 | /// 响应增加其他邮件已读1按钮点击 283 | /// 284 | private void OnBtnAddReadOtherMailClick() 285 | { 286 | var newOtherMailNum = GameModel.Singleton.NewOtherMailNum + 1; 287 | GameModel.Singleton.SetmNewOtherMailNum(newOtherMailNum); 288 | } 289 | 290 | /// 291 | /// 响应减少其他邮件已读1按钮点击 292 | /// 293 | private void OnBtnMinusReadOtherMailClick() 294 | { 295 | var newOtherMailNum = GameModel.Singleton.NewOtherMailNum - 1; 296 | GameModel.Singleton.SetmNewOtherMailNum(newOtherMailNum); 297 | } 298 | 299 | /// 300 | /// 移除所有监听 301 | /// 302 | private void RemoveAllListeners() 303 | { 304 | BtnClose.onClick.RemoveListener(OnBtnCloseClick); 305 | BtnAddReadPublicMail.onClick.RemoveListener(OnBtnAddReadPublicMailClick); 306 | BtnMinusReadPublicMail.onClick.RemoveListener(OnBtnMinusReadPublicMailClick); 307 | BtnAddClaimPublicMail.onClick.RemoveListener(OnBtnAddClaimPublicMailClick); 308 | BtnMinusClaimPublicMail.onClick.RemoveListener(OnBtnMinusClaimPublicMailClick); 309 | BtnAddReadBattleMail.onClick.RemoveListener(OnBtnAddReadBattleMailClick); 310 | BtnMinusReadBattleMail.onClick.RemoveListener(OnBtnMinusReadBattleMailClick); 311 | BtnAddClaimBattleMail.onClick.RemoveListener(OnBtnAddClaimBattleMailClick); 312 | BtnMinusClaimBattleMail.onClick.RemoveListener(OnBtnMinusClaimBattleMailClick); 313 | BtnAddReadOtherMail.onClick.RemoveListener(OnBtnAddReadOtherMailClick); 314 | BtnMinusReadOtherMail.onClick.RemoveListener(OnBtnMinusReadOtherMailClick); 315 | } 316 | 317 | /// 318 | /// 响应关闭 319 | /// 320 | public void OnClose() 321 | { 322 | gameObject.SetActive(false); 323 | UnbindAllRedDotNames(); 324 | RemoveAllListeners(); 325 | } 326 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/MailUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 913c1f40f07094d4e965a675964899a2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/MainUI.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: MainUI.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | using UnityEngine.UI; 11 | 12 | /// 13 | /// MainUI.cs 14 | /// 主UI 15 | /// 16 | public class MainUI : MonoBehaviour 17 | { 18 | /// 19 | /// 菜单组 20 | /// 21 | [Header("菜单组")] 22 | public GameObject MenuGroup; 23 | 24 | /// 25 | /// 菜单按钮 26 | /// 27 | [Header("菜单按钮")] 28 | public Button BtnMenu; 29 | 30 | /// 31 | /// 菜单红点 32 | /// 33 | [Header("菜单红点")] 34 | public RedDotWidget MenuRedDot; 35 | 36 | /// 37 | /// 邮件按钮 38 | /// 39 | [Header("邮件按钮")] 40 | public Button BtnMail; 41 | 42 | /// 43 | /// 邮件红点 44 | /// 45 | [Header("邮件红点")] 46 | public RedDotWidget MailRedDot; 47 | 48 | /// 49 | /// 背包按钮 50 | /// 51 | [Header("背包按钮")] 52 | public Button BtnBackpack; 53 | 54 | /// 55 | /// 背包红点 56 | /// 57 | [Header("背包红点")] 58 | public RedDotWidget BackpackRedDot; 59 | 60 | /// 61 | /// 装备按钮 62 | /// 63 | [Header("装备按钮")] 64 | public Button BtnEquip; 65 | 66 | /// 67 | /// 装备红点 68 | /// 69 | [Header("装备红点")] 70 | public RedDotWidget EquipRedDot; 71 | 72 | /// 73 | /// 动态功能1按钮 74 | /// 75 | [Header("动态功能1按钮")] 76 | public Button BtnDynamicFunc1; 77 | 78 | /// 79 | /// 动态功能1红点 80 | /// 81 | [Header("动态功能1红点")] 82 | public RedDotWidget DynamicFunc1RedDot; 83 | 84 | /// 85 | /// 动态功能2按钮 86 | /// 87 | [Header("动态功能2按钮")] 88 | public Button BtnDynamicFunc2; 89 | 90 | /// 91 | /// 动态功能2红点 92 | /// 93 | [Header("动态功能2红点")] 94 | public RedDotWidget DynamicFunc2RedDot; 95 | 96 | /// 97 | /// 标记功能1新按钮 98 | /// 99 | [Header("标记功能1新按钮")] 100 | public Button BtnFunc1MarkNew; 101 | 102 | /// 103 | /// 标记功能2新按钮 104 | /// 105 | [Header("标记功能2新按钮")] 106 | public Button BtnFunc2MarkNew; 107 | 108 | /// 109 | /// 菜单组是否激活 110 | /// 111 | private bool mMenuGroupActive; 112 | 113 | /// 114 | /// 响应打开 115 | /// 116 | public void OnOpen() 117 | { 118 | gameObject.SetActive(true); 119 | mMenuGroupActive = false; 120 | AddAllListeners(); 121 | BindAllRedDotNames(); 122 | RefreshView(); 123 | } 124 | 125 | /// 126 | /// 添加所有监听 127 | /// 128 | private void AddAllListeners() 129 | { 130 | BtnMenu.onClick.AddListener(OnBtnMenuClick); 131 | BtnMail.onClick.AddListener(OnBtnMailClick); 132 | BtnBackpack.onClick.AddListener(OnBtnBackpackClick); 133 | BtnEquip.onClick.AddListener(OnBtnEquipClick); 134 | BtnDynamicFunc1.onClick.AddListener(OnBtnDynamicFunc1Click); 135 | BtnDynamicFunc2.onClick.AddListener(OnBtnDynamicFunc2Click); 136 | BtnFunc1MarkNew.onClick.AddListener(OnBtnFunc1MarkNewClick); 137 | BtnFunc2MarkNew.onClick.AddListener(OnBtnFunc2MarkNewClick); 138 | } 139 | 140 | /// 141 | /// 绑定所有红点名 142 | /// 143 | private void BindAllRedDotNames() 144 | { 145 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIN_UI_MENU, OnRedDotRefresh); 146 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIN_UI_MAIL, OnRedDotRefresh); 147 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIN_UI_MENU_BACKPACK, OnRedDotRefresh); 148 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIN_UI_MENU_EQUIP, OnRedDotRefresh); 149 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIN_UI_NEW_FUNC1, OnRedDotRefresh); 150 | RedDotManager.Singleton.BindRedDotName(RedDotNames.MAIN_UI_NEW_FUNC2, OnRedDotRefresh); 151 | } 152 | 153 | /// 154 | /// 刷新显示 155 | /// 156 | private void RefreshView() 157 | { 158 | RefreshMenuGroupView(); 159 | RefreshRedDotView(); 160 | } 161 | 162 | /// 163 | /// 刷新菜单组显示 164 | /// 165 | private void RefreshMenuGroupView() 166 | { 167 | MenuGroup.SetActive(mMenuGroupActive); 168 | } 169 | 170 | /// 171 | /// 刷新红点显示 172 | /// 173 | private void RefreshRedDotView() 174 | { 175 | (int result, RedDotType redDotType) redDotNameResult; 176 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIN_UI_MENU); 177 | OnRedDotRefresh(RedDotNames.MAIN_UI_MENU, redDotNameResult.result, redDotNameResult.redDotType); 178 | 179 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIN_UI_MAIL); 180 | OnRedDotRefresh(RedDotNames.MAIN_UI_MAIL, redDotNameResult.result, redDotNameResult.redDotType); 181 | 182 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIN_UI_MENU_BACKPACK); 183 | OnRedDotRefresh(RedDotNames.MAIN_UI_MENU_BACKPACK, redDotNameResult.result, redDotNameResult.redDotType); 184 | 185 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIN_UI_MENU_EQUIP); 186 | OnRedDotRefresh(RedDotNames.MAIN_UI_MENU_EQUIP, redDotNameResult.result, redDotNameResult.redDotType); 187 | 188 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIN_UI_NEW_FUNC1); 189 | OnRedDotRefresh(RedDotNames.MAIN_UI_NEW_FUNC1, redDotNameResult.result, redDotNameResult.redDotType); 190 | 191 | redDotNameResult = RedDotManager.Singleton.GetRedDotNameResult(RedDotNames.MAIN_UI_NEW_FUNC2); 192 | OnRedDotRefresh(RedDotNames.MAIN_UI_NEW_FUNC2, redDotNameResult.result, redDotNameResult.redDotType); 193 | } 194 | 195 | /// 196 | /// 响应红点刷新 197 | /// 198 | /// 199 | /// 200 | /// 201 | private void OnRedDotRefresh(string redDotName, int result, RedDotType redDotType) 202 | { 203 | var resultText = RedDotUtilities.GetRedDotResultText(result, redDotType); 204 | if (string.Equals(redDotName, RedDotNames.MAIN_UI_MENU)) 205 | { 206 | MenuRedDot.SetActive(result > 0); 207 | MenuRedDot.SetRedDotTxt(resultText); 208 | } 209 | else if (string.Equals(redDotName, RedDotNames.MAIN_UI_MAIL)) 210 | { 211 | MailRedDot.SetActive(result > 0); 212 | MailRedDot.SetRedDotTxt(resultText); 213 | } 214 | else if (string.Equals(redDotName, RedDotNames.MAIN_UI_MENU_BACKPACK)) 215 | { 216 | BackpackRedDot.SetActive(result > 0); 217 | BackpackRedDot.SetRedDotTxt(resultText); 218 | } 219 | else if (string.Equals(redDotName, RedDotNames.MAIN_UI_MENU_EQUIP)) 220 | { 221 | EquipRedDot.SetActive(result > 0); 222 | EquipRedDot.SetRedDotTxt(resultText); 223 | } 224 | else if (string.Equals(redDotName, RedDotNames.MAIN_UI_NEW_FUNC1)) 225 | { 226 | DynamicFunc1RedDot.SetActive(result > 0); 227 | DynamicFunc1RedDot.SetRedDotTxt(resultText); 228 | } 229 | else if (string.Equals(redDotName, RedDotNames.MAIN_UI_NEW_FUNC2)) 230 | { 231 | DynamicFunc2RedDot.SetActive(result > 0); 232 | DynamicFunc2RedDot.SetRedDotTxt(resultText); 233 | } 234 | } 235 | 236 | /// 237 | /// 响应菜单按钮点击 238 | /// 239 | private void OnBtnMenuClick() 240 | { 241 | mMenuGroupActive = !mMenuGroupActive; 242 | RefreshMenuGroupView(); 243 | } 244 | 245 | /// 246 | /// 响应邮件按钮点击 247 | /// 248 | private void OnBtnMailClick() 249 | { 250 | GameLauncher.Singleton.MailUI.OnOpen(); 251 | } 252 | 253 | /// 254 | /// 响应背包按钮点击 255 | /// 256 | private void OnBtnBackpackClick() 257 | { 258 | GameLauncher.Singleton.BackpackUI.OnOpen(); 259 | } 260 | 261 | /// 262 | /// 响应装备按钮点击 263 | /// 264 | private void OnBtnEquipClick() 265 | { 266 | GameLauncher.Singleton.EquipUI.OnOpen(); 267 | } 268 | 269 | /// 270 | /// 响应动态功能1按钮点击 271 | /// 272 | private void OnBtnDynamicFunc1Click() 273 | { 274 | GameModel.Singleton.SetNewFunc1(false); 275 | } 276 | 277 | /// 278 | /// 响应动态功能2按钮点击 279 | /// 280 | private void OnBtnDynamicFunc2Click() 281 | { 282 | GameModel.Singleton.SetNewFunc2(false); 283 | } 284 | 285 | /// 286 | /// 响应标记功能1新按钮点击 287 | /// 288 | private void OnBtnFunc1MarkNewClick() 289 | { 290 | GameModel.Singleton.SetNewFunc1(true); 291 | } 292 | 293 | /// 294 | /// 响应标记功能2新按钮点击 295 | /// 296 | private void OnBtnFunc2MarkNewClick() 297 | { 298 | GameModel.Singleton.SetNewFunc2(true); 299 | } 300 | 301 | /// 302 | /// 解绑所有红点名 303 | /// 304 | private void UnbindAllRedDotNames() 305 | { 306 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIN_UI_MENU, OnRedDotRefresh); 307 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIN_UI_MAIL, OnRedDotRefresh); 308 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIN_UI_MENU_BACKPACK, OnRedDotRefresh); 309 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIN_UI_MENU_EQUIP, OnRedDotRefresh); 310 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIN_UI_NEW_FUNC1, OnRedDotRefresh); 311 | RedDotManager.Singleton.UnbindRedDotName(RedDotNames.MAIN_UI_NEW_FUNC2, OnRedDotRefresh); 312 | } 313 | 314 | /// 315 | /// 移除所有监听 316 | /// 317 | private void RemoveAllListeners() 318 | { 319 | BtnMenu.onClick.RemoveListener(OnBtnMenuClick); 320 | BtnMail.onClick.RemoveListener(OnBtnMailClick); 321 | BtnBackpack.onClick.RemoveListener(OnBtnBackpackClick); 322 | BtnEquip.onClick.RemoveListener(OnBtnEquipClick); 323 | BtnDynamicFunc1.onClick.RemoveListener(OnBtnDynamicFunc1Click); 324 | BtnDynamicFunc2.onClick.RemoveListener(OnBtnDynamicFunc2Click); 325 | BtnFunc1MarkNew.onClick.RemoveListener(OnBtnFunc1MarkNewClick); 326 | BtnFunc2MarkNew.onClick.RemoveListener(OnBtnFunc2MarkNewClick); 327 | } 328 | 329 | /// 330 | /// 响应关闭 331 | /// 332 | public void OnClose() 333 | { 334 | gameObject.SetActive(false); 335 | UnbindAllRedDotNames(); 336 | RemoveAllListeners(); 337 | } 338 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/UI/MainUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe756ea38a8ee7143b5f91ffb7f950ed 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/Widget.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dafc46bc60f949f4db1e1bddf9678e32 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/Widget/RedDotWidget.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: RedDotWidget.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/14 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | using UnityEngine.UI; 11 | 12 | /// 13 | /// RedDotWidget.cs 14 | /// 红点子组件 15 | /// 16 | public class RedDotWidget : MonoBehaviour 17 | { 18 | /// 19 | /// 红点图片 20 | /// 21 | [Header("红点图片")] 22 | public Image ImgRedDot; 23 | 24 | /// 25 | /// 红点文本 26 | /// 27 | [Header("红点文本")] 28 | public Text TxtRedDotDes; 29 | 30 | /// 31 | /// 设置红点显隐 32 | /// 33 | /// 34 | public void SetActive(bool active) 35 | { 36 | gameObject.SetActive(active); 37 | } 38 | 39 | /// 40 | /// 设置红点描述 41 | /// 42 | /// 43 | public void SetRedDotTxt(string redDotRes) 44 | { 45 | TxtRedDotDes.text = redDotRes; 46 | } 47 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/GameLogic/Widget/RedDotWidget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a9a32cc14fa2f248b312d7a0bfae923 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Trie.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec40b3e8ce5f52449b55476bebd647d9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Trie/Trie.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: Trie.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/12 5 | */ 6 | 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Text; 11 | using UnityEngine; 12 | 13 | /// 14 | /// 前缀树 15 | /// 16 | public class Trie 17 | { 18 | /// 19 | /// 单词分隔符 20 | /// 21 | public char Separator 22 | { 23 | get; 24 | private set; 25 | } 26 | 27 | /// 28 | /// 单词数量 29 | /// 30 | public int WorldCount 31 | { 32 | get; 33 | private set; 34 | } 35 | 36 | /// 37 | /// 树深度 38 | /// 39 | public int TrieDeepth 40 | { 41 | get; 42 | private set; 43 | } 44 | 45 | /// 46 | /// 根节点 47 | /// 48 | public TrieNode RootNode 49 | { 50 | get; 51 | private set; 52 | } 53 | 54 | /// 55 | /// 单词列表(用于缓存分割结果,优化单个单词判定时重复分割问题) 56 | /// 57 | private List mWordList; 58 | 59 | /// 60 | /// 构造函数 61 | /// 62 | /// 63 | public Trie(char separator = '|') 64 | { 65 | Separator = separator; 66 | WorldCount = 0; 67 | TrieDeepth = 0; 68 | RootNode = ObjectPool.Singleton.pop(); 69 | RootNode.Init("Root", null, this, 0, false); 70 | mWordList = new List(); 71 | } 72 | 73 | /// 74 | /// 添加单词 75 | /// 76 | /// 77 | public void AddWord(string word) 78 | { 79 | mWordList.Clear(); 80 | var words = word.Split(Separator); 81 | mWordList.AddRange(words); 82 | var length = mWordList.Count; 83 | var node = RootNode; 84 | for (int i = 0; i < length; i++) 85 | { 86 | var spliteWord = mWordList[i]; 87 | var isLast = i == (length - 1); 88 | if (!node.ContainWord(spliteWord)) 89 | { 90 | node = node.AddChildNode(spliteWord, isLast); 91 | } 92 | else 93 | { 94 | node = node.GetChildNode(spliteWord); 95 | if(!node.IsTail && isLast) 96 | { 97 | node.IsTail = isLast; 98 | } 99 | //if(isLast) 100 | //{ 101 | // Debug.Log($"添加重复单词:{word}"); 102 | //} 103 | } 104 | } 105 | } 106 | 107 | /// 108 | /// 移除指定单词 109 | /// Note: 110 | /// 仅当指定单词存在时才能移除成功 111 | /// 112 | /// 113 | /// 114 | public bool RemoveWord(string word) 115 | { 116 | if(string.IsNullOrEmpty(word)) 117 | { 118 | Debug.LogError($"不允许移除空单词!"); 119 | return false; 120 | } 121 | var wordNode = GetWordNode(word); 122 | if(wordNode == null) 123 | { 124 | Debug.LogError($"找不到单词:{word}的节点信息,移除单词失败!"); 125 | return false; 126 | } 127 | if(wordNode.IsRoot) 128 | { 129 | Debug.LogError($"不允许删除根节点!"); 130 | return false; 131 | } 132 | // 从最里层节点开始反向判定更新和删除 133 | if(!wordNode.IsTail) 134 | { 135 | Debug.LogError($"单词:{word}的节点不是单词节点,移除单词失败!"); 136 | return false; 137 | } 138 | // 删除的节点是叶子节点时要删除节点并往上递归更新节点数据 139 | // 反之只更新标记为非单词节点即可结束 140 | if(wordNode.ChildCount > 0) 141 | { 142 | wordNode.IsTail = false; 143 | return true; 144 | } 145 | wordNode.RemoveFromParent(); 146 | // 网上遍历更新节点信息 147 | var node = wordNode.Parent; 148 | while(node != null && !node.IsRoot) 149 | { 150 | // 没有子节点且不是单词节点则直接删除 151 | if(node.ChildCount == 0 && !node.IsTail) 152 | { 153 | node.RemoveFromParent(); 154 | } 155 | node = node.Parent; 156 | // 有子节点则停止往上更新 157 | if(node.ChildCount > 0) 158 | { 159 | break; 160 | } 161 | } 162 | return true; 163 | } 164 | 165 | /// 166 | /// 获取指定字符串的单词节点 167 | /// Note: 168 | /// 只有满足每一层且最后一层是单词的节点才算有效单词节点 169 | /// 170 | /// 171 | /// 172 | public TrieNode GetWordNode(string word) 173 | { 174 | if (string.IsNullOrEmpty(word)) 175 | { 176 | Debug.LogError($"无法获取空单词的单次节点!"); 177 | return null; 178 | } 179 | // 从最里层节点开始反向判定更新和删除 180 | var wordArray = word.Split(Separator); 181 | var node = RootNode; 182 | foreach(var spliteWord in wordArray) 183 | { 184 | var childNode = node.GetChildNode(spliteWord); 185 | if (childNode != null) 186 | { 187 | node = childNode; 188 | } 189 | else 190 | { 191 | break; 192 | } 193 | } 194 | if(node == null || !node.IsTail) 195 | { 196 | Debug.Log($"找不到单词:{word}的单词节点!"); 197 | return null; 198 | } 199 | return node; 200 | } 201 | 202 | /// 203 | /// 有按指定单词开头的词语 204 | /// 205 | /// 206 | /// 207 | public bool StartWith(string word) 208 | { 209 | if (string.IsNullOrEmpty(word)) 210 | { 211 | return false; 212 | } 213 | mWordList.Clear(); 214 | var wordArray = word.Split(Separator); 215 | mWordList.AddRange(wordArray); 216 | return FindWord(RootNode, mWordList); 217 | } 218 | 219 | /// 220 | /// 查找单词 221 | /// 222 | /// 223 | /// 224 | /// 225 | private bool FindWord(TrieNode trieNode, List wordList) 226 | { 227 | if (wordList.Count == 0) 228 | { 229 | return true; 230 | } 231 | var firstWord = wordList[0]; 232 | if (!trieNode.ContainWord(firstWord)) 233 | { 234 | return false; 235 | } 236 | var childNode = trieNode.GetChildNode(firstWord); 237 | wordList.RemoveAt(0); 238 | return FindWord(childNode, wordList); 239 | } 240 | 241 | /// 242 | /// 单词是否存在 243 | /// 244 | /// 245 | /// 246 | public bool ContainWord(string word) 247 | { 248 | if(string.IsNullOrEmpty(word)) 249 | { 250 | return false; 251 | } 252 | mWordList.Clear(); 253 | var wordArray = word.Split(Separator); 254 | mWordList.AddRange(wordArray); 255 | return MatchWord(RootNode, mWordList); 256 | } 257 | 258 | /// 259 | /// 匹配单词(单词必须完美匹配) 260 | /// 261 | /// 262 | /// 263 | /// 264 | private bool MatchWord(TrieNode trieNode, List wordList) 265 | { 266 | if (wordList.Count == 0) 267 | { 268 | return trieNode.IsTail; 269 | } 270 | var firstWord = wordList[0]; 271 | if (!trieNode.ContainWord(firstWord)) 272 | { 273 | return false; 274 | } 275 | var childNode = trieNode.GetChildNode(firstWord); 276 | wordList.RemoveAt(0); 277 | return MatchWord(childNode, wordList); 278 | } 279 | 280 | /// 281 | /// 获取所有单词列表 282 | /// 283 | /// 284 | public List GetWordList() 285 | { 286 | return GetNodeWorldList(RootNode, string.Empty); 287 | } 288 | 289 | /// 290 | /// 获取节点单词列表 291 | /// 292 | /// 293 | /// 294 | /// 295 | private List GetNodeWorldList(TrieNode trieNode, string preFix) 296 | { 297 | var wordList = new List(); 298 | foreach (var childNodeKey in trieNode.ChildNodesMap.Keys) 299 | { 300 | var childNode = trieNode.ChildNodesMap[childNodeKey]; 301 | string word; 302 | if (trieNode.IsRoot) 303 | { 304 | word = $"{preFix}{childNodeKey}"; 305 | } 306 | else 307 | { 308 | word = $"{preFix}{Separator}{childNodeKey}"; 309 | } 310 | if (childNode.IsTail) 311 | { 312 | wordList.Add(word); 313 | } 314 | if (childNode.ChildNodesMap.Count > 0) 315 | { 316 | var childNodeWorldList = GetNodeWorldList(childNode, word); 317 | wordList.AddRange(childNodeWorldList); 318 | } 319 | } 320 | return wordList; 321 | } 322 | 323 | /// 324 | /// 打印树形节点 325 | /// 326 | public void PrintTreeNodes() 327 | { 328 | PrintNodes(RootNode, 1); 329 | } 330 | 331 | /// 332 | /// 打印节点 333 | /// 334 | /// 335 | /// 336 | private void PrintNodes(TrieNode node, int depth = 1) 337 | { 338 | var count = 1; 339 | foreach (var childeNode in node.ChildNodesMap) 340 | { 341 | Console.Write($"{childeNode.Key}({depth}-{count})"); 342 | count++; 343 | } 344 | Console.WriteLine(); 345 | foreach (var childeNode in node.ChildNodesMap) 346 | { 347 | PrintNodes(childeNode.Value, depth + 1); 348 | } 349 | } 350 | } -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Trie/Trie.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e302875a5cbb944439c5828e903439d9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Trie/TrieNode.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Description: TrieNode.cs 3 | * Author: TONYTANG 4 | * Create Date: 2022/08/12 5 | */ 6 | 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | using UnityEngine; 10 | 11 | /// 12 | /// TrieNode.cs 13 | /// 前缀树节点类 14 | /// 15 | public class TrieNode : IRecycle 16 | { 17 | /// 18 | /// 节点字符串 19 | /// 20 | public string NodeValue 21 | { 22 | get; 23 | private set; 24 | } 25 | 26 | /// 27 | /// 父节点 28 | /// 29 | public TrieNode Parent 30 | { 31 | get; 32 | private set; 33 | } 34 | 35 | /// 36 | /// 所属前缀树 37 | /// 38 | public Trie OwnerTree 39 | { 40 | get; 41 | private set; 42 | } 43 | 44 | /// 45 | /// 节点深度(根节点为0) 46 | /// 47 | public int Depth 48 | { 49 | get; 50 | private set; 51 | } 52 | 53 | /// 54 | /// 是否是单词节点 55 | /// 56 | public bool IsTail 57 | { 58 | get; 59 | set; 60 | } 61 | 62 | /// 63 | /// 是否是根节点 64 | /// 65 | public bool IsRoot 66 | { 67 | get 68 | { 69 | return Parent == null; 70 | } 71 | } 72 | 73 | /// 74 | /// 子节点映射Map<节点字符串, 节点对象> 75 | /// 76 | public Dictionary ChildNodesMap 77 | { 78 | get; 79 | private set; 80 | } 81 | 82 | /// 83 | /// 子节点数量 84 | /// 85 | public int ChildCount 86 | { 87 | get 88 | { 89 | return ChildNodesMap.Count; 90 | } 91 | } 92 | 93 | public TrieNode() 94 | { 95 | ChildNodesMap = new Dictionary(); 96 | } 97 | 98 | public void OnCreate() 99 | { 100 | NodeValue = null; 101 | Parent = null; 102 | OwnerTree = null; 103 | Depth = 0; 104 | IsTail = false; 105 | ChildNodesMap.Clear(); 106 | } 107 | 108 | /// 109 | /// 初始化数据 110 | /// 111 | /// 字符串 112 | /// 父节点 113 | /// 所属前缀树 114 | /// 节点深度 115 | /// 是否是单词节点 116 | public void Init(string value, TrieNode parent, Trie ownerTree, int depth, bool isTail = false) 117 | { 118 | NodeValue = value; 119 | Parent = parent; 120 | OwnerTree = ownerTree; 121 | Depth = depth; 122 | IsTail = isTail; 123 | } 124 | 125 | public void OnDispose() 126 | { 127 | NodeValue = null; 128 | Parent = null; 129 | OwnerTree = null; 130 | Depth = 0; 131 | IsTail = false; 132 | ChildNodesMap.Clear(); 133 | } 134 | 135 | /// 136 | /// 添加子节点 137 | /// 138 | /// 139 | /// 140 | /// 141 | public TrieNode AddChildNode(string nodeWord, bool isTail) 142 | { 143 | TrieNode node; 144 | if (ChildNodesMap.TryGetValue(nodeWord, out node)) 145 | { 146 | Debug.Log($"节点字符串:{NodeValue}已存在字符串:{nodeWord}的子节点,不重复添加子节点!"); 147 | return node; 148 | } 149 | node = ObjectPool.Singleton.pop(); 150 | node.Init(nodeWord, this, OwnerTree, Depth + 1, isTail); 151 | ChildNodesMap.Add(nodeWord, node); 152 | return node; 153 | } 154 | 155 | /// 156 | /// 移除指定子节点 157 | /// 158 | /// 159 | /// 160 | public bool RemoveChildNodeByWord(string nodeWord) 161 | { 162 | var childNode = GetChildNode(nodeWord); 163 | return RemoveChildNode(childNode); 164 | } 165 | 166 | /// 167 | /// 移除指定子节点 168 | /// 169 | /// 170 | /// 171 | public bool RemoveChildNode(TrieNode childNode) 172 | { 173 | if(childNode == null) 174 | { 175 | Debug.LogError($"无法移除空节点!"); 176 | return false; 177 | } 178 | var realChildNode = GetChildNode(childNode.NodeValue); 179 | if(realChildNode != childNode) 180 | { 181 | Debug.LogError($"移除的子节点单词:{childNode.NodeValue}对象不是同一个,移除子节点失败!"); 182 | return false; 183 | } 184 | ChildNodesMap.Remove(childNode.NodeValue); 185 | ObjectPool.Singleton.push(childNode); 186 | return true; 187 | } 188 | 189 | /// 190 | /// 当前节点从父节点移除 191 | /// 192 | /// 193 | public bool RemoveFromParent() 194 | { 195 | if(IsRoot) 196 | { 197 | Debug.LogError($"当前节点是根节点,不允许从父节点移除,从父节点移除当前节点失败!"); 198 | return false; 199 | } 200 | return Parent.RemoveChildNode(this); 201 | } 202 | 203 | /// 204 | /// 获取指定字符串的子节点 205 | /// 206 | /// 207 | /// 208 | /// 209 | public TrieNode GetChildNode(string nodeWord) 210 | { 211 | TrieNode trieNode; 212 | if (!ChildNodesMap.TryGetValue(nodeWord, out trieNode)) 213 | { 214 | Debug.Log($"节点字符串:{NodeValue}找不到子节点字符串:{nodeWord},获取子节点失败!"); 215 | return null; 216 | } 217 | return trieNode; 218 | } 219 | 220 | /// 221 | /// 是否包含指定字符串的子节点 222 | /// 223 | /// 224 | /// 225 | /// 226 | public bool ContainWord(string nodeWord) 227 | { 228 | return ChildNodesMap.ContainsKey(nodeWord); 229 | } 230 | 231 | /// 232 | /// 获取当前节点构成的单词 233 | /// Note: 234 | /// 不管当前节点是否是单词节点,都返回从当前节点回溯到根节点拼接的单词 235 | /// 若当前节点为根节点,则返回根节点的字符串(默认为"Root") 236 | /// 237 | /// 238 | public string GetFullWord() 239 | { 240 | var trieNodeWord = NodeValue; 241 | var node = Parent; 242 | while(node != null && !node.IsRoot) 243 | { 244 | trieNodeWord = $"{node.NodeValue}{OwnerTree.Separator}{trieNodeWord}"; 245 | node = node.Parent; 246 | } 247 | return trieNodeWord; 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /RedDotSystem/Assets/Scripts/Trie/TrieNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79b4fba9ecdaffe46a71c01a3578b825 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /RedDotSystem/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.15.16", 4 | "com.unity.ide.rider": "2.0.7", 5 | "com.unity.ide.visualstudio": "2.0.22", 6 | "com.unity.ide.vscode": "1.2.5", 7 | "com.unity.test-framework": "1.1.31", 8 | "com.unity.textmeshpro": "3.0.6", 9 | "com.unity.timeline": "1.4.8", 10 | "com.unity.ugui": "1.0.0", 11 | "com.unity.modules.ai": "1.0.0", 12 | "com.unity.modules.androidjni": "1.0.0", 13 | "com.unity.modules.animation": "1.0.0", 14 | "com.unity.modules.assetbundle": "1.0.0", 15 | "com.unity.modules.audio": "1.0.0", 16 | "com.unity.modules.autostreaming": "1.0.0", 17 | "com.unity.modules.cloth": "1.0.0", 18 | "com.unity.modules.director": "1.0.0", 19 | "com.unity.modules.imageconversion": "1.0.0", 20 | "com.unity.modules.imgui": "1.0.0", 21 | "com.unity.modules.jsonserialize": "1.0.0", 22 | "com.unity.modules.particlesystem": "1.0.0", 23 | "com.unity.modules.physics": "1.0.0", 24 | "com.unity.modules.physics2d": "1.0.0", 25 | "com.unity.modules.screencapture": "1.0.0", 26 | "com.unity.modules.terrain": "1.0.0", 27 | "com.unity.modules.terrainphysics": "1.0.0", 28 | "com.unity.modules.tilemap": "1.0.0", 29 | "com.unity.modules.ui": "1.0.0", 30 | "com.unity.modules.uielements": "1.0.0", 31 | "com.unity.modules.umbra": "1.0.0", 32 | "com.unity.modules.unityanalytics": "1.0.0", 33 | "com.unity.modules.unitywebrequest": "1.0.0", 34 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 35 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 36 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 37 | "com.unity.modules.unitywebrequestwww": "1.0.0", 38 | "com.unity.modules.vehicles": "1.0.0", 39 | "com.unity.modules.video": "1.0.0", 40 | "com.unity.modules.vr": "1.0.0", 41 | "com.unity.modules.wind": "1.0.0", 42 | "com.unity.modules.xr": "1.0.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /RedDotSystem/Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": { 4 | "version": "1.15.16", 5 | "depth": 0, 6 | "source": "registry", 7 | "dependencies": { 8 | "com.unity.services.core": "1.0.1" 9 | }, 10 | "url": "https://packages.unity.cn" 11 | }, 12 | "com.unity.ext.nunit": { 13 | "version": "1.0.6", 14 | "depth": 1, 15 | "source": "registry", 16 | "dependencies": {}, 17 | "url": "https://packages.unity.cn" 18 | }, 19 | "com.unity.ide.rider": { 20 | "version": "2.0.7", 21 | "depth": 0, 22 | "source": "registry", 23 | "dependencies": { 24 | "com.unity.test-framework": "1.1.1" 25 | }, 26 | "url": "https://packages.unity.cn" 27 | }, 28 | "com.unity.ide.visualstudio": { 29 | "version": "2.0.22", 30 | "depth": 0, 31 | "source": "registry", 32 | "dependencies": { 33 | "com.unity.test-framework": "1.1.9" 34 | }, 35 | "url": "https://packages.unity.cn" 36 | }, 37 | "com.unity.ide.vscode": { 38 | "version": "1.2.5", 39 | "depth": 0, 40 | "source": "registry", 41 | "dependencies": {}, 42 | "url": "https://packages.unity.cn" 43 | }, 44 | "com.unity.nuget.newtonsoft-json": { 45 | "version": "3.0.2", 46 | "depth": 2, 47 | "source": "registry", 48 | "dependencies": {}, 49 | "url": "https://packages.unity.cn" 50 | }, 51 | "com.unity.services.core": { 52 | "version": "1.4.0", 53 | "depth": 1, 54 | "source": "registry", 55 | "dependencies": { 56 | "com.unity.modules.unitywebrequest": "1.0.0", 57 | "com.unity.nuget.newtonsoft-json": "3.0.2", 58 | "com.unity.modules.androidjni": "1.0.0" 59 | }, 60 | "url": "https://packages.unity.cn" 61 | }, 62 | "com.unity.test-framework": { 63 | "version": "1.1.31", 64 | "depth": 0, 65 | "source": "registry", 66 | "dependencies": { 67 | "com.unity.ext.nunit": "1.0.6", 68 | "com.unity.modules.imgui": "1.0.0", 69 | "com.unity.modules.jsonserialize": "1.0.0" 70 | }, 71 | "url": "https://packages.unity.cn" 72 | }, 73 | "com.unity.textmeshpro": { 74 | "version": "3.0.6", 75 | "depth": 0, 76 | "source": "registry", 77 | "dependencies": { 78 | "com.unity.ugui": "1.0.0" 79 | }, 80 | "url": "https://packages.unity.cn" 81 | }, 82 | "com.unity.timeline": { 83 | "version": "1.4.8", 84 | "depth": 0, 85 | "source": "registry", 86 | "dependencies": { 87 | "com.unity.modules.director": "1.0.0", 88 | "com.unity.modules.animation": "1.0.0", 89 | "com.unity.modules.audio": "1.0.0", 90 | "com.unity.modules.particlesystem": "1.0.0" 91 | }, 92 | "url": "https://packages.unity.cn" 93 | }, 94 | "com.unity.ugui": { 95 | "version": "1.0.0", 96 | "depth": 0, 97 | "source": "builtin", 98 | "dependencies": { 99 | "com.unity.modules.ui": "1.0.0", 100 | "com.unity.modules.imgui": "1.0.0" 101 | } 102 | }, 103 | "com.unity.modules.ai": { 104 | "version": "1.0.0", 105 | "depth": 0, 106 | "source": "builtin", 107 | "dependencies": {} 108 | }, 109 | "com.unity.modules.androidjni": { 110 | "version": "1.0.0", 111 | "depth": 0, 112 | "source": "builtin", 113 | "dependencies": {} 114 | }, 115 | "com.unity.modules.animation": { 116 | "version": "1.0.0", 117 | "depth": 0, 118 | "source": "builtin", 119 | "dependencies": {} 120 | }, 121 | "com.unity.modules.assetbundle": { 122 | "version": "1.0.0", 123 | "depth": 0, 124 | "source": "builtin", 125 | "dependencies": {} 126 | }, 127 | "com.unity.modules.audio": { 128 | "version": "1.0.0", 129 | "depth": 0, 130 | "source": "builtin", 131 | "dependencies": {} 132 | }, 133 | "com.unity.modules.autostreaming": { 134 | "version": "1.0.0", 135 | "depth": 0, 136 | "source": "builtin", 137 | "dependencies": { 138 | "com.unity.modules.animation": "1.0.0", 139 | "com.unity.modules.assetbundle": "1.0.0", 140 | "com.unity.modules.audio": "1.0.0", 141 | "com.unity.modules.jsonserialize": "1.0.0", 142 | "com.unity.modules.unitywebrequest": "1.0.0", 143 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0" 144 | } 145 | }, 146 | "com.unity.modules.cloth": { 147 | "version": "1.0.0", 148 | "depth": 0, 149 | "source": "builtin", 150 | "dependencies": { 151 | "com.unity.modules.physics": "1.0.0" 152 | } 153 | }, 154 | "com.unity.modules.director": { 155 | "version": "1.0.0", 156 | "depth": 0, 157 | "source": "builtin", 158 | "dependencies": { 159 | "com.unity.modules.audio": "1.0.0", 160 | "com.unity.modules.animation": "1.0.0" 161 | } 162 | }, 163 | "com.unity.modules.imageconversion": { 164 | "version": "1.0.0", 165 | "depth": 0, 166 | "source": "builtin", 167 | "dependencies": {} 168 | }, 169 | "com.unity.modules.imgui": { 170 | "version": "1.0.0", 171 | "depth": 0, 172 | "source": "builtin", 173 | "dependencies": {} 174 | }, 175 | "com.unity.modules.jsonserialize": { 176 | "version": "1.0.0", 177 | "depth": 0, 178 | "source": "builtin", 179 | "dependencies": {} 180 | }, 181 | "com.unity.modules.particlesystem": { 182 | "version": "1.0.0", 183 | "depth": 0, 184 | "source": "builtin", 185 | "dependencies": {} 186 | }, 187 | "com.unity.modules.physics": { 188 | "version": "1.0.0", 189 | "depth": 0, 190 | "source": "builtin", 191 | "dependencies": {} 192 | }, 193 | "com.unity.modules.physics2d": { 194 | "version": "1.0.0", 195 | "depth": 0, 196 | "source": "builtin", 197 | "dependencies": {} 198 | }, 199 | "com.unity.modules.screencapture": { 200 | "version": "1.0.0", 201 | "depth": 0, 202 | "source": "builtin", 203 | "dependencies": { 204 | "com.unity.modules.imageconversion": "1.0.0" 205 | } 206 | }, 207 | "com.unity.modules.subsystems": { 208 | "version": "1.0.0", 209 | "depth": 1, 210 | "source": "builtin", 211 | "dependencies": { 212 | "com.unity.modules.jsonserialize": "1.0.0" 213 | } 214 | }, 215 | "com.unity.modules.terrain": { 216 | "version": "1.0.0", 217 | "depth": 0, 218 | "source": "builtin", 219 | "dependencies": {} 220 | }, 221 | "com.unity.modules.terrainphysics": { 222 | "version": "1.0.0", 223 | "depth": 0, 224 | "source": "builtin", 225 | "dependencies": { 226 | "com.unity.modules.physics": "1.0.0", 227 | "com.unity.modules.terrain": "1.0.0" 228 | } 229 | }, 230 | "com.unity.modules.tilemap": { 231 | "version": "1.0.0", 232 | "depth": 0, 233 | "source": "builtin", 234 | "dependencies": { 235 | "com.unity.modules.physics2d": "1.0.0" 236 | } 237 | }, 238 | "com.unity.modules.ui": { 239 | "version": "1.0.0", 240 | "depth": 0, 241 | "source": "builtin", 242 | "dependencies": {} 243 | }, 244 | "com.unity.modules.uielements": { 245 | "version": "1.0.0", 246 | "depth": 0, 247 | "source": "builtin", 248 | "dependencies": { 249 | "com.unity.modules.ui": "1.0.0", 250 | "com.unity.modules.imgui": "1.0.0", 251 | "com.unity.modules.jsonserialize": "1.0.0", 252 | "com.unity.modules.uielementsnative": "1.0.0" 253 | } 254 | }, 255 | "com.unity.modules.uielementsnative": { 256 | "version": "1.0.0", 257 | "depth": 1, 258 | "source": "builtin", 259 | "dependencies": { 260 | "com.unity.modules.ui": "1.0.0", 261 | "com.unity.modules.imgui": "1.0.0", 262 | "com.unity.modules.jsonserialize": "1.0.0" 263 | } 264 | }, 265 | "com.unity.modules.umbra": { 266 | "version": "1.0.0", 267 | "depth": 0, 268 | "source": "builtin", 269 | "dependencies": {} 270 | }, 271 | "com.unity.modules.unityanalytics": { 272 | "version": "1.0.0", 273 | "depth": 0, 274 | "source": "builtin", 275 | "dependencies": { 276 | "com.unity.modules.unitywebrequest": "1.0.0", 277 | "com.unity.modules.jsonserialize": "1.0.0" 278 | } 279 | }, 280 | "com.unity.modules.unitywebrequest": { 281 | "version": "1.0.0", 282 | "depth": 0, 283 | "source": "builtin", 284 | "dependencies": {} 285 | }, 286 | "com.unity.modules.unitywebrequestassetbundle": { 287 | "version": "1.0.0", 288 | "depth": 0, 289 | "source": "builtin", 290 | "dependencies": { 291 | "com.unity.modules.assetbundle": "1.0.0", 292 | "com.unity.modules.unitywebrequest": "1.0.0" 293 | } 294 | }, 295 | "com.unity.modules.unitywebrequestaudio": { 296 | "version": "1.0.0", 297 | "depth": 0, 298 | "source": "builtin", 299 | "dependencies": { 300 | "com.unity.modules.unitywebrequest": "1.0.0", 301 | "com.unity.modules.audio": "1.0.0" 302 | } 303 | }, 304 | "com.unity.modules.unitywebrequesttexture": { 305 | "version": "1.0.0", 306 | "depth": 0, 307 | "source": "builtin", 308 | "dependencies": { 309 | "com.unity.modules.unitywebrequest": "1.0.0", 310 | "com.unity.modules.imageconversion": "1.0.0" 311 | } 312 | }, 313 | "com.unity.modules.unitywebrequestwww": { 314 | "version": "1.0.0", 315 | "depth": 0, 316 | "source": "builtin", 317 | "dependencies": { 318 | "com.unity.modules.unitywebrequest": "1.0.0", 319 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 320 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 321 | "com.unity.modules.audio": "1.0.0", 322 | "com.unity.modules.assetbundle": "1.0.0", 323 | "com.unity.modules.imageconversion": "1.0.0" 324 | } 325 | }, 326 | "com.unity.modules.vehicles": { 327 | "version": "1.0.0", 328 | "depth": 0, 329 | "source": "builtin", 330 | "dependencies": { 331 | "com.unity.modules.physics": "1.0.0" 332 | } 333 | }, 334 | "com.unity.modules.video": { 335 | "version": "1.0.0", 336 | "depth": 0, 337 | "source": "builtin", 338 | "dependencies": { 339 | "com.unity.modules.audio": "1.0.0", 340 | "com.unity.modules.ui": "1.0.0", 341 | "com.unity.modules.unitywebrequest": "1.0.0" 342 | } 343 | }, 344 | "com.unity.modules.vr": { 345 | "version": "1.0.0", 346 | "depth": 0, 347 | "source": "builtin", 348 | "dependencies": { 349 | "com.unity.modules.jsonserialize": "1.0.0", 350 | "com.unity.modules.physics": "1.0.0", 351 | "com.unity.modules.xr": "1.0.0" 352 | } 353 | }, 354 | "com.unity.modules.wind": { 355 | "version": "1.0.0", 356 | "depth": 0, 357 | "source": "builtin", 358 | "dependencies": {} 359 | }, 360 | "com.unity.modules.xr": { 361 | "version": "1.0.0", 362 | "depth": 0, 363 | "source": "builtin", 364 | "dependencies": { 365 | "com.unity.modules.physics": "1.0.0", 366 | "com.unity.modules.jsonserialize": "1.0.0", 367 | "com.unity.modules.subsystems": "1.0.0" 368 | } 369 | } 370 | } 371 | } 372 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/AutoStreamingSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1200 &1 4 | AutoStreamingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | mSearchMode: 15 8 | mCustomSearchFile: 9 | mTextureSearchString: 10 | mMeshSearchString: 11 | mTextures: [] 12 | mAudios: [] 13 | mMeshes: [] 14 | mScenes: [] 15 | mConfigCCD: 16 | useCCD: 0 17 | cosKey: 18 | projectGuid: 19 | bucketUuid: 20 | bucketName: 21 | badgeName: 22 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 0 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 0 30 | m_SerializeInlineMappingsOnOneLine: 1 -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | m_LogWhenShaderIsCompiled: 0 63 | m_AllowEnlightenSupportForUpgradedProject: 0 64 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreviewPackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | oneTimeWarningShown: 0 20 | m_Registries: 21 | - m_Id: main 22 | m_Name: 23 | m_Url: https://packages.unity.cn 24 | m_Scopes: [] 25 | m_IsDefault: 1 26 | m_Capabilities: 7 27 | m_UserSelectedRegistryName: 28 | m_UserAddingNewScopedRegistry: 0 29 | m_RegistryInfoDraft: 30 | m_ErrorMessage: 31 | m_Original: 32 | m_Id: 33 | m_Name: 34 | m_Url: 35 | m_Scopes: [] 36 | m_IsDefault: 0 37 | m_Capabilities: 0 38 | m_Modified: 0 39 | m_Name: 40 | m_Url: 41 | m_Scopes: 42 | - 43 | m_SelectedScopeIndex: 0 44 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2020.3.34f1c2 2 | m_EditorVersionWithRevision: 2020.3.34f1c2 (841de61e17c8) 3 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | Nintendo 3DS: 5 223 | Nintendo Switch: 5 224 | PS4: 5 225 | PSP2: 2 226 | Stadia: 5 227 | Standalone: 5 228 | WebGL: 3 229 | Windows Store Apps: 5 230 | XboxOne: 5 231 | iPhone: 2 232 | tvOS: 2 233 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_DashboardUrl: https://dashboard.unity3d.com 13 | m_CNEventUrl: https://cdp.cloud.unity.cn/v1/events 14 | m_CNConfigUrl: https://cdp.cloud.unity.cn/config 15 | m_TestInitMode: 0 16 | CrashReportingSettings: 17 | m_EventUrl: https://perf-events.cloud.unity.cn 18 | m_Enabled: 0 19 | m_LogBufferSize: 10 20 | m_CaptureEditorExceptions: 1 21 | UnityPurchasingSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | UnityAnalyticsSettings: 25 | m_Enabled: 1 26 | m_TestMode: 0 27 | m_InitializeOnStartup: 1 28 | UnityAdsSettings: 29 | m_Enabled: 0 30 | m_InitializeOnStartup: 1 31 | m_TestMode: 0 32 | m_IosGameId: 33 | m_AndroidGameId: 34 | m_GameIds: {} 35 | m_GameId: 36 | PerformanceReportingSettings: 37 | m_Enabled: 0 38 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /RedDotSystem/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /RedDotSystem/RedDotSystem.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{4977E1B6-A2A7-1B17-B025-050D8AAC3700}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{417EBEA4-E5E2-BD01-CA73-19A801C67DF6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {4977E1B6-A2A7-1B17-B025-050D8AAC3700}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {4977E1B6-A2A7-1B17-B025-050D8AAC3700}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {4977E1B6-A2A7-1B17-B025-050D8AAC3700}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {4977E1B6-A2A7-1B17-B025-050D8AAC3700}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {417EBEA4-E5E2-BD01-CA73-19A801C67DF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {417EBEA4-E5E2-BD01-CA73-19A801C67DF6}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {417EBEA4-E5E2-BD01-CA73-19A801C67DF6}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {417EBEA4-E5E2-BD01-CA73-19A801C67DF6}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RedDotSystem/UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | RecentlyUsedScenePath-0: 9 | value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d 10 | flags: 0 11 | vcSharedLogLevel: 12 | value: 0d5e400f0650 13 | flags: 0 14 | m_VCAutomaticAdd: 1 15 | m_VCDebugCom: 0 16 | m_VCDebugCmd: 0 17 | m_VCDebugOut: 0 18 | m_SemanticMergeMode: 2 19 | m_VCShowFailedCheckout: 1 20 | m_VCOverwriteFailedCheckoutAssets: 1 21 | m_VCProjectOverlayIcons: 1 22 | m_VCHierarchyOverlayIcons: 1 23 | m_VCOtherOverlayIcons: 1 24 | m_VCAllowAsyncUpdate: 1 25 | -------------------------------------------------------------------------------- /RedDotSystem/UserSettings/Search.settings: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /img/RedDotSystem/AllRedDotUnitInfoPreview.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/AllRedDotUnitInfoPreview.PNG -------------------------------------------------------------------------------- /img/RedDotSystem/BackpackUIOperation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/BackpackUIOperation.PNG -------------------------------------------------------------------------------- /img/RedDotSystem/BackpackUIOperationAfterReduce.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/BackpackUIOperationAfterReduce.PNG -------------------------------------------------------------------------------- /img/RedDotSystem/MainUIAfterBackpackOperation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/MainUIAfterBackpackOperation.PNG -------------------------------------------------------------------------------- /img/RedDotSystem/RedDotDetailAfterBackpackOperation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/RedDotDetailAfterBackpackOperation.PNG -------------------------------------------------------------------------------- /img/RedDotSystem/RedDotTrieAfterBackpackUIOperation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/RedDotTrieAfterBackpackUIOperation.PNG -------------------------------------------------------------------------------- /img/RedDotSystem/RedDotTriePreiview.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/RedDotTriePreiview.PNG -------------------------------------------------------------------------------- /img/RedDotSystem/RedDotTriePreiviewAfterMarkFunc1New.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/RedDotTriePreiviewAfterMarkFunc1New.PNG -------------------------------------------------------------------------------- /img/RedDotSystem/RedDotTriePreviewAfterBackpackReduce.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TonyTang1990/RedDotSystem/07e4f0b54d756f76338c9c480734df8d9fef8c4c/img/RedDotSystem/RedDotTriePreviewAfterBackpackReduce.PNG --------------------------------------------------------------------------------