示例#1
0
        protected internal override void OnShow(object userData)
        {
            base.OnShow(userData);

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

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

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

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

            //调用热更新层的OnInit
            GameEntry.ILRuntime.AppDomain.Invoke(m_HotfixEntityFullName, "OnInit", hotfixInstance, this, m_Data.UserData);
        }