Ejemplo n.º 1
0
        /********************************************
        ****** METHODES SPECIFIQUES AU WIDGET ******
        ********************************************/


        /// <summary>
        /// base menu constructor
        /// </summary>
        public TeamSelection() : base(new Rect(0, 0, Screen.width * DIM_WIDTH, Screen.height * DIM_HEIGHT))
        {
            this.Background = BACKGROUND_COLOR;
            team_selector   = new Selector(new Rect(this.area.width * (1 - DIM_SELECTOR_WIDTH) / 2, (this.area.height - 2 * DIM_SELECTOR_HEIGHT) / 3, DIM_SELECTOR_WIDTH * this.area.width, DIM_SELECTOR_HEIGHT), (int)(DIM_SELECTOR_DROP_HEIGHT_1 * this.area.height), this);
            unit_selector   = new Selector(new Rect(this.area.width * (1 - DIM_SELECTOR_WIDTH) / 2, (this.area.height - 2 * DIM_SELECTOR_HEIGHT) * 2 / 3 + DIM_SELECTOR_HEIGHT, DIM_SELECTOR_WIDTH * this.area.width, DIM_SELECTOR_HEIGHT), (int)(DIM_SELECTOR_DROP_HEIGHT_2 * this.area.height), this);

            this.AddChild(unit_selector);
            this.AddChild(team_selector);
            team_selector.SelectItem   += OnSelectItem;
            team_selector.DeployOrTuck += OnDeployOrTuck;
            unit_selector.SelectItem   += OnSelectItem;

            XMLInterpreter interpreter = new XMLInterpreter();

            // A SUPPRIMER
            team_selector.Elements = interpreter.allTeamsInXmlFiles(Constants.teamsDirectory).ToArray();

            List <string> units = new List <string> ();

            foreach (BotType t in BotType.GetValues(typeof(BotType)))
            {
                units.Add(BotTypes.WarType(t));
            }

            unit_selector.Elements = units.ToArray();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reload this instance.
        /// </summary>
        public void Reload()
        {
            XMLInterpreter interpreter = new XMLInterpreter();

            team_selector.Elements = interpreter.allTeamsInXmlFiles(Constants.teamsDirectory).ToArray();

            List <string> units = new List <string>();

            foreach (BotType t in BotType.GetValues(typeof(BotType)))
            {
                units.Add(BotTypes.WarType(t));
            }

            unit_selector.Elements = units.ToArray();
            if (team_selector.Elements.Length > 0)
            {
                GameObject.Find("Button_Return").GetComponent <UnityEngine.UI.Button>().interactable = true;
            }
        }