Example #1
0
        public void ShowCharacter(bool show)
        {
            if (mIsShow == show)
            {
                return;
            }
            mIsShow = show;
            if (show)
            {
                m_CharacterContainer.CustomSetActive(true);
            }
            else
            {
                if (m_Character != null)
                {
                    MoveEditor.FXHelper fxHelper = m_Character.GetComponent <MoveEditor.FXHelper>();
                    if (fxHelper != null)
                    {
                        fxHelper.StopAll(true);
                        //if (PSPoolManager.Instance != null)
                        //{
                        //    PSPoolManager.Instance.Update();
                        //}
                    }
                }

                m_CharacterContainer.CustomSetActive(false);
            }
        }
Example #2
0
        private void InitHeadBar()
        {
            Transform m_locator = mDMono.transform.Find("HealthBarTarget");

            if (m_locator == null)
            {
                MoveEditor.FXHelper fx_helper = mDMono.transform.GetComponent <MoveEditor.FXHelper>();

                if (fx_helper != null)
                {
                    m_locator = fx_helper.HeadNubTransform;
                }
            }

            if (m_locator == null)
            {
                m_locator = mDMono.transform;
            }

            if (mHeadBars2DMonitor == null)
            {
                mHeadBars2DMonitor = mDMono.gameObject.AddComponent <Main.MainLand.HeadBars2DMonitor>();
                mHeadBars2DMonitor.SetLocator(m_locator);
            }
        }
Example #3
0
        public void ChangeArenaModel(string Tid, int skin = 0, bool ChangeModel = false)
        {
            try
            {
                if (ChangeModel)
                {
                    ResetModel();
                    _HeadBar = null;
                    CharacterVariant CV = mDMono.transform.GetComponentInChildren <CharacterVariant>();
                    if (CV != null && GameEngine.Instance != null)
                    {
                        SetObjLayer(CV.CharacterInstance, GameEngine.Instance.defaultLayer);
                        CV.Recycle();
                        PoolModel.DestroyModel(CV.gameObject);
                    }
                    MoveEditor.FXHelper FH = mDMono.transform.GetComponentInChildren <MoveEditor.FXHelper>();
                    if (FH != null)
                    {
                        FH.StopAll(true);
                    }
                    if (enemyController.SkinnedRigPrefab != null)
                    {
                        PoolModel.DestroyModel(enemyController.SkinnedRigPrefab);
                    }

                    string classname   = null;
                    string characterid = CharacterTemplateManager.Instance.TemplateidToCharacterid(Tid);
                    var    charTpl     = CharacterTemplateManager.Instance.GetHeroInfo(characterid, skin);
                    classname = charTpl.model_name;//需添加皮肤
                    if (string.IsNullOrEmpty(classname))
                    {
                        EB.Debug.LogError("OnViewIdAllocated: classname not found for tid = {0}", Tid);
                        return;
                    }
                    enemyController.CharacterModel = CharacterCatalog.Instance.GetModel(classname);

                    OnSpawnFun();

                    Role = _role;
                    SceneLogic scene     = MainLandLogic.GetInstance();
                    string     sceneName = scene.CurrentSceneName;
                    SetNpcName(sceneName);
                }
            }
            catch (System.Exception e)
            {
                EB.Debug.LogError(e.StackTrace);
            }
        }
Example #4
0
 public override void OnDisable()
 {
     if (m_Character != null)
     {
         MoveEditor.FXHelper fxHelper = m_Character.GetComponent <MoveEditor.FXHelper>();
         if (fxHelper != null)
         {
             fxHelper.StopAll(true);
             //if (PSPoolManager.Instance != null)
             //{
             //    PSPoolManager.Instance.Update();
             //}
         }
     }
     ErasureMonoUpdater();
 }
Example #5
0
        static StackObject *set_DisableFX_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Boolean @value = ptr_of_this_method->Value == 1;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            MoveEditor.FXHelper instance_of_this_method = (MoveEditor.FXHelper) typeof(MoveEditor.FXHelper).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.DisableFX = value;

            return(__ret);
        }
Example #6
0
        //public override void OnEnable()
        //{
        //	RegisterMonoUpdater();
        //}

        public void DestroyCharacter()
        {
            if (m_Character != null)
            {
                if (!ShouldSetMipMapBias)
                {
                    UpdateMipMapBias(m_Avatar, 0.0f);
                }

                MoveEditor.FXHelper fxHelper = m_Character.GetComponent <MoveEditor.FXHelper>();
                if (fxHelper != null)
                {
                    fxHelper.StopAll(true);
                    //if (PSPoolManager.Instance != null)
                    //{
                    //    PSPoolManager.Instance.Update();
                    //}
                }

                CharacterVariant variant = m_CharacterContainer.GetComponentInChildren <CharacterVariant>();
                if (variant != null && GameEngine.Instance != null)
                {
                    SetObjLayer(variant.CharacterInstance, GameEngine.Instance.defaultLayer);
                    variant.Recycle();
                    PoolModel.DestroyModel(variant.gameObject);
                }

                m_Character = null;
            }

            /*
             * if (!string.IsNullOrEmpty(m_VariantName))
             * {
             *  if (PoolModel != null)
             *  {
             *      PoolModel.RemoveResource(variantPath, false);
             *  }
             *
             *  m_VariantName = null;
             * }
             */
            m_Loading = false;
        }
