Example #1
0
        //void OnGUI()
        //{
        //    GUILayout.Label(CurrentHP.ToString());
        //}

        public void SetHeroStatus()//此处设置主角显示的所有状态
        {
            RollStrengthTrough.UpdateMaxValue();
            PlayerValue = PlayerManager.Instance.FindHeroDataModel().PlayerValues;
            UnityValue  = PlayerManager.Instance.FindHeroDataModel().UnitValues;
            //TraceUtil.Log("获取玩家职业:" + PlayerValue.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION);
            //TraceUtil.Log("获取玩家HP:" + UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP);
            //TraceUtil.Log(string.Format("获取玩家MP:{0}/{1}" , UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP,UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXHP));
            //if (CurrentVocation != PlayerValue.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION)
            //{
            //    HeadIcon.ChangeSprite(PlayerValue.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION);
            //    CurrentVocation = PlayerValue.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION;
            //}
            if (LevelNum != null)
            {
                this.LevelNum.text = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_LEVEL.ToString();
            }
            //if (CurrentHP != UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP)
            //{

            m_TweenHP = TweenFloat.Begin(1, CurrentHP, UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP, ChangeHp);
            CurrentHP = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP;
            if (GO_HP != null)
            {
                float MaxHp   = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXHP;
                float hpValue = CurrentHP / MaxHp;
                GO_HP.transform.localScale = new Vector3(m_HPScale.x * hpValue, m_HPScale.y, m_HPScale.z);
                //GO_HP.transform.localScale = Vector3.one;
            }

            //}
            //if (CurrentMP != UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURMP)
            //{


            m_TweenMP = TweenFloat.Begin(1, CurrentMP, UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURMP, ChangeMP);
            CurrentMP = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURMP;
            if (GO_MP != null)
            {
                float MaxMP   = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXMP;
                float mpValue = CurrentMP / MaxMP;
                GO_MP.transform.localScale = new Vector3(m_MPScale.x * mpValue, m_MPScale.y, m_MPScale.z);
            }
            //}
            //if (CurrentEXP != PlayerValue.PLAYER_FIELD_EXP)
            //{
            if (this.EXP != null)
            {
                m_TweenEXP = TweenFloat.Begin(1, CurrentEXP, PlayerValue.PLAYER_FIELD_EXP, ChangeEXP);
                CurrentEXP = PlayerValue.PLAYER_FIELD_EXP;
            }
            //}
            //this.HP.sliderValue = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP/UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXHP;
            //this.MP.sliderValue = UnityValue.sMsgPropCreateEntity_SC_UnitInvisibleValue.UNIT_FIELD_CURMP/UnityValue.sMsgPropCreateEntity_SC_UnitInvisibleValue.UNIT_FIELD_MAXMP;
            //this.EXP.sliderValue = PlayerValue.PLAYER_FIELD_EXP/PlayerValue.PLAYER_FIELD_NEXT_LEVEL_EXP;
        }
Example #2
0
 public void UpdateValue(short index, int value)
 {
     #region UpdateValueSwitch
     int baseValueIndex = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_BaseValue>() / 4;
     int unitValueIndex = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_Player_UnitValue>() / 4;
     if (index < baseValueIndex)           //SMsgPropCreateEntity_SC_BaseValue
     {
         this.BaseObjectValues = this.BaseObjectValues.SetValue(index, value);
     }
     else if (index < baseValueIndex + unitValueIndex)        //SMsgPropCreateEntity_SC_Player_UnitValue
     {
         this.UnitValues = this.UnitValues.SetValue(index - baseValueIndex, value);
     }
     else    //SMsgPropCreateEntity_SC_MainPlayer_PlayerValue
     {
         this.PlayerValues = this.PlayerValues.SetValue(index - baseValueIndex - unitValueIndex, value);
     }
     #endregion
 }
