public void Start() { HotfixNetManager.Instance.Create(); FsmManager.Instance.Create(); // 缓存所有的特性 HotfixLog.Log("收集所有热更类的属性并缓存"); { Attribute attribute1 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UILogin)); ILRManager.Instance.CacheHotfixAttribute(typeof(UILogin), attribute1); Attribute attribute2 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UIMain)); ILRManager.Instance.CacheHotfixAttribute(typeof(UIMain), attribute2); Attribute attribute3 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UIMap)); ILRManager.Instance.CacheHotfixAttribute(typeof(UIMap), attribute3); } // 开启协程加载资源 MotionEngine.StartCoroutine(AsyncLoadAssets()); // 测试热更事件 HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill1Event>(OnHandleEventMessage); HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill2Event>(OnHandleEventMessage); HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill3Event>(OnHandleEventMessage); HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill4Event>(OnHandleEventMessage); HotfixEventManager.Instance.AddListener <HotfixEventDefine.ClickSkill5Event>(OnHandleEventMessage); }
public void Start() { HotfixNetManager.Instance.Create(); FsmManager.Instance.Create(); // 缓存所有的特性 HotfixLog.Log("收集所有热更类的属性并缓存"); { Attribute attribute1 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UILogin)); ILRManager.Instance.CacheHotfixAttribute(typeof(UILogin), attribute1); Attribute attribute2 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UIMain)); ILRManager.Instance.CacheHotfixAttribute(typeof(UIMain), attribute2); Attribute attribute3 = HotfixTypeHelper.GetAttribute <WindowAttribute>(typeof(UIMap)); ILRManager.Instance.CacheHotfixAttribute(typeof(UIMap), attribute3); } // 开启协程加载资源 MotionEngine.StartCoroutine(AsyncLoadAssets()); }
// 收集所有网络协议的类型 private void CollectTypes() { List <Type> types = ILRManager.Instance.HotfixAssemblyTypes; for (int i = 0; i < types.Count; i++) { System.Type type = types[i]; // 判断属性标签 if (Attribute.IsDefined(type, typeof(NetworkMessageAttribute))) { // 判断是否重复 NetworkMessageAttribute attribute = HotfixTypeHelper.GetAttribute <NetworkMessageAttribute>(type); if (_types.ContainsKey(attribute.MsgID)) { throw new Exception($"Message {type} has same value : {attribute.MsgID}"); } // 添加到集合 _types.Add(attribute.MsgID, type); } } }