Example #7
0
        public void DestroyHealthBar()
        {
            if (m_fxHelper != null)
            {
                m_fxHelper.m_HealthBarFXAttachment = null;
                m_fxHelper = null;
            }

            if (m_healthBar != null && m_healthBar.mDMono != null)
            {
                m_healthBar.Show(false);
                GameObject.Destroy(m_healthBar.mDMono.gameObject);
                m_healthBar          = null;
                m_healthBarTransform = null;
            }

            m_moveCtrl      = null;
            m_lastMoveState = MoveController.CombatantMoveState.kIdle;
            Hidden          = false;
        }
Example #8
0
        static StackObject *get_HeadNubTransform_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            MoveEditor.FXHelper instance_of_this_method = (MoveEditor.FXHelper) typeof(MoveEditor.FXHelper).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.HeadNubTransform;

            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Example #9
0
        static StackObject *PlayParticle_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Boolean @forcePlay = ptr_of_this_method->Value == 1;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            MoveEditor.ParticleEventProperties @properties = (MoveEditor.ParticleEventProperties) typeof(MoveEditor.ParticleEventProperties).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            MoveEditor.FXHelper instance_of_this_method = (MoveEditor.FXHelper) typeof(MoveEditor.FXHelper).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.PlayParticle(@properties, @forcePlay);

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Example #10
0
        public void SetupDataLookups()
        {
            mDL.ClearRegisteredDataIDs();
            scenetype = getSceneType();
            MoveEditor.FXHelper fx_helper = mDL.gameObject.GetComponentInChildren <MoveEditor.FXHelper>();

            if (fx_helper != null)
            {
                if (pldl == null)
                {
                    pldl = new PlayerLocationDataLookup();
                }

                pldl.UserId = userid;
                mDL.RegisterDataID(string.Format("{0}.pl.{1}", scenetype, userid));
                headBars2D = fx_helper.gameObject.GetMonoILRComponent <HeadBars2D>(false);

                if (headBars2D == null)
                {
                    headBars2D = fx_helper.gameObject.AddMonoILRComponent <HeadBars2D>("Hotfix_LT.UI.HeadBars2D");
                }

                if (nameDataLookup == null)
                {
                    nameDataLookup = new PlayerNameDataLookup();
                    nameDataLookup.SetHeadBars(headBars2D);
                }

                mDL.RegisterDataID(string.Format("{0}.pl.{1}.un", scenetype, userid));

                if (stateDataLookup == null)
                {
                    stateDataLookup = new PlayerStateDataLookup();
                    stateDataLookup.SetHeadBars(headBars2D);
                }

                mDL.RegisterDataID(string.Format("{0}.pl.{1}.state", scenetype, userid));
                mDL.RegisterDataID(string.Format("{0}.pl.{1}.promoid", scenetype, userid));
            }
        }
Example #11
0
        public void InitHealthBar()
        {
            m_fxHelper = mDMono.gameObject.GetComponent <MoveEditor.FXHelper>();

            if (m_locator == null)
            {
                m_locator = CachedTransform.Find("HealthBarTarget");
            }

            if (m_locator == null)
            {
                if (m_fxHelper != null)
                {
                    m_locator = m_fxHelper.HeadNubTransform;
                }
            }

            if (m_locator == null)
            {
                m_locator = CachedTransform;
            }

            if (m_healthBar == null)
            {
                m_healthBar = Hotfix_LT.UI.HealthBarHUDController.Instance.GetHUD();
            }

            if (m_healthBar == null)
            {
                EB.Debug.LogError("InitHealthBar: m_healthBar is null");
                return;
            }

            if (IsLeft())
            {
                m_healthBar.HpColor = Color.green;
            }
            else if (IsRight())
            {
                m_healthBar.HpColor = Color.red;
            }
            else
            {
                EB.Debug.LogError("InitHealthBar: direction error");
            }

            m_healthBar.MaxHp            = 0;
            m_healthBar.Hp               = 0;
            m_healthBar.TransitionHp     = 0;
            m_healthBar.Shield           = 0;
            m_healthBar.TransitionShield = 0;

            m_healthBarTransform = m_healthBar.mDMono.transform;

            if (m_fxHelper != null)
            {
                m_fxHelper.m_HealthBarFXAttachment = m_healthBar.buffAnchor;
            }

            m_healthBarMonotor = m_healthBar.mDMono.GetComponent <Main.Combat.UI.HealthBarHUDMonitor>();
            m_healthBarMonotor.SetLocator(m_locator);
        }
