public EditMemoryBankDialog(MemoryBankData memoryBankData, Action handler)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/EditMemoryBankDialog");

            LoadContents(this, node);
            m_linearPanel      = Children.Find <Widget>("EditMemoryBankDialog.LinearPanel");
            m_gridPanel        = Children.Find <Widget>("EditMemoryBankDialog.GridPanel");
            m_okButton         = Children.Find <ButtonWidget>("EditMemoryBankDialog.OK");
            m_cancelButton     = Children.Find <ButtonWidget>("EditMemoryBankDialog.Cancel");
            m_switchViewButton = Children.Find <ButtonWidget>("EditMemoryBankDialog.SwitchViewButton");
            m_linearTextBox    = Children.Find <TextBoxWidget>("EditMemoryBankDialog.LinearText");
            for (int i = 0; i < 16; i++)
            {
                m_lineTextBoxes[i] = Children.Find <TextBoxWidget>("EditMemoryBankDialog.Line" + i.ToString());
            }
            m_handler               = handler;
            m_memoryBankData        = memoryBankData;
            m_tmpMemoryBankData     = (MemoryBankData)m_memoryBankData.Copy();
            m_linearPanel.IsVisible = false;
            for (int j = 0; j < 16; j++)
            {
                m_lineTextBoxes[j].TextChanged += TextBox_TextChanged;
            }
            m_linearTextBox.TextChanged += TextBox_TextChanged;
        }
Beispiel #2
0
        public PublishCommunityLinkDialog(string user, string address, string name)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/PublishCommunityLinkDialog");

            LoadContents(this, node);
            m_linkTextBoxWidget              = Children.Find <TextBoxWidget>("PublishCommunityLinkDialog.Link");
            m_nameTextBoxWidget              = Children.Find <TextBoxWidget>("PublishCommunityLinkDialog.Name");
            m_typeIconWidget                 = Children.Find <RectangleWidget>("PublishCommunityLinkDialog.TypeIcon");
            m_typeLabelWidget                = Children.Find <LabelWidget>("PublishCommunityLinkDialog.Type");
            m_changeTypeButtonWidget         = Children.Find <ButtonWidget>("PublishCommunityLinkDialog.ChangeType");
            m_publishButtonWidget            = Children.Find <ButtonWidget>("PublishCommunityLinkDialog.Publish");
            m_cancelButtonWidget             = Children.Find <ButtonWidget>("PublishCommunityLinkDialog.Cancel");
            m_linkTextBoxWidget.TextChanged += delegate
            {
                m_nameTextBoxWidget.Text = Storage.GetFileNameWithoutExtension(GetFilenameFromLink(m_linkTextBoxWidget.Text));
            };
            if (!string.IsNullOrEmpty(address))
            {
                m_linkTextBoxWidget.Text = address;
            }
            if (!string.IsNullOrEmpty(name))
            {
                m_nameTextBoxWidget.Text = name;
            }
            m_user = user;
        }
Beispiel #3
0
        public Widget makeTextBox(Action <TextBoxWidget> ac, string text = "")
        {
            CanvasWidget canvasWidget = new CanvasWidget()
            {
                HorizontalAlignment = WidgetAlignment.Center
            };
            RectangleWidget rectangleWidget = new RectangleWidget()
            {
                FillColor = Color.Black, OutlineColor = Color.White, Size = new Vector2(120, 30)
            };
            StackPanelWidget stack = new StackPanelWidget()
            {
                Direction = LayoutDirection.Vertical
            };
            TextBoxWidget textBox = new TextBoxWidget()
            {
                VerticalAlignment = WidgetAlignment.Center, Color = new Color(255, 255, 255), Margin = new Vector2(4f, 0f), Size = new Vector2(120, 30), MaximumLength = 256
            };

            textBox.FontScale    = 0.7f;
            textBox.Text         = text;
            textBox.TextChanged += ac;
            stack.Children.Add(textBox);
            canvasWidget.Children.Add(rectangleWidget);
            canvasWidget.Children.Add(stack);
            return(canvasWidget);
        }
Beispiel #4
0
        public PlayerScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/PlayerScreen");

            LoadContents(this, node);
            m_playerModel                     = Children.Find <PlayerModelWidget>("Model");
            m_playerClassButton               = Children.Find <ButtonWidget>("PlayerClassButton");
            m_nameTextBox                     = Children.Find <TextBoxWidget>("Name");
            m_characterSkinLabel              = Children.Find <LabelWidget>("CharacterSkinLabel");
            m_characterSkinButton             = Children.Find <ButtonWidget>("CharacterSkinButton");
            m_controlsLabel                   = Children.Find <LabelWidget>("ControlsLabel");
            m_controlsButton                  = Children.Find <ButtonWidget>("ControlsButton");
            m_descriptionLabel                = Children.Find <LabelWidget>("DescriptionLabel");
            m_addButton                       = Children.Find <ButtonWidget>("AddButton");
            m_addAnotherButton                = Children.Find <ButtonWidget>("AddAnotherButton");
            m_deleteButton                    = Children.Find <ButtonWidget>("DeleteButton");
            m_playButton                      = Children.Find <ButtonWidget>("PlayButton");
            m_characterSkinsCache             = new CharacterSkinsCache();
            m_playerModel.CharacterSkinsCache = m_characterSkinsCache;
            m_nameTextBox.FocusLost          += delegate
            {
                if (VerifyName())
                {
                    m_playerData.Name = m_nameTextBox.Text.Trim();
                }
                else
                {
                    m_nameWasInvalid = true;
                }
            };
        }
Beispiel #5
0
        public EditTruthTableDialog(TruthTableData truthTableData, Action <bool> handler)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/EditTruthTableDialog");

            LoadContents(this, node);
            m_linearPanel      = Children.Find <Widget>("EditTruthTableDialog.LinearPanel");
            m_gridPanel        = Children.Find <Widget>("EditTruthTableDialog.GridPanel");
            m_okButton         = Children.Find <ButtonWidget>("EditTruthTableDialog.OK");
            m_cancelButton     = Children.Find <ButtonWidget>("EditTruthTableDialog.Cancel");
            m_switchViewButton = Children.Find <ButtonWidget>("EditTruthTableDialog.SwitchViewButton");
            m_linearTextBox    = Children.Find <TextBoxWidget>("EditTruthTableDialog.LinearText");
            for (int i = 0; i < 16; i++)
            {
                m_lineCheckboxes[i] = Children.Find <CheckboxWidget>("EditTruthTableDialog.Line" + i.ToString());
            }
            m_handler                    = handler;
            m_truthTableData             = truthTableData;
            m_tmpTruthTableData          = (TruthTableData)m_truthTableData.Copy();
            m_linearPanel.IsVisible      = false;
            m_linearTextBox.TextChanged += delegate
            {
                if (!m_ignoreTextChanges)
                {
                    m_tmpTruthTableData = new TruthTableData();
                    m_tmpTruthTableData.LoadBinaryString(m_linearTextBox.Text);
                }
            };
        }
Beispiel #6
0
        public ExternalContentLinkDialog(string link)
        {
            ClipboardManager.ClipboardString = link;
            XElement node = ContentManager.Get <XElement>("Dialogs/ExternalContentLinkDialog");

            LoadContents(this, node);
            m_textBoxWidget      = Children.Find <TextBoxWidget>("ExternalContentLinkDialog.TextBox");
            m_okButtonWidget     = Children.Find <ButtonWidget>("ExternalContentLinkDialog.OkButton");
            m_textBoxWidget.Text = link;
        }
        public EditSignDialog(SubsystemSignBlockBehavior subsystemSignBlockBehavior, Point3 signPoint)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/EditSignDialog");

            LoadContents(this, node);
            m_linesPage     = Children.Find <ContainerWidget>("EditSignDialog.LinesPage");
            m_urlPage       = Children.Find <ContainerWidget>("EditSignDialog.UrlPage");
            m_textBox1      = Children.Find <TextBoxWidget>("EditSignDialog.TextBox1");
            m_textBox2      = Children.Find <TextBoxWidget>("EditSignDialog.TextBox2");
            m_textBox3      = Children.Find <TextBoxWidget>("EditSignDialog.TextBox3");
            m_textBox4      = Children.Find <TextBoxWidget>("EditSignDialog.TextBox4");
            m_colorButton1  = Children.Find <ButtonWidget>("EditSignDialog.ColorButton1");
            m_colorButton2  = Children.Find <ButtonWidget>("EditSignDialog.ColorButton2");
            m_colorButton3  = Children.Find <ButtonWidget>("EditSignDialog.ColorButton3");
            m_colorButton4  = Children.Find <ButtonWidget>("EditSignDialog.ColorButton4");
            m_urlTextBox    = Children.Find <TextBoxWidget>("EditSignDialog.UrlTextBox");
            m_urlTestButton = Children.Find <ButtonWidget>("EditSignDialog.UrlTestButton");
            m_okButton      = Children.Find <ButtonWidget>("EditSignDialog.OkButton");
            m_cancelButton  = Children.Find <ButtonWidget>("EditSignDialog.CancelButton");
            m_urlButton     = Children.Find <ButtonWidget>("EditSignDialog.UrlButton");
            m_linesButton   = Children.Find <ButtonWidget>("EditSignDialog.LinesButton");
            m_subsystemSignBlockBehavior = subsystemSignBlockBehavior;
            m_signPoint = signPoint;
            SignData signData = m_subsystemSignBlockBehavior.GetSignData(m_signPoint);

            if (signData != null)
            {
                m_textBox1.Text      = signData.Lines[0];
                m_textBox2.Text      = signData.Lines[1];
                m_textBox3.Text      = signData.Lines[2];
                m_textBox4.Text      = signData.Lines[3];
                m_colorButton1.Color = signData.Colors[0];
                m_colorButton2.Color = signData.Colors[1];
                m_colorButton3.Color = signData.Colors[2];
                m_colorButton4.Color = signData.Colors[3];
                m_urlTextBox.Text    = signData.Url;
            }
            else
            {
                m_textBox1.Text      = string.Empty;
                m_textBox2.Text      = string.Empty;
                m_textBox3.Text      = string.Empty;
                m_textBox4.Text      = string.Empty;
                m_colorButton1.Color = Color.Black;
                m_colorButton2.Color = Color.Black;
                m_colorButton3.Color = Color.Black;
                m_colorButton4.Color = Color.Black;
                m_urlTextBox.Text    = string.Empty;
            }
            m_linesPage.IsVisible = true;
            m_urlPage.IsVisible   = false;
            UpdateControls();
        }
        public CommandHelperDialog(SubsystemCommandEngine engine)
        {
            commandEngine = engine;

            XElement node = ContentManager.Get <XElement>("Dialogs/CommandHelperDialog");

            WidgetsManager.LoadWidgetContents(this, this, node);
            animals = Children.Find <ButtonWidget>("CommandHelperDialog.ShowAnimals");
            blocks  = Children.Find <ButtonWidget>("CommandHelperDialog.ShowBlocks");
            back    = Children.Find <ButtonWidget>("CommandHelperDialog.Back");

            textBoxAnimal = Children.Find <TextBoxWidget>("CommandHelperDialog.AnimalName");
            textBoxBlock  = Children.Find <TextBoxWidget>("CommandHelperDialog.BlockName");
        }
        public DownloadContentFromLinkDialog()
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/DownloadContentFromLinkDialog");

            LoadContents(this, node);
            m_linkTextBoxWidget              = Children.Find <TextBoxWidget>("DownloadContentFromLinkDialog.Link");
            m_nameTextBoxWidget              = Children.Find <TextBoxWidget>("DownloadContentFromLinkDialog.Name");
            m_typeIconWidget                 = Children.Find <RectangleWidget>("DownloadContentFromLinkDialog.TypeIcon");
            m_typeLabelWidget                = Children.Find <LabelWidget>("DownloadContentFromLinkDialog.Type");
            m_changeTypeButtonWidget         = Children.Find <ButtonWidget>("DownloadContentFromLinkDialog.ChangeType");
            m_downloadButtonWidget           = Children.Find <ButtonWidget>("DownloadContentFromLinkDialog.Download");
            m_cancelButtonWidget             = Children.Find <ButtonWidget>("DownloadContentFromLinkDialog.Cancel");
            m_linkTextBoxWidget.TextChanged += delegate
            {
                m_updateContentName = true;
                m_updateContentType = true;
            };
        }
Beispiel #10
0
        public EditCommandBlockDialog(CommandData data)
        {
            XElement node = ContentManager.Get <XElement>("Dialogs/EditCommandBlockDialog");

            WidgetsManager.LoadWidgetContents(this, this, node);
            textBox      = Children.Find <TextBoxWidget>("EditCommandBlockDialog.TextBox");
            list         = Children.Find <ListPanelWidget>("EditCommandBlockDialog.List");
            okButton     = Children.Find <ButtonWidget>("EditCommandBlockDIalog.OkButton");
            cancelButton = Children.Find <ButtonWidget>("EditCommandBlockDIalog.CancelButton");

            commandData          = data;
            command              = data.Command;
            textBox.Text         = command;
            textBox.TextChanged += TextChanged;

            list.ItemClicked += ListSelected;

            engine = GameManager.Project.FindSubsystem <SubsystemCommandEngine>(true);
        }
Beispiel #11
0
        public ModifyWorldScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/ModifyWorldScreen");

            LoadContents(this, node);
            m_nameTextBox              = Children.Find <TextBoxWidget>("Name");
            m_seedLabel                = Children.Find <LabelWidget>("Seed");
            m_gameModeButton           = Children.Find <ButtonWidget>("GameMode");
            m_worldOptionsButton       = Children.Find <ButtonWidget>("WorldOptions");
            m_errorLabel               = Children.Find <LabelWidget>("Error");
            m_descriptionLabel         = Children.Find <LabelWidget>("Description");
            m_applyButton              = Children.Find <ButtonWidget>("Apply");
            m_deleteButton             = Children.Find <ButtonWidget>("Delete");
            m_uploadButton             = Children.Find <ButtonWidget>("Upload");
            m_nameTextBox.TextChanged += delegate
            {
                m_worldSettings.Name = m_nameTextBox.Text;
            };
        }
        public void TextBox_TextChanged(TextBoxWidget textBox)
        {
            if (m_ignoreTextChanges)
            {
                return;
            }
            if (textBox == m_linearTextBox)
            {
                m_tmpMemoryBankData = new MemoryBankData();
                m_tmpMemoryBankData.LoadString(m_linearTextBox.Text);
                return;
            }
            string text = string.Empty;

            for (int i = 0; i < 16; i++)
            {
                text += m_lineTextBoxes[i].Text;
            }
            m_tmpMemoryBankData = new MemoryBankData();
            m_tmpMemoryBankData.LoadString(text);
        }
Beispiel #13
0
        public TextBoxDialog(string title, string text, int maximumLength, Action <string> handler)
        {
            m_handler = handler;
            XElement node = ContentManager.Get <XElement>("Dialogs/TextBoxDialog");

            LoadContents(this, node);
            m_titleWidget                 = Children.Find <LabelWidget>("TextBoxDialog.Title");
            m_textBoxWidget               = Children.Find <TextBoxWidget>("TextBoxDialog.TextBox");
            m_okButtonWidget              = Children.Find <ButtonWidget>("TextBoxDialog.OkButton");
            m_cancelButtonWidget          = Children.Find <ButtonWidget>("TextBoxDialog.CancelButton");
            m_titleWidget.IsVisible       = !string.IsNullOrEmpty(title);
            m_titleWidget.Text            = (title ?? string.Empty);
            m_textBoxWidget.MaximumLength = maximumLength;
            m_textBoxWidget.Text          = (text ?? string.Empty);
            m_textBoxWidget.HasFocus      = true;
            m_textBoxWidget.Enter        += delegate
            {
                Dismiss(m_textBoxWidget.Text);
            };
            AutoHide = true;
        }
        public NewWorldScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/NewWorldScreen");

            LoadContents(this, node);
            m_nameTextBox              = Children.Find <TextBoxWidget>("Name");
            m_seedTextBox              = Children.Find <TextBoxWidget>("Seed");
            m_gameModeButton           = Children.Find <ButtonWidget>("GameMode");
            m_startingPositionButton   = Children.Find <ButtonWidget>("StartingPosition");
            m_worldOptionsButton       = Children.Find <ButtonWidget>("WorldOptions");
            m_blankSeedLabel           = Children.Find <LabelWidget>("BlankSeed");
            m_descriptionLabel         = Children.Find <LabelWidget>("Description");
            m_errorLabel               = Children.Find <LabelWidget>("Error");
            m_playButton               = Children.Find <ButtonWidget>("Play");
            m_nameTextBox.TextChanged += delegate
            {
                m_worldSettings.Name = m_nameTextBox.Text;
            };
            m_seedTextBox.TextChanged += delegate
            {
                m_worldSettings.Seed = m_seedTextBox.Text;
            };
        }
Beispiel #15
0
        public Widget makeTextBox(string title)
        {
            CanvasWidget canvasWidget = new CanvasWidget()
            {
                Margin = new Vector2(10, 0)
            };
            RectangleWidget rectangleWidget = new RectangleWidget()
            {
                FillColor = Color.Black, OutlineColor = Color.White, Size = new Vector2(float.PositiveInfinity, 80)
            };
            StackPanelWidget stack = new StackPanelWidget()
            {
                Direction = LayoutDirection.Horizontal
            };
            LabelWidget label = new LabelWidget()
            {
                HorizontalAlignment = WidgetAlignment.Near, VerticalAlignment = WidgetAlignment.Near, Text = title, Margin = new Vector2(1f, 1f)
            };
            TextBoxWidget textBox = new TextBoxWidget()
            {
                VerticalAlignment = WidgetAlignment.Center, HorizontalAlignment = WidgetAlignment.Stretch, Color = new Color(255, 255, 255), Margin = new Vector2(4f, 0f), Size = new Vector2(float.PositiveInfinity, 80)
            };

            if (title == "用户名:")
            {
                txa = textBox;
            }
            if (title == "密  码:")
            {
                txb = textBox;
            }
            stack.Children.Add(label);
            stack.Children.Add(textBox);
            canvasWidget.Children.Add(rectangleWidget);
            canvasWidget.Children.Add(stack);
            return(canvasWidget);
        }
Beispiel #16
0
 void TextChanged(TextBoxWidget widget)
 {
     command = widget.Text;
     engine.AutoCompleteCommand(command, this);
 }