Example #1
0
    void Awake()
    {
        playerInstance = GameObject.Find("Player").GetComponent <Player>();

        gameControlInstance       = gc.GetComponent <GameControl> ();
        gameControlGUIInstance    = gc.GetComponent <GameControlGUI> ();
        shopControlInstance       = gc.GetComponent <ShopControl> ();
        shopControlGUIInstance    = gc.GetComponent <ShopControlGUI> ();
        clickControlInstance      = gc.GetComponent <ClickControl> ();
        gridControlInstance       = gc.GetComponent <GridControl>();
        optionControlInstance     = gc.GetComponent <OptionControl>();
        dragControlInstance       = gc.GetComponent <DragControl>();
        eventGUIInstance          = gc.GetComponent <EventGUI>();
        enemyLibraryInstance      = gc.GetComponent <EnemyLibrary>();
        cardLibraryInstance       = gc.GetComponent <CardLibrary>();
        goalLibraryInstance       = gc.GetComponent <GoalLibrary>();
        guiStyleLibraryInstance   = gc.GetComponent <GUIStyleLibrary>();
        mainMenuInstance          = gc.GetComponent <MainMenu>();
        encyclopediaMenuInstance  = gc.GetComponent <EncyclopediaMenu>();
        godChoiceMenuInstance     = gc.GetComponent <GodChoiceMenu>();
        customizeMenuInstance     = gc.GetComponent <CustomizeMenu>();
        gridCursorControlInstance = gc.GetComponent <GridCursorControl>();
        menuControlInstance       = gc.GetComponent <MenuControl>();
        tutorialInstance          = gc.GetComponent <Tutorial>();
        deckAnimateInstance       = deck.GetComponent <DeckAnimate>();

        shopAndGoalParentCanvasInstance = goalandshopparent
                                          .GetComponent <ShopAndGoalParentCanvas>();
        shopGridCanvasInstance = shopgrid
                                 .GetComponent <ShopGridCanvas>();
        gridCursorControlGUIInstance = gridcursorcontrolgui
                                       .GetComponent <GridCursorControlGUI>();
    }
Example #2
0
        //==================================================================

        //CheckBox Event management ==========================================
        public void SettingsPanel_Changed(object sender, EventArgs e)
        {
            OptionControl checkbox = (OptionControl)sender;

            ((ParamRow)checkbox.Tag2).FieldData.Value = checkbox.Selected;
            SaveChange();
        }
Example #3
0
        private void CreateControls()
        {
            _replaysList = new ListControl
            {
                SelectionMode = ListSelectionMode.Single,
                Bounds        =
                    new UniRectangle(
                        new UniScalar(0f, 0),
                        new UniScalar(0f, 20),
                        new UniScalar(0f, 300),
                        new UniScalar(0f, 300))
            };

            _replayLabel = new LabelControl("Select replay:")
            {
                Bounds = new UniRectangle(new UniScalar(0f, 0), new UniScalar(0f, 0), 0, 0)
            };

            _watchButton = new ButtonControl
            {
                Text   = "Watch",
                Bounds =
                    new UniRectangle(
                        new UniScalar(0f, 310),
                        new UniScalar(0f, 20),
                        new UniScalar(0f, 100),
                        new UniScalar(0f, 30))
            };

            _backButton = new ButtonControl
            {
                Text   = "Back",
                Bounds =
                    new UniRectangle(
                        new UniScalar(0f, 0),
                        new UniScalar(0.15f, 280),
                        new UniScalar(0f, 100),
                        new UniScalar(0f, 30))
            };

            _saveReplayCheckBox = new OptionControl()
            {
                Bounds = new UniRectangle(
                    new UniScalar(0f, 210),
                    new UniScalar(0.1f, 275),
                    new UniScalar(0f, 20),
                    new UniScalar(0f, 20))
            };

            _saveReplayLabel = new LabelControl()
            {
                Text   = "Save replay in My Documents: ",
                Bounds = new UniRectangle(
                    new UniScalar(0f, 0),
                    new UniScalar(0.1f, 275),
                    new UniScalar(0f, 20),
                    new UniScalar(0f, 20))
            };
        }
Example #4
0
 private void AddOption(object sender, EventArgs e)
 {
     try
     {
         if (chkMulipleChoice.Checked)
         {
             if (pan_options.Controls.Count > 0)
             {
                 OptionsControl ctrl = new OptionsControl()
                 {
                     Name     = "option" + (pan_options.Controls.Count - 1),
                     Letter   = (char)(Convert.ToInt32(((OptionsControl)pan_options.Controls[pan_options.Controls.Count - 1]).Letter) + 1),
                     Location = new Point(2, 2 + (pan_options.Controls.Count * 36))
                 };
                 pan_options.Controls.Add(ctrl);
             }
             else
             {
                 OptionsControl ctrl = new OptionsControl()
                 {
                     Location = new Point(2, 2),
                     Name     = "option0",
                     Letter   = 'A'
                 };
                 pan_options.Controls.Add(ctrl);
             }
         }
         else
         {
             if (pan_options.Controls.Count > 0)
             {
                 OptionControl ctrl = new OptionControl()
                 {
                     Name     = "option" + (pan_options.Controls.Count - 1),
                     Letter   = (char)(Convert.ToInt32(((OptionControl)pan_options.Controls[pan_options.Controls.Count - 1]).Letter) + 1),
                     Location = new Point(2, 2 + (pan_options.Controls.Count * 36))
                 };
                 pan_options.Controls.Add(ctrl);
             }
             else
             {
                 OptionControl ctrl = new OptionControl()
                 {
                     Location = new Point(2, 2),
                     Name     = "option0",
                     Letter   = 'A'
                 };
                 pan_options.Controls.Add(ctrl);
             }
         }
         //
         QuestionChanged(sender, e);
     }
     catch (Exception)
     {
         MessageBox.Show("Sorry, you cannot mix option types. First remove the existing options then replace them.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #5
0
        private void SetupControls()
        {
            _lblPosition = new LabelControl()
            {
                Bounds = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 40 + Children.Count * 25), new UniScalar(1, -10), new UniScalar(0, 0)),
                Text   = PositionText
            };
            Children.Add(_lblPosition);

            _lblMousePos = new LabelControl()
            {
                Bounds = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 40 + Children.Count * 25), new UniScalar(1, -10), new UniScalar(0, 0)),
                Text   = MousePosText
            };
            Children.Add(_lblMousePos);

            _lblSize = new LabelControl()
            {
                Bounds = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 40 + Children.Count * 25), new UniScalar(1, -10), new UniScalar(0, 0)),
                Text   = SizeText
            };
            Children.Add(_lblSize);

            _lblZoom = new LabelControl()
            {
                Bounds = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 40 + Children.Count * 25), new UniScalar(1, -10), new UniScalar(0, 0)),
                Text   = ZoomText
            };
            Children.Add(_lblZoom);

            _lblTileSize = new LabelControl()
            {
                Bounds = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 40 + Children.Count * 25), new UniScalar(1, -10), new UniScalar(0, 0)),
                Text   = ZoomText
            };
            Children.Add(_lblTileSize);

            _lblRegion = new LabelControl()
            {
                Bounds = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 40 + Children.Count * 25), new UniScalar(1, -10), new UniScalar(0, 0)),
                Text   = ZoomText
            };
            Children.Add(_lblRegion);

            _optLockCamera = new OptionControl()
            {
                Bounds   = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 40 + Children.Count * 25), 15, 19),
                Enabled  = true,
                Selected = false,
                Text     = "Lock Camera"
            };
            Children.Add(_optLockCamera);
        }
