예제 #1
0
 protected void OnUpdateNeedAttribute(AdditionalAttribute needAttribute)
 {
     for (int index = 0; index < needAttribute.data.Count; index++)
     {
         SetGame(NeedAttributeParent, "需要" + DataName.GetDataName(needAttribute.data[index].Type, true), needAttribute.data[index].value.ToString());
     }
     for (int index = 0; index < needAttribute.attribute.Count; index++)
     {
         SetGame(NeedAttributeParent, "需要" + DataName.GetAttributeName(needAttribute.attribute[index].Type, true), needAttribute.attribute[index].value.ToString());
     }
     for (int index = 0; index < needAttribute.resistance.Count; index++)
     {
         SetGame(NeedAttributeParent, "需要" + DataName.GetResistanceName(needAttribute.resistance[index].Type, true), needAttribute.resistance[index].value.ToString());
     }
     for (int index = 0; index < needAttribute.skill.Count; index++)
     {
         SetGame(NeedAttributeParent, "需要" + DataName.GetSkillName(needAttribute.skill[index].Type, true), needAttribute.skill[index].value.ToString());
     }
 }
        void StartAttributeStats(string parent, int keyType, GameObject prefab, int leng, ref List <AttributeStatsGame> ary)
        {
            ary.Clear();
            Transform p = transform.Find("Right/Attribute/Mask/" + parent + "/panel");

            for (int index = 0; index < leng; index++)
            {
                GameObject _game = Instantiate <GameObject>(prefab);
                _game.transform.SetParent(p, false);
                _game.transform.localScale = Vector3.one;
                AttributeStatsGame game  = new AttributeStatsGame(_game.transform, index);
                string             _name = "";
                switch (keyType)
                {
                case 1:
                    AttribueCountText = p.Find("Count/name").GetComponent <Text>();
                    SaveAttribute     = p.Find("Count/Save").GetComponent <Button>();
                    SaveAttribute.onClick.AddListener(SaveAddAttribute);
                    _name         = DataName.GetAttributeName(index, false);
                    game.BtnEvent = OnClickAttributeBtn;
                    break;

                case 2:
                    skillCountText = p.Find("Count/name").GetComponent <Text>();
                    SaveSkill      = p.Find("Count/Save").GetComponent <Button>();
                    SaveSkill.onClick.AddListener(SaveAddSkill);
                    _name         = DataName.GetSkillName(index, false);
                    game.BtnEvent = OnClickSkillBtn;
                    break;

                case 3:
                    _name = DataName.GetDataName(index, false);
                    break;

                case 4:
                    _name = DataName.GetResistanceName(index, false);
                    break;
                }
                game.SetName(_name);
                ary.Add(game);
            }
        }
예제 #3
0
        protected void OnUpdateAttributeGame(AdditionalAttribute baseAttribute)
        {
            float _atk    = 0;
            float _maxAtk = 0;

            for (int index = 0; index < baseAttribute.data.Count; index++)
            {
                if (baseAttribute.data[index].Type == (int)DataEnum.Atk)
                {
                    _atk = baseAttribute.data[index].GetValue();
                    continue;
                }
                else
                if (baseAttribute.data[index].Type == (int)DataEnum.maxAtk)
                {
                    _maxAtk = baseAttribute.data[index].GetValue();
                    continue;
                }
                SetGame(AttributeParent, DataName.GetDataName(baseAttribute.data[index].Type, true), GetAttributeString(baseAttribute.data[index].value));
            }
            if (_atk != 0 || _maxAtk != 0)
            {
                string str = string.Format("{0}-{1}", _atk, _maxAtk);
                SetGame(AttributeParent, DataName.GetDataName((int)DataEnum.Atk, true), str);
            }
            for (int index = 0; index < baseAttribute.attribute.Count; index++)
            {
                SetGame(AttributeParent, DataName.GetAttributeName(baseAttribute.attribute[index].Type, true), GetAttributeString(baseAttribute.attribute[index].value));
            }
            for (int index = 0; index < baseAttribute.resistance.Count; index++)
            {
                SetGame(AttributeParent, DataName.GetResistanceName(baseAttribute.resistance[index].Type, true), GetAttributeString(baseAttribute.resistance[index].value));
            }
            for (int index = 0; index < baseAttribute.skill.Count; index++)
            {
                SetGame(AttributeParent, DataName.GetSkillName(baseAttribute.skill[index].Type, true), GetAttributeString(baseAttribute.skill[index].value));
            }
        }