Exemple #1
0
        public override void OnCreateGUI()
        {
            _loadingBoxStyle = new GUIStyle(UnityEngine.GUI.skin.box)
            {
                alignment = TextAnchor.MiddleCenter,
                fontSize  = 16
            };

            GUI.Group btnGroup = new GUI.Group(GUI.GUIItem.Direction.Horizontal);

            GUI.Button exportBtn = new GUI.Button("Export");
            exportBtn.Clicked += ExportBtn_Clicked;
            btnGroup.Items.Add(exportBtn);

            GUI.Button importBtn = new GUI.Button("Import");
            importBtn.Clicked += ImportBtn_Clicked;
            btnGroup.Items.Add(importBtn);

            ModWindow.Items.Add(btnGroup);
        }
        private void SetupGUI(GameObject mainMenuRight)
        {
            _SelectedScenario = null;

            _ScenarioWindow = new GUI.Window(ModGUI.GetWindowIndex(), "Scenarios")
            {
                IsDraggable  = true,
                IsResizeable = true,
                IsCloseable  = true,
                Rect         = new Rect((Screen.width / 2) - 200, (Screen.height / 2) - 200, 400, 400),
                Visible      = false,
                MinWidth     = 200,
                MinHeight    = 200
            };

            _ScenarioWindow.WindowClosed += _ScenarioWindow_WindowClosed;

            GUI.Group group = new GUI.Group(GUI.GUIItem.Direction.Vertical);
            _ScenarioWindow.Items.Add(group);

            GUI.Group group1 = new GUI.Group(GUI.GUIItem.Direction.Horizontal);
            group.Items.Add(group1);

            lstScenarios = new GUI.Group(GUI.GUIItem.Direction.Vertical);
            group1.Items.Add(lstScenarios);

            foreach (Scenario scenario in Scenarios)
            {
                GUI.Button btn = new GUI.Button(scenario.Name)
                {
                    Tag = scenario
                };
                btn.Clicked += ScenarioBtn_Clicked;
                lstScenarios.Items.Add(btn);
            }

            _ScenarioInfo = new GUI.Group(GUI.GUIItem.Direction.Vertical)
            {
                Visible = false
            };
            group1.Items.Add(_ScenarioInfo);

            _Name = new GUI.Label("");
            _ScenarioInfo.Items.Add(_Name);

            _Desc = new GUI.TextArea("")
            {
                IsEditable = false,
                IsRichText = true
            };
            _ScenarioInfo.Items.Add(_Desc);

            _ThumbNail = new GUI.Box("")
            {
                Visible   = false,
                MaxWidth  = 200,
                MaxHeight = 200
            };
            _ScenarioInfo.Items.Add(_ThumbNail);

            GUI.Group btnGroup = new GUI.Group(GUI.GUIItem.Direction.Horizontal);
            group.Items.Add(btnGroup);

            _CancelBtn          = new GUI.Button("Cancel");
            _CancelBtn.Clicked += CancelBtn_Clicked;
            btnGroup.Items.Add(_CancelBtn);

            btnGroup.Items.Add(new GUI.FlexibleSpace());

            _LoadBtn = new GUI.Button("Load")
            {
                IsEnabled = false
            };
            _LoadBtn.Clicked += LoadBtn_Clicked;
            btnGroup.Items.Add(_LoadBtn);
        }