Example #6
0
 void Awake()
 {
     Load();
     if (oControl == null)
     {
         DontDestroyOnLoad(gameObject);
         oControl = this;
     }
     else if (oControl != this)
     {
         Destroy(gameObject);
     }
 }
Example #7
0
    void createHeaderMenu()
    {
        for (int i = 0; i < playerParts.Length + 1; i++)
        {
            GameObject option;
            if (i == 0)
            {
                //Create icon "All Parts"
                option = Instantiate(firstOption);
            }
            else if (i < (playerParts.Length))
            {
                //Middle Content
                option = Instantiate(middleOption);
            }
            else
            {
                //Last Content
                option = Instantiate(lastOption);
            }
            option.transform.parent = this.transform;

            //Set Info
            OptionControl optionControl = option.GetComponent <OptionControl>();
            Sprite        levelIconBG;
            string        nameOption;

            if (i == 0)
            {
                nameOption  = "Everything";
                levelIconBG = Resources.Load <Sprite>("UI/header/All");
            }
            else
            {
                nameOption  = playerParts[i - 1].ToString();
                levelIconBG = Resources.Load <Sprite>("UI/header/" + playerParts[i - 1].ToString());
            }

            if (i == 0)
            {
                optionControl.setSelectOption(true);
            }

            optionControl.setOptionName(nameOption);
            optionControl.setOptionImage(levelIconBG);
            optionControl.textBox.active = false;
            optionsArray.Add(option);
        }

        activateOption(0);
    }
Example #8
0
        /// <summary>
        /// Takes the center of the control and places it at the center of the client,
        /// makes the center of the client coordinate (0, 0)
        /// @Added by Steven
        /// </summary>
        /// <param name="text"></param>
        /// <param name="offSetX"></param>
        /// <param name="offSetY"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="center"></param>
        /// <param name="XPos"></param>
        /// <param name="YPos"></param>
        /// <returns></returns>
        public static OptionControl CreateOption(String text, int offSetX, int offSetY, int width, int height, bool center = true, float XPos = 0.0f, float YPos = 0.0f)
        {
            if (center)
            {
                XPos    = 0.5f;
                YPos    = 0.5f;
                offSetX = offSetX + (-1 * width / 2);
                offSetY = offSetY + (-1 * height / 2);
            }
            OptionControl option = new OptionControl();

            option.Text   = text;
            option.Bounds = new UniRectangle(
                new UniScalar(XPos, offSetX), new UniScalar(YPos, offSetY), width, height);
            return(option);
        }
Example #9
0
    void activateOption(int _option)
    {
        GameObject    currentOption    = optionsArray[_option] as GameObject;
        OptionControl optionControl    = currentOption.GetComponent <OptionControl>();
        GameObject    oldOptionGO      = optionsArray[oldOptionCount] as GameObject;
        OptionControl oldOptionControl = oldOptionGO.GetComponent <OptionControl>();

        if (currentOptionCount != oldOptionCount)
        {
            oldOptionControl.textBox.active = false;
            oldOptionControl.setSelectOption(false);
        }

        optionControl.textBox.active = true;
        optionControl.setSelectOption(true);
        oldOptionCount = _option;
    }
Example #10
0
        private static void AddOptions(Paragraph p, Questions question, OptionControl optionControl)
        {
            var options = question.Options.OrderBy(o => o.Order);

            for (int i = 0; i < options.Count(); i++)
            {
                if (i != 0)
                {
                    p.Inlines.Add(Environment.NewLine);
                }
                var control = new InlineUIContainer()
                {
                    Child = optionControl()
                };
                p.Inlines.Add(control);
                p.Inlines.Add(" ");
                p.Inlines.Add(options.ElementAt(i).Option);
            }
        }
Example #11
0
 private void AddOption(object sender, EventArgs e)
 {
     if (pan_options.Controls.Count > 0)
     {
         OptionControl ctrl = new OptionControl();
         ctrl.Name     = "option" + (pan_options.Controls.Count - 1);
         ctrl.Letter   = (char)(Convert.ToInt32(((OptionControl)pan_options.Controls[pan_options.Controls.Count - 1]).Letter) + 1);
         ctrl.Location = new Point(2, 2 + (pan_options.Controls.Count * 36));
         pan_options.Controls.Add(ctrl);
     }
     else
     {
         OptionControl ctrl = new OptionControl();
         ctrl.Location = new Point(2, 2);
         ctrl.Name     = "option0";
         ctrl.Letter   = 'A';
         pan_options.Controls.Add(ctrl);
     }
     //
     QuestionChanged(sender, e);
 }
        private static ParamRow AddCheckBoxComponent(string ParameterName, bool value, string fieldName, bool isNumeric, SpriteFont customFont, SpriteTexture customInputBackgroundTexture)
        {
            LabelControl label = new LabelControl()
            {
                Text = ParameterName, CustomFont = customFont
            };
            OptionControl input = new OptionControl()
            {
                Selected = value
            };
            ParamRow row = new ParamRow()
            {
                LabelName = label, InputingComp = input, ParamInputMethod = ParamInputMethod.CheckBox, FieldData = new ParamValue()
                {
                    Value = value, Name = fieldName
                }
            };

            input.Tag2 = row;
            return(row);
        }
        public GameComponentControlRow(Control parent, float y)
        {
            _parent = parent;
            _y      = y;

            lblGameComp        = new LabelControl();
            lblGameComp.Bounds = new UniRectangle(10.0f, _y, 110.0f, 18.0f);

            optUpdatable          = new OptionControl();
            optUpdatable.Bounds   = new UniRectangle(200.0f, _y, 20.0f, 16.0f);
            optUpdatable.Changed += optUpdatable_Changed;

            updateOrder                  = new InputControl();
            updateOrder.Bounds           = new UniRectangle(220.0f, y, 50.0f, 18.0f);
            updateOrder.EnterKeyPressed += updateOrder_EnterKeyPressed;

            optDrawable          = new OptionControl();
            optDrawable.Bounds   = new UniRectangle(290.0f, y, 20.0f, 16.0f);
            optDrawable.Changed += optDrawable_Changed;

            drawOrder                  = new InputControl();
            drawOrder.Bounds           = new UniRectangle(310.0f, y, 50.0f, 18.0f);
            drawOrder.EnterKeyPressed += drawOrder_EnterKeyPressed;
        }
