Ejemplo n.º 1
0
 public override void Init()
 {
     base.Init();
     _heroDataManager = new HeroDataManager();
     _typeList.Clear();
     _colorList.Clear();
     _gridChildList.Clear();
     _heroInfoItemDic.Clear();
 }
Ejemplo n.º 2
0
 //execute once
 private void init()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     if (!Directory.Exists(path))
     {
         Directory.CreateDirectory(path);
     }
     heroes = new Dictionary <long, Hero>();
 }
Ejemplo n.º 3
0
    // 点击进入hero 详情页面
    public void HeroDetialPanelCB()
    {
        UIHeroDragItem dragUI = GetComponent <UIHeroDragItem> ();

        if (dragUI.state == UIHeroDragItem.STATE.SCROLLVIEW)
        {
            HeroDataManager          dataHeroManager = new HeroDataManager();
            DataHero                 dataHero        = DataManager.instance.dataHeroGroup.GetHeroPrimitive(heroId);
            HeroDataManager.HeroData uiHeroData      = dataHeroManager.InitHeroData(dataHero);

            UIController.instance.CreatePanel(UICommon.UI_PANEL_HEROUPLEVEL, uiHeroData);
        }
    }
Ejemplo n.º 4
0
    private void CollectTalent()
    {
        Dictionary <AttrType, float> dictionary  = new Dictionary <AttrType, float>();
        Dictionary <AttrType, float> dictionary2 = new Dictionary <AttrType, float>();

        HeroDataManager.CellectTalentAttrs(out dictionary, out dictionary2);
        foreach (KeyValuePair <AttrType, float> current in dictionary)
        {
            base.ChangeAttr(current.Key, OpType.Add, current.Value);
        }
        foreach (KeyValuePair <AttrType, float> current2 in dictionary2)
        {
            base.ChangeAttr(current2.Key, OpType.Mul, current2.Value);
        }
    }
Ejemplo n.º 5
0
    private void GetGameItemAttr(string equips, ref Dictionary <AttrType, float> addDict, ref Dictionary <AttrType, float> mulDict)
    {
        SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(equips);

        if (dataById == null)
        {
            return;
        }
        if (addDict == null)
        {
            addDict = new Dictionary <AttrType, float>();
        }
        if (mulDict == null)
        {
            mulDict = new Dictionary <AttrType, float>();
        }
        string[] stringValue = StringUtils.GetStringValue(dataById.attribute, ',');
        for (int i = 0; i < stringValue.Length; i++)
        {
            string[] array = stringValue[i].Split(new char[]
            {
                '|'
            });
            AttrType type = (AttrType)int.Parse(array[0]);
            if (!array[1].Contains("%"))
            {
                if (dataById.rune_type == 2)
                {
                    HeroDataManager.AddToDict(ref addDict, type, float.Parse(array[1]) * (float)this.level);
                }
                else
                {
                    HeroDataManager.AddToDict(ref addDict, type, float.Parse(array[1]));
                }
            }
            else
            {
                string text = array[1].Trim();
                float  num  = float.Parse(text.Substring(0, text.Length - 1)) / 100f;
                if (dataById.rune_type == 2)
                {
                    num *= (float)this.level;
                }
                HeroDataManager.AddToDict(ref mulDict, type, num);
            }
        }
    }
Ejemplo n.º 6
0
 private void CollectEquipAttr(string equips, int magicStar, ref Dictionary <AttrType, float> addDict, ref Dictionary <AttrType, float> mulDict)
 {
     if (addDict == null || addDict.Keys.Count == 0)
     {
         addDict = new Dictionary <AttrType, float>();
     }
     if (mulDict == null || mulDict.Keys.Count == 0)
     {
         mulDict = new Dictionary <AttrType, float>();
     }
     string[] stringValue = StringUtils.GetStringValue(equips, ',');
     for (int i = 0; i < stringValue.Length; i++)
     {
         SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(stringValue[i]);
         if (dataById == null)
         {
             Debug.LogError("HeroAttr.CollectEquipAttr , equips [" + equips + "] has null id: " + stringValue[i]);
         }
         else
         {
             string[] stringValue2 = StringUtils.GetStringValue(dataById.attribute, ',');
             for (int j = 0; j < stringValue2.Length; j++)
             {
                 string[] array = stringValue2[j].Split(new char[]
                 {
                     '|'
                 });
                 AttrType type = (AttrType)int.Parse(array[0]);
                 if (!array[1].Contains("%"))
                 {
                     HeroDataManager.AddToDict(ref addDict, type, float.Parse(array[1]));
                 }
                 else
                 {
                     string text  = array[1].Trim();
                     float  value = float.Parse(text.Substring(0, text.Length - 1)) / 100f;
                     HeroDataManager.AddToDict(ref mulDict, type, value);
                 }
             }
             if (magicStar > 0)
             {
                 string[] stringValue3 = StringUtils.GetStringValue(dataById.enchant_attribute, ',');
                 for (int k = 0; k < stringValue3.Length; k++)
                 {
                     string[] array2 = stringValue3[k].Split(new char[]
                     {
                         '|'
                     });
                     AttrType type2 = (AttrType)int.Parse(array2[0]);
                     if (!array2[1].Contains("%"))
                     {
                         HeroDataManager.AddToDict(ref addDict, type2, float.Parse(array2[1]) * (float)magicStar);
                     }
                     else
                     {
                         string text2 = array2[1].Trim();
                         float  num   = float.Parse(text2.Substring(0, text2.Length - 1)) / 100f;
                         HeroDataManager.AddToDict(ref mulDict, type2, num * (float)magicStar);
                     }
                 }
             }
         }
     }
 }