Exemplo n.º 1
0
    void readTowerPassive()
    {
        TowerPassiveInfo = new Dictionary <string, TowerPassiveData>();

        TextAsset textAsset = (TextAsset)Resources.Load(GameConfig.DatabasePathTowerPassiveInfo);

        string[] temp = textAsset.text.Split('\n');

        int lenght = temp.Length;

        for (int i = 1; i < lenght - 1; i++)
        {
            if (temp[i].Equals(""))
            {
                break;
            }

            TowerPassiveData data = new TowerPassiveData();
            string[]         s    = temp[i].Split(';');

            data.Type     = s[1].Replace('\"', ' ').ToString().Trim();
            data.Level    = int.Parse(s[2].ToString());
            data.Describe = s[4].Replace('\"', ' ').ToString().Trim();

            data.Cost       = int.Parse(s[5].ToString());
            data.Value      = int.Parse(s[6].ToString());
            data.UpdateTime = float.Parse(s[7].ToString());

            data.TimeBuild = float.Parse(s[8].ToString());

            data.Branch = s[9].Replace('\"', ' ').ToString().Trim();
            TowerPassiveInfo.Add(data.Type + data.Level.ToString(), data);
        }
    }
Exemplo n.º 2
0
    void getTowerPassiveDatabase()
    {
        int length = TowersPassive.Length;

        for (int i = 0; i < length; i++)
        {
            TowerPassiveController tower = TowersPassive[i].GetComponent <TowerPassiveController>();
            TowerPassiveController tower2;
            while (true)
            {
                if (ReadDatabase.Instance.TowerPassiveInfo.ContainsKey(tower.ID.Type.ToString() + tower.ID.Level.ToString()))
                {
                    TowerPassiveData data = ReadDatabase.Instance.TowerPassiveInfo[tower.ID.Type.ToString() + tower.ID.Level.ToString()];
                    tower.passiveAttribute.Cost       = data.Cost;
                    tower.passiveAttribute.UpdateTime = data.UpdateTime;

                    tower.passiveAttribute.Value     = data.Value;
                    tower.passiveAttribute.TimeBuild = data.TimeBuild;
                    tower.passiveAttribute.Describe  = data.Describe;
                    switch (data.Type)
                    {
                    case "IRON":
                        tower.Branch = EBranchGame.IRON;
                        break;

                    case "PLANT":
                        tower.Branch = EBranchGame.PLANT;
                        break;

                    case "ICE":
                        tower.Branch = EBranchGame.ICE;
                        break;

                    case "FIRE":
                        tower.Branch = EBranchGame.FIRE;
                        break;

                    case "EARTH":
                        tower.Branch = EBranchGame.EARTH;
                        break;
                    }
                }

                if (tower.nextLevel)
                {
                    tower2 = (TowerPassiveController)tower.nextLevel;
                    tower  = tower2;
                }
                else
                {
                    break;
                }
            }
        }
    }
Exemplo n.º 3
0
    void readTowerPassive()
    {
        TowerPassiveInfo = new Dictionary<string, TowerPassiveData>();

        TextAsset textAsset = (TextAsset)Resources.Load(GameConfig.DatabasePathTowerPassiveInfo);
        string[] temp = textAsset.text.Split('\n');

        int lenght = temp.Length;
        for (int i = 1; i < lenght - 1; i++)
        {
            if (temp[i].Equals(""))
                break;

            TowerPassiveData data = new TowerPassiveData();
            string[] s = temp[i].Split(';');

            data.Type = s[1].Replace('\"', ' ').ToString().Trim();
            data.Level = int.Parse(s[2].ToString());
            data.Describe = s[4].Replace('\"', ' ').ToString().Trim();

            data.Cost = int.Parse(s[5].ToString());
            data.Value = int.Parse(s[6].ToString());
            data.UpdateTime = float.Parse(s[7].ToString());

            data.TimeBuild = float.Parse(s[8].ToString());

            data.Branch = s[9].Replace('\"', ' ').ToString().Trim();
            TowerPassiveInfo.Add(data.Type + data.Level.ToString(), data);
        }
    }