Example #14
0
        private void CreateControls()
        {
            _loginBox = new InputControl
            {
                Name     = "login",
                IsHidden = false,
                Bounds   = new UniRectangle(
                    new UniScalar(0.5f, -100f),
                    new UniScalar(0.4f, -30), 200, 30),
                Text = ""
            };

            _passwordBox = new InputControl
            {
                Name     = "password",
                IsHidden = true,
                Bounds   = new UniRectangle(
                    new UniScalar(0.5f, -100f),
                    new UniScalar(0.4f, 30),
                    new UniScalar(0f, 200),
                    new UniScalar(0f, 30)),
                RealText = "",
                Text     = InputControl.HiddenText("")
            };

            _rememberCheckBox = new OptionControl()
            {
                Bounds = new UniRectangle(
                    new UniScalar(0.5f, 50),
                    new UniScalar(0.4f, 70),
                    new UniScalar(0f, 20),
                    new UniScalar(0f, 20))
            };

            _loginLabel = new LabelControl("Username")
            {
                Bounds = new UniRectangle(
                    new UniScalar(0.5f, -32),
                    new UniScalar(0.4f, -70),
                    new UniScalar(0f, 100),
                    new UniScalar(0f, 30))
            };

            _passwordLabel = new LabelControl("Password")
            {
                Bounds = new UniRectangle(
                    new UniScalar(0.5f, -32),
                    new UniScalar(0.4f, 0),
                    new UniScalar(0f, 100),
                    new UniScalar(0f, 30))
            };

            _rememberLabel = new LabelControl("Remember me:")
            {
                Bounds = new UniRectangle(
                    new UniScalar(0.5f, -60),
                    new UniScalar(0.4f, 65),
                    new UniScalar(0f, 100),
                    new UniScalar(0f, 30))
            };

            _loginButton = new ButtonControl
            {
                Text   = "Login",
                Bounds = new UniRectangle(
                    new UniScalar(0.5f, 110),
                    new UniScalar(0.4f, 100),
                    new UniScalar(0f, 100),
                    new UniScalar(0f, 32))
            };

            _exitButton = new ButtonControl
            {
                Text   = "Exit",
                Bounds = new UniRectangle(
                    new UniScalar(0.5f, -210),
                    new UniScalar(0.4f, 100),
                    new UniScalar(0f, 100),
                    new UniScalar(0f, 32)),
            };

            _newAccountButton = new ButtonControl
            {
                Text   = "Create new account",
                Bounds = new UniRectangle(
                    new UniScalar(0.5f, -75),
                    new UniScalar(0.4f, 100),
                    new UniScalar(0f, 150),
                    new UniScalar(0f, 32))
            };
        }
Example #15
0
        /// <summary>
        /// @Author Troy, Edited by Steven
        /// </summary>
        /// <param name="mainScreen"></param>
        private void CreateMenuControls(Screen mainScreen)
        {
            //Menu Name Label
            LabelControl menuNameLabel = new LabelControl();

            //NETWORKING
            //menuNameLabel.Text = "Lobby: " + game.roomInfo.RoomName;
            menuNameLabel.Text = "Lobby: ";

            menuNameLabel.Bounds = GuiHelper.MENU_TITLE_LABEL;
            mainScreen.Desktop.Children.Add(menuNameLabel);

            //Players Labels
            playersLabel = GuiHelper.CreateLabel("Players:",
                                                 UIConstants.LOBBY_PLAYER_LABEL.X, UIConstants.LOBBY_PLAYER_LABEL.Y - UIConstants.LOBBY_PLAYER_LABEL_SPACE,
                                                 UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height);
            mainScreen.Desktop.Children.Add(playersLabel);

            int i = 0;

            foreach (LabelControl ctrl in playerLabelList)
            {
                //ctrl.Text = playerNameList[i]; // Use if using the List<string> to store player names
                ctrl.Bounds = GuiHelper.CenterBound(
                    UIConstants.LOBBY_PLAYER_LABEL.X, UIConstants.LOBBY_PLAYER_LABEL.Y + i * UIConstants.LOBBY_PLAYER_LABEL_SPACE,
                    UIConstants.LOBBY_PLAYER_LABEL.Width, UIConstants.LOBBY_PLAYER_LABEL.Height);
                mainScreen.Desktop.Children.Add(ctrl);
                i++;
            }

            shipChoice_1.Changed += delegate(object sender, EventArgs arguments)
            {
                selectShipIcon(0);
            };
            shipChoice_2.Changed += delegate(object sender, EventArgs arguments)
            {
                selectShipIcon(1);
            };
            shipChoice_3.Changed += delegate(object sender, EventArgs arguments)
            {
                selectShipIcon(2);
            };

            createShipSelection(mainScreen);

            //Ready Up Button.
            OptionControl readyUpButton = GuiHelper.CreateOption("I'm Ready!",
                                                                 UIConstants.LOBBY_READY_BTN.X, UIConstants.LOBBY_READY_BTN.Y,
                                                                 UIConstants.LOBBY_READY_BTN.Width, UIConstants.LOBBY_READY_BTN.Height);

            mainScreen.Desktop.Children.Add(readyUpButton);

            //Start Game Button
            ButtonControl startGameButton = GuiHelper.CreateButton("Start Game",
                                                                   UIConstants.LOBBY_START_BTN.X, UIConstants.LOBBY_START_BTN.Y,
                                                                   UIConstants.LOBBY_START_BTN.Width, UIConstants.LOBBY_START_BTN.Height);

            startGameButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                if (readyUpButton.Selected == true &&
                    (shipChoice_1.Selected == true || shipChoice_2.Selected == true || shipChoice_3.Selected == true))
                {
                    menuNameLabel.Text = "You are ready";
                }
                else
                {
                    menuNameLabel.Text = "You are not ready";
                }
            };
            if (!isLeader)
            {
                startGameButton.Enabled = false;
            }

            mainScreen.Desktop.Children.Add(startGameButton);

            //Cancel Button
            ButtonControl cancelGameButton = GuiHelper.CreateButton("Cancel",
                                                                    UIConstants.LOBBY_CANCEL_BTN.X, UIConstants.LOBBY_CANCEL_BTN.Y,
                                                                    UIConstants.LOBBY_CANCEL_BTN.Width, UIConstants.LOBBY_CANCEL_BTN.Height);

            cancelGameButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                //NETWORKING
                //game.Communication.sendRoomExitRequest(game.Player, game.roomInfo.RoomNumber);
                game.EnterLobbyBrowserMenu();
            };
            mainScreen.Desktop.Children.Add(cancelGameButton);
        }