Example #3
0
        //void OnGUI()
        //{
        //    GUILayout.Label(CurrentHP.ToString());
        //}

        public void SetHeroStatus()//此处设置主角显示的所有状态
        {
            var pvpPlayerData  = PVPBattleManager.Instance.GetPVPPlayerData();
            var pvpEntityModel = PlayerManager.Instance.GetEntityMode(pvpPlayerData.uidEntity);

            if (pvpEntityModel == null)
            {
                TraceUtil.Log("find pvpEntityModel is null!");
                return;
            }
            PlayerValue = ((SMsgPropCreateEntity_SC_OtherPlayer)pvpEntityModel.EntityDataStruct).PlayerValues;
            UnityValue  = ((SMsgPropCreateEntity_SC_OtherPlayer)pvpEntityModel.EntityDataStruct).UnitValues;

            //TraceUtil.Log("获取玩家职业:" + PlayerValue.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION);
            //TraceUtil.Log("获取玩家HP:" + UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP);
            //TraceUtil.Log("获取玩家MP:" + UnityValue.sMsgPropCreateEntity_SC_UnitInvisibleValue.UNIT_FIELD_CURMP);
            if (CurrentVocation != PlayerValue.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION)
            {
                HeadIcon.ChangeSprite(PlayerValue.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION);
                CurrentVocation = PlayerValue.PlayerCommonValue.PLAYER_FIELD_VISIBLE_VOCATION;
            }
            //等级
            //this.LevelNum.text = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_LEVEL.ToString();
            if (CurrentHP != UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP)
            {
                TweenFloat.Begin(1, CurrentHP, UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP, ChangeHp);
                CurrentHP = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP;
            }
            //TraceUtil.Log(SystemModel.Common,TraceLevel.Error,"CurrentMP : " + CurrentMP + " , UNIT_FIELD_CURMP" + UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURMP);
            if (CurrentMP != UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURMP)
            {
                TweenFloat.Begin(1, CurrentMP, UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURMP, ChangeMP);
                CurrentMP = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURMP;
            }
            //if (CurrentEXP != PlayerValue.PLAYER_FIELD_EXP)
            //{
            //    TweenFloat.Begin(1, CurrentEXP, PlayerValue.PLAYER_FIELD_EXP, ChangeEXP);
            //    CurrentEXP = PlayerValue.PLAYER_FIELD_EXP;
            //}
            //this.HP.sliderValue = UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP/UnityValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXHP;
            //this.MP.sliderValue = UnityValue.sMsgPropCreateEntity_SC_UnitInvisibleValue.UNIT_FIELD_CURMP/UnityValue.sMsgPropCreateEntity_SC_UnitInvisibleValue.UNIT_FIELD_MAXMP;
            //this.EXP.sliderValue = PlayerValue.PLAYER_FIELD_EXP/PlayerValue.PLAYER_FIELD_NEXT_LEVEL_EXP;
        }
Example #4
0
        void UpdateHeroStatus()//此处设置主角显示的所有状态
        {
            m_playerValue = PlayerManager.Instance.FindHeroDataModel().PlayerValues;
            m_unitValue   = PlayerManager.Instance.FindHeroDataModel().UnitValues;

            //float MaxHp = m_unitValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXHP;
            //if (MaxHp > m_hpShort)
            //{
            //    BloodProgressBar.transform.localScale = Vector3.one;
            //}
            //else
            //{
            //    BloodProgressBar.transform.localScale = Vector3.one;
            //}
            //float MaxMP = m_unitValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXMP;
            //if (MaxMP > m_spShort)
            //    ManaProgressBar.transform.localScale = Vector3.one;
            //else
            //    ManaProgressBar.transform.localScale = Vector3.one;
            int newBlood = m_unitValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURHP;

            if (m_curBloodValue != newBlood)
            {
                m_TweenHP = TweenFloat.Begin(1, m_curBloodValue, newBlood, ChangeHp);
                float MaxHP = m_unitValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXHP;
                //BloodProgressBar.sliderValue = newBlood / MaxHP;
                UI_BloodProgress.fillAmount = newBlood / MaxHP;
                m_curBloodValue             = newBlood;
            }

            int newMp = m_unitValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_CURMP;

            if (m_curManaValue != newMp)
            {
                //Debug.LogWarning("角色耗蓝量刷新:"+m_curManaValue+"=>"+newMp);
                m_TweenMP = TweenFloat.Begin(1, m_curManaValue, newMp, ChangeMP);
                float MaxMP = m_unitValue.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_MAXMP;
                //ManaProgressBar.sliderValue = newMp / MaxMP;
                UI_ManaProgress.fillAmount = newMp / MaxMP;
                m_curManaValue             = newMp;
            }

            /* 去掉能量值
             * float gasValue = (float)m_playerValue.PLAYER_FIELD_ENERGY_NUM / (float)m_playerValue.PLAYER_FIELD_MAX_ENERGY_NUM;
             *
             * if (m_curGasValue != gasValue)
             * {
             * float beginFloat = 0.32f;
             * float endFloat = 0.85f;
             * gasValue = gasValue * (endFloat - beginFloat) + beginFloat;  //转换成UI数据
             *
             * CancelInvoke("AirSlotAnim");
             * if (gasValue <= beginFloat)
             * {
             * if (m_airSlotFullEffect != null)
             * {
             * DestroyImmediate(m_airSlotFullEffect);
             * }
             * InvokeRepeating("AirSlotAnim", 0f, 0.1f);
             * }
             * else
             * {
             * TweenFloat.Begin(0.3f, GasSlotProgressBar.fillAmount, gasValue, ChangeGas);
             * }
             * if (gasValue >= endFloat)
             * {
             * if (m_airSlotFullEffect == null)
             * {
             *                      m_airSlotFullEffect = CreatObjectToNGUI.InstantiateObj(GasSlotFullEffect, GasSlotFullEffectPos);
             * //m_airSlotFullEffect.transform.localPosition = new Vector3(75, -145, -30);
             * }
             * }
             * m_curGasValue = gasValue;
             * }
             */
            PlayerGasSlotManager.Instance.UpdateRollStrength(m_playerValue.PLAYER_FIELD_ENERGY_NUM);
        }