예제 #1
0
        /****************************
        ****** APPELS D'UNITY ******
        ****************************/


        /// <summary>
        /// Appelée à l'initialisation du GameObject
        /// </summary>
        void Start()
        {
            MainLayout.actual    = this;
            mouse_position       = new Vector2();
            widgets              = new List <Widget> ();
            this.upper_container = new Container(new Rect(0, 0, Screen.width, Screen.height));

            this.teamSelection        = new TeamSelection();
            this.editor               = new BehaviorEditor(this.teamSelection.Team_selector.Selection, this.teamSelection.Unit_selector.Selection);
            this.primitivesCollection = new PrimitivesCollection(this.teamSelection.Unit_selector.Selection);
            this.AddWidget(editor);
            this.AddWidget(primitivesCollection);
            this.AddWidget(teamSelection);

            this.drag_and_drop = new DragAndDrop(primitivesCollection, editor);
            this.AddWidget(this.drag_and_drop);
            this.AddWidget(this.upper_container);

            if (this.teamSelection.Team_selector.Elements.Length > 0)
            {
                this.DisplayUI = false;
            }
            else
            {
                this.DisplayUI = true;
                GameObject.Find("Button_Return").GetComponent <UnityEngine.UI.Button>().interactable = false;
                this.UI_Text.SetActive(false);
            }
        }
예제 #2
0
        /********************************************
        ****** METHODES SPECIFIQUES AU WIDGET ******
        ********************************************/

        /// <summary>
        /// Initializes a new instance of the <see cref="WarBotEngine.Editeur.DragAndDrop"/> class.
        /// </summary>
        /// <param name="primitives">Primitives.</param>
        /// <param name="editor">Editor.</param>
        public DragAndDrop(PrimitivesCollection primitives, BehaviorEditor editor)
        {
            this.LocalArea  = new Rect(0, 0, Screen.width, Screen.height);
            this.primitives = primitives;
            this.editor     = editor;
            foreach (Category ca in primitives.Categories)
            {
                ca.SelectItem   += OnSelectItem;
                ca.HoverItem    += OnHoverItem;
                ca.HoverOutItem += OnHoverOutItem;
            }
        }