Example #16
0
        private void CreateControls()
        {
            _descrLabel = new LabelControl("Select two intellects to start game:")
            {
                Bounds = new UniRectangle(
                    new UniScalar(0f, 250),
                    new UniScalar(0f, 20),
                    0, 0)
            };

            _startGameButton = new ButtonControl
            {
                Text   = "Fight!",
                Bounds =
                    new UniRectangle(
                        new UniScalar(0f, 275),
                        new UniScalar(0f, 540),
                        new UniScalar(0f, 200),
                        new UniScalar(0f, 30))
            };

            _backButton = new ButtonControl
            {
                Text   = "Back",
                Bounds =
                    new UniRectangle(
                        new UniScalar(0f, -10),
                        new UniScalar(0f, 540),
                        new UniScalar(0f, 100),
                        new UniScalar(0f, 30))
            };

            _gameNameBox = new InputControl
            {
                Bounds = new UniRectangle(
                    new UniScalar(0f, 275),
                    new UniScalar(0f, 500),
                    new UniScalar(0f, 200),
                    new UniScalar(0f, 30)),
                // todo for what is this time needed
                Text = DateTime.Now.ToString()
            };

            _gameNameLabel = new LabelControl("Game name:")
            {
                Bounds = new UniRectangle(
                    new UniScalar(0f, 275),
                    new UniScalar(0f, 470),
                    new UniScalar(0f, 100),
                    new UniScalar(0f, 30))
            };


            _offlineLabel = new LabelControl("Offline mode:")
            {
                Bounds = new UniRectangle(
                    new UniScalar(0f, 50),
                    new UniScalar(0f, 455),
                    new UniScalar(0f, 100),
                    new UniScalar(0f, 30))
            };

            _offlineModeCheckBox = new OptionControl
            {
                Bounds = new UniRectangle(
                    new UniScalar(0f, 150),
                    new UniScalar(0f, 460),
                    new UniScalar(0f, 20),
                    new UniScalar(0f, 20))
            };

            _intellectFirstList = new Nuclex.UserInterface.Controls.Desktop.ListControl
            {
                SelectionMode = ListSelectionMode.Single,
                Bounds        =
                    new UniRectangle(
                        new UniScalar(0f, 50),
                        new UniScalar(0f, 50),
                        new UniScalar(0f, 250),
                        new UniScalar(0f, 400))
            };

            _intellectSecondList = new Nuclex.UserInterface.Controls.Desktop.ListControl
            {
                SelectionMode = ListSelectionMode.Single,
                Bounds        =
                    new UniRectangle(
                        new UniScalar(0f, 450),
                        new UniScalar(0f, 50),
                        new UniScalar(0f, 250),
                        new UniScalar(0f, 400))
            };
        }
Example #17
0
        /// <summary>
        ///   Create gui controls
        /// </summary>
        /// <param name="mainScreen">
        ///   Screen to whose desktop the controls will be added
        /// </param>
        private void createDesktopControls(Screen mainScreen)
        {
            WindowControl options = new WindowControl();
            options.Title = "Options";
            options.EnableDragging = true;
            options.Bounds = new UniRectangle(
                new UniScalar(1.0f, -210.0f), 10,
                200, 275);
            mainScreen.Desktop.Children.Add(options);

            OptionControl wireFrameToggle = new OptionControl();
            wireFrameToggle.Text = "Wireframe";
            wireFrameToggle.Bounds = new UniRectangle(10, 30, 100, 32);
            wireFrameToggle.Selected = Wireframe;
            wireFrameToggle.Changed += delegate(object sender, EventArgs arguments) { Wireframe = wireFrameToggle.Selected; };
            options.Children.Add(wireFrameToggle);

            /*
            OptionControl fogToggle = new OptionControl();
            fogToggle.Text = "Fog";
            fogToggle.Bounds = new UniRectangle(10, 65, 100, 32);
            fogToggle.Selected = terrainDrawContext.BasicEffect.FogEnabled;
            fogToggle.Changed += delegate(object sender, EventArgs arguments) { terrainDrawContext.BasicEffect.FogEnabled = fogToggle.Selected; };
            options.Children.Add(fogToggle);

            LabelControl fogNearLabel = new LabelControl("Near");
            fogNearLabel.Bounds = new UniRectangle(10, 100, 20, 24);
            options.Children.Add(fogNearLabel);

            const float fogRange = 1000f;

            HorizontalSliderControl fogNear = new HorizontalSliderControl();
            fogNear.Bounds = new UniRectangle(50, 100, 140, 24);
            fogNear.ThumbSize = 0.1f;
            fogNear.ThumbPosition = terrainDrawContext.BasicEffect.FogStart / fogRange;
            fogNear.Moved += delegate(object sender, EventArgs arguments) { terrainDrawContext.BasicEffect.FogStart = fogNear.ThumbPosition * fogRange; };
            options.Children.Add(fogNear);

            LabelControl fogFarLabel = new LabelControl("Far");
            fogFarLabel.Bounds = new UniRectangle(10, 125, 20, 24);
            options.Children.Add(fogFarLabel);

            HorizontalSliderControl fogFar = new HorizontalSliderControl();
            fogFar.Bounds = new UniRectangle(50, 125, 140, 24);
            fogFar.ThumbSize = 0.1f;
            fogFar.ThumbPosition = terrainDrawContext.BasicEffect.FogEnd / fogRange;
            fogFar.Moved += delegate(object sender, EventArgs arguments) { terrainDrawContext.BasicEffect.FogEnd = fogFar.ThumbPosition * fogRange; };
            options.Children.Add(fogFar);
            */

            LabelControl cellGapLabel = new LabelControl("Gap");
            cellGapLabel.Bounds = new UniRectangle(10, 65, 20, 24);
            options.Children.Add(cellGapLabel);

            HorizontalSliderControl cellGapControl = new HorizontalSliderControl();
            cellGapControl.Bounds = new UniRectangle(50, 65, 140, 24);
            cellGapControl.ThumbSize = 0.1f;
            const float cellGapRange = 5.0f;
            cellGapControl.ThumbPosition = cellGap / cellGapRange;
            cellGapControl.Moved += delegate(object sender, EventArgs arguments) { cellGap = cellGapControl.ThumbPosition * cellGapRange; };
            options.Children.Add(cellGapControl);

            LabelControl densityLabel = new LabelControl("Density");
            densityLabel.Bounds = new UniRectangle(10, 90, 20, 24);
            options.Children.Add(densityLabel);

            const float densityRange = 100.0f;
            HorizontalSliderControl densityControl = new HorizontalSliderControl();
            densityControl.Bounds = new UniRectangle(60, 90, 130, 24);
            densityControl.ThumbSize = 0.1f;
            densityControl.ThumbPosition = terrainNoiseDensity / densityRange;
            densityControl.Moved += delegate(object sender, EventArgs arguments) { terrainNoiseDensity = densityControl.ThumbPosition * densityRange; };
            options.Children.Add(densityControl);

            LabelControl cellResLabel = new LabelControl("CellRes");
            cellResLabel.Bounds = new UniRectangle(10, 115, 20, 24);
            options.Children.Add(cellResLabel);

            const float cellResRange = 5.0f;
            HorizontalSliderControl cellResControl = new HorizontalSliderControl();
            cellResControl.Bounds = new UniRectangle(60, 115, 130, 24);
            cellResControl.ThumbSize = 0.1f;
            cellResControl.ThumbPosition = cellRes / (float)Math.Pow(2, cellResRange);
            cellResControl.Moved += delegate(object sender, EventArgs arguments) { cellRes = (float)Math.Pow(2, (int)(cellResControl.ThumbPosition * cellResRange)); };
            options.Children.Add(cellResControl);

            LabelControl terrainResLabel = new LabelControl("TerRes");
            terrainResLabel.Bounds = new UniRectangle(10, 140, 20, 24);
            options.Children.Add(terrainResLabel);

            const float terrainResRange = 5.0f;
            HorizontalSliderControl terrainResControl = new HorizontalSliderControl();
            terrainResControl.Bounds = new UniRectangle(60, 140, 130, 24);
            terrainResControl.ThumbSize = 0.1f;
            terrainResControl.ThumbPosition = terrainRes / (float)Math.Pow(2, terrainResRange);
            terrainResControl.Moved += delegate(object sender, EventArgs arguments) { terrainRes = (float)Math.Pow(2, (int)(terrainResControl.ThumbPosition * terrainResRange)); };
            options.Children.Add(terrainResControl);

            OptionControl cubicToggle = new OptionControl();
            cubicToggle.Text = "Cubic (requires regen)";
            cubicToggle.Bounds = new UniRectangle(10, 165, 100, 32);
            cubicToggle.Selected = cubicTerrain;
            cubicToggle.Changed += delegate(object sender, EventArgs arguments) { cubicTerrain = cubicToggle.Selected; };
            options.Children.Add(cubicToggle);

            ButtonControl regenerateButton = new ButtonControl();
            regenerateButton.Text = "Regenerate";
            regenerateButton.Bounds = new UniRectangle(
                new UniScalar(1.0f, -190.0f), new UniScalar(1.0f, -75.0f), 110, 32);
            regenerateButton.Pressed += delegate(object sender, EventArgs arguments) { GenerateTerrain(random.Next(255)); };
            options.Children.Add(regenerateButton);

            ButtonControl resetButton = new ButtonControl();
            resetButton.Text = "Reset Camera";
            resetButton.Bounds = new UniRectangle(
                new UniScalar(1.0f, -190.0f), new UniScalar(1.0f, -40.0f), 110, 32);
            resetButton.Pressed += delegate(object sender, EventArgs arguments) { ResetCamera(); };
            options.Children.Add(resetButton);

            // Button through which the user can quit the application
            ButtonControl quitButton = new ButtonControl();
            quitButton.Text = "Quit";
            quitButton.Bounds = new UniRectangle(
                new UniScalar(1.0f, -70.0f), new UniScalar(1.0f, -40.0f), 60, 32);
            quitButton.Pressed += delegate(object sender, EventArgs arguments) { Exit(); };
            options.Children.Add(quitButton);
        }
Example #18
0
 private void AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (trv_view_exam.SelectedNode.GetType() == typeof(ExamNode))
     {
         newQuestionToolStripButton.Enabled = false;
         //
         if (splitContainer2.Panel2.Controls.Contains(pan_display_questions))
         {
             splitContainer2.Panel2.Controls.Remove(pan_display_questions);
             splitContainer2.Panel2.Controls.Add(pan_exam_properties);
         }
         else if (splitContainer2.Panel2.Controls.Contains(pan_splash))
         {
             splitContainer2.Panel2.Controls.Remove(pan_splash);
             splitContainer2.Panel2.Controls.Add(pan_exam_properties);
         }
     }
     else if (trv_view_exam.SelectedNode.GetType() == typeof(SectionNode))
     {
         newQuestionToolStripButton.Enabled = true;
         //
         if (splitContainer2.Panel2.Controls.Contains(pan_exam_properties))
         {
             splitContainer2.Panel2.Controls.Remove(pan_exam_properties);
             splitContainer2.Panel2.Controls.Add(pan_display_questions);
         }
         else if (splitContainer2.Panel2.Controls.Contains(pan_splash))
         {
             splitContainer2.Panel2.Controls.Remove(pan_splash);
             splitContainer2.Panel2.Controls.Add(pan_display_questions);
         }
         pan_display_questions.Enabled = false;
     }
     else
     {
         newQuestionToolStripButton.Enabled = true;
         //
         if (splitContainer2.Panel2.Controls.Contains(pan_exam_properties))
         {
             splitContainer2.Panel2.Controls.Remove(pan_exam_properties);
             splitContainer2.Panel2.Controls.Add(pan_display_questions);
         }
         else if (splitContainer2.Panel2.Controls.Contains(pan_splash))
         {
             splitContainer2.Panel2.Controls.Remove(pan_splash);
             splitContainer2.Panel2.Controls.Add(pan_display_questions);
         }
         pan_display_questions.Enabled = true;
         //
         Question question = ((QuestionNode)trv_view_exam.SelectedNode).Question;
         txt_explanation.Text      = question.Explanation;
         txt_question_text.Text    = question.Text;
         lbl_section_question.Text = "Section: " + trv_view_exam.SelectedNode.Parent.Text + " Question " + question.No;
         pct_image.Image           = question.Image;
         //
         chkMulipleChoice.Checked = question.IsMultipleChoice;
         //
         pan_options.Controls.Clear();
         //
         int i = 0;
         if (question.IsMultipleChoice)
         {
             foreach (var option in question.Options)
             {
                 OptionsControl ctrl = new OptionsControl()
                 {
                     Letter   = option.Alphabet,
                     Text     = option.Text,
                     Location = new Point(2, i * 36)
                 };
                 if (question.Answers.Contains(option.Alphabet))
                 {
                     ctrl.Checked = true;
                 }
                 pan_options.Controls.Add(ctrl);
                 i++;
             }
         }
         else
         {
             foreach (var option in question.Options)
             {
                 OptionControl ctrl = new OptionControl()
                 {
                     Letter   = option.Alphabet,
                     Text     = option.Text,
                     Location = new Point(2, i * 36)
                 };
                 if (option.Alphabet == question.Answer)
                 {
                     ctrl.Checked = true;
                 }
                 pan_options.Controls.Add(ctrl);
                 i++;
             }
         }
     }
     //
     ReconnectHandlers();
 }
Example #19
0
        private void CreateControls()
        {
            _titleLabel = new LabelControl("Options")
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, -32), new UniScalar(0.1f, -70), 100, 30)
            };

            _fullscreenLabel = new LabelControl("FullScreen: ")
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -50), new UniScalar(0.25f, -70), 80, 30)
            };

            _fullscreenButton = new OptionControl
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, 30), new UniScalar(0.25f, -70), 100, 30)
            };

            _keyboardLabel = new LabelControl("Keyboard:")
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -110), new UniScalar(0.4f, -70), 50, 30)
            };

            _backButton = new ButtonControl
            {
                Text   = "Back",
                Bounds = new UniRectangle(new UniScalar(0.5f, -50), new UniScalar(1.1f, -70), 100, 30)
            };

            /*
             * _upVolume = new ButtonControl
             * {
             *  Text = "+",
             *  Bounds = new UniRectangle(new UniScalar(0.5f, -50), new UniScalar(0.9f, -70), 100, 30)
             * };
             *
             * _downVolume = new ButtonControl
             * {
             *  Text = "-",
             *  Bounds = new UniRectangle(new UniScalar(0.5f, -50), new UniScalar(0.9f, -30), 100, 30)
             * };
             *
             * _volumeLabel = new LabelControl("Volume:")
             * {
             *  Bounds =
             *      new UniRectangle(new UniScalar(0.62f, -220), new UniScalar(0.94f, -70), 70, 30)
             * };
             *
             * _volumeValueLabel = new LabelControl
             * {
             *  Text = Math.Round(Settings.Default.Volume, 1).ToString(CultureInfo.InvariantCulture),
             *  Bounds =
             *      new UniRectangle(new UniScalar(1.0f, -220), new UniScalar(0.94f, -70), 70, 30)
             * };*/

            _keyboardList = new ListControl
            {
                Bounds = new UniRectangle(350f, 125f, 150f, 50f)
            };

            _keyboardList.Items.Add("A, S, D, W");
            _keyboardList.Items.Add("Arrows");
            _keyboardList.Slider.Bounds.Location.X.Offset -= 1.0f;
            _keyboardList.Slider.Bounds.Location.Y.Offset += 1.0f;
            _keyboardList.Slider.Bounds.Size.Y.Offset     -= 2.0f;
            _keyboardList.SelectionMode = ListSelectionMode.Single;

            _cursorLabel = new LabelControl("Cursor:")
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -220), new UniScalar(0.58f, -70), 70, 30)
            };

            _arrowButton = new ChoiceControl
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -150f), new UniScalar(0.7f, -70), 70, 30)
            };

            _plusButton = new ChoiceControl
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, -60f), new UniScalar(0.7f, -70), 70, 30)
            };


            _crossButton = new ChoiceControl
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, 30f), new UniScalar(0.7f, -70), 70, 30)
            };

            _targetButton = new ChoiceControl
            {
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, 120f), new UniScalar(0.7f, -70), 70, 30)
            };
        }
Example #20
0
        private void InitGameComponents()
        {
            _displayResultsColumnPosi[(int)LabelResultColumn.Component] = 10;
            _displayResultsColumnPosi[(int)LabelResultColumn.AvgUpdt]   = 160;
            _displayResultsColumnPosi[(int)LabelResultColumn.MaxUpdt]   = 220;
            _displayResultsColumnPosi[(int)LabelResultColumn.AvgDraw]   = 290;
            _displayResultsColumnPosi[(int)LabelResultColumn.MaxDraw]   = 350;

            int y = 10;

            OptionControl oc = ToDispose(new OptionControl());

            oc.Bounds   = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component], y, 70.0f, 16.0f);
            oc.Text     = "Perf tracing";
            oc.Changed += (sender, e) =>
            {
                _game.ComponentsPerfMonitor.Updatable = !_game.ComponentsPerfMonitor.Updatable;
            };
            oc.Selected = _game.ComponentsPerfMonitor.Updatable;
            Children.Add(oc);

            oc          = ToDispose(new OptionControl());
            oc.Bounds   = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component] + 100, y, 70.0f, 16.0f);
            oc.Text     = "Avg in %";
            oc.Changed += (sender, e) =>
            {
                _showInPercent = !_showInPercent;
            };
            oc.Selected = _showInPercent;
            Children.Add(oc);


            ButtonControl bc = ToDispose(new ButtonControl());

            bc.Bounds   = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component] + 170, y, 70.0f, 16.0f);
            bc.Text     = "Reset Max";
            bc.Pressed += (sender, e) =>
            {
                _game.ComponentsPerfMonitor.PerfTimer.ResetMinMax();
            };
            Children.Add(bc);

            y += 15;

            LabelControl ColumnTitles;

            ColumnTitles           = ToDispose(new LabelControl());
            ColumnTitles.FontStyle = System.Drawing.FontStyle.Regular;
            ColumnTitles.Bounds    = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component], y, 110.0f, 18.0f);
            ColumnTitles.Text      = "Avg Frame time :";
            Children.Add(ColumnTitles);

            _avgFrameTime           = ToDispose(new LabelControl());
            _avgFrameTime.FontStyle = System.Drawing.FontStyle.Regular;
            _avgFrameTime.Bounds    = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component] + 90, y, 110.0f, 18.0f);
            _avgFrameTime.Text      = "xxx fps";
            Children.Add(_avgFrameTime);

            _vsc                     = ToDispose(new VerticalSliderControl());
            _vsc.Bounds              = new UniRectangle(this.Bounds.Size.X - 20, y + 25, 15.0f, 150.0f);
            _vsc.LayoutFlags         = ControlLayoutFlags.WholeRow;
            _vsc.Moved              += new EventHandler(_vsc_Moved);
            _vsc.ThumbSmoothMovement = true;
            _vsc.ThumbMinValue       = 0;
            Children.Add(_vsc);

            y += 15;

            ColumnTitles           = ToDispose(new LabelControl());
            ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold;
            ColumnTitles.Bounds    = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.Component], y, 50.0f, 18.0f);
            ColumnTitles.Text      = "Component";
            Children.Add(ColumnTitles);

            ColumnTitles           = ToDispose(new LabelControl());
            ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold;
            ColumnTitles.Bounds    = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.AvgUpdt], y, 50.0f, 18.0f);
            ColumnTitles.Text      = "Avg Updt";
            ColumnTitles.Color     = SharpDX.Color.DarkBlue;
            ColumnTitles.Tag       = LabelResultColumn.AvgUpdt;
            ColumnTitles.Clicked  += ColumnTitles_Clicked;
            Children.Add(ColumnTitles);

            ColumnTitles           = ToDispose(new LabelControl());
            ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold;
            ColumnTitles.Bounds    = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.MaxUpdt], y, 50.0f, 18.0f);
            ColumnTitles.Text      = "Max Updt";
            ColumnTitles.Color     = SharpDX.Color.DarkBlue;
            ColumnTitles.Tag       = LabelResultColumn.MaxUpdt;
            ColumnTitles.Clicked  += ColumnTitles_Clicked;
            Children.Add(ColumnTitles);

            ColumnTitles           = ToDispose(new LabelControl());
            ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold;
            ColumnTitles.Bounds    = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.AvgDraw], y, 50.0f, 18.0f);
            ColumnTitles.Text      = "Avg Draw";
            ColumnTitles.Color     = SharpDX.Color.DarkBlue;
            ColumnTitles.Tag       = LabelResultColumn.AvgDraw;
            ColumnTitles.Clicked  += ColumnTitles_Clicked;
            Children.Add(ColumnTitles);

            ColumnTitles           = ToDispose(new LabelControl());
            ColumnTitles.FontStyle = System.Drawing.FontStyle.Bold;
            ColumnTitles.Bounds    = new UniRectangle(_displayResultsColumnPosi[(int)LabelResultColumn.MaxDraw], y, 50.0f, 18.0f);
            ColumnTitles.Text      = "Max Draw";
            ColumnTitles.Color     = SharpDX.Color.DarkBlue;
            ColumnTitles.Tag       = LabelResultColumn.MaxDraw;
            ColumnTitles.Clicked  += ColumnTitles_Clicked;
            Children.Add(ColumnTitles);
            y += 15;

            //Create the result Array
            LabelControl lc;
            int          arrayLinePosition;

            for (int column = 0; column < _displayedResults.GetLength(0); column++)
            {
                arrayLinePosition = y;
                for (int line = 0; line < _displayedResults.GetLength(1); line++)
                {
                    lc        = ToDispose(new LabelControl());
                    lc.Bounds = new UniRectangle(_displayResultsColumnPosi[column], arrayLinePosition, 50, 18);
                    lc.Text   = "";
                    Children.Add(lc);
                    _displayedResults[column, line] = lc;

                    arrayLinePosition += 15;
                }
            }
        }
Example #21
0
        private void Redo(object sender, EventArgs e)
        {
            ChangeRepresentationObject redoObject = undoRedo.Redo();

            if (redoObject == null)
            {
                return;
            }
            else
            {
                switch (redoObject.Action)
                {
                case ActionType.Add:
                    SectionNode sectionNode = trv_view_exam.Nodes[0].Nodes.Cast <SectionNode>().FirstOrDefault(s => s.Title == redoObject.SectionTitle);
                    if (sectionNode == null)
                    {
                        sectionNode = new SectionNode(redoObject.SectionTitle)
                        {
                            ContextMenuStrip = cms_section
                        };
                        //
                        QuestionNode questionNode = new QuestionNode(redoObject.Question)
                        {
                            ContextMenuStrip = cms_question
                        };
                        sectionNode.Nodes.Add(questionNode);
                        //
                        trv_view_exam.Nodes[0].Nodes.Add(sectionNode);
                        trv_view_exam.ExpandAll();
                    }
                    else
                    {
                        sectionNode.ContextMenuStrip = cms_section;
                        //
                        QuestionNode questionNode = new QuestionNode(redoObject.Question)
                        {
                            ContextMenuStrip = cms_question
                        };
                        sectionNode.Nodes.Add(questionNode);
                        //
                        trv_view_exam.ExpandAll();
                    }
                    //
                    int i = 1;
                    foreach (QuestionNode questionNode_ in sectionNode.Nodes)
                    {
                        questionNode_.Text        = "Question " + i;
                        questionNode_.Question.No = i;
                        i++;
                    }
                    break;

                case ActionType.Delete:
                    SectionNode _sectionNode = trv_view_exam.Nodes[0].Nodes.Cast <SectionNode>().FirstOrDefault(s => s.Title == redoObject.SectionTitle);
                    if (_sectionNode != null)
                    {
                        if (_sectionNode.Nodes.Count >= redoObject.Question.No)
                        {
                            exam.Sections.First(s => s.Title == redoObject.SectionTitle).Questions.RemoveAt(redoObject.Question.No - 1);
                            _sectionNode.Nodes.RemoveAt(redoObject.Question.No - 1);
                        }
                    }
                    //
                    int j = 1;
                    foreach (QuestionNode questionNode_ in _sectionNode.Nodes)
                    {
                        questionNode_.Text        = "Question " + j;
                        questionNode_.Question.No = j;
                        j++;
                    }
                    break;

                case ActionType.Modify:
                    SectionNode sectionNode_ = trv_view_exam.Nodes[0].Nodes.Cast <SectionNode>().FirstOrDefault(s => s.Title == redoObject.SectionTitle);
                    if (sectionNode_ != null)
                    {
                        QuestionNode questionNode = (QuestionNode)sectionNode_.Nodes[redoObject.Question.No - 1];
                        questionNode.Question = redoObject.Question;
                        //
                        txt_explanation.Text      = redoObject.Question.Explanation;
                        txt_question_text.Text    = redoObject.Question.Text;
                        lbl_section_question.Text = "Section: " + trv_view_exam.SelectedNode.Parent.Text + " Question " + redoObject.Question.No;
                        pct_image.Image           = redoObject.Question.Image;
                        //
                        pan_options.Controls.Clear();
                        //
                        int k = 0;
                        if (redoObject.Question.IsMultipleChoice)
                        {
                            foreach (var option in redoObject.Question.Options)
                            {
                                OptionsControl ctrl = new OptionsControl()
                                {
                                    Letter   = option.Alphabet,
                                    Text     = option.Text,
                                    Location = new Point(2, k * 36)
                                };
                                if (redoObject.Question.Answers.Contains(option.Alphabet))
                                {
                                    ctrl.Checked = true;
                                }
                                pan_options.Controls.Add(ctrl);
                                k++;
                            }
                        }
                        else
                        {
                            foreach (var option in redoObject.Question.Options)
                            {
                                OptionControl ctrl = new OptionControl()
                                {
                                    Letter   = option.Alphabet,
                                    Text     = option.Text,
                                    Location = new Point(2, k * 36)
                                };
                                if (option.Alphabet == redoObject.Question.Answer)
                                {
                                    ctrl.Checked = true;
                                }
                                pan_options.Controls.Add(ctrl);
                                k++;
                            }
                        }
                    }
                    break;
                }
            }
        }
Example #22
0
        public DialogControl()
        {
            // generate inputs controls
            // supported types: string, int, float, bool, array

            var type       = typeof(T);
            var fieldInfos = type.GetFields();

            int LabelWidth = 80;
            int EditWidth  = 80;

            foreach (var fieldInfo in fieldInfos)
            {
                LabelWidth = Math.Max(LabelWidth, fieldInfo.Name.Length * 6);
            }

            foreach (var fieldInfo in fieldInfos)
            {
                if (!fieldInfo.IsPublic)
                {
                    continue;
                }

                var label = new LabelControl {
                    Bounds = new UniRectangle(0, 0, LabelWidth, 20), Text = fieldInfo.Name
                };
                Children.Add(label);

                if (fieldInfo.FieldType == typeof(int))
                {
                    var edit = new InputControl {
                        Name = fieldInfo.Name, Bounds = new UniRectangle(0, 0, EditWidth, 20), IsNumeric = true
                    };
                    Children.Add(edit);
                    Bounds.Size.Y += 25;
                }

                if (fieldInfo.FieldType == typeof(float))
                {
                    var edit = new InputControl {
                        Name = fieldInfo.Name, Bounds = new UniRectangle(0, 0, EditWidth, 20), IsNumeric = true
                    };
                    Children.Add(edit);
                    Bounds.Size.Y += 25;
                }

                if (fieldInfo.FieldType == typeof(string))
                {
                    var edit = new InputControl {
                        Name = fieldInfo.Name, Bounds = new UniRectangle(0, 0, EditWidth, 20)
                    };
                    Children.Add(edit);
                    Bounds.Size.Y += 25;
                }

                if (fieldInfo.FieldType == typeof(bool))
                {
                    var edit = new OptionControl {
                        Name = fieldInfo.Name, Bounds = new UniRectangle(0, 0, EditWidth, 20)
                    };
                    Children.Add(edit);
                    Bounds.Size.Y += 25;
                }

                if (fieldInfo.FieldType == typeof(DialogSelection))
                {
                    var edit = new ListControl {
                        Name = fieldInfo.Name, Bounds = new UniRectangle(0, 0, EditWidth, 80), SelectionMode = ListSelectionMode.Single
                    };
                    Children.Add(edit);
                    Bounds.Size.Y += 85;
                }

                if (fieldInfo.FieldType == typeof(ByteColor))
                {
                    var edit = new ColorButtonControl
                    {
                        Name   = fieldInfo.Name,
                        Bounds = new UniRectangle(0, 0, EditWidth, 20)
                    };
                    edit.Pressed += delegate {
                        var colorDialog = new ColorDialog();
                        colorDialog.Color = System.Drawing.Color.FromArgb(edit.Color.A, edit.Color.R, edit.Color.G, edit.Color.B);
                        if (colorDialog.ShowDialog() == DialogResult.OK)
                        {
                            edit.Color = new ByteColor(colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B, colorDialog.Color.A);
                        }
                    };
                    Children.Add(edit);
                    Bounds.Size.Y += 25;
                }
            }

            _buttonOk = new ButtonControl {
                Text = "Ok", Bounds = new UniRectangle(0, 0, 50, 20)
            };
            _buttonOk.Pressed += delegate { ApplyDialog(); };
            _buttonCancel      = new ButtonControl {
                Text = "Cancel", Bounds = new UniRectangle(0, 0, 50, 20)
            };
            _buttonCancel.Pressed += delegate { HideDialog(); };

            var buttonsGroup = new Control {
                Bounds = new UniRectangle(0, 0, 105, 20), LayoutFlags = ControlLayoutFlags.WholeRowCenter, LeftTopMargin = new Vector2()
            };

            buttonsGroup.Children.Add(_buttonOk);
            buttonsGroup.Children.Add(_buttonCancel);
            buttonsGroup.UpdateLayout();

            Children.Add(buttonsGroup);

            Bounds.Size.Y += 60;
            Bounds.Size.X  = 120 + LabelWidth;

            UpdateLayout();
        }
Example #23
0
    void Awake()
    {
        playerInstance = GameObject.Find("Player").GetComponent<Player>();

        gameControlInstance = gc.GetComponent<GameControl> ();
        gameControlGUIInstance = gc.GetComponent<GameControlGUI> ();
        shopControlInstance = gc.GetComponent<ShopControl> ();
        shopControlGUIInstance = gc.GetComponent<ShopControlGUI> ();
        clickControlInstance = gc.GetComponent<ClickControl> ();
        gridControlInstance = gc.GetComponent<GridControl>();
        optionControlInstance = gc.GetComponent<OptionControl>();
        dragControlInstance = gc.GetComponent<DragControl>();
        eventGUIInstance = gc.GetComponent<EventGUI>();
        enemyLibraryInstance = gc.GetComponent<EnemyLibrary>();
        cardLibraryInstance = gc.GetComponent<CardLibrary>();
        goalLibraryInstance = gc.GetComponent<GoalLibrary>();
        guiStyleLibraryInstance = gc.GetComponent<GUIStyleLibrary>();
        mainMenuInstance = gc.GetComponent<MainMenu>();
        encyclopediaMenuInstance = gc.GetComponent<EncyclopediaMenu>();
        godChoiceMenuInstance = gc.GetComponent<GodChoiceMenu>();
        customizeMenuInstance = gc.GetComponent<CustomizeMenu>();
        gridCursorControlInstance = gc.GetComponent<GridCursorControl>();
        menuControlInstance = gc.GetComponent<MenuControl>();
        tutorialInstance = gc.GetComponent<Tutorial>();
        deckAnimateInstance = deck.GetComponent<DeckAnimate>();

        shopAndGoalParentCanvasInstance = goalandshopparent
                                          .GetComponent<ShopAndGoalParentCanvas>();
        shopGridCanvasInstance = shopgrid
                                 .GetComponent<ShopGridCanvas>();
        gridCursorControlGUIInstance = gridcursorcontrolgui
                                       .GetComponent<GridCursorControlGUI>();
    }
Example #24
0
        private void InitializeComponent()
        {
            Bounds = LayoutManager.Instance.NavigatorPanelBounds;
            EnableDragging = false;
            SkinName = "navigator.panel";

            //Contruct Children
            horizontalSlider = new SkinNamedHorizontalSliderControl();
            verticalSlider = new SkinNamedVerticalSliderControl();
            playPauseButton = new OptionControl();
            stopButton = new SkinNamedButtonControl();
            tempoLabel = new SkinNamedLabelControl();
            timeSignatureNLabel = new SkinNamedLabelControl();
            timeSignatureDLabel = new SkinNamedLabelControl();

            //
            // playPauseButton
            //
            playPauseButton.Bounds = LayoutManager.Instance.PlayPauseButtonBounds;
            playPauseButton.Changed += new EventHandler(PlayPauseButtonToggled);
            playPauseButton.Selected = false;

            //
            // stopButton
            //
            stopButton.Bounds = LayoutManager.Instance.StopButtonBounds;
            stopButton.Pressed += new EventHandler(StopButtonPressed);
            stopButton.SkinName = "stop";

            //
            // horizontalSlider
            //
            horizontalSlider.Bounds = LayoutManager.Instance.HorizontalScrollBarBounds;
            horizontalSlider.ThumbPosition = LayoutManager.Instance.HorizontalSliderThumbSize;
            horizontalSlider.Moved += new EventHandler(HorizontalSliderMoved);
            horizontalSlider.SkinName = "navigator";

            //
            // verticalSlider
            //
            verticalSlider.Bounds = LayoutManager.Instance.VerticalScrollBarBounds;
            verticalSlider.ThumbPosition = LayoutManager.Instance.VerticalSliderThumbSize;
            verticalSlider.Moved += new EventHandler(VerticalSliderMoved);
            verticalSlider.SkinName = "navigator";

            //
            // tempoLabel
            //
            tempoLabel.Bounds = LayoutManager.Instance.TempoLabelBounds;
            tempoLabel.Text = "Tempo: " + InputParameters.Instance.Tempo.ToString();
            tempoLabel.SkinName = "settings";

            //
            // timeSignatureNLabel
            //
            timeSignatureNLabel.Bounds = LayoutManager.Instance.TimeSignatureNLabelBounds;
            timeSignatureNLabel.Text = "Time Signature: " + InputParameters.Instance.TimeSignatureN.ToString();
            timeSignatureNLabel.SkinName = "settings";

            //
            // timeSignatureDLabel
            //
            timeSignatureDLabel.Bounds = LayoutManager.Instance.TimeSignatureDLabelBounds;
            timeSignatureDLabel.Text = InputParameters.Instance.TimeSignatureD.ToString();
            timeSignatureDLabel.SkinName = "settings";

            //Add Children
            Children.Add(playPauseButton);
            Children.Add(stopButton);
            Children.Add(horizontalSlider);
            Children.Add(verticalSlider);
            Children.Add(tempoLabel);
            Children.Add(timeSignatureNLabel);
            Children.Add(timeSignatureDLabel);
        }