コード例 #1
0
        private void OnSelfAttribute(KProtoBuf buf)
        {
            S2C_SYNC_SELF_ATTRIBUTE respond = buf as S2C_SYNC_SELF_ATTRIBUTE;
            KAttributeType          eType   = (KAttributeType)respond.AttributeType;
            int nValue = respond.AttributeValue;

            MajorPlayer majorPlayer = PlayerManager.GetInstance().MajorPlayer;

            majorPlayer.HeroData[eType] = nValue;

            switch (eType)
            {
            case KAttributeType.atMaxHP:
                MainHero.property.maxHp = nValue;
                break;

            case KAttributeType.atMaxMP:
                MainHero.property.maxMp = nValue;
                break;

            case KAttributeType.atMoveSpeed:
                MainHero.DispatchEvent(ControllerCommand.SET_SPEED, nValue);
                break;
            }
        }
コード例 #2
0
        public void SetEquipInfo(EquipInfo itemInfo)
        {
            equipIndex           = itemInfo.typeId;
            equipStrengthenLevel = itemInfo.CurStrengthenLv;
            equipBagPos          = itemInfo.Position;
            equipLoadPos         = itemInfo.PutWhere;
            attributeType        = KAttributeType.atInvalid;
            attributeValue       = 0;
            extValue             = 0;
            capacityValue        = 0;

            string           dataKey   = equipIndex.ToString() + "_" + equipStrengthenLevel.ToString();
            KEquipStrengthen equipData = KConfigFileManager.GetInstance().equipStrengthenTab.getData(dataKey);

            if (equipData != null)
            {
                foreach (KeyValuePair <KAttributeType, int> tempData in equipData.AttributeDict)
                {
                    attributeType  = tempData.Key;
                    attributeValue = tempData.Value;
                    break;
                }
                capacityValue = Util.GetFightCalculate(equipData.AttributeDict);
            }
            UpdateEquipInfo();
        }
コード例 #3
0
        private void OnOneAttribute(KProtoBuf buf)
        {
            S2C_SYNC_ONE_ATTRIBUTE respond = buf as S2C_SYNC_ONE_ATTRIBUTE;
            KAttributeType         eType   = (KAttributeType)respond.AttributeType;
            int         nValue             = respond.AttributeValue;
            SceneEntity hero = GetSceneObject(respond.HeroID);

            if (hero.property.Id == MainHero.property.Id)
            {
                MajorPlayer majorPlayer = PlayerManager.GetInstance().MajorPlayer;
                majorPlayer.HeroData[eType] = nValue;
            }

            switch (eType)
            {
            case KAttributeType.atMaxHP:
                hero.property.maxHp = nValue;
                break;

            case KAttributeType.atMaxMP:
                hero.property.maxMp = nValue;
                break;

            case KAttributeType.atMoveSpeed:
                hero.DispatchEvent(ControllerCommand.SET_SPEED, nValue);
                break;
            }
        }
コード例 #4
0
        public static string GetAttributeText(KAttributeType attributeType)
        {
            string retString = atttibuteToText[attributeType];

            if (retString == null)
            {
                retString = "未知";
            }
            return(retString);
        }
コード例 #5
0
 public int this[KAttributeType eType]
 {
     get
     {
         if (!dictAttributeValue.ContainsKey(eType))
         {
             return(0);
         }
         return(dictAttributeValue[eType]);
     }
     set
     {
         dictAttributeValue[eType] = value;
     }
 }
コード例 #6
0
        public Dictionary <KAttributeType, int> SplitValue(string attributeStr)
        {
            Dictionary <KAttributeType, int> dict = new Dictionary <KAttributeType, int>();

            string[] propertyDoc = attributeStr.Split('|');
            foreach (string str in propertyDoc)
            {
                string[] propertyNode = str.Split(':');
                if (propertyNode.Length > 1)
                {
                    string         propertyName  = propertyNode[0].ToString();
                    int            propertyValue = int.Parse(propertyNode[1]);
                    KAttributeType tempType      = (KAttributeType)Enum.Parse(typeof(KAttributeType), propertyName);
                    dict[tempType] = propertyValue;
                }
                else
                {
                    throw new Exception("strengthen.tab属性内容编辑错误");
                }
            }
            return(dict);
        }
コード例 #7
0
        public static int GetFightCalculate(Dictionary <KAttributeType, int> attributeDict)
        {
            int   ret             = 0;
            float fAttack         = 0;
            float fDefence        = 0;
            float fMaxHP          = 0;
            float fMaxMP          = 0;
            float fReflex         = 0;
            float fCrit           = 0;
            float fCritHurt       = 0;
            float fReduceCritHurt = 0;
            float fHpRecover      = 0;
            float fMpRecover      = 0;
            float fAttackSpeed    = 0;
            float fReduceDamage   = 0;
            float fDamageMore     = 0;
            float fDamageLess     = 0;
            float fExtDamage      = 0;
            float fReduceDefence  = 0;
            float fReduceCrit     = 0;
            float fMiss           = 0;
            float fUpAttack       = 0;
            float fAttackRecover  = 0;
            float fDamageBack     = 0;

            foreach (KeyValuePair <KAttributeType, int> tempData in attributeDict)
            {
                KAttributeType tempKey   = tempData.Key;
                float          tempValue = (float)tempData.Value;
                switch (tempKey)
                {
                case KAttributeType.atMaxHP:
                    fMaxHP = tempValue;
                    break;

                case KAttributeType.atMaxMP:
                    fMaxMP = tempValue;
                    break;

                case KAttributeType.atAttack:
                    fAttack = tempValue;
                    break;

                case KAttributeType.atDefence:
                    fDefence = tempValue;
                    break;

                case KAttributeType.atReflex:
                    fReflex = tempValue;
                    break;

                case KAttributeType.atCrit:
                    fCrit = tempValue;
                    break;

                case KAttributeType.atCritHurt:
                    fCritHurt = tempValue;
                    break;

                case KAttributeType.atReduceCrit:
                    fReduceCrit = tempValue;
                    break;

                case KAttributeType.atReduceCritHurt:
                    fReduceCritHurt = tempValue;
                    break;

                case KAttributeType.atHpRecover:
                    fHpRecover = tempValue;
                    break;

                case KAttributeType.atMpRecover:
                    fMpRecover = tempValue;
                    break;

                case KAttributeType.atAttackSpeed:
                    fAttackSpeed = tempValue;
                    break;

                case KAttributeType.atReduceDamage:
                    fReduceDamage = tempValue;
                    break;

                case KAttributeType.atReduceDefence:
                    fReduceDefence = tempValue;
                    break;

                case KAttributeType.atMiss:
                    fMiss = tempValue;
                    break;

                case KAttributeType.atDamageMore:
                    fDamageMore = tempValue;
                    break;

                case KAttributeType.atDamageLess:
                    fDamageLess = tempValue;
                    break;

                case KAttributeType.atDamageBack:
                    fDamageBack = tempValue;
                    break;

                case KAttributeType.atAttackRecover:
                    fAttackRecover = tempValue;
                    break;

                case KAttributeType.atExtDamage:
                    fExtDamage = tempValue;
                    break;

                case KAttributeType.atUpAttack:
                    fUpAttack = tempValue;
                    break;
                }
            }

            ret = (int)(fAttack
                        + fDefence
                        + (fMaxHP * 0.13)
                        + (fMaxMP * 0.1)
                        + (fReflex * 0.2)
                        + (fCrit * 0.4)
                        + (fCritHurt * 0.45)
                        + (fReduceCritHurt * 0.45)
                        + (fHpRecover * 1.5)
                        + (fMpRecover * 2)
                        + (fAttackSpeed * 120)
                        + (fReduceDamage * 100)
                        + (fDamageMore * 1.2)
                        + (fDamageLess * 1.2)
                        + (fExtDamage * 1.1)
                        + (fReduceDefence * 50)
                        + (fReduceCrit * 0.9)
                        + (fMiss * 0.4)
                        + (fUpAttack * 0.6)
                        + (fAttackRecover * 75)
                        + (fDamageBack * 75));

            return(ret);
        }