Exemple #1
0
        protected override void OnShow(object userData)
        {
            base.OnShow(userData);

            m_Data = (HotfixEntityData)userData;
            m_OnShow.Invoke(m_Data.UserData);
        }
Exemple #2
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);

            m_Data           = (HotfixEntityData)userData;
            HotfixEntityName = m_Data.HotfixEntityName;

            string hotfixEntityFullName = Utility.Text.Format("{0}.{1}", "Trinity.Hotfix", HotfixEntityName);

            //获取热更新层的实例
            IType  type           = GameEntry.ILRuntime.AppDomain.LoadedTypes[hotfixEntityFullName];
            object hotfixInstance = ((ILType)type).Instantiate();

            //获取热更新层的方法并缓存
            m_OnShow       = new ILInstanceMethod(hotfixInstance, hotfixEntityFullName, "OnShow", 1);
            m_OnHide       = new ILInstanceMethod(hotfixInstance, hotfixEntityFullName, "OnHide", 1);
            m_OnAttached   = new ILInstanceMethod(hotfixInstance, hotfixEntityFullName, "OnAttached", 3);
            m_OnDetached   = new ILInstanceMethod(hotfixInstance, hotfixEntityFullName, "OnDetached", 2);
            m_OnAttachTo   = new ILInstanceMethod(hotfixInstance, hotfixEntityFullName, "OnAttachTo", 3);
            m_OnDetachFrom = new ILInstanceMethod(hotfixInstance, hotfixEntityFullName, "OnDetachFrom", 2);
            m_OnUpdate     = new ILInstanceMethod(hotfixInstance, hotfixEntityFullName, "OnUpdate", 2);

            //调用热更新层的OnInit
            GameEntry.ILRuntime.AppDomain.Invoke(hotfixEntityFullName, "OnInit", hotfixInstance, this, m_Data.UserData);
        }
Exemple #3
0
 /// <summary>
 /// 显示热更新层实体
 /// </summary>
 public static void ShowHotfixEntity(this EntityComponent entityComponent, int priority, HotfixEntityData data)
 {
     entityComponent.ShowEntity(typeof(HotfixEntity), priority, data);
 }
Exemple #4
0
 /// <summary>
 /// 显示热更新层实体(可等待)
 /// </summary>
 public static Task <Entity> AwaitShowHotfixEntity(this EntityComponent self, int priority, HotfixEntityData data)
 {
     s_EntityTcs      = new TaskCompletionSource <Entity>();
     s_EntitySerialId = data.Id;
     self.ShowHotfixEntity(priority, data);
     return(s_EntityTcs.Task);
 }