예제 #1
0
 void txtWorldWidth_OnTabPressed(TextBox sender)
 {
     txtLevelHeight_Clicked(sender);
 }
예제 #2
0
        public override void LoadContent(ContentManager Content)
        {
            base.LoadContent(Content);

            wndPanel.LoadContent(Content);
            wndPanel.DrawWindow = false;

            UI.Button bClose = new UI.Button(new Rectangle(WindowRectangle.Width - 112, WindowRectangle.Height - 48, 96, 32));
            bClose.Parent = wndPanel;
            bClose.LoadContent(Content);
            bClose.Text = "Cancel";
            bClose.Clicked += bClose_Clicked;
            wndPanel.AddWindow("btnClose", bClose);

            UI.Button bCreate = new UI.Button(new Rectangle(WindowRectangle.Width - bClose.WindowRectangle.Width - 16 - 112, WindowRectangle.Height - 48, 96, 32));
            bCreate.Parent = wndPanel;
            bCreate.LoadContent(Content);
            bCreate.Text = "Create";
            bCreate.Clicked += bCreate_Clicked;
            wndPanel.AddWindow("btnCreate", bCreate);

            UI.ComboBox cboWorldType = new ComboBox(new Rectangle(WindowRectangle.X + 9, WindowRectangle.Y + 104, 256, 32));
            cboWorldType.LoadContent(Content);
            cboWorldType.AddItem("Forest Jungle");
            cboWorldType.AddItem("Prison Cells");
            cboWorldType.AddItem("Sandy Beach");
            cboWorldType.SelectedItem = "Forest Jungle";
            wndPanel.AddWindow("cboWorldType", cboWorldType);

            UI.Label lblWorldType = new UI.Label(new Rectangle(0, 74, wndPanel.WindowRectangle.Width, 20));
            lblWorldType.Parent = wndPanel;
            lblWorldType.LoadContent(Content);
            lblWorldType.Text = "World Type";
            wndPanel.AddWindow("lblWorldType", lblWorldType);

            UI.Label lblName = new UI.Label(new Rectangle(0, 12, wndPanel.WindowRectangle.Width, 20));
            lblName.Parent = wndPanel;
            lblName.LoadContent(Content);
            lblName.Text = "Level Name:";
            wndPanel.AddWindow("lblLvlName", lblName);

            UI.TextBox txtLevelName = new TextBox(new Rectangle(4, lblName.WindowRectangle.Height * 2, wndPanel.WindowRectangle.Width - 10, 32));
            txtLevelName.Parent = wndPanel;
            txtLevelName.LoadContent(Content);
            txtLevelName.Clicked += txtLevelName_Clicked;
            txtLevelName.OnTabPressed += txtLevelName_OnTabPressed;
            txtLevelName.Text = "bla";
            wndPanel.AddWindow("txtLevelName", txtLevelName);

            UI.Label lblSize = new UI.Label(new Rectangle(0, 140, wndPanel.WindowRectangle.Width, 20));
            lblSize.Parent = wndPanel;
            lblSize.LoadContent(Content);
            lblSize.Text = "World Size (In Tiles)";
            wndPanel.AddWindow("lblSize", lblSize);

            UI.Label lblWorldWidth = new UI.Label(new Rectangle(0, 180, 150, 20));
            lblWorldWidth.Parent = wndPanel;
            lblWorldWidth.LoadContent(Content);
            lblWorldWidth.Text = "World Width:";
            wndPanel.AddWindow("lblWorldWidth", lblWorldWidth);

            UI.Label lblWorldHeight = new UI.Label(new Rectangle(220, 180, 50, 20));
            lblWorldHeight.Parent = wndPanel;
            lblWorldHeight.LoadContent(Content);
            lblWorldHeight.Text = "World Height:";
            wndPanel.AddWindow("lblWorldHeight", lblWorldHeight);

            UI.TextBox txtWorldWidth = new TextBox(new Rectangle(140, 175, 80, 32));
            txtWorldWidth.Parent = wndPanel;
            txtWorldWidth.LoadContent(Content);
            txtWorldWidth.MaxLength = 3;
            txtWorldWidth.Clicked += txtLevelWidth_Clicked;
            txtWorldWidth.OnTabPressed += txtWorldWidth_OnTabPressed;
            txtWorldWidth.NumericBox = true;
            txtWorldWidth.Text = "22";
            wndPanel.AddWindow("txtLevelWidth", txtWorldWidth);

            UI.TextBox txtLevelHeight = new TextBox(new Rectangle(360, 175, 80, 32));
            txtLevelHeight.Parent = wndPanel;
            txtLevelHeight.LoadContent(Content);
            txtLevelHeight.NumericBox = true;
            txtLevelHeight.MaxLength = 3;
            txtLevelHeight.Text = "22";
            txtLevelHeight.Clicked += txtLevelHeight_Clicked;
            txtLevelHeight.OnTabPressed += txtLevelHeight_OnTabPressed;
            wndPanel.AddWindow("txtLevelHeight", txtLevelHeight);

            UI.CheckBox chkWater = new CheckBox(new Rectangle(4, WindowRectangle.Height - 48, 150, 24));
            chkWater.Parent = wndPanel;
            chkWater.LoadContent(Content);
            chkWater.Text = "Water Level";
            chkWater.WindowClicked += chkWater_WindowClicked;
            wndPanel.AddWindow("chkWater", chkWater);

            UI.TextBox txtWaterLevel = new TextBox(new Rectangle(160, WindowRectangle.Height - 48, 40, 32));
            txtWaterLevel.Parent = wndPanel;
            txtWaterLevel.LoadContent(Content);
            txtWaterLevel.NumericBox = true;
            txtWaterLevel.MaxLength = 1;
            txtWaterLevel.Text = DEFAULT_WATER_LEVEL;
            txtWaterLevel.Clicked += txtWaterLevel_Clicked;
            txtWaterLevel.OnTabPressed += txtWaterLevel_OnTabPressed;
            txtWaterLevel.OnEnterPressed += txtWaterLevel_OnEnterPressed;
            txtWaterLevel.Visible = false;
            wndPanel.AddWindow("txtWaterLevel", txtWaterLevel);
        }
예제 #3
0
 void txtWaterLevel_OnEnterPressed(TextBox sender)
 {
     if (sender.Text == "")
         sender.Text = DEFAULT_WATER_LEVEL;
 }
예제 #4
0
        void txtWaterLevel_OnTabPressed(TextBox sender)
        {
            if (sender.Text == "")
                sender.Text = DEFAULT_WATER_LEVEL;

            txtLevelName_Clicked(sender);
        }
예제 #5
0
 void txtWaterLevel_Clicked(TextBox sender)
 {
     Engine.KeyboardDispatcher.Subscriber = wndPanel.GetWindow<TextBox>("txtWaterLevel");
 }
예제 #6
0
 void txtLevelName_OnTabPressed(TextBox sender)
 {
     txtLevelWidth_Clicked(sender);
 }
예제 #7
0
        void txtLevelHeight_OnTabPressed(TextBox sender)
        {
            var wnd = wndPanel.GetWindow<TextBox>("txtWaterLevel");

            if (wnd.Visible)
            {
                txtWaterLevel_Clicked(sender);
            }
            else
            {
                txtLevelName_Clicked(sender);
            }
        }
예제 #8
0
        public override void LoadContent(ContentManager Content)
        {
            base.LoadContent(Content);

            wndPanel.LoadContent(Content);
            wndPanel.DrawWindow = false;
            wndPanel.Parent = this;

            Label lblText;
            TextBox txtText;
            Button btnOK;
            Button btnCancel;

            lblText = new Label(new Rectangle(4, 20, WindowRectangle.Width - 106, 50));
            lblText.Parent = wndPanel;
            lblText.LoadContent(Content);
            wndPanel.AddWindow("lblText", lblText);

            txtText = new TextBox(new Rectangle(4, 60, WindowRectangle.Width - 118, 32));
            txtText.Parent = wndPanel;
            txtText.LoadContent(Content);
            txtText.Clicked += txtText_Clicked;
            wndPanel.AddWindow("txtText", txtText);

            btnOK = new Button(new Rectangle(WindowRectangle.Width - 110, 20, 96, 32));
            btnOK.Parent = wndPanel;
            btnOK.LoadContent(Content);
            btnOK.Text = "OK";
            btnOK.Clicked += btnOK_Clicked;
            wndPanel.AddWindow("btnOK", btnOK);

            btnCancel = new Button(new Rectangle(WindowRectangle.Width - 110, 60, 96, 32));
            btnCancel.Parent = wndPanel;
            btnCancel.LoadContent(Content);
            btnCancel.Text = "Cancel";
            btnCancel.Clicked += btnCancel_Clicked;
            wndPanel.AddWindow("btnCancel", btnCancel);
        }
예제 #9
0
 void txtText_Clicked(TextBox sender)
 {
     Engine.KeyboardDispatcher.Subscriber = sender;
 }