Example #1
0
    private void InitFactory()
    {
        InscriptionPage a = InscriptionPageFactory.Instance.GetInscriptionPageById(1);

        if (a == null)
        {
            Debug.Log(2313);
        }
        a.CalculatedAttribute();
        Debug.Log(a.inscriptionAttribute.Count);
        foreach (KeyValuePair <int, InscriptionAttribute> item in a.inscriptionAttribute)
        {
            Debug.Log(item.Value.attributeName + ":" + item.Value.attribueValue.ToString());
        }
    }
        /// <summary>
        /// SendMessage函数的接受体
        /// </summary>
        /// <param name="inscriptionPage"></param>
        public void OnReciveFromInscriptionPage(InscriptionPage inscriptionPage)
        {
            inscriptionPage.CalculatedAttribute();
            levelText.text = inscriptionPage.CalculatedInscriptionLevel().ToString();
            SortedDictionary <int, InscriptionAttribute> attributeList = inscriptionPage.inscriptionAttribute;

            attributeText.text = "";
            foreach (KeyValuePair <int, InscriptionAttribute> item in attributeList)
            {
                if (item.Value.valueType == AttributeValue.NUMBER)
                {
                    string valuestring = (System.Math.Round(item.Value.attribueValue, 1).ToString());
                    attributeText.text += (item.Value.attributeName + ":" + valuestring);
                }
                else
                {
                    string valuestring = (System.Math.Round(item.Value.attribueValue * 100, 1)).ToString() + "%";
                    attributeText.text += (item.Value.attributeName + ":" + valuestring);
                }
                attributeText.text += "\n";
            }
        }
Example #3
0
        /// <summary>
        /// 将符文属性加到英雄的战斗属性中
        /// </summary>
        /// <param name="inscriptionPage"></param>
        private void InitInscriptionAttibute(InscriptionPage inscriptionPage)
        {
            inscriptionPage.CalculatedAttribute();
            foreach (KeyValuePair <int, InscriptionAttribute> item in inscriptionPage.inscriptionAttribute)
            {
                switch ((BatteryAttributeType)item.Key)
                {
                case BatteryAttributeType.MEGIC_ATTACK:
                    baseAttibute.magicAttack += item.Value._attributeValue;
                    break;

                case BatteryAttributeType.ATTACK_SPEED:
                    attackAttibute.cttackSpeed += item.Value._attributeValue;
                    break;

                case BatteryAttributeType.COOL_REDUCE:
                    attackAttibute.coolReduce += item.Value._attributeValue;
                    break;

                case BatteryAttributeType.CRITICAL_CHANGE:
                    attackAttibute.criticalChance += item.Value._attributeValue;
                    break;

                case BatteryAttributeType.CRITICAL_EFFECT:
                    attackAttibute.criticalEffect += item.Value._attributeValue;
                    break;

                case BatteryAttributeType.MAX_BLUE:
                    baseAttibute.baseLife += item.Value._attributeValue;
                    break;

                case BatteryAttributeType.MAX_LIFE:
                    baseAttibute.baseMagic += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.MEGIC_DEFENCE:
                    baseAttibute.magicDefense += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.MEGIC_THROUGH:
                    attackAttibute.magicPenetration += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.MEGIC_VAMPIRE:
                    attackAttibute.magicHemophagia += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.MOVE_SPEED:
                    attackAttibute.moveSpeed += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.PHYSIC_ATTACK:
                    baseAttibute.physicalAttack += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.PHYSIC_DEFENCE:
                    baseAttibute.physicalDefense += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.PHYSIC_THROUGH:
                    attackAttibute.physicalPenetration += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.PHYSIC_VANPIRE:
                    attackAttibute.chysicalHemophagia += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.RECOVE_BLOOD:
                    attackAttibute.coolReduce += item.Value.attribueValue;
                    break;

                case BatteryAttributeType.RECOVE_BLUE:
                    defenseAttibute.recoveMagic += item.Value.attribueValue;
                    break;
                }
            }
        }