Ejemplo n.º 1
0
    public TranslationsController()
    {
        if (instance != null)
        {
            return;
        }

        instance         = this;
        textTranslations = new Dictionary <string, string> ();

        var text = (ResourcesController.LoadOnce("Translations") as TextAsset).text;

        var splitted = text.Split('☻');

        var languages = splitted [0].Split('☺');

        string [] currentList;

        for (int i = 1; i < splitted.Length; i++)
        {
            currentList = splitted [i].Split('☺');

            if (currentList.Length < languages.Length)
            {
                continue;
            }

            for (int q = 0; q < languages.Length; q++)
            {
                textTranslations.Add(currentList [0] + "_" + languages [q], currentList [q + 1]);
            }
        }
    }
Ejemplo n.º 2
0
    public LanguageController()
    {
        if (instance != null)
        {
            return;
        }

        instance = this;

        languages             = new List <string> ();
        languagesSelfNames    = new List <string> ();
        languageLetters       = new List <List <char> > ();
        languageLetterChances = new List <List <int> > ();
        languageGameLetters   = new List <List <string> > ();
        languageFontLetters   = new List <string> ();

        var init = (ResourcesController.LoadOnce("Languages") as TextAsset).text.Split('\n');

        for (int i = 0; i + 4 < init.Length; i += 5)
        {
            var languageNames = init [i + 0].Split(' ');

            languages.Add(languageNames [0]);
            languagesSelfNames.Add(languageNames [0]);

            var         letters       = init [i + 1].Split(' ');
            List <char> resultLetters = new List <char> ();

            for (int q = 0; q < letters.Length; q++)
            {
                resultLetters.Add(letters [q] [0]);
            }

            languageLetters.Add(resultLetters);

            var        chances       = init [i + 2].Split(' ');
            List <int> resultChances = new List <int> ();

            for (int q = 0; q < chances.Length; q++)
            {
                resultChances.Add(int.Parse(chances [q]));
            }

            languageLetterChances.Add(resultChances);

            var gameLetters = init [i + 3].Split(' ');

            //Debug.Log (gameLetters [gameLetters.Length - 1]);

            languageGameLetters.Add(new List <string> (gameLetters));

            languageFontLetters.Add(init [i + 4]);
        }

        if (languages.Count == 0)
        {
            Debug.LogError("No languages");
        }
    }
Ejemplo n.º 3
0
    public TowersSettings()
    {
        instance = this;

        attackPosition     = new Dictionary <string, Vector2> ();
        towerPlacePosition = new Dictionary <string, Vector2> ();
        buffs       = new Dictionary <string, List <string> > ();
        upgrades    = new Dictionary <string, List <string> > ();
        startTowers = new List <string> ();

        var text   = (ResourcesController.LoadOnce("Towers") as TextAsset).text;
        var towers = text.Split('\n');

        foreach (var s in towers)
        {
            if (s == "")
            {
                continue;
            }

            var res = s.Split('|');

            var name = res [0];

            if (name == "")
            {
                continue;
            }

            var ups = res [1].Split('☺');

            upgrades.Add(name, new List <string> ());

            for (int i = 1; i < ups.Length; i++)
            {
                upgrades [name].Add(ups [i]);
            }

            var bfs = res [2].Split('☺');

            buffs.Add(name, new List <string> ());

            for (int i = 1; i < bfs.Length; i++)
            {
                buffs [name].Add(bfs [i]);
            }

            if (res [3] == "True")
            {
                startTowers.Add(name);
            }

            attackPosition.Add(name, new Vector2(float.Parse(res [4].Split('☺') [0]), float.Parse(res [4].Split('☺') [1])));
            towerPlacePosition.Add(name, new Vector2(float.Parse(res [5].Split('☺') [0]), float.Parse(res [5].Split('☺') [1])));
        }
    }
Ejemplo n.º 4
0
    public UnitsSettings()
    {
        instance = this;

        shadowPosition    = new Dictionary <string, Vector2> ();
        healthBarPosition = new Dictionary <string, Vector2> ();
        buffs             = new Dictionary <string, List <string> > ();

        var text  = (ResourcesController.LoadOnce("Units") as TextAsset).text;
        var units = text.Split('\n');

        foreach (var s in units)
        {
            if (s == "")
            {
                continue;
            }

            var res = s.Split('|');

            var name = res [0];

            var bfs = res [1].Split('☺');

            if (!buffs.ContainsKey(name))
            {
                buffs.Add(name, new List <string> ());
            }

            for (int i = 1; i < bfs.Length; i++)
            {
                buffs [name].Add(bfs [i]);
            }
            if (!shadowPosition.ContainsKey(name))
            {
                shadowPosition.Add(name, new Vector2(float.Parse(res [2].Split('☺') [0]), float.Parse(res [2].Split('☺') [1])));
            }

            if (!healthBarPosition.ContainsKey(name))
            {
                healthBarPosition.Add(name, new Vector2(float.Parse(res [3].Split('☺') [0]), float.Parse(res [3].Split('☺') [1])));
            }
        }
    }