public ChatInputForm(Manager _manager, Vector2 _pos, int width)
 {
     manager = _manager;
     Init(_pos, width);
     Position = _pos;
     manager.Add(txtBox);
 }
Beispiel #2
0
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            ngui = Gui as NeoforceGui;
            manager = ngui.Manager;

            Window window = new Window(manager);
            window.Init();
            window.Text = "Options";
            window.Width = 480;
            window.Height = 200;
            window.Center();
            window.Visible = true;

            Button button = new Button(manager);
            button.Init();
            button.Text = "OK";
            button.Width = 72;
            button.Height = 24;
            button.Left = (window.ClientWidth / 2) - (button.Width / 2);
            button.Top = window.ClientHeight - button.Height - 8;
            button.Anchor = Anchors.Bottom;
            button.Parent = window;
            button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click);

            manager.Add(window);
        }
        private UnitInfoDialog(Manager manager)
            : base(manager)
        {
            Init();

            Height = 300;
            Width = 500;

            txtBox = new TextBox(manager);
            txtBox.Init();
            txtBox.Width = ClientWidth;
            txtBox.Height = ClientHeight - 30;
            txtBox.Left = 0;
            txtBox.Top = 0;
            txtBox.Parent = this;

            okButton = new Button(manager);
            okButton.Init();
            okButton.Text = "OK";
            okButton.Width = txtBox.Width; ;
            okButton.Height = 30;
            okButton.Top = txtBox.Height;
            okButton.Parent = this;
            okButton.Click += new TomShane.Neoforce.Controls.EventHandler(okButton_Click);

            manager.Add(this);
        }
        private EditNodeWindow(Sidebar sidebar, ViewType viewType)
        {
            this.sidebar = sidebar;
            this.manager = sidebar.manager;
            neoSidebar = new NeoSidebar(manager);
            neoSidebar.Init();
            int tomtom = 5;
            neoSidebar.ClientArea.BackColor = UserInterface.TomDark;
            neoSidebar.BackColor = Color.Black;
            neoSidebar.BevelBorder = BevelBorder.All;
            Margins tomtomtomtom = new Margins(tomtom, tomtom, tomtom, tomtom);
            neoSidebar.ClientMargins = tomtomtomtom;

            neoSidebar.Left = sidebar.master.Left;
            neoSidebar.Width = sidebar.Width;
            neoSidebar.Top = 0;
            neoSidebar.Resizable = false;
            neoSidebar.Movable = false;
            neoSidebar.Height = OrbIt.ScreenHeight;
            neoSidebar.Text = "Edit";
            manager.Add(neoSidebar);

            int width = 120;
            int offset = neoSidebar.Width - width - 20;

            titlePanelEditNode = new TitlePanel(sidebar, neoSidebar, "Edit", true);
            titlePanelEditNode.btnBack.Click += (s, e) =>
            {
                sidebar.groupsView.UpdateGroups();
                manager.Remove(neoSidebar);
            };

            HeightCounter += titlePanelEditNode.Height;

            lblName = new Label(manager);
            lblName.Init();
            lblName.Parent = neoSidebar;
            lblName.Left = LeftPadding;
            lblName.Top = HeightCounter;
            lblName.Width = width;

            txtName = new TextBox(manager);
            txtName.Init();
            txtName.Parent = neoSidebar;
            txtName.Top = HeightCounter;
            txtName.Width = width;
            txtName.Left = offset;
            HeightCounter += txtName.Height + LeftPadding;
            txtName.TextColor = Color.Black;
            txtName.Enabled = false;

            componentView = new ComponentView(sidebar, neoSidebar, 0, HeightCounter, viewType);
            componentView.Width = neoSidebar.Width - 20;
            componentView.insView.Height += componentView.insView.Height / 2;

            neoSidebar.Width += 100;
            neoSidebar.Width -= 100;
        }
Beispiel #5
0
 public MessageBox(Manager manager, MessageBoxType type)
     : base(manager)
 {
     Type = type;
     buttons = new List<Button>();
     Init();
     manager.Add(window);
     Pop();
 }
        //, Control under)
        public LoadLevelWindow(Sidebar sidebar)
        {
            previouslyPaused = sidebar.ui.IsPaused;
            sidebar.ui.IsPaused = true;
            sidebar.master.Visible = false;
            Control par = sidebar.tbcViews.TabPages[0];
            UserInterface.GameInputDisabled = true;
            this.manager = sidebar.manager;
            this.sidebar = sidebar;
            tomShaneSidebar = new TomShaneSidebar(manager);
            tomShaneSidebar.Init();
            tomShaneSidebar.Left = sidebar.master.Left;
            tomShaneSidebar.Width = par.Width;
            tomShaneSidebar.Top = 20;
            tomShaneSidebar.Height = par.Height + 15;
            tomShaneSidebar.BevelBorder = BevelBorder.All;
            tomShaneSidebar.BevelColor = Color.Black;
            tomShaneSidebar.Left = LeftPadding;
            tomShaneSidebar.Text = "Load Level";
            tomShaneSidebar.BackColor = new Color(30, 60, 30);
            manager.Add(tomShaneSidebar);

            wallGroup = sidebar.room.groups.walls;
            foreach(Node n in wallGroup.entities)
            {
                previousWallNodes.Add(n);
            }

            TitlePanel titlePanelAddComponent = new TitlePanel(sidebar, tomShaneSidebar, "Load Level", false);
            //titlePanelAddComponent.btnBack.Click += Close;
            HeightCounter += titlePanelAddComponent.Height;

            normalView = new NormalView(sidebar, tomShaneSidebar, 0, 100, Height: 350);
            normalView.Width -= 15;
            PopulateLevelSaves();

            normalView.OnSelectionChanged += normalView_OnSelectionChanged;

            btnLoad = new Button(manager);
            btnLoad.Init();
            tomShaneSidebar.Add(btnLoad);
            btnLoad.Text = "Load";
            btnLoad.Top = 500;
            btnLoad.Left = LeftPadding * 4;
            btnLoad.Width = 70;
            btnLoad.Click += btnLoad_Click;

            btnCancel = new Button(manager);
            btnCancel.Init();
            tomShaneSidebar.Add(btnCancel);
            btnCancel.Text = "Cancel";
            btnCancel.Top = 500;
            btnCancel.Left = btnLoad.Left + btnLoad.Width + 50;
            btnCancel.Width = 70;
            btnCancel.Click += btnCancel_Click;
        }
 public TowerBaseInfoWindow(Manager manager)
     : base(manager)
 {
     lblInterval = new Label(manager);
     lblDamage = new Label(manager);
     lblDescription = new RappingLabel(manager);
     lblRange = new Label(manager);
     lblPrice = new Label(manager);
     manager.Add(this);
 }
Beispiel #8
0
 public MessageBox(Manager manager, MessageBoxType type, String _message, String _title)
     : base(manager)
 {
     Type = type;
     buttons = new List<Button>();
     message = _message;
     title = _title;
     Init();
     manager.Add(window);
     Pop();
 }
Beispiel #9
0
 public GameOverWindow(Manager manager, GamePlayScreen screen)
     : base(manager)
 {
     GamePlayScreen = screen;
     LostMessage = new RappingLabel(manager);
     Points = new Label(manager);
     RestartGame = new Button(manager);
     GoMainMenu = new Button(manager);
     ExitGame = new Button(manager);
     manager.Add(this);
 }
        public GamemodeWindow(Sidebar sidebar)
        {
            this.manager = sidebar.manager;
            this.sidebar = sidebar;

            window = new Window(manager);
            window.Init();
            window.Left = sidebar.master.Left;
            window.Width = sidebar.master.Width;
            window.Top = 0;
            window.Height = 600;
            window.Text = "Game Mode";
            manager.Add(window);

            TitlePanel titlePanel = new TitlePanel(sidebar, window, "Game Mode", true);
            titlePanel.btnBack.Click += (s, e) => window.Close();

            HeightCounter += titlePanel.topPanel.Height + LeftPadding * 2;

            lblMode = new Label(manager);
            lblMode.Init();
            lblMode.Parent = window;
            lblMode.Top = HeightCounter;
            lblMode.Left = LeftPadding;
            lblMode.Text = "Game Mode Options";
            lblMode.Width = 120;
            lblMode.TextColor = Color.Black;

            //cbMode = new ComboBox(manager);
            //cbMode.Init();
            //cbMode.Parent = window;
            //cbMode.Left = lblMode.Left + lblMode.Width;
            //cbMode.Top = HeightCounter;
            //cbMode.Width = 100;
            //
            //foreach (GameModes m in Enum.GetValues(typeof(GameModes)))
            //{
            //    cbMode.Items.Add(m);
            //}
            HeightCounter += lblMode.Height + LeftPadding * 3;

            insViewModes = new InspectorView(sidebar, window, LeftPadding, HeightCounter);
            insViewModes.Width -= 20;
            insViewModes.Height -= 100;
            HeightCounter += insViewModes.Height + LeftPadding * 3;
            insViewModes.SetRootObject(OrbIt.globalGameMode);

            //insViewGlobal = new InspectorView(sidebar, window, LeftPadding, HeightCounter);
            //insViewGlobal.Width -= 20;
            //insViewGlobal.Height -= 100;

            window.Refresh();
        }
        /// <summary>
        /// Shows the simple input dialog.
        /// </summary>
        public void ShowSimpleInputDialog(Manager manager, string caption, string text, string initialValue,
            TomShane.Neoforce.Controls.EventHandler okBtnEventHandler)
        {
            window = new Window(manager);
            window.Init();
            window.Width = 450;
            window.Height = 150;
            window.Text = caption;
            window.Closing += OnSimpleInputDialogClosing;
            window.Visible = true;

            Label label = new Label(manager);
            label.Init();
            label.Text = text;
            label.Width = 400;
            label.Height = 20;
            label.Left = 5;
            label.Top = 5;
            label.Parent = window;

            TextBox textBox = new TextBox(manager);
            textBox.Init();
            textBox.Width = 400;
            textBox.Height = 20;
            textBox.Left = 5;
            textBox.Top = 40;
            textBox.Text = initialValue;
            textBox.Parent = window;

            Button btnSimpleInputDialogOk = new Button(manager);
            btnSimpleInputDialogOk.Init();
            btnSimpleInputDialogOk.Text = "Ok";
            btnSimpleInputDialogOk.Width = 100;
            btnSimpleInputDialogOk.Height = 30;
            btnSimpleInputDialogOk.Left = 5;
            btnSimpleInputDialogOk.Top = 75;
            btnSimpleInputDialogOk.Click += okBtnEventHandler;
            btnSimpleInputDialogOk.Click += OnClickBtnSimpleInputDialogOk;
            btnSimpleInputDialogOk.Tag = textBox; // Textbox as Tag, to access the value
            btnSimpleInputDialogOk.Parent = window;

            Button btnSimpleInputDialogCancel = new Button(manager);
            btnSimpleInputDialogCancel.Init();
            btnSimpleInputDialogCancel.Text = "Cancel";
            btnSimpleInputDialogCancel.Width = 100;
            btnSimpleInputDialogCancel.Height = 30;
            btnSimpleInputDialogCancel.Left = 110;
            btnSimpleInputDialogCancel.Top = 75;
            btnSimpleInputDialogCancel.Click += OnClickBtnSimpleInputDialogCancel;
            btnSimpleInputDialogCancel.Parent = window;

            manager.Add(window);
        }
        private AddComponentWindow(Sidebar sidebar, Control under, DetailedView view, bool addToGroup = true)
        {
            this.under = under;
            under.Visible = false;
            sidebar.master.Visible = false;
            this.addToGroup = addToGroup;

            Control par = sidebar.tbcViews.TabPages[0];
            UserInterface.GameInputDisabled = true;
            this.view = view;
            this.manager = sidebar.manager;
            this.sidebar = sidebar;
            neoSidebar = new NeoSidebar(manager);
            neoSidebar.Init();
            neoSidebar.Left = sidebar.master.Left;
            neoSidebar.Width = par.Width;
            neoSidebar.Top = 5;
            neoSidebar.Height = par.Height + 15;
            neoSidebar.BevelBorder = BevelBorder.All;
            neoSidebar.BevelColor = Color.Black;
            neoSidebar.Left = LeftPadding;
            neoSidebar.Text = "Add Component";
            neoSidebar.BackColor = new Color(30, 60, 30);
            manager.Add(neoSidebar);

            TitlePanel titlePanelAddComponent = new TitlePanel(sidebar, neoSidebar, "Add Component", true);
            titlePanelAddComponent.btnBack.Click += Close;
            HeightCounter += titlePanelAddComponent.Height;
            NewLabel("Add", 15, false);
            NewLabel("Name", 50, false);
            int left = 145;
            NewLabel("AO", left, false);
            NewLabel("AS", left + 20, false);
            NewLabel("DR", left + 40, false);

            btnAdd = new Button(manager);
            btnAdd.Init();
            btnAdd.Parent = neoSidebar;
            btnAdd.Width = 150;
            btnAdd.Top = neoSidebar.Height - btnAdd.Height * 2;
            btnAdd.Left = neoSidebar.Width / 2 - btnAdd.Width / 2;
            btnAdd.Text = "Add Components";
            btnAdd.Click += AddComponents;
        }
        /// <summary>
        /// Shows the chose enum dialog.
        /// </summary>
        public void ShowChooseEnumDialog(Manager manager, string caption, Type type, EnumChooseEventHandler btnEventHandler)
        {
            _type = type;
            _handler = btnEventHandler;

            window = new Window(manager);
            window.Init();
            window.Width = 175;
            window.Text = caption;
            window.Icon = IconProvider.ApplicationIcon;
            window.CaptionVisible = true;
            window.Closing += OnChooseEnumDialogClosing;
            window.Visible = true;

            if (!type.IsEnum)
            {
                CloseDialog();
            }
            else
            {
                int offsetY = 5;

                foreach (object value in Enum.GetValues(type))
                {
                    string name = value.ToString();

                    Button btnEnumName = new Button(manager);
                    btnEnumName.Init();
                    btnEnumName.Text = name;
                    btnEnumName.Width = 150;
                    btnEnumName.Height = 30;
                    btnEnumName.Left = 5;
                    btnEnumName.Top = offsetY;
                    btnEnumName.Tag = value;
                    btnEnumName.Click += OnClickBtnEnumName;
                    btnEnumName.Parent = window;

                    offsetY += 35;
                }

                window.Height = offsetY + 35;
                manager.Add(window);
            }
        }
        public EditLinkWindow(Sidebar sidebar, Link link, string FieldName)
        {
            this.sidebar = sidebar;
            this.manager = sidebar.manager;
            neoSidebar = new NeoSidebar(manager);
            neoSidebar.Init();
            int tomtom = 5;
            neoSidebar.ClientArea.BackColor = UserInterface.TomDark;
            neoSidebar.BackColor = Color.Black;
            neoSidebar.BevelBorder = BevelBorder.All;
            Margins tomtomtomtom = new Margins(tomtom, tomtom, tomtom, tomtom);
            neoSidebar.ClientMargins = tomtomtomtom;

            neoSidebar.Left = sidebar.master.Left;
            neoSidebar.Width = sidebar.Width;
            neoSidebar.Top = 0;
            neoSidebar.Resizable = false;
            neoSidebar.Movable = false;
            neoSidebar.Height = OrbIt.ScreenHeight;
            neoSidebar.Text = "Edit";
            manager.Add(neoSidebar);

            int width = 120;
            int offset = neoSidebar.Width - width - 20;

            titlePanelEditNode = new TitlePanel(sidebar, neoSidebar, "Edit" + FieldName, true);
            titlePanelEditNode.btnBack.Click += (s, e) =>
            {
                sidebar.groupsView.UpdateGroups();
                manager.Remove(neoSidebar);
            };

            HeightCounter += titlePanelEditNode.Height;

            componentView = new ComponentView(sidebar, neoSidebar, 0, HeightCounter, ViewType.Link);
            componentView.Width = neoSidebar.Width - 20;
            componentView.insView.Height += componentView.insView.Height / 2;

            neoSidebar.Width += 100;
            neoSidebar.Width -= 100;

            componentView.SwitchLink(link);
        }
Beispiel #15
0
        public void GuiInitialize(Manager manager, GraphicsDeviceManager graphics)
        {
            // Create and setup Window control.
            BottomBar = new Window(manager);
            BottomBar.Init();
            BottomBar.Width = graphics.PreferredBackBufferWidth;
            BottomBar.Height = 100;
            BottomBar.Top = graphics.PreferredBackBufferHeight - BottomBar.Height;
            BottomBar.Left = 0;
            BottomBar.BorderVisible = false;
            BottomBar.Movable = false;
            BottomBar.Resizable = false;
            BottomBar.Visible = true;

            // Create Alert Text
            textbox = new TextBox(manager);
            textbox.Init();
            textbox.Text = "In philosophy and science, emergence is the way complex systems and patterns arise out of a multiplicity of relatively simple interactions.";
            textbox.Width = 830;
            textbox.Height = 20;
            textbox.ReadOnly = true;
            textbox.Passive = true;
            textbox.Left = (1024 / 2) - (textbox.Width / 2);
            textbox.Top = 0;
            textbox.Parent = BottomBar;

            #region BottomBar
            // Create Tool Select.
            radStimulant = new RadioButton(manager);
            radStimulant.Init();
            radStimulant.Parent = BottomBar;
            radStimulant.Left = (1024 / 2) - (textbox.Width / 2);
            radStimulant.Top = 30;
            radStimulant.Width = 100;
            radStimulant.Height = 16;
            radStimulant.Text = "Stimulant";
            radStimulant.Checked = false;
            radStimulant.Click += new MouseEventHandler(Tool_Click);

            radPoison = new RadioButton(manager);
            radPoison.Init();
            radPoison.Parent = BottomBar;
            radPoison.Left = (1024 / 2) - (textbox.Width / 2) + 110;
            radPoison.Top = 30;
            radPoison.Width = 100;
            radPoison.Height = 16;
            radPoison.Text = "Poison";
            radPoison.Checked = false;
            radPoison.Click += new MouseEventHandler(Tool_Click);

            radMutigen = new RadioButton(manager);
            radMutigen.Init();
            radMutigen.Parent = BottomBar;
            radMutigen.Left = (1024 / 2) - (textbox.Width / 2) + 220;
            radMutigen.Top = 30;
            radMutigen.Width = 100;
            radMutigen.Height = 16;
            radMutigen.Text = "Mutigen";
            radMutigen.Checked = false;
            radMutigen.Click += new MouseEventHandler(Tool_Click);

            radGrab = new RadioButton(manager);
            radGrab.Init();
            radGrab.Parent = BottomBar;
            radGrab.Left = (1024 / 2) - (textbox.Width / 2) + 330;
            radGrab.Top = 30;
            radGrab.Width = 100;
            radGrab.Height = 16;
            radGrab.Text = "Grab";
            radGrab.Checked = true;
            radGrab.Click += new MouseEventHandler(Tool_Click);

            // Create Settings button.
            btnSettings = new Button(manager);
            btnSettings.Init();
            btnSettings.Text = "Settings";
            btnSettings.Width = 72;
            btnSettings.Height = 24;
            btnSettings.Left = 10;
            btnSettings.Top = 10;
            btnSettings.Anchor = Anchors.Bottom;
            btnSettings.Parent = BottomBar;
            btnSettings.Click += new MouseEventHandler(btnSettings_Click);

            // Create Sample button.
            btnSample = new Button(manager);
            btnSample.Init();
            btnSample.Text = "Sample";
            btnSample.Width = 72;
            btnSample.Height = 24;
            btnSample.Left = 10;
            btnSample.Top = 44;
            btnSample.Anchor = Anchors.Bottom;
            btnSample.Parent = BottomBar;
            btnSample.Click += new MouseEventHandler(btnSample_Click);

            // Create Edit button.
            btnEdit = new Button(manager);
            btnEdit.Init();
            btnEdit.Text = "Edit";
            btnEdit.Width = 72;
            btnEdit.Height = 24;
            btnEdit.Left = textbox.Left + textbox.Width - btnEdit.Width;
            btnEdit.Top = textbox.Top + textbox.Height + 10;
            btnEdit.Anchor = Anchors.Bottom;
            btnEdit.Parent = BottomBar;
            btnEdit.Click += new MouseEventHandler(btnEdit_Click);

            // Create Save Button.
            btnSave = new Button(manager);
            btnSave.Init();
            btnSave.Text = "Save";
            btnSave.Width = 72;
            btnSave.Height = 24;
            btnSave.Left = 1024 - btnSave.Width - 10;
            btnSave.Top = 10;
            btnSave.Anchor = Anchors.Bottom;
            btnSave.Parent = BottomBar;

            // Create Load Button.
            btnLoad = new Button(manager);
            btnLoad.Init();
            btnLoad.Text = "Load";
            btnLoad.Width = 72;
            btnLoad.Height = 24;
            btnLoad.Left = 1024 - btnLoad.Width - 10;
            btnLoad.Top = 44;
            btnLoad.Anchor = Anchors.Bottom;
            btnLoad.Parent = BottomBar;
            #endregion

            #region SettingsPane
            //Create Settings Pane
            wndSettings = new Window(manager);
            wndSettings.Init();
            wndSettings.Text = "Settings";
            wndSettings.Width = 400;
            wndSettings.Height = 300;
            wndSettings.Top = 20;
            wndSettings.Left = 20;
            wndSettings.Resizable = false;
            wndSettings.Visible = false;

            //Create Environment settings

            lblMutRate = new Label(manager);
            lblMutRate.Init();
            lblMutRate.Parent = wndSettings;
            lblMutRate.Left = 10;
            lblMutRate.Top = 10;
            lblMutRate.Text = "Mutation rate:";
            lblMutRate.Width = 130;
            lblMutRate.Height = 20;

            spnMutRate = new SpinBox(manager, SpinBoxMode.Range);
            spnMutRate.Init();
            spnMutRate.ReadOnly = true;
            spnMutRate.Width = 60;
            spnMutRate.Height = 20;
            spnMutRate.Top = 30;
            spnMutRate.Left = 10;
            spnMutRate.Maximum = 10;
            spnMutRate.Minimum = 0;
            spnMutRate.Rounding = 0;
            spnMutRate.Value = Game1.Globals.MutationRate;
            spnMutRate.Step = 1;
            spnMutRate.Passive = true;
            spnMutRate.Text = Convert.ToString(spnMutRate.Value);
            spnMutRate.Parent = wndSettings;

            lblSolar = new Label(manager);
            lblSolar.Init();
            lblSolar.Parent = wndSettings;
            lblSolar.Left = 10;
            lblSolar.Top = 60;
            lblSolar.Text = "Solar Radiation:";
            lblSolar.Width = 130;
            lblSolar.Height = 20;

            spnSolar = new SpinBox(manager, SpinBoxMode.Range);
            spnSolar.Init();
            spnSolar.ReadOnly = true;
            spnSolar.Width = 60;
            spnSolar.Height = 20;
            spnSolar.Top = 80;
            spnSolar.Left = 10;
            spnSolar.Maximum = 10;
            spnSolar.Minimum = 0;
            spnSolar.Rounding = 0;
            spnSolar.Step = 1;
            spnSolar.Value = Game1.Globals.SolarIntensity;
            spnSolar.Passive = true;
            spnSolar.Text = Convert.ToString(spnSolar.Value);
            spnSolar.Parent = wndSettings;

            lblLifeSpan = new Label(manager);
            lblLifeSpan.Init();
            lblLifeSpan.Parent = wndSettings;
            lblLifeSpan.Left = 10;
            lblLifeSpan.Top = 110;
            lblLifeSpan.Text = "Life in Mins:";
            lblLifeSpan.Width = 130;
            lblLifeSpan.Height = 20;

            spnLifeSpan = new SpinBox(manager, SpinBoxMode.Range);
            spnLifeSpan.Init();
            spnLifeSpan.ReadOnly = true;
            spnLifeSpan.Width = 60;
            spnLifeSpan.Height = 20;
            spnLifeSpan.Top = 130;
            spnLifeSpan.Left = 10;
            spnLifeSpan.Maximum = 30;
            spnLifeSpan.Minimum = 0;
            spnLifeSpan.Rounding = 0;
            spnLifeSpan.Step = 1;
            spnLifeSpan.Value = Game1.Globals.SymetLifespan;
            spnLifeSpan.Passive = true;
            spnLifeSpan.Text = Convert.ToString(spnLifeSpan.Value);
            spnLifeSpan.Parent = wndSettings;

            lblSpeed = new Label(manager);
            lblSpeed.Init();
            lblSpeed.Parent = wndSettings;
            lblSpeed.Left = 10;
            lblSpeed.Top = 160;
            lblSpeed.Text = "Game Speed:";
            lblSpeed.Width = 130;
            lblSpeed.Height = 20;

            spnSpeed = new SpinBox(manager, SpinBoxMode.Range);
            spnSpeed.Init();
            spnSpeed.ReadOnly = true;
            spnSpeed.Width = 60;
            spnSpeed.Height = 20;
            spnSpeed.Top = 180;
            spnSpeed.Left = 10;
            spnSpeed.Maximum = 10;
            spnSpeed.Minimum = 0;
            spnSpeed.Rounding = 0;
            spnSpeed.Step = 1;
            spnSpeed.Value = Game1.Globals.SymetSpeed;
            spnSpeed.Text = Convert.ToString(spnSpeed.Value);
            spnSpeed.Passive = true;
            spnSpeed.Parent = wndSettings;

            // Create Done Button.
            btnSettingsClose = new Button(manager);
            btnSettingsClose.Init();
            btnSettingsClose.Text = "Done";
            btnSettingsClose.Width = 72;
            btnSettingsClose.Height = 24;
            btnSettingsClose.Left = 400 - 92;
            btnSettingsClose.Top = 300 - 64;
            btnSettingsClose.Anchor = Anchors.Bottom;
            btnSettingsClose.Parent = wndSettings;
            btnSettingsClose.Click += new MouseEventHandler(btnDone_Click);
            #endregion

            // Add the window controls to the manager processing queue.
            manager.Add(BottomBar);
            manager.Add(wndSettings);
        }
Beispiel #16
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="manager"></param>
        public DetoxConsole(Manager manager)
            : base(manager)
        {
            // Initialize this control..
            base.Init();
            base.Left = base.Top = 0;
            base.Name = "frmConsole";
            base.Width = Terraria.MainGame.Window.ClientBounds.Width;
            base.Height = 250;
            base.Alpha = 255;
            base.Resizable = false;
            //
            //
            //
            this._console = new TomShane.Neoforce.Controls.Console(manager)
                {
                    Anchor = Anchors.All,
                    Name = "DetoxConsole",
                    Width = base.ClientArea.Width,
                    Height = base.ClientArea.Height,
                    ChannelsVisible = false,
                    MessageFormat = ConsoleMessageFormats.TimeStamp,
                    TextColor = Color.White
                };
            this._console.Channels.AddRange(new[]
                {
                    new ConsoleChannel(0, "About", Color.Chartreuse),
                    new ConsoleChannel(1, "Default", Color.White),
                    new ConsoleChannel(2, "Warning", Color.Yellow),
                    new ConsoleChannel(3, "Error", Color.Red)
                });
            this._console.SelectedChannel = 1;
            this._console.MessageSent += (sender, e) =>
                {
                    // Ensure the command is valid..
                    if (string.IsNullOrEmpty(e.Message.Text) || !e.Message.Text.StartsWith("/"))
                        return;

                    // Attempt to handle the command..
                    e.Handled = ConsoleCommands.ProcessCommand(e.Message.Text);
                    if (!e.Handled)
                    {
                        this.LogConsoleMessage(new DetoxAPI.ConsoleMessage("Invalid command or command error occurred.", ConsoleMessageType.Error));
                        e.Handled = true;
                    }
                };
            this._console.Init();
            //
            //
            //
            base.Add(this._console);
            manager.Add(this);

            // Attach device settings event to resize console..
            manager.DeviceSettingsChanged += args =>
                {
                    // Adjust the base panel size..
                    base.Width = Terraria.MainGame.Window.ClientBounds.Width;
                    base.Height = 250;

                    // Adjust the console size..
                    this._console.Width = base.ClientArea.Width;
                    this._console.Height = base.ClientArea.Height;
                };

            // Locate the console textbox..
            var consoleEdit = this._console.Controls.SingleOrDefault(c => c.GetType() == typeof(TextBox));
            if (consoleEdit == null) return;

            consoleEdit.KeyDown += (sender, e) =>
                {
                    // Prevent tilde from being processed..
                    if (e.Key == Keys.OemTilde)
                        e.Handled = true;

                    // Force escape to remove focus from the console..
                    if (e.Key == Keys.Escape)
                    {
                        consoleEdit.Focused = false;
                        e.Handled = true;
                    }
                };
            consoleEdit.KeyPress += (sender, e) =>
                {
                    if (e.Key == Keys.OemTilde)
                        e.Handled = true;
                };
            consoleEdit.KeyUp += (sender, e) =>
                {
                    if (e.Key == Keys.OemTilde)
                        e.Handled = true;
                };
            consoleEdit.TextChanged += (sender, e) =>
                {
                    consoleEdit.Suspended = true;
                    consoleEdit.Text = consoleEdit.Text.Replace("`", "");
                    consoleEdit.Suspended = false;
                    e.Handled = true;
                };
            consoleEdit.FocusGained += (sender, e) => Terraria.SetMainField("chatMode", false);
            consoleEdit.FocusLost += (sender, e) => Terraria.SetMainField("chatMode", false);

            // Subscribe to the API console message event..
            DetoxAPI.Console.PrintConsoleMessage += (sender, e) => this.LogConsoleMessage(e);

            // Register some basic console commands..
            DetoxAPI.ConsoleCommands.AddCommnd(new List<string> { "help", "info", "h", "?" }, "Prints a list of registered console commands.", OnHelpCommand);
            DetoxAPI.ConsoleCommands.AddCommnd(new List<string> { "exit", "close", "terminate" }, "Exits Terraria immediately.", args => System.Windows.Forms.Application.Exit());
            DetoxAPI.ConsoleCommands.AddCommnd(new List<string> { "plugin", "extension", "p" }, "Handles a plugin command.", OnPluginCommand);
        }
Beispiel #17
0
        public override void LoadContent(ContentManager contentloader)
        {
            _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default");
            _guiman.Initialize();

            _mainmenu = new Window(_guiman);
            _mainmenu.Init();
            _mainmenu.Resizable = false;
            _mainmenu.Movable = false;
            _mainmenu.CloseButtonVisible = false;
            _mainmenu.Text = "Main Menu";
            _mainmenu.Width = 300;
            _mainmenu.Height = 400;
            _mainmenu.Center();
            _mainmenu.Visible = true;
            _mainmenu.BorderVisible = true;
            //mainmenu.Cursor = guiman.Skin.Cursors["Default"].Resource;

            _play = new Button(_guiman);
            _play.Init();
            _play.Text = "Play";
            _play.Width = 200;
            _play.Height = 50;
            _play.Left = 50;
            _play.Top = 0;
            _play.Anchor = Anchors.Bottom;
            _play.Parent = _mainmenu;

            _settings = new Button(_guiman);
            _settings.Init();
            _settings.Text = "Settings";
            _settings.Width = 200;
            _settings.Height = 50;
            _settings.Left = 50;
            _settings.Top = 50;
            _settings.Anchor = Anchors.Bottom;
            _settings.Parent = _mainmenu;

            _exit = new Button(_guiman);
            _exit.Init();
            _exit.Text = "Exit";
            _exit.Width = 200;
            _exit.Height = 50;
            _exit.Left = 50;
            _exit.Top = 100;
            _exit.Anchor = Anchors.Bottom;
            _exit.Parent = _mainmenu;

            _guiman.Cursor = _guiman.Skin.Cursors["Default"].Resource;
            _guiman.Add(_mainmenu);

            _gamemanager.Game.IsMouseVisible = true;
        }
        public CreateGroupWindow(Sidebar sidebar)
        {
            this.sidebar = sidebar;
            this.manager = sidebar.manager;
            sidebar.CreatingGroup = true;
            //sidebar.ui.game.SwitchToTempRoom();
            //temproom = sidebar.ui.game.tempRoom;
            //tempgroup = g;// sidebar.ActiveGroup;//temproom.groups.generalGroups.childGroups.ElementAt(0).Value;

            neoSidebar = new NeoSidebar(manager);
            neoSidebar.Init();
            int tomtom = 5;
            neoSidebar.ClientArea.BackColor = UserInterface.TomDark;
            neoSidebar.BackColor = Color.Black;
            neoSidebar.BevelBorder = BevelBorder.All;
            Margins tomtomtomtom = new Margins(tomtom, tomtom, tomtom, tomtom);
            neoSidebar.ClientMargins = tomtomtomtom;

            neoSidebar.Left = sidebar.master.Left;
            neoSidebar.Width = sidebar.Width;
            neoSidebar.Top = 0;
            neoSidebar.Height = OrbIt.ScreenHeight;
            //poop.Text = "Create Group";
            //poop.Closed += delegate { UserInterface.GameInputDisabled = false; sidebar.CreatingGroup = false; sidebar.ui.game.SwitchToMainRoom(); sidebar.groupsView.createGroupWindow = null; };
            //window.ShowModal();
            manager.Add(neoSidebar);

            int width = 120;
            int offset = neoSidebar.Width - width - 20;

            TitlePanel titlePanelCreateGroup = new TitlePanel(sidebar, neoSidebar, "Create Group", true);
            titlePanelCreateGroup.btnBack.Click += (s, e) => Close();

            HeightCounter += titlePanelCreateGroup.Height;

            Label lblName = new Label(manager);
            lblName.Init();
            lblName.Parent = neoSidebar;
            lblName.Left = LeftPadding;
            lblName.Top = HeightCounter;
            lblName.Width = width;
            lblName.Text = "Group Name:";

            TextBox txtName = new TextBox(manager);
            txtName.Init();
            txtName.Parent = neoSidebar;
            txtName.Top = HeightCounter;
            txtName.Width = width;
            txtName.Left = offset;
            HeightCounter += txtName.Height + LeftPadding;

            Button btnRandomName = new Button(manager);
            btnRandomName.Init();
            btnRandomName.Parent = neoSidebar;
            btnRandomName.Top = HeightCounter;
            btnRandomName.Width = txtName.Width;
            btnRandomName.Left = offset;
            btnRandomName.Text = "Random Name";
            HeightCounter += txtName.Height + LeftPadding;
            btnRandomName.Click += (s, e) =>
            {
                txtName.Text = Utils.RandomName();
            };

            RadioButton rdEmpty = new RadioButton(manager);
            rdEmpty.Init();
            rdEmpty.Parent = neoSidebar;
            rdEmpty.Top = HeightCounter;
            rdEmpty.Left = LeftPadding;
            rdEmpty.Text = "Default";
            rdEmpty.Checked = true;
            HeightCounter += rdEmpty.Height + LeftPadding;

            RadioButton rdExisting = new RadioButton(manager);
            rdExisting.Init();
            rdExisting.Parent = neoSidebar;
            rdExisting.Top = HeightCounter;
            rdExisting.Left = LeftPadding;
            rdExisting.Text = "Existing";
            rdExisting.Checked = false;
            rdExisting.Width = width;

            ComboBox cbExisting = new ComboBox(manager);
            cbExisting.Init();
            cbExisting.Parent = neoSidebar;
            cbExisting.Top = HeightCounter;
            cbExisting.Width = width;
            cbExisting.Left = offset;
            foreach(Group gg in sidebar.game.room.groups.general.childGroups.Values)
            {
                cbExisting.Items.Add(gg);
            }
            cbExisting.ItemIndex = 0;
            cbExisting.Enabled = false;
            HeightCounter += cbExisting.Height + LeftPadding;

            RadioButton rdTemplate = new RadioButton(manager);
            rdTemplate.Init();
            rdTemplate.Parent = neoSidebar;
            rdTemplate.Top = HeightCounter;
            rdTemplate.Left = LeftPadding;
            rdTemplate.Text = "Template";
            rdTemplate.Checked = false;
            rdTemplate.Width = width;

            ComboBox cbTemplate = new ComboBox(manager);
            cbTemplate.Init();
            cbTemplate.Parent = neoSidebar;
            cbTemplate.Top = HeightCounter;
            cbTemplate.Width = width;
            cbTemplate.Left = offset;
            foreach (Node n in Assets.NodePresets)
            {
                cbTemplate.Items.Add(n);
            }
            if (Assets.NodePresets.Count > 0) cbTemplate.ItemIndex = 0;
            cbTemplate.Enabled = false;
            HeightCounter += cbTemplate.Height + LeftPadding;

            componentView = new ComponentView(sidebar, neoSidebar, 0, HeightCounter, ViewType.Group);
            componentView.Height = 150;
            componentView.Width = neoSidebar.Width - LeftPadding * 4;

            neoSidebar.Width += 100;
            neoSidebar.Width -= 100;
            tempgroup = new Group(sidebar.room, sidebar.room.defaultNode.CreateClone(sidebar.room), null, "tempgroup", false);

            SetGroup(sidebar.room.defaultNode);

            rdEmpty.Click += (s, e) =>
            {
                cbExisting.Enabled = false;
                cbTemplate.Enabled = false;
                SetGroup(sidebar.room.defaultNode);
            };
            rdExisting.Click += (s, e) =>
            {
                cbExisting.Enabled = true;
                cbTemplate.Enabled = false;
                ComboUpdate(cbExisting);
            };
            cbExisting.ItemIndexChanged += (s, e) =>
            {
                ComboUpdate(cbExisting);
            };
            rdTemplate.Click += (s, e) =>
            {
                cbExisting.Enabled = false;
                cbTemplate.Enabled = true;
                ComboUpdate(cbTemplate);
            };
            cbTemplate.ItemIndexChanged += (s, e) =>
            {
                ComboUpdate(cbTemplate);
            };

            btnCreateGroup = new Button(manager);
            btnCreateGroup.Init();
            btnCreateGroup.Parent = neoSidebar;
            btnCreateGroup.Top = componentView.bottomArea.Top + componentView.bottomArea.Height + LeftPadding * 2;
            btnCreateGroup.Text = "Create Group";
            btnCreateGroup.Width = width;
            btnCreateGroup.Left = neoSidebar.Width / 2 - btnCreateGroup.Width / 2;

            btnCreateGroup.Click += (s, e) =>
            {
                if (String.IsNullOrWhiteSpace(txtName.Text))
                    PopUp.Toast("Please enter a group name.");
                else if(sidebar.game.room.groups.general.childGroups.Keys.Contains(txtName.Text))
                    PopUp.Toast("Group already exists.");
                else{

                    OrbIt.game.room = sidebar.game.room;
                    Node newNode = tempgroup.defaultNode.CreateClone(sidebar.game.room);
                    newNode.body.color = ColorChanger.randomColorHue();
                    newNode.basicdraw.UpdateColor();
                    Group newGroup = new Group(sidebar.game.room, newNode, sidebar.game.room.groups.general, txtName.Text.Trim());
                    newNode.name = txtName.Text.Trim();
                    newNode.group = newGroup;
                    sidebar.groupsView.UpdateGroups();
                    foreach(DetailedItem item in sidebar.groupsView.viewItems)
                    {
                        if (item.obj == newGroup)
                        {
                            sidebar.groupsView.SelectItem(item);
                            break;
                        }
                    }
                    Close();
                }
            };
        }
Beispiel #19
0
        public override void LoadContent(ContentManager contentloader)
        {
            _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default");
            _guiman.Initialize();

            _settingsmenu = new Window(_guiman);
            _settingsmenu.Init();
            _settingsmenu.Resizable = false;
            _settingsmenu.Movable = false;
            _settingsmenu.CloseButtonVisible = false;
            _settingsmenu.Text = "Settings Menu";
            _settingsmenu.Width = 300;
            _settingsmenu.Height = 400;
            _settingsmenu.Center();
            _settingsmenu.Visible = true;
            _settingsmenu.BorderVisible = true;
            _settingsmenu.Cursor = _guiman.Skin.Cursors["Default"].Resource;

            _back = new Button(_guiman);
            _back.Init();
            _back.Text = "Go Back";
            _back.Width = 200;
            _back.Height = 50;
            _back.Left = 50;
            _back.Top = 300;
            _back.Anchor = Anchors.Bottom;
            _back.Parent = _settingsmenu;

            _playername = new TextBox(_guiman);
            _playername.Init();
            _playername.Text = _gamemanager.Pbag.Player.Name;
            _playername.Width = 200;
            _playername.Height = 50;
            _playername.Left = 50;
            _playername.Top = 0;
            _playername.Anchor = Anchors.Bottom;
            _playername.Parent = _settingsmenu;

            _volume = new ScrollBar(_guiman, Orientation.Horizontal);
            _volume.Init();
            //Todo check why volume.value is reseting it to 50 :S
            _volume.Value = _gamemanager.Audiomanager.GetVolume();
            _volume.Range = 100;
            _volume.PageSize = 10;
            _volume.StepSize = 1;
            _volume.Width = 200;
            _volume.Height = 50;
            _volume.Left = 50;
            _volume.Top = 50;
            _volume.Anchor = Anchors.Bottom;
            _volume.Parent = _settingsmenu;

            _guiman.Add(_settingsmenu);

            _gamemanager.Game.IsMouseVisible = true;
        }
Beispiel #20
0
        private IGameState[] CardSelected(Manager manager, GameInfo gameInfo, Story story)
        {
            var storyGraphic = gameInfo.Content.Load<Texture2D>(story.StoryGraphic);
            const int spacing = 20;
            const int width = 400;
            var yPos = spacing;

            var window = new Window(manager) {
                Text =
                    String.Format("Your fate has been decided! You spun a {0} story", story.StoryType), AutoScroll = false
            };

            window.Init();

            var storybox = new GroupBox(manager) { Width = 400, Height = 100, Left = 30, Top = yPos, Parent = window, Color = story.StoryType == StoryType.Red ? Color.Red : Color.Black, Text = ""+story.StoryType, TextColor = Color.White };
            storybox.Init();

            var storylabel = new Label(manager)
            {
                Width = storybox.Width,
                Height = storybox.Height,
                Parent = storybox,
                Text = story.DisplayedMessage,
                Left = spacing,
                StayOnTop = true
            };
            storylabel.Init();

            var imageBox = new ImageBox(manager)
            {
                Left = window.Width/2-100,
                Top = 140,
                Image = storyGraphic,
                Color = Color.White,
                Width = storyGraphic.Width,
                Height = storyGraphic.Height
            };
            imageBox.Init();
            window.Add(imageBox);
            var close = new Button(manager) { Text = "OK", Top = window.Height-50-spacing, Left = window.Width / 2 - 50, Parent = window };
            close.Init();
            close.Click += (sender, args) => window.Close();

            window.Closed += (sender, args) => WindowClosed(gameInfo);

            manager.Add(window);

            if (story.Positive)
                gameInfo.Content.Load<SoundEffect>("Sounds/applause").Play();
            else
                gameInfo.Content.Load<SoundEffect>("Sounds/sadtrombone").Play();

            return new[] { story.PureLogic, waitState };
        }
Beispiel #21
0
        private void CreateFirstDisplayWindow(Manager manager, GameInfo gameInfo, Story red, Story black)
        {
            const int spacing = 20;
            const int width = 500;
            int yPos = spacing;
            var window = new Window(manager) { Text = "Story card", Width = 600 };
            window.Init();

            var descriptionlabel = new Label(manager) { Text = red.DisplayedMessage, Top = yPos, Width = width, Height = 70, Left = 30};
            descriptionlabel.Text =
                "When this window closes you will be required to spin the spinner.\n" +
                "If the spinner lands on a black spot you will undergo what the black card says.\n" +
                "If the spinner lands on a red spot you will undergo what the red card says.\n\n" +
                "These are stories you are spinning for!";
            yPos += descriptionlabel.Height + spacing / 2;

            var redstorybox = new GroupBox(manager) { Width = 500, Height = 100, Left = 30, Top = 100, Parent = window, Color = Color.Red, Text = "Red Story", TextColor = Color.White};
            redstorybox.Init();
            yPos += redstorybox.Height;
            var redstorylabel = new Label(manager)
                                    {
                                        Width = redstorybox.Width,
                                        Height = redstorybox.Height,
                                        Parent = redstorybox,
                                        Text = red.DisplayedMessage,
                                        Left = spacing,
                                        StayOnTop = true
                                    };
            redstorylabel.Init();

            var blackstorybox = new GroupBox(manager) { Width = 500, Height = 100, Left = 30, Top = 200, Parent = window, Color = Color.Black, Text = "Black Story", TextColor = Color.White };
            blackstorybox.Init();
            yPos += blackstorybox.Height+spacing/2;

            var blackstorylabel = new Label(manager)
            {
                Width = blackstorybox.Width,
                Height = blackstorybox.Height,
                Parent = blackstorybox,
                Text = black.DisplayedMessage,
                Left = spacing,
                StayOnTop = true
            };
            blackstorylabel.Init();

            var close = new Button(manager) { Text = "OK", Top = yPos, Left = window.Width / 2 - 50, Parent = window };
            close.Init();
            close.Click += (sender, args) => window.Close();
            yPos += close.Height + spacing;

            window.Add(descriptionlabel);
            window.Height = blackstorybox.Height + redstorybox.Height + yPos/2;
            manager.Add(window);

            window.Closed += (sender, args) => WindowClosed(gameInfo);

            gameInfo.CreateMessage("Click the spinner to see your story!");
        }
Beispiel #22
0
        /// <summary>
        /// Код дизайнера всех базовых окон
        /// </summary>
        private void WindowsDesigner()
        {
            Manager = new Manager(this, graphics, "Default");
            Manager.Initialize();

            #region mainmenu

            mainmenu = new Window(Manager) {BackColor = Color.Black};
            mainmenu.Init();
            mainmenu.Text = "";
            mainmenu.SetPosition(resx/3, resy/4);
            mainmenu.Width = resx/3;
            mainmenu.Height = resy/2;
            mainmenu.Visible = true;
            mainmenu.BorderVisible = false;
            mainmenu.Movable = false;
            mainmenu.Resizable = false;

            mainmenucloseB = new Button(Manager);
            mainmenucloseB.Init();
            mainmenucloseB.Text = "Quit";
            mainmenucloseB.Width = resx/5;
            mainmenucloseB.Height = 25;
            mainmenucloseB.Left = (resx/3 - resx/5)/2;
            mainmenucloseB.Top = mainmenu.ClientHeight - mainmenucloseB.Height - 8;
            mainmenucloseB.Anchor = Anchors.Bottom;
            mainmenucloseB.Parent = mainmenu;
            mainmenucloseB.Click += button_Click;

            mainmenugeneratenewB = new Button(Manager);
            mainmenugeneratenewB.Init();
            mainmenugeneratenewB.Text = "Создать новый мир и начать игру";
            mainmenugeneratenewB.Width = resx/5;
            mainmenugeneratenewB.Height = 25;
            mainmenugeneratenewB.Left = (resx/3 - resx/5)/2;
            mainmenugeneratenewB.Top = 50;
            mainmenugeneratenewB.Anchor = Anchors.Bottom;
            mainmenugeneratenewB.Parent = mainmenu;
            mainmenugeneratenewB.Click += mainmenugeneratenewB_Click;

            mainmenuloadmapB = new Button(Manager) {Text = "Начать игру в созданном мире", Width = resx/5};
            mainmenuloadmapB.Init();
            mainmenuloadmapB.Height = 25;
            mainmenuloadmapB.Left = (resx/3 - resx/5)/2;
            mainmenuloadmapB.Top = 100;
            mainmenuloadmapB.Anchor = Anchors.Bottom;
            mainmenuloadmapB.Parent = mainmenu;
            mainmenuloadmapB.Click += mainmenuloadmapB_Click;

            mainmenuloadgameB = new Button(Manager);
            mainmenuloadgameB.Init();
            mainmenuloadgameB.Text = "Загрузить игру";
            mainmenuloadgameB.Width = resx/5;
            mainmenuloadgameB.Height = 25;
            mainmenuloadgameB.Left = (resx/3 - resx/5)/2;
            mainmenuloadgameB.Top = 150;
            mainmenuloadgameB.Anchor = Anchors.Bottom;
            mainmenuloadgameB.Parent = mainmenu;
            mainmenuloadgameB.Click += mainmenuloadgameB_Click;

            mainmenuoptionsB = new Button(Manager);
            mainmenuoptionsB.Init();
            mainmenuoptionsB.Text = "Опции";
            mainmenuoptionsB.Width = resx/5;
            mainmenuoptionsB.Height = 25;
            mainmenuoptionsB.Left = (resx/3 - resx/5)/2;
            mainmenuoptionsB.Top = 200;
            mainmenuoptionsB.Anchor = Anchors.Bottom;
            mainmenuoptionsB.Parent = mainmenu;
            mainmenuoptionsB.Click += mainmenuoptionsB_Click;

            Manager.Add(mainmenu);

            #endregion

            #region generateoptionsmenu

            generateoptionsmenu = new Window(Manager) {BackColor = Color.Black};
            generateoptionsmenu.Init();
            generateoptionsmenu.Text = "";
            generateoptionsmenu.SetPosition(resx/3, resy/4);
            generateoptionsmenu.Width = resx/3;
            generateoptionsmenu.Height = resy/2;
            generateoptionsmenu.Visible = false;
            generateoptionsmenu.BorderVisible = false;
            generateoptionsmenu.Movable = false;
            generateoptionsmenu.Resizable = false;

            generateoptionnextB = new Button(Manager);
            generateoptionnextB.Init();
            generateoptionnextB.Text = "Продолжить";
            generateoptionnextB.Width = resx/5;
            generateoptionnextB.Height = 25;
            generateoptionnextB.Left = (resx/3 - resx/5)/2;
            generateoptionnextB.Top = 50;
            generateoptionnextB.Anchor = Anchors.Bottom;
            generateoptionnextB.Parent = generateoptionsmenu;
            generateoptionnextB.Click += generateoptionnextB_Click;

            generateoptionbackB = new Button(Manager);
            generateoptionbackB.Init();
            generateoptionbackB.Text = "Назад";
            generateoptionbackB.Width = resx/5;
            generateoptionbackB.Height = 25;
            generateoptionbackB.Left = (resx/3 - resx/5)/2;
            generateoptionbackB.Top = generateoptionsmenu.ClientHeight - generateoptionbackB.Height - 8;
            generateoptionbackB.Anchor = Anchors.Bottom;
            generateoptionbackB.Parent = generateoptionsmenu;
            generateoptionbackB.Click += generateoptionbackB_Click;

            Manager.Add(generateoptionsmenu);

            #endregion

            #region generationMenu

            generationMenu = new Window(Manager) {BackColor = Color.Black};
            generationMenu.Init();
            generationMenu.Text = "";
            generationMenu.SetPosition(20, 20);
            generationMenu.Width = resx/6;
            generationMenu.Height = 300;
            generationMenu.Visible = false;
            generationMenu.BorderVisible = false;
            generationMenu.Movable = false;
            generationMenu.Resizable = false;

            generationbegingameB = new Button(Manager);
            generationbegingameB.Init();
            generationbegingameB.Text = "Начать игру";
            generationbegingameB.Width = resx/8;
            generationbegingameB.Height = 25;
            generationbegingameB.Left = (resx/6 - resx/8)/2;
            generationbegingameB.Top = 50;
            generationbegingameB.Anchor = Anchors.Bottom;
            generationbegingameB.Parent = generationMenu;
            generationbegingameB.Click += generationbegingameB_Click;

            generationgenerateB = new Button(Manager);
            generationgenerateB.Init();
            generationgenerateB.Text = "Генерировать";
            generationgenerateB.Width = resx/8;
            generationgenerateB.Height = 25;
            generationgenerateB.Left = (resx/6 - resx/8)/2;
            generationgenerateB.Top = 80;
            generationgenerateB.Anchor = Anchors.Bottom;
            generationgenerateB.Parent = generationMenu;
            generationgenerateB.Click += generationgenerateB_Click;

            generationNormalMapB = new Button(Manager);
            generationNormalMapB.Init();
            generationNormalMapB.Text = "Обычная карта";
            generationNormalMapB.Width = resx/8;
            generationNormalMapB.Height = 25;
            generationNormalMapB.Left = (resx/6 - resx/8)/2;
            generationNormalMapB.Top = 110;
            generationNormalMapB.Anchor = Anchors.Bottom;
            generationNormalMapB.Parent = generationMenu;
            generationNormalMapB.Click += generationnormalmapB_Click;

            generationheightmapB = new Button(Manager);
            generationheightmapB.Init();
            generationheightmapB.Text = "Карта высот";
            generationheightmapB.Width = resx/8;
            generationheightmapB.Height = 25;
            generationheightmapB.Left = (resx/6 - resx/8)/2;
            generationheightmapB.Top = 140;
            generationheightmapB.Anchor = Anchors.Bottom;
            generationheightmapB.Parent = generationMenu;
            generationheightmapB.Click += generationheightmapB_Click;

            generationtempmapB = new Button(Manager);
            generationtempmapB.Init();
            generationtempmapB.Text = "Карта температур";
            generationtempmapB.Width = resx/8;
            generationtempmapB.Height = 25;
            generationtempmapB.Left = (resx/6 - resx/8)/2;
            generationtempmapB.Top = 170;
            generationtempmapB.Anchor = Anchors.Bottom;
            generationtempmapB.Parent = generationMenu;
            generationtempmapB.Click += generationtempmapB_Click;

            generationbackB = new Button(Manager);
            generationbackB.Init();
            generationbackB.Text = "Назад";
            generationbackB.Width = resx/8;
            generationbackB.Height = 25;
            generationbackB.Left = (resx/6 - resx/8)/2;
            generationbackB.Top = 200;
            generationbackB.Anchor = Anchors.Bottom;
            generationbackB.Parent = generationMenu;
            generationbackB.Click += generationbackB_Click;

            generateoption = new TrackBar(Manager);
            generateoption.Init();
            generateoption.Top = 230;
            generateoption.Left = (resx/6 - resx/8)/2;
            generateoption.Width = resx/8;
            generateoption.Height = 25;
            generateoption.Parent = generationMenu;
            generateoption.ValueChanged += generateoption_ValueChanged;

            generateoptionlabel = new Label(Manager);
            generateoptionlabel.Init();
            generateoptionlabel.Top = 250;
            generateoptionlabel.Left = (resx/6 - resx/8)/2;
            generateoptionlabel.Width = resx/8;
            generateoptionlabel.Height = 25;
            generateoptionlabel.Parent = generationMenu;

            Manager.Add(generationMenu);

            #endregion

            #region mapload

            maploadmenu = new Window(Manager) {Color = Color.Black};
            maploadmenu.Init();
            maploadmenu.Text = "";
            maploadmenu.SetPosition(resx/3, resy/4);
            maploadmenu.Width = resx/3;
            maploadmenu.Height = resy/2;
            maploadmenu.Visible = false;
            maploadmenu.BorderVisible = false;
            maploadmenu.Movable = false;
            maploadmenu.Resizable = false;

            maploadmenuLoad = new Button(Manager);
            maploadmenuLoad.Init();
            maploadmenuLoad.Text = "Назад";
            maploadmenuLoad.Width = resx/5;
            maploadmenuLoad.Height = 25;
            maploadmenuLoad.Left = (resx/3 - resx/5)/2;
            maploadmenuLoad.Top = maploadmenu.ClientHeight - maploadmenuLoad.Height - 8;
            maploadmenuLoad.Anchor = Anchors.Bottom;
            maploadmenuLoad.Parent = maploadmenu;
            maploadmenuLoad.Click += maploadmenuLoad_Click;

            maploadmenuLoadNext = new Button(Manager);
            maploadmenuLoadNext.Init();
            maploadmenuLoadNext.Text = "Далее";
            maploadmenuLoadNext.Width = resx/5;
            maploadmenuLoadNext.Height = 25;
            maploadmenuLoadNext.Left = (resx/3 - resx/5)/2;
            maploadmenuLoadNext.Top = maploadmenu.ClientHeight - maploadmenuLoad.Height - 8 - 30;
            maploadmenuLoadNext.Anchor = Anchors.Bottom;
            maploadmenuLoadNext.Parent = maploadmenu;
            maploadmenuLoadNext.Click += maploadmenuLoadNext_Click;

            maploadmenulistbox = new ListBox(Manager);
            maploadmenulistbox.Init();
            maploadmenulistbox.Text = "";
            maploadmenulistbox.Width = resx/5;
            maploadmenulistbox.Height = resy/3;
            maploadmenulistbox.Left = (resx/3 - resx/5)/2;
            maploadmenulistbox.Top = 50;
            maploadmenulistbox.Anchor = Anchors.Bottom;
            maploadmenulistbox.Parent = maploadmenu;
            maploadmenulistbox.DoubleClick += maploadmenulistbox_DoubleClick;

            Manager.Add(maploadmenu);

            #endregion

            #region Summary Window

            SummaryWindow = new Window(Manager) {Color = Color.Black};
            SummaryWindow.Init();
            SummaryWindow.Text = "";
            SummaryWindow.SetPosition(100, 100);
            SummaryWindow.Width = resx/4;
            SummaryWindow.Height = resy/4;
            SummaryWindow.Visible = false;
            SummaryWindow.BorderVisible = true;
            SummaryWindow.Movable = true;
            SummaryWindow.Resizable = false;

            summarytb = new TextBox(Manager);
            summarytb.Init();
            summarytb.Text = "";
            summarytb.Width = resx/4 - 30;
            summarytb.Height = resy/4 - 60;
            summarytb.Left = (20)/2;
            summarytb.CaretVisible = false;
            summarytb.Passive = true;
            summarytb.Mode = TextBoxMode.Multiline;
            summarytb.Top = (20)/2;
            summarytb.Anchor = Anchors.Bottom;
            summarytb.Parent = SummaryWindow;

            Manager.Add(SummaryWindow);

            #endregion

            #region ingameUIpartLeft

            ingameUIpartLeft = new Window(Manager) {Color = Color.Black};
            ingameUIpartLeft.Init();
            ingameUIpartLeft.Text = "";
            ingameUIpartLeft.SetPosition(resx/5*4, 0);
            ingameUIpartLeft.Width = resx/5;
            ingameUIpartLeft.Height = resy;
            ingameUIpartLeft.Visible = false;
            ingameUIpartLeft.BorderVisible = false;
            ingameUIpartLeft.Movable = false;
            ingameUIpartLeft.Resizable = false;

            ingameshowOrdersB = new Button(Manager);
            ingameshowOrdersB.Init();
            ingameshowOrdersB.Text = "Приказы (O)";
            ingameshowOrdersB.Width = resx/5 - 20;
            ingameshowOrdersB.Height = 25;
            ingameshowOrdersB.Left = (20)/2;
            ingameshowOrdersB.Top = 10;
            ingameshowOrdersB.Anchor = Anchors.Bottom;
            ingameshowOrdersB.Parent = ingameUIpartLeft;
            ingameshowOrdersB.Click += ingameshowOrdersB_Click;

            ingameshowZonesB = new Button(Manager);
            ingameshowZonesB.Init();
            ingameshowZonesB.Text = "Зоны (Z)";
            ingameshowZonesB.Width = resx/5 - 20;
            ingameshowZonesB.Height = 25;
            ingameshowZonesB.Left = (20)/2;
            ingameshowZonesB.Top = 40;
            ingameshowZonesB.Anchor = Anchors.Bottom;
            ingameshowZonesB.Parent = ingameUIpartLeft;
            ingameshowZonesB.Click += ingameshowZonesB_Click;

            ingameshowBuildingsB = new Button(Manager);
            ingameshowBuildingsB.Init();
            ingameshowBuildingsB.Text = "Постройки (Z)";
            ingameshowBuildingsB.Width = resx/5 - 20;
            ingameshowBuildingsB.Height = 25;
            ingameshowBuildingsB.Left = (20)/2;
            ingameshowBuildingsB.Top = 70;
            ingameshowBuildingsB.Anchor = Anchors.Bottom;
            ingameshowBuildingsB.Parent = ingameUIpartLeft;
            ingameshowBuildingsB.Click += ingameshowBuildingsB_Click;

            ingameshowallinfo = new Button(Manager);
            ingameshowallinfo.Init();
            ingameshowallinfo.Text = "Подробная информация";
            ingameshowallinfo.Width = resx/5 - 20;
            ingameshowallinfo.Height = 25;
            ingameshowallinfo.Left = (20)/2;
            ingameshowallinfo.Top = 100;
            ingameshowallinfo.Anchor = Anchors.Bottom;
            ingameshowallinfo.Parent = ingameUIpartLeft;
            ingameshowallinfo.Click += ingameshowallinfo_Click;

            ingameUIpartLeftlistbox = new ListBox(Manager);
            ingameUIpartLeftlistbox.Init();
            ingameUIpartLeftlistbox.Text = "";
            ingameUIpartLeftlistbox.Width = resx/5 - 20;
            ingameUIpartLeftlistbox.Height = 90;
            ingameUIpartLeftlistbox.Left = 10;
            ingameUIpartLeftlistbox.Top = 200;
            ingameUIpartLeftlistbox.Anchor = Anchors.Bottom;
            ingameUIpartLeftlistbox.Parent = ingameUIpartLeft;
            ingameUIpartLeftlistbox.DoubleClick += maploadmenulistbox_DoubleClick;

            ingameUIpartLeftlistbox2 = new ListBox(Manager);
            ingameUIpartLeftlistbox2.Init();
            ingameUIpartLeftlistbox2.Text = "";
            ingameUIpartLeftlistbox2.Width = resx/5 - 20;
            ingameUIpartLeftlistbox2.Height = 200;
            ingameUIpartLeftlistbox2.Left = 10;
            ingameUIpartLeftlistbox2.Top = 300;
            ingameUIpartLeftlistbox2.Anchor = Anchors.Bottom;
            ingameUIpartLeftlistbox2.Parent = ingameUIpartLeft;

            Manager.Add(ingameUIpartLeft);

            #endregion

            #region orderssubmenu

            orderssubmenu = new Window(Manager);
            orderssubmenu.Init();
            orderssubmenu.Text = "";
            orderssubmenu.Width = 150;
            orderssubmenu.Height = 200;
            orderssubmenu.Center();
            orderssubmenu.Visible = false;
            orderssubmenu.Resizable = false;

            digorder = new Button(Manager);
            digorder.Init();
            digorder.Text = "Выкопать";
            digorder.Width = orderssubmenu.Width - 40;
            digorder.Height = 24;
            digorder.Left = 20;
            digorder.Top = 20;
            digorder.Anchor = Anchors.Bottom;
            digorder.Parent = orderssubmenu;
            digorder.Click += digorder_Click;

            supplyorder = new Button(Manager);
            supplyorder.Init();
            supplyorder.Text = "Обеспечить ресурсами";
            supplyorder.Width = orderssubmenu.Width - 40;
            supplyorder.Height = 24;
            supplyorder.Left = 20;
            supplyorder.Top = 50;
            supplyorder.Anchor = Anchors.Bottom;
            supplyorder.Parent = orderssubmenu;
            supplyorder.Click += supplyorder_Click;

            cancelorder = new Button(Manager);
            cancelorder.Init();
            cancelorder.Text = "Отменить все приказы";
            cancelorder.Width = orderssubmenu.Width - 40;
            cancelorder.Height = 24;
            cancelorder.Left = 20;
            cancelorder.Top = 80;
            cancelorder.Anchor = Anchors.Bottom;
            cancelorder.Parent = orderssubmenu;
            cancelorder.Click += cancelorder_Click;

            collectorder = new Button(Manager);
            collectorder.Init();
            collectorder.Text = "Cобрать";
            collectorder.Width = orderssubmenu.Width - 40;
            collectorder.Height = 24;
            collectorder.Left = 20;
            collectorder.Top = 110;
            collectorder.Anchor = Anchors.Bottom;
            collectorder.Parent = orderssubmenu;
            collectorder.Click += collectorder_Click;

            orderslabel = new Label(Manager);
            orderslabel.Left = 5;
            orderslabel.Top = 5;
            orderslabel.Text = "Приказы";
            orderslabel.Parent = orderssubmenu;

            Manager.Add(orderssubmenu);

            #endregion

            #region Buildings window

            buildinsgwindow = new Window(Manager) {BackColor = Color.Black};
            buildinsgwindow.Init();
            buildinsgwindow.Text = "";
            buildinsgwindow.SetPosition(20, 20);
            buildinsgwindow.Width = 42*6 + 20;
            buildinsgwindow.Height = 300;
            buildinsgwindow.Visible = false;
            buildinsgwindow.Resizable = false;

            buildingssb = new ScrollBar(Manager, Orientation.Vertical);
            buildingssb.Init();
            buildingssb.Top = 0;
            buildingssb.Width = 20;
            buildingssb.Left = buildinsgwindow.Width - buildingssb.Width - 20;
            buildingssb.Height = buildinsgwindow.Height - 40;
            buildingssb.Parent = buildinsgwindow;
            buildingssb.ValueChanged += buildingssb_ValueChanged;

            buildingsbuttons = new Button[dbobject.Data.Count];
            buildingsbuttonslabel = new Label[dbobject.Data.Count];
            int i = 0;
            foreach (var dbo in dbobject.Data) {
                buildingsbuttons[i] = new Button(Manager);
                buildingsbuttons[i].Init();
                buildingsbuttons[i].Text = dbo.Value.Name;
                buildingsbuttons[i].Width = 40;
                buildingsbuttons[i].Height = 40;
                buildingsbuttons[i].Left = i%5*42;
                buildingsbuttons[i].Top = i/5*42;
                int[] tg = {buildingsbuttons[i].Top, dbo.Key};
                buildingsbuttons[i].Tag = tg;
                buildingsbuttons[i].Anchor = Anchors.Bottom;
                buildingsbuttons[i].Parent = buildinsgwindow;
                buildingsbuttons[i].Glyph = new Glyph(object_tex, GetTexRectFromN(dbo.Value.MetatexN));
                buildingsbuttons[i].ToolTip = new ToolTip(Manager);
                buildingsbuttons[i].ToolTip.Text = dbo.Value.Name + " id " + dbo.Key;
                buildingsbuttons[i].Click += Buildingsbutton_Click;
                iss.n.Add(dbo.Key, new LocalItem {id = dbo.Key, count = 0});

                buildingsbuttonslabel[i] = new Label(Manager);
                buildingsbuttonslabel[i].Init();
                buildingsbuttonslabel[i].Text = "0";
                buildingsbuttonslabel[i].Width = 40;
                buildingsbuttonslabel[i].Height = 40;
                buildingsbuttonslabel[i].Left = i%5*42;
                buildingsbuttonslabel[i].Top = i/5*42;
                buildingsbuttonslabel[i].Parent = buildinsgwindow;

                i++;
            }

            Manager.Add(buildinsgwindow);

            #endregion

            #region Ingamemesages

            Ingamemesages = new Window(Manager);
            Ingamemesages.Init();
            Ingamemesages.Text = "";
            Ingamemesages.Width = 480;
            Ingamemesages.Height = 200;
            Ingamemesages.Center();
            Ingamemesages.Visible = false;
            Ingamemesages.Resizable = false;

            IngamemesagesOk = new Button(Manager);
            IngamemesagesOk.Init();
            IngamemesagesOk.Text = "OK";
            IngamemesagesOk.Width = 72;
            IngamemesagesOk.Height = 24;
            IngamemesagesOk.Left = (Ingamemesages.ClientWidth/2) - (IngamemesagesOk.Width/2);
            IngamemesagesOk.Top = Ingamemesages.ClientHeight - IngamemesagesOk.Height - 8;
            IngamemesagesOk.Anchor = Anchors.Bottom;
            IngamemesagesOk.Parent = Ingamemesages;
            IngamemesagesOk.Click += IngamemesagesOk_Click;

            Ingamemesageslabel = new Label(Manager);
            Ingamemesageslabel.Left = 5;
            Ingamemesageslabel.Top = 5;
            Ingamemesageslabel.Text = "Text";
            Ingamemesageslabel.Parent = Ingamemesages;

            Manager.Add(Ingamemesages);

            #endregion
        }
        public LinkGeneratorWindow(Manager manager, Sidebar sidebar)
        {
            OrbIt game = OrbIt.game;
            UserInterface.GameInputDisabled = true;

            this.manager = manager;
            this.sidebar = sidebar;
            window = new Window(manager);
            window.Init();
            window.Left = OrbIt.ui.sidebar.master.Left;
            window.Width = OrbIt.ui.sidebar.master.Width;
            window.Top = 200;
            window.Height = 200;
            window.Text = "Link Generator";
            window.Closed += delegate { UserInterface.GameInputDisabled = false; };
            window.ShowModal();
            manager.Add(window);

            //LinkGenerator.ExpandedHeight += 30;
            HeightCounter3 = 0;
            int left = 0;
            int middle = 100;

            lblGenerateLink = new Label(manager);
            lblGenerateLink.Init();
            lblGenerateLink.Left = left + middle / 2;
            lblGenerateLink.Top = HeightCounter3; HeightCounter3 += lblGenerateLink.Height;
            lblGenerateLink.Text = "Generate Link";
            lblGenerateLink.Width += 40;
            lblGenerateLink.Parent = window;

            lblLinkType = new Label(manager);
            lblLinkType.Init();
            lblLinkType.Left = left;
            lblLinkType.Text = "Link Type";
            lblLinkType.Parent = window;
            lblLinkType.Top = HeightCounter3; HeightCounter3 += lblLinkType.Height;

            cbLinkType = new ComboBox(manager);
            cbLinkType.Init();
            cbLinkType.Left = left;
            cbLinkType.Width += 100;
            cbLinkType.Parent = window;
            cbLinkType.MaxItems = 15;
            cbLinkType.Top = HeightCounter3; HeightCounter3 += cbLinkType.Height;
            //cbLinkType.Items.AddRange(new List<object>() { });
            Link.GetILinkableEnumVals(cbLinkType.Items);

            /*
            foreach (comp key in Enum.GetValues(typeof(comp)))
            {
                Type compType = Game1.compTypes[key];

                if (!typeof(ILinkable).IsAssignableFrom(compType)) continue;

                cbLinkType.Items.Add(key);

                /*
                MethodInfo mInfo = compType.GetMethod("AffectOther");
                if (mInfo != null
                    && mInfo.DeclaringType == compType)
                {
                    cbLinkType.Items.Add(key);
                }
                //
            }
            */

            lblLinkFormation = new Label(manager);
            lblLinkFormation.Init();
            lblLinkFormation.Left = left;
            lblLinkFormation.Text = "Formation";
            lblLinkFormation.Parent = window;
            lblLinkFormation.Top = HeightCounter3; HeightCounter3 += lblLinkFormation.Height;

            cbLinkFormation = new ComboBox(manager);
            cbLinkFormation.Init();
            cbLinkFormation.Left = left;
            cbLinkFormation.Width += 20;
            cbLinkFormation.Parent = window;
            cbLinkFormation.Top = HeightCounter3; HeightCounter3 += cbLinkFormation.Height;

            foreach (formationtype f in Enum.GetValues(typeof(formationtype)))
            {
                cbLinkFormation.Items.Add(f);
            }
            cbLinkFormation.ItemIndex = 0;

            chkEntangled = new CheckBox(manager);
            chkEntangled.Init();
            chkEntangled.Left = left;
            chkEntangled.Width += 20;
            chkEntangled.Text = "Entangled";
            chkEntangled.Parent = window;
            chkEntangled.Top = HeightCounter3; HeightCounter3 += chkEntangled.Height;

            HeightCounter3 = lblGenerateLink.Height;

            lblLinkPresets = new Label(manager);
            lblLinkPresets.Init();
            lblLinkPresets.Left = left + middle;
            lblLinkPresets.Text = "Preset";
            lblLinkPresets.Parent = window;
            lblLinkPresets.Top = lblLinkFormation.Top;

            cbLinkPresets = new ComboBox(manager);
            cbLinkPresets.Init();
            cbLinkPresets.Left = left + middle;
            //cbLinkPresets.Width += 20;
            cbLinkPresets.Parent = window;
            cbLinkPresets.Top = cbLinkFormation.Top;

            cbLinkPresets.Items.Add("Default");
            cbLinkPresets.ItemIndex = 0;

            btnAddToPalette = new Button(manager);
            btnAddToPalette.Init();
            btnAddToPalette.Left = left + middle;
            btnAddToPalette.Width = middle - 20;
            btnAddToPalette.Text = "Add to\nPalette";
            btnAddToPalette.Height = btnAddToPalette.Height * 2 - 10;
            btnAddToPalette.Parent = window;
            btnAddToPalette.Top = chkEntangled.Top + chkEntangled.Height;
            btnAddToPalette.Click += btnAddToPalette_Click;
        }
Beispiel #24
0
        private void CreateCareerWindow(Manager manager, GameInfo gameInfo, Career[] randomJobs, IGameState waitState)
        {
            const int spacing = 20;
            const int width = 500;

            int yPos = spacing;
            int xPos = spacing * 4;
            var window = new Window(manager) {
                Text = "Choose a career!",
                Width = width,
                CloseButtonVisible = false,
                Resizable = false
            };

            window.Init();

            var description = new Label(manager) { Text = "Choose a random unknown career!\nWhen you select the career it will show you your fate!", Width = 400, Left = 16, Top = 16, Height = 40 };
            description.Init();
            yPos += description.Height + spacing;
            window.Add(description);

            var chosenJob = new Label(manager) { Text = String.Empty, Width = 400, Left = 16, Top = 16, Height = 70 };
            chosenJob.Init();
            window.Add(chosenJob);

            var possibleJobImages = new List<Button>();
            var chooseCareerTexture = gameInfo.Content.Load<Texture2D>("Images/career_icons/BlankJob");
            foreach (var career in randomJobs) {
                var chosenCareer = career;

                var careerButton = new Button(manager) {
                    Top = yPos,
                    Left = xPos,
                    StayOnBack = true,
                    Width = 100,
                    Height = 100,
                    Glyph = new Glyph(chooseCareerTexture)
                };
                possibleJobImages.Add(careerButton);
                careerButton.Init();
                window.Add(careerButton);

                careerButton.Click += (sender, args) => {
                    gameInfo.CurrentPlayer.CurrentCareer = chosenCareer;
                    window.CloseButtonVisible = true;

                    chosenJob.Text = "Congratulations! You have become a " +
                                       chosenCareer.Title
                                       + "\n\nClose the window to receive your first Pay Day!";

                    int i = 0;
                    foreach (var possibleJob in possibleJobImages) {
                        possibleJob.Glyph = new Glyph(gameInfo.Content.Load<Texture2D>("images/career_icons/" + randomJobs[i++].Title));
                        possibleJob.Enabled = false;
                        possibleJob.SetSize(100, 100);
                    }

                    careerButton.Color = Color.Red;

                    yPos += chosenJob.Height + 16;

                    var close = new Button(manager) { Text = "OK", Parent = window, Top = yPos, Left = window.Width / 2 - 50 };
                    close.Click += (s, a) => {window.Close(); WindowClosed(gameInfo, waitState);};
                    close.Init();
                };

                xPos += careerButton.Width + 20;
            }

            yPos += possibleJobImages[0].Height + 16;

            chosenJob.Top = yPos;
            manager.Add(window);
            window.Closed += (sender, args) => WindowClosed(gameInfo, waitState);
        }
Beispiel #25
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="manager"></param>
        public DetoxChatWindow(Manager manager)
            : base(manager)
        {
            // Initialize class properties..
            this._messages = new EventedList<ChatMessage>();
            this._messages.ItemAdded += ChatMessages_OnItemAdded;
            this._isBackgroundVisible = true;

            // Initialize base control..
            base.Init();
            base.Width = 350;
            base.Height = 150;
            base.Alpha = 255;
            base.MinimumWidth = 64;
            base.MinimumHeight = 64;
            base.CanFocus = true;
            base.Movable = true;
            base.Resizable = true;
            base.ClientArea.Draw += ClientArea_OnDraw;
            //
            //
            //
            this._chatInput = new TextBox(manager);
            this._chatInput.Init();
            this._chatInput.Anchor = Anchors.Left | Anchors.Right | Anchors.Bottom;
            this._chatInput.AutoSelection = false;
            this._chatInput.Detached = false;
            this._chatInput.Left = 0;
            this._chatInput.Top = base.Height - this._chatInput.Height;
            this._chatInput.Visible = true;
            this._chatInput.KeyDown += ChatInput_OnKeyDown;
            this._chatInput.FocusGained += ChatInput_OnFocusGained;
            this._chatInput.FocusLost += ChatInput_OnFocusLost;
            //
            //
            //
            this._chatScroller = new ScrollBar(manager, Orientation.Vertical)
                {
                    Anchor = Anchors.Right | Anchors.Top | Anchors.Bottom,
                    Left = base.Width - 16,
                    PageSize = 1,
                    Range = 1,
                    Top = 2,
                    Value = 0
                };
            this._chatScroller.ValueChanged += ChatScroller_OnValueChanged;
            this._chatScroller.Init();
            //
            //
            //
            base.Add(this._chatInput, false);
            base.Add(this._chatScroller, false);
            manager.Add(this);

            // Update the control positions..
            this.PositionControls();
            base.Left = 5;
            base.Top = Terraria.MainGame.Window.ClientBounds.Height - base.Height - 5;
        }
Beispiel #26
0
        public GeneralDialog(Manager manager)
        {
            _manager = manager;

            _window = new Window(_manager);
            _window.Init();
            _window.Text = "General";
            _window.Width = 200;
            _window.Height = 200;
            _window.Left = 809;
            _window.Top = 15;
            _window.Visible = true;
            _window.Movable = false;
            _window.CloseButtonVisible = false;

            _wireframe = new CheckBox(_manager);
            _wireframe.Init();
            _wireframe.Text = "Wireframe";
            _wireframe.Width = 100;
            _wireframe.Height = 24;
            _wireframe.Anchor = Anchors.Bottom;
            _wireframe.Left = 15;
            _wireframe.Top = 15;
            _wireframe.Visible = true;
            _wireframe.Parent = _window;

            _terrain = new CheckBox(_manager);
            _terrain.Init();
            _terrain.Text = "Terrain";
            _terrain.Width = 100;
            _terrain.Height = 24;
            _terrain.Anchor = Anchors.Bottom;
            _terrain.Left = 15;
            _terrain.Top = 45;
            _terrain.Visible = true;
            _terrain.Parent = _window;

            _doodad = new CheckBox(_manager);
            _doodad.Init();
            _doodad.Text = "Doodads";
            _doodad.Width = 100;
            _doodad.Height = 24;
            _doodad.Anchor = Anchors.Bottom;
            _doodad.Left = 15;
            _doodad.Top = 75;
            _doodad.Visible = true;
            _doodad.Parent = _window;

            _wmo = new CheckBox(_manager);
            _wmo.Init();
            _wmo.Text = "WMOs";
            _wmo.Width = 100;
            _wmo.Height = 24;
            _wmo.Anchor = Anchors.Bottom;
            _wmo.Left = 15;
            _wmo.Top = 105;
            _wmo.Visible = true;
            _wmo.Parent = _window;

            _water = new CheckBox(_manager);
            _water.Init();
            _water.Text = "Water";
            _water.Width = 100;
            _water.Height = 24;
            _water.Anchor = Anchors.Bottom;
            _water.Left = 15;
            _water.Top = 135;
            _water.Visible = true;
            _water.Parent = _window;

            _console = new Console(_manager);
            _console.Init();
            _console.Left = 15;
            _console.Top = 15;
            _console.Width = 779;
            _console.Height = 200;
            _console.Visible = true;
            _console.Text = "meshDisplay Console";
            _console.Visible = true;
            _console.Movable = false;
            _console.Channels.Add(new ConsoleChannel(1, "Default", Color.White));
            _console.MessageSent += HandleMessage;

            _manager.Add(_console);
            _manager.Add(_window);
        }
Beispiel #27
0
        private void InitializeControls()
        {
            manager = new Manager(CurrGame, CurrGame.Graphics, "Green") { SkinDirectory = CurrGame.ApplicationDirectory + @"\Content\GUI\Skin\" };
            try
            {
                manager.Initialize();
            }
            catch (Exception)
            {
                throw;
            }

            manager.AutoCreateRenderTarget = true;

            Console = new Console(manager);
            Console.Init();
            LoadConsoleCommands();
            manager.Add(Console);
            Console.ChannelsVisible = false;
            Console.MessageSent += Console_MessageSent;
            Console.MessageFormat = ConsoleMessageFormats.None;
            Console.Width = manager.ScreenWidth;
            Console.Channels.Add(new ConsoleChannel(0, "[System]", Color.Orange));
            Console.Channels.Add(new ConsoleChannel(1, "[User]", Color.White));
            Console.Channels.Add(new ConsoleChannel(2, "[Error]", Color.DarkRed));
            Console.SelectedChannel = 1;
            Console.Hide();

            tabControl = new TabControl(manager);
            tabControl.Init();
            tabControl.Left = CurrGame.CreepFieldWidth;
            tabControl.Top = 0;
            tabControl.Width = CurrGame.Width - CurrGame.CreepFieldWidth;
            tabControl.Height = CurrGame.Height;

            #region Gameplaypage

            GameplayPage = tabControl.AddPage();
            GameplayPage.Init();
            GameplayPage.Text = "Spiel";

            #region Turmauswahl

            var thumbnailBox = new GroupBox(manager);
            thumbnailBox.Init();
            thumbnailBox.Parent = GameplayPage;
            thumbnailBox.Left = 2;
            thumbnailBox.Top = 2;
            thumbnailBox.Width = thumbnailBox.Parent.Width - 4;
            thumbnailBox.Height = 100;

            int counter = 0;
            foreach (TowerClass towerClass in GamePlayScreen.TowerManager.TowerClassList)
            {
                var towerButton = new ImageButton(manager)
                                      {
                                          Image = GamePlayScreen.TowerManager.GetThumbnail(towerClass.TowerKey),
                                          SizeMode = SizeMode.Stretched,
                                          Top = 14,
                                          Tag = towerClass
                                      };
                towerButton.Width = towerButton.Height = 60;
                towerButton.Left = 6 + counter * (towerButton.Width + 5);
                towerButton.Click += towerButton_Click;
                towerButton.MouseOver += towerButton_MouseOver;
                towerButton.MouseOut += towerButton_MouseOut;
                towerButton.Init();
                thumbnailBox.Add(towerButton);
                BuyTowerButtons.Add(towerButton);
                counter++;
            }

            thumbnailBox.AutoScroll = true;

            var scrollBar = new ScrollBar(manager, Orientation.Horizontal);
            scrollBar.Init();
            thumbnailBox.Add(scrollBar);
            scrollBar.Visible = false;

            #endregion

            #region Informationen

            var infoBox = new GroupBox(manager);
            infoBox.Init();
            infoBox.Parent = GameplayPage;
            infoBox.Text = "Informationen";
            infoBox.Width = infoBox.Parent.Width - 4;
            infoBox.Height = 110;
            infoBox.Left = 2;
            infoBox.Top = thumbnailBox.Top + thumbnailBox.Height + 2;

            CreepNumber = new Label(manager);
            CreepNumber.Init();
            CreepNumber.Parent = infoBox;
            CreepNumber.Top = 14;
            CreepNumber.Left = 4;
            CreepNumber.Width = CreepNumber.Parent.Width - 4;
            CreepNumber.ToolTip = new ToolTip(manager) { Text = "So viele Creeps sind momentan\nauf dem Spielfeld" };
            CreepNumber.Passive = false;

            CreepHealth = new Label(manager);
            CreepHealth.Init();
            CreepHealth.Parent = infoBox;
            CreepHealth.Top = CreepNumber.Top + CreepNumber.Height + 2;
            CreepHealth.Left = CreepNumber.Left;
            CreepHealth.Width = CreepHealth.Parent.Width - 4;
            CreepHealth.ToolTip = new ToolTip(manager) { Text = "Die Gesamtenergie aller auf dem\nSpielfeld befindlicher Creeps" };
            CreepHealth.Passive = false;

            Money = new Label(manager);
            Money.Init();
            Money.Parent = infoBox;
            Money.Top = CreepHealth.Top + CreepHealth.Height + 2;
            Money.Left = CreepNumber.Left;
            Money.Width = Money.Parent.Width - 4;
            Money.ToolTip = new ToolTip(manager) { Text = "So viel Geld besitzt der Spieler" };
            Money.Passive = false;

            OwnHealth = new Label(manager);
            OwnHealth.Init();
            OwnHealth.Parent = infoBox;
            OwnHealth.Top = Money.Top + Money.Height + 2;
            OwnHealth.Left = CreepNumber.Left;
            OwnHealth.Width = OwnHealth.Parent.Width - 4;
            OwnHealth.ToolTip = new ToolTip(manager) { Text = "So viel Energie hat der Spieler noch" };
            OwnHealth.Passive = false;

            Points = new Label(manager);
            Points.Init();
            Points.Parent = infoBox;
            Points.Top = OwnHealth.Top + OwnHealth.Height + 2;
            Points.Left = CreepNumber.Left;
            Points.Width = Points.Parent.Width - 4;
            Points.ToolTip = new ToolTip(manager) { Text = "So viele Punkte hat der Spieler schon.\nDie Punkte setzen sich aus Energie\nund Geschwindigkeit der Creeps zusammen.\nJe näher ein Gegner am Ziel ist, desto mehr\nPunkte gibt er." };
            Points.Passive = false;

            #endregion

            #region Waves

            var waveBox = new GroupBox(manager);
            waveBox.Init();
            waveBox.Parent = GameplayPage;
            waveBox.Text = "Waves";
            waveBox.Left = 2;
            waveBox.Top = infoBox.Top + infoBox.Height + 2;
            waveBox.Width = waveBox.Parent.Width - 4;
            waveBox.Height = 137;

            WaveNumber = new Label(manager);
            WaveNumber.Init();
            WaveNumber.Parent = waveBox;
            WaveNumber.Top = 14;
            WaveNumber.Left = 4;
            WaveNumber.Width = WaveNumber.Parent.Width - 4;

            RealWaveNumber = new Label(manager);
            RealWaveNumber.Init();
            RealWaveNumber.Parent = waveBox;
            RealWaveNumber.Top = WaveNumber.Top + WaveNumber.Height + 2;
            RealWaveNumber.Left = WaveNumber.Left;
            RealWaveNumber.Width = RealWaveNumber.Parent.Width - 4;

            CreepsLeft = new Label(manager);
            CreepsLeft.Init();
            CreepsLeft.Parent = waveBox;
            CreepsLeft.Top = RealWaveNumber.Top + RealWaveNumber.Height + 2;
            CreepsLeft.Left = WaveNumber.Left;
            CreepsLeft.Width = CreepsLeft.Parent.Width - 4;
            CreepsLeft.Passive = false;
            CreepsLeft.ToolTip = new ToolTip(manager) { Text = "So viele Creeps werden noch im Level erscheinen,\nbevor die Aktuelle Welle vorbei ist." };

            CreepHealthLevel = new Label(manager);
            CreepHealthLevel.Init();
            CreepHealthLevel.Parent = waveBox;
            CreepHealthLevel.Top = CreepsLeft.Top + CreepsLeft.Height + 2;
            CreepHealthLevel.Left = WaveNumber.Left;
            CreepHealthLevel.Width = CreepHealthLevel.Parent.Width - 4;
            CreepHealthLevel.Passive = false;
            CreepHealthLevel.ToolTip = new ToolTip(manager) { Text = "Wenn alle Waves eines Levels fertig sind, werden die Waves von Anfang anwiederholt.\nAllerdings steigt die Energie der Creeps dabei.\nDas Gesundheitsniveau liegt dieser Energie zugrunde." };

            TimeLeftNextWave = new Label(manager);
            TimeLeftNextWave.Init();
            TimeLeftNextWave.Parent = waveBox;
            TimeLeftNextWave.Top = CreepHealthLevel.Top + CreepHealthLevel.Height + 2;
            TimeLeftNextWave.Left = WaveNumber.Left;
            TimeLeftNextWave.Width = TimeLeftNextWave.Parent.Width - 4;

            var nextWaveButton = new Button(manager);
            nextWaveButton.Init();
            nextWaveButton.Parent = waveBox;
            nextWaveButton.Text = "Nächste Welle";
            nextWaveButton.Left = 2;
            nextWaveButton.Top = TimeLeftNextWave.Top + TimeLeftNextWave.Height + 2;
            nextWaveButton.Width = nextWaveButton.Parent.Width - 4;
            nextWaveButton.Click += delegate { GamePlayScreen.StartNextWave(); };

            #endregion

            #region Spielsteuerung

            var gameBox = new GroupBox(manager);
            gameBox.Init();
            gameBox.Text = "Spielsteuerung";
            gameBox.Parent = GameplayPage;
            gameBox.Width = gameBox.Parent.Width - 4;
            gameBox.Height = 200;
            gameBox.Left = 2;
            gameBox.Top = waveBox.Top + waveBox.Height + 2;

            var playButton = new ImageButton(manager)
                                 {
                                     Image =
                                         CurrGame.Content.Load<Texture2D>(CurrGame.ApplicationDirectory + "\\Content\\GUI\\play"),
                                     SizeMode = SizeMode.Stretched,
                                     Top = 14,
                                     Left = 2,
                                     Width = 50
                                 };
            playButton.Height = playButton.Width;
            playButton.Click += ((sender, e) => GamePlayScreen.StartGame());
            playButton.Init();

            var pauseButton = new ImageButton(manager)
                                  {
                                      Image =
                                          CurrGame.Content.Load<Texture2D>(CurrGame.ApplicationDirectory +
                                                                           "\\Content\\GUI\\pause"),
                                      SizeMode = SizeMode.Stretched,
                                      Top = 14,
                                      Left = playButton.Left + playButton.Width + 4
                                  };
            pauseButton.Width = pauseButton.Height = playButton.Width;
            pauseButton.Click += ((sender, e) => GamePlayScreen.StopGame());
            pauseButton.Init();

            gameBox.Add(playButton);
            gameBox.Add(pauseButton);

            #endregion

            RefreshGameInformation();

            #endregion

            #region Optionspage

            OptionsPage = tabControl.AddPage();
            OptionsPage.Text = "Optionen";

            #endregion

            #region SaveLoadPage

            #endregion

            manager.Add(tabControl);
        }
        public OptionsWindow(Sidebar sidebar)
        {
            UserInterface.GameInputDisabled = true;
            this.manager = sidebar.manager;
            this.sidebar = sidebar;

            window = new Window(manager);
            window.Init();
            window.Left = sidebar.master.Left;
            window.Width = sidebar.master.Width;
            window.Top = 200;
            window.Height = 200;
            window.Width = 240;
            window.Text = "Options";
            window.Resizable = false;
            window.Movable = false;

            window.Closed += delegate { UserInterface.GameInputDisabled = false; };
            window.ShowModal();
            manager.Add(window);

            btnOk = new Button(manager);
            btnOk.Init();
            btnOk.Parent = window;
            btnOk.Left = LeftPadding;
            btnOk.Top = window.Height - (btnOk.Height * 3);
            btnOk.Text = "Ok";// +"\u2713";
            btnOk.Click += (s, e) => window.Close();

            //btnLoadLevel = new Button(manager);
            //btnLoadLevel.Init();
            //window.Add(btnLoadLevel);
            //btnLoadLevel.Width += 30;
            //btnLoadLevel.Left = window.Width - btnLoadLevel.Width - LeftPadding * 5;
            //btnLoadLevel.Text = "Load Level";
            //btnLoadLevel.Top = window.Height - (btnLoadLevel.Height * 3);
            //btnLoadLevel.Click += btnLoadLevel_Click;
            //
            //btnSaveLevel = new Button(manager);
            //btnSaveLevel.Init();
            //window.Add(btnSaveLevel);
            //btnSaveLevel.Width += 30;
            //btnSaveLevel.Left = window.Width - btnSaveLevel.Width - LeftPadding * 5;
            //btnSaveLevel.Text = "Save Level";
            //btnSaveLevel.Top = btnLoadLevel.Top - btnSaveLevel.Height - LeftPadding;
            //btnSaveLevel.Click += btnSaveLevel_Click;

            lblUserLevel = new Label(manager);
            lblUserLevel.Init();
            lblUserLevel.Parent = window;
            lblUserLevel.Left = LeftPadding;
            lblUserLevel.Top = HeightCounter;
            lblUserLevel.Text = "User Level";
            lblUserLevel.Width += 10;

            cbUserLevel = new ComboBox(manager);
            cbUserLevel.Init();
            cbUserLevel.Parent = window;
            cbUserLevel.Top = HeightCounter;
            cbUserLevel.Left = lblUserLevel.Width;
            cbUserLevel.Width = 150;
            HeightCounter += cbUserLevel.Height;
            cbUserLevel.TextColor = Color.Black;
            foreach(string ul in Enum.GetNames(typeof(UserLevel)))
            {
                cbUserLevel.Items.Add(ul);
            }
            cbUserLevel.ItemIndexChanged += (s, e) =>
            {
                sidebar.userLevel = (UserLevel)cbUserLevel.ItemIndex;

            };
            int count = 0;
            foreach(object s in cbUserLevel.Items)
            {
                if (s.ToString().Equals(sidebar.userLevel.ToString()))
                {
                    cbUserLevel.ItemIndex = count;
                }
                count++;
            }

            Label lblRes = new Label(manager);
            lblRes.Init();
            lblRes.Parent = window;
            lblRes.Left = LeftPadding;
            lblRes.Top = HeightCounter;
            lblRes.Text = "Resolution";
            lblRes.Width += 10;

            ComboBox cbResolutions = new ComboBox(manager);
            cbResolutions.Init();
            cbResolutions.Parent = window;
            cbResolutions.Top = HeightCounter;
            cbResolutions.Left = lblUserLevel.Width;
            cbResolutions.Width = 150;
            HeightCounter += cbResolutions.Height;
            cbUserLevel.TextColor = Color.Black;
            foreach (resolutions r in Enum.GetValues(typeof(resolutions)))
            {
                cbResolutions.Items.Add(r);
            }
            cbResolutions.ItemIndexChanged += (s, e) =>
            {
                OrbIt.game.setResolution((resolutions)cbResolutions.ItemIndex, OrbIt.game.Graphics.IsFullScreen);
                if (OrbIt.game.Graphics.IsFullScreen)
                    OrbIt.game.prefFullScreenResolution = (resolutions)cbResolutions.ItemIndex;
                else OrbIt.game.prefWindowedResolution = (resolutions)cbResolutions.ItemIndex;

            };

            CreateCheckBox("FullScreen", OrbIt.isFullScreen, (o, e) =>
            {
                if ((o as CheckBox).Checked) OrbIt.game.setResolution(resolutions.AutoFullScreen, true);
                else OrbIt.game.setResolution(resolutions.WXGA_1280x800, false);
            });
            CreateCheckBox("Hide Links", sidebar.ui.game.room.DrawLinks, (o, e) => sidebar.ui.game.room.DrawLinks = !(o as CheckBox).Checked);

            CreateCheckBox("Edit Selected Node", false, (o, e) => Utils.notImplementedException() );

            //CreateCheckBox("Edit Selected Node", sidebar.EditSelectedNode, (o, e) => sidebar.EditSelectedNode = (o as CheckBox).Checked);
        }
        public override void LoadContent(ContentManager contentloader)
        {
            _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default");
            _guiman.Initialize();

            _serverbrowsingmenu = new Window(_guiman);
            _serverbrowsingmenu.Init();
            _serverbrowsingmenu.Resizable = false;
            _serverbrowsingmenu.Movable = false;
            _serverbrowsingmenu.CloseButtonVisible = false;
            _serverbrowsingmenu.Text = "Server Browser";
            _serverbrowsingmenu.Width = 300;
            _serverbrowsingmenu.Height = 400;
            _serverbrowsingmenu.Center();
            _serverbrowsingmenu.Visible = true;
            _serverbrowsingmenu.BorderVisible = true;

            _serversbox = new ListBox(_guiman);
            _serversbox.Init();
            //servers.SetPosition(50, 50);
            _serversbox.Left = 50;
            _serversbox.Top = 150;
            _serversbox.Width = 200;
            _serversbox.Height = 200;
            _serversbox.Anchor = Anchors.Bottom;
            _serversbox.Parent = _serverbrowsingmenu;

            _join = new Button(_guiman);
            _join.Init();
            _join.Text = "Join";
            _join.Width = 200;
            _join.Height = 50;
            _join.Left = 50;
            _join.Top = 0;
            _join.Anchor = Anchors.Bottom;
            _join.Parent = _serverbrowsingmenu;

            _refresh = new Button(_guiman);
            _refresh.Init();
            _refresh.Text = "Refresh";
            _refresh.Width = 200;
            _refresh.Height = 50;
            _refresh.Left = 50;
            _refresh.Top = 50;
            _refresh.Anchor = Anchors.Bottom;
            _refresh.Parent = _serverbrowsingmenu;

            _back = new Button(_guiman);
            _back.Init();
            _back.Text = "Back";
            _back.Width = 200;
            _back.Height = 50;
            _back.Left = 50;
            _back.Top = 100;
            _back.Anchor = Anchors.Bottom;
            _back.Parent = _serverbrowsingmenu;

            _guiman.Cursor = _guiman.Skin.Cursors["Default"].Resource;
            _guiman.Add(_serverbrowsingmenu);

            _gamemanager.Game.IsMouseVisible = true;
        }