Example #12
0
        public void ChangeModel(string modelName, bool firstCreate, float scale = 1)
        {
            if (playerController == null)
            {
                EB.Debug.LogWarning("playerController is null");
                return;
            }

            if (playerController.CharacterModel != null && playerController.CharacterModel.ResourcePrefabNameMain.IndexOf(modelName) >= 0)
            {
                EB.Debug.LogWarning("ChangeModel: Aready Exist model={0}", modelName);
                return;
            }

            if (_HeadBar != null)
            {
                _HeadBar.ClearBars();
                _HeadBar = null;
            }

            try
            {
                CharacterVariant    CV = mDMono.transform.GetComponentInChildren <CharacterVariant>();
                MoveEditor.FXHelper FH = mDMono.transform.GetComponentInChildren <MoveEditor.FXHelper>();

                if (FH != null)
                {
                    FH.StopAll(true);
                }

                if (CV != null && GameEngine.Instance != null)
                {
                    SetObjLayer(CV.CharacterInstance, GameEngine.Instance.defaultLayer);
                    CV.Recycle();
                    PoolModel.DestroyModel(CV.gameObject);
                }

                if (playerController.SkinnedRigPrefab != null)
                {
                    PoolModel.DestroyModel(playerController.SkinnedRigPrefab);
                }
                ///
                playerController.Gender         = eGender.Male;
                playerController.CharacterModel = CharacterCatalog.Instance.GetModel(modelName);
                string prefabName = playerController.CharacterModel.PrefabNameFromGenderMain(playerController.Gender);
                PoolModel.GetModelAsync(prefabName, mDMono.transform.position, Quaternion.identity, (o, prm) =>
                {
                    var variantObj = o as GameObject;
                    variantObj.transform.SetParent(mDMono.transform);
                    variantObj.transform.localPosition = Vector3.zero;

                    CharacterVariant variant = variantObj.GetComponent <CharacterVariant>();
                    variant.SyncLoad         = true;
                    IDictionary partions     = GetPartitionsData(LoginManager.Instance.LocalUserId.Value);
                    variant.InstantiateCharacter(partions);
                    InitDataLookupSet();

                    playerController.SkinnedRigPrefab      = variant.CharacterInstance;
                    playerController.SkinnedRigPrefab.name = prefabName + "_Character";
                    playerController.SkinnedRigPrefab.tag  = "CharacterMesh";
                    playerController.SkinnedRigPrefab.transform.SetParent(mDMono.transform);
                    playerController.SkinnedRigPrefab.transform.localRotation = Quaternion.identity;
                    playerController.SkinnedRigPrefab.transform.localScale    = new Vector3(scale, scale, scale);
                    _combatController = mDMono.GetComponent <CombatController>();
                    _combatController.Initialize(playerController.SkinnedRigPrefab.transform, playerController.CharacterModel, 1 << LayerMask.NameToLayer("Enemy"));

                    playerController.CharacterComponent = mDMono.GetComponent <CharacterComponent>();
                    playerController.CharacterComponent.OnSpawn(playerController.CharacterModel, playerController.SkinnedRigPrefab, -1, false);

                    _HeadBar = playerController.SkinnedRigPrefab.GetMonoILRComponent <HeadBars2D>(false);
                    if (_HeadBar == null)
                    {
                        _HeadBar = playerController.SkinnedRigPrefab.AddMonoILRComponent <HeadBars2D>("Hotfix_LT.UI.HeadBars2D");
                    }

                    if (mDMono.GetComponent <Collider>() != null && mDMono.GetComponent <Collider>() is BoxCollider)
                    {
                        BoxCollider box = mDMono.GetComponent <Collider>() as BoxCollider;
                        box.size        = new Vector3(1.5f, 1.5f, 1.5f) + new Vector3(0, playerController.CharacterModel.heightOffset, 0);
                        box.center      = new Vector3(0, box.size.y / 2.0f, 0);
                    }

                    _muzzle = GameUtils.SearchHierarchyForBone(playerController.SkinnedRigPrefab.transform, "muzzle");
                    if (null == _muzzle)
                    {
                        _muzzle = mDMono.transform;
                    }

                    if (firstCreate)
                    {
                        LevelOwnerComponent.AssignLevelOwner(mDMono.gameObject); // this must be called after PlayerManager.RegisterPlayerController(this);
                    }
                    _avatar             = playerController.SkinnedRigPrefab.GetComponent <AvatarComponent>();
                    _shouldSetHideColor = !PerformanceManager.Instance.CurrentEnvironmentInfo.slowDevice;

                    if (!firstCreate)
                    {
                        PlayerDataLookupSet PDLS = playerController.SkinnedRigPrefab.transform.GetDataLookupILRComponent <PlayerDataLookupSet>();
                        if (PDLS != null)
                        {
                            PDLS.UserId = playerController.playerUid;
                        }
                    }

                    MoveController mc = playerController.SkinnedRigPrefab.GetComponent <MoveController>();
                    if (mDMono != null && mDMono.GetComponent <CharacterComponent>().State != eCampaignCharacterState.Idle)
                    {
                        mc.TransitionTo(MoveController.CombatantMoveState.kLocomotion);
                    }
                }, null);
            }
            catch (System.NullReferenceException e)
            {
                EB.Debug.LogError(e.ToString());
            }
        }