コード例 #1
0
ファイル: Menu.cs プロジェクト: Lautenschlager-id/HeadWars
        // Methods
        /// Constructor
        public Menu()
        {
            buttons.Add(new HButton(Translation.GetString("play")));
            buttons.Add(new HButton(Translation.GetString("skills")));
            buttons.Add(new HButton(Translation.GetString("options")));
            buttons.Add(new HButton(Translation.GetString("code")));
            buttons.Add(new HButton(Translation.GetString("credits")));
            buttons.Add(new HButton(Translation.GetString("logout")));

            // Resizes the window
            HeadWars.Resize(250, 130 + (buttons.Count * 32));

            for (int i = 0; i < buttons.Count; i++)
            {
                buttons[i].setPosition(0, 60 + (i * 45), "xcenter");
            }

            // Title
            label = new HLabel(Translation.GetString("menu"), Font.WindowTitle);
            label.setPosition(0, 0, "xcenter top");

            if (HeadWars.changedSoundtrack)
            {
                MediaPlayer.Play(Sound.MenuMusic);
                HeadWars.changedSoundtrack = false;
            }
        }
コード例 #2
0
        // Methods
        /// Constructor
        public HTextBox(int x, int y, int maxChar = 12, Boolean hide = false, int width = 100, int height = 30)
            : base(x, y, width, height)
        {
            maxCharacters = maxChar;
            hideText      = hide;

            componentColor = new Color[] { Color.CadetBlue, Color.LightSlateGray };
            contentColor   = new Color[] { Color.White, Color.WhiteSmoke };

            label = new HLabel(componentRectangle, "", Font.Text);
            label.setColor(contentColor);
        }
コード例 #3
0
        // Methods
        /// Constructor
        public HButton(string buttonText = "", int x = 10, int y = 10, int width = 120, int height = 30)
            : base(x, y, width, height)
        {
            componentColor = new Color[] { Color.CadetBlue, Color.LightSlateGray };
            contentColor   = new Color[] { Color.White, Color.WhiteSmoke };

            label = new HLabel(componentRectangle, buttonText, Font.Text);
            label.setColor(contentColor);

            setHoverSound = Sound.buttonHover;
            setClickSound = Sound.buttonClick;
        }
コード例 #4
0
        // Methods
        /// Constructor
        public GameMode()
        {
            HeadWars.mode = -1;

            buttons.Add(new HButton(Translation.GetString("normal")));
            buttons.Add(new HButton("ETECH"));
            // Back to Menu
            buttons.Add(new HButton(Translation.GetString("button_back")));

            // Resizes the window
            HeadWars.Resize(200, 70 + (buttons.Count * 40));

            for (int i = 0; i < buttons.Count; i++)
            {
                buttons[i].setPosition(0, 70 + (i * 40), "xcenter");
            }

            // Title
            label = new HLabel(Translation.GetString("modes"), Font.WindowTitle);
            label.setPosition(0, 0, "xcenter top");
        }
コード例 #5
0
        // Methods
        /// Constructor
        public ModeOption()
        {
            if (HeadWars.mode == 1)
            {
                buttons.Add(new HButton("MB"));
                buttons.Add(new HButton("I"));
            }

            // Back to GameMode
            buttons.Add(new HButton(Translation.GetString("button_back")));

            // Resizes the window
            HeadWars.Resize(200, 70 + (buttons.Count * 40));

            for (int i = 0; i < buttons.Count; i++)
            {
                buttons[i].setPosition(0, 70 + (i * 40), "xcenter");
            }

            // Title
            label = new HLabel(Translation.GetString("modes"), Font.WindowTitle);
            label.setPosition(0, 0, "xcenter top");
        }