示例#1
0
    // Update is called once per frame
    void Update()
    {
        mLbName.text       = (null == m_RefNpc)?"--":m_RefNpc.FullName;
        mSprSex.spriteName = (null == m_RefNpc) ? "man" : (m_RefNpc.Sex == PeSex.Male)? "man" : "woman";
        mSprSex.MakePixelPerfect();

        float cur, max;

        cur                   = AttrHpInfo.CurValue;
        max                   = AttrHpInfo.MaxValue;
        mLbHealth.text        = AttrHpInfo.GetCur_MaxStr();
        mSdHealth.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbHealthBuff.text    = AttrHpInfo.GetBuffStr();


        //cur = AttrStaminaInfo.CurValue;
        //max = AttrStaminaInfo.MaxValue;
        //mLbStamina.text = AttrStaminaInfo.GetCur_MaxStr();
        //mSdStamina.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        //mLbStaminaBuff.text = AttrStaminaInfo.GetBuffStr();

        cur                   = AttrHungerInfo.CurValue;
        max                   = AttrHungerInfo.MaxValue;
        mLbHunger.text        = AttrHungerInfo.GetCur_MaxStr();
        mSdHunger.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbHungerBuff.text    = AttrHungerInfo.GetBuffStr();


        cur                    = AttrComfortInfo.CurValue;
        max                    = AttrComfortInfo.MaxValue;
        mLbComfort.text        = AttrComfortInfo.GetCur_MaxStr();
        mSdComfort.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbComfortBuff.text    = AttrComfortInfo.GetBuffStr();

        //cur = AttrOxygenInfo.CurValue;
        //max = AttrOxygenInfo.MaxValue;
        //mLbOxygen.text = AttrOxygenInfo.GetCur_MaxStr();
        //mSdOxygen.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        //mLbOxygenBuff.text = AttrOxygenInfo.GetBuffStr();

        cur                   = AttrShieldInfo.CurValue;
        max                   = AttrShieldInfo.MaxValue;
        mLbShield.text        = AttrShieldInfo.GetCur_MaxStr();
        mSdShield.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbShieldBuff.text    = AttrShieldInfo.GetBuffStr();

        cur                   = AttrEnergyInfo.CurValue;
        max                   = AttrEnergyInfo.MaxValue;
        mLbEnergy.text        = AttrEnergyInfo.GetCur_MaxStr();
        mSdEnergy.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbEnergyBuff.text    = AttrEnergyInfo.GetBuffStr();

        cur            = AttrAtkInfo.CurValue;
        mLbAttack.text = string.Format((AttrAtkInfo.BuffValue > 0 ? AttributeInfo.GreenColFormat : AttributeInfo.YellowColFomat), cur);
        //mLbAttackBuff.text = AttrAtkInfo.GetBuffStr();

        cur             = AttrDefInfo.CurValue;
        mLbDefense.text = string.Format((AttrDefInfo.BuffValue > 0 ? AttributeInfo.GreenColFormat : AttributeInfo.YellowColFomat), cur);
        //mLbDefenseBuff.text = AttrDefInfo.GetBuffStr();
    }
    void UpdatePalyerInfo()
    {
        if (null == entityInfoCmpt)
        {
            mLbName.text = "--";
            mLbName.MakePixelPerfect();
        }
        else
        {
            mLbName.text = entityInfoCmpt.characterName.ToString();
            mLbName.MakePixelPerfect();
        }

        if (null == commonCmpt)
        {
            mSprSexFemale.spriteName = "male_icon";
            mSprSexFemale.MakePixelPerfect();
        }
        else
        {
            if (commonCmpt.sex == PeSex.Female)
            {
                mSprSexFemale.spriteName = "female_icon";
                mSprSexFemale.enabled    = true;
                mSprSexMale.enabled      = false;
            }
            else
            {
                mSprSexMale.spriteName = "male_icon";
                mSprSexFemale.enabled  = false;
                mSprSexMale.enabled    = true;
            }
        }


        float cur, max;

        cur                   = AttrHpInfo.CurValue;
        max                   = AttrHpInfo.MaxValue;
        mLbHealth.text        = AttrHpInfo.GetCur_MaxStr();
        mSdHealth.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbHealthBuff.text    = AttrHpInfo.GetBuffStr();


        cur                    = AttrStaminaInfo.CurValue;
        max                    = AttrStaminaInfo.MaxValue;
        mLbStamina.text        = AttrStaminaInfo.GetCur_MaxStr();
        mSdStamina.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbStaminaBuff.text    = AttrStaminaInfo.GetBuffStr();

        cur                   = AttrHungerInfo.CurValue;
        max                   = AttrHungerInfo.MaxValue;
        mLbHunger.text        = AttrHungerInfo.GetCur_MaxStr();
        mSdHunger.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbHungerBuff.text    = AttrHungerInfo.GetBuffStr();


        cur                    = AttrComfortInfo.CurValue;
        max                    = AttrComfortInfo.MaxValue;
        mLbComfort.text        = AttrComfortInfo.GetCur_MaxStr();
        mSdComfort.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbComfortBuff.text    = AttrComfortInfo.GetBuffStr();

        cur                   = AttrOxygenInfo.CurValue;
        max                   = AttrOxygenInfo.MaxValue;
        mLbOxygen.text        = AttrOxygenInfo.GetCur_MaxStr();
        mSdOxygen.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbOxygenBuff.text    = AttrOxygenInfo.GetBuffStr();

        cur                   = AttrShieldInfo.CurValue;
        max                   = AttrShieldInfo.MaxValue;
        mLbShield.text        = AttrShieldInfo.GetCur_MaxStr();
        mSdShield.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbShieldBuff.text    = AttrShieldInfo.GetBuffStr();

        cur                   = AttrEnergyInfo.CurValue;
        max                   = AttrEnergyInfo.MaxValue;
        mLbEnergy.text        = AttrEnergyInfo.GetCur_MaxStr();
        mSdEnergy.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbEnergyBuff.text    = AttrEnergyInfo.GetBuffStr();

        cur            = AttrAtkInfo.CurValue;
        mLbAttack.text = string.Format((AttrAtkInfo.BuffValue > 0 ? AttributeInfo.GreenColFormat : AttributeInfo.YellowColFomat), cur);
        //mLbAttackBuff.text = AttrAtkInfo.GetBuffStr();

        cur             = AttrDefInfo.CurValue;
        mLbDefense.text = string.Format((AttrDefInfo.BuffValue > 0 ? AttributeInfo.GreenColFormat : AttributeInfo.YellowColFomat), cur);
        //mLbDefenseBuff.text = AttrDefInfo.GetBuffStr();
    }
示例#3
0
    void Update()
    {
        if (null == entityInfoCmpt)
        {
            mLbName.text = "--";
            mLbName.MakePixelPerfect();
        }
        else
        {
            mLbName.text = entityInfoCmpt.characterName.fullName;
            mLbName.MakePixelPerfect();
        }

        if (null == commonCmpt)
        {
            mSprSex.spriteName = "man";
            mSprSex.MakePixelPerfect();
        }
        else
        {
            mSprSex.spriteName = commonCmpt.sex == PeSex.Male ? "man" : "woman";
            mSprSex.MakePixelPerfect();
        }

        float cur, max;

        cur                   = AttrHpInfo.CurValue;
        max                   = AttrHpInfo.MaxValue;
        mLbHealth.text        = AttrHpInfo.GetCur_MaxStr();
        mSdHealth.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbHealthBuff.text    = AttrHpInfo.GetBuffStr();

        //lz-2016.11.1 npc不消耗体力和氧气,去除显示
        //cur = AttrStaminaInfo.CurValue;
        //max = AttrStaminaInfo.MaxValue;
        //mLbStamina.text = AttrStaminaInfo.GetCur_MaxStr();
        //mSdStamina.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        //mLbStaminaBuff.text = AttrStaminaInfo.GetBuffStr();

        cur                   = AttrHungerInfo.CurValue;
        max                   = AttrHungerInfo.MaxValue;
        mLbHunger.text        = AttrHungerInfo.GetCur_MaxStr();
        mSdHunger.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbHungerBuff.text    = AttrHungerInfo.GetBuffStr();


        cur                    = AttrComfortInfo.CurValue;
        max                    = AttrComfortInfo.MaxValue;
        mLbComfort.text        = AttrComfortInfo.GetCur_MaxStr();
        mSdComfort.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbComfortBuff.text    = AttrComfortInfo.GetBuffStr();

        //cur = AttrOxygenInfo.CurValue;
        //max = AttrOxygenInfo.MaxValue;
        //mLbOxygen.text = AttrOxygenInfo.GetCur_MaxStr();
        //mSdOxygen.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        //mLbOxygenBuff.text = AttrOxygenInfo.GetBuffStr();

        cur                   = AttrShieldInfo.CurValue;
        max                   = AttrShieldInfo.MaxValue;
        mLbShield.text        = AttrShieldInfo.GetCur_MaxStr();
        mSdShield.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbShieldBuff.text    = AttrShieldInfo.GetBuffStr();

        cur                   = AttrEnergyInfo.CurValue;
        max                   = AttrEnergyInfo.MaxValue;
        mLbEnergy.text        = AttrEnergyInfo.GetCur_MaxStr();
        mSdEnergy.sliderValue = (max <= 0) ? 0 : Convert.ToSingle(cur) / max;
        mLbEnergyBuff.text    = AttrEnergyInfo.GetBuffStr();

        cur            = AttrAtkInfo.CurValue;
        mLbAttack.text = string.Format((AttrAtkInfo.BuffValue > 0 ? AttributeInfo.GreenColFormat : AttributeInfo.YellowColFomat), cur);
        //mLbAttackBuff.text = AttrAtkInfo.GetBuffStr();

        cur             = AttrDefInfo.CurValue;
        mLbDefense.text = string.Format((AttrDefInfo.BuffValue > 0 ? AttributeInfo.GreenColFormat : AttributeInfo.YellowColFomat), cur);
        //mLbDefenseBuff.text = AttrDefInfo.GetBuffStr();

        this.UpdateOpBtnState();

        mSprSex.enabled = !(servant == null);

        if (packageCmpt != null)
        {
            mLbPrivatePageText.text = mPageIndex.ToString() + " / " + mMaxPageIndex.ToString();
            mLbMoney.text           = packageCmpt.money.current.ToString();
        }
        else
        {
            mLbPrivatePageText.text = "0 / 0";
            mLbMoney.text           = "--";
        }
        mLbNextServant.text = ((int)mCurrentIndex + 1).ToString() + "/" + ((int)ServantIndex.Max).ToString();

        ShowBattle();
    }