Exemple #1
0
        public TileSpawnPanel(Size size, IResourceManager resourceManager, IPlacementManager placementManager)
            : base("Tile Spawn Panel", size, resourceManager)
        {
            _resourceManager = resourceManager;
            _placementManager = placementManager;

            _tileList = new ScrollableContainer("tilespawnlist", new Size(200, 400), _resourceManager)
                            {Position = new Point(5, 5)};
            components.Add(_tileList);

            var searchLabel = new Label("Tile Search:", "CALIBRI", _resourceManager) {Position = new Point(210, 0)};
            components.Add(searchLabel);

            _tileSearchTextbox = new Textbox(125, _resourceManager) {Position = new Point(210, 20)};
            _tileSearchTextbox.OnSubmit += tileSearchTextbox_OnSubmit;
            components.Add(_tileSearchTextbox);

            _clearLabel = new Label("[Clear Filter]", "CALIBRI", _resourceManager)
                              {
                                  DrawBackground = true,
                                  DrawBorder = true,
                                  Position = new Point(210, 55)
                              };

            _clearLabel.Clicked += ClearLabelClicked;
            _clearLabel.BackgroundColor = Color.Gray;
            components.Add(_clearLabel);

            BuildTileList();

            Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
                                 (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
 private void textboxPassword_OnSubmit(string text, Textbox sender)
 {
     if (text.Length > 1 && !string.IsNullOrWhiteSpace(text))
     {
         TryAdminLogin(text);
         _textboxPassword.Text = string.Empty;
     }
 }
Exemple #3
0
 private void search_OnSubmit(string text, Textbox sender)
 {
     foreach (PropWindowStruct struc in ObjPropList)
     {
         if (struc.VarName.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0)
             struc.LabelName.BackgroundColor = Color.Bisque;
         else
             struc.LabelName.BackgroundColor = Color.Gray;
     }
 }
Exemple #4
0
 public DebugConsole(string uniqueName, Size size, IResourceManager resourceManager) : base(uniqueName, size, resourceManager)
 {
     input = new Textbox(size.Width, resourceManager);
     input.ClearFocusOnSubmit = false;
     input.drawColor = Color.FromArgb(100, Color.Gray);
     input.textColor = Color.FloralWhite;
     input.OnSubmit += new Textbox.TextSubmitHandler(input_OnSubmit);
     this.BackgroundColor = Color.FromArgb(100, Color.Gray);
     this.DrawBackground = true;
     this.DrawBorder = true;
     Update(0);
 }
        public AdminPasswordDialog(Size size, INetworkManager networkManager, IResourceManager resourceManager)
            : base("Admin Login", size, resourceManager)
        {
            _networkManager = networkManager;
            _resourceManager = resourceManager;

            _textboxPassword = new Textbox((int) (size.Width/2f), _resourceManager);
            _okayButton = new Button("Submit", _resourceManager);
            _okayButton.Clicked += OkayButtonClicked;
            _okayButton.mouseOverColor = Color.LightSkyBlue;
            _textboxPassword.OnSubmit += textboxPassword_OnSubmit;
            components.Add(_textboxPassword);
            components.Add(_okayButton);
            Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
                                 (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
        }
Exemple #6
0
        public MainScreen(IDictionary<Type, object> managers)
            : base(managers)
        {
            _background = ResourceManager.GetSprite("mainbg_filler");
            _background.Smoothing = Smoothing.Smooth;

            _buttConnect = new ImageButton
                               {
                                   ImageNormal = "connect_norm",
                                   ImageHover = "connect_hover"
                               };
            _buttConnect.Clicked += _buttConnect_Clicked;

            _buttOptions = new ImageButton
                               {
                                   ImageNormal = "options_norm",
                                   ImageHover = "options_hover"
                               };
            _buttOptions.Clicked += _buttOptions_Clicked;

            _buttExit = new ImageButton
                            {
                                ImageNormal = "exit_norm",
                                ImageHover = "exit_hover"
                            };
            _buttExit.Clicked += _buttExit_Clicked;

            _connectTextbox = new Textbox(100, ResourceManager) {Text = ConfigurationManager.GetServerAddress()};
            _connectTextbox.OnSubmit += ConnectTextboxOnSubmit;
            _connectTextbox.SetVisible(false);

            Assembly assembly = Assembly.GetExecutingAssembly();
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);

            _lblVersion = new Label("v. " + fvi.FileVersion, "CALIBRI", ResourceManager);
            _lblVersion.Text.Color = Color.WhiteSmoke;
            _lblVersion.Position = new Point(Gorgon.Screen.Width - _lblVersion.ClientArea.Width - 3,
                                             Gorgon.Screen.Height - _lblVersion.ClientArea.Height - 3);

            _titleImage = new SimpleImage
                              {
                                  Sprite = "SpaceStationLogoColor",
                                  Position = new Point(Gorgon.Screen.Width - 550, 100)
                              };
        }
Exemple #7
0
        public PropEditWindow(Size size, IResourceManager resourceManager, Object obj)
            : base("Object Properties : " + obj, size, resourceManager)
        {
            Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
                                 (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));

            search = new Textbox(150, resourceManager);
            search.Position = new Point(5, 5);
            search.OnSubmit += search_OnSubmit;
            search.ClearOnSubmit = true;
            search.ClearFocusOnSubmit = false;
            components.Add(search);

            assigned = obj;
            BuildPropList();

            Update(0);
        }
Exemple #8
0
        private void editTxt_OnSubmit(string text, Textbox sender)
        {
            var assigned = (MarshalComponentParameter) sender.UserData;

            if (assigned.Parameter.ParameterType == typeof (string))
            {
                assigned.Parameter.Parameter = text;
                _owner.GetComponent<ISVarsComponent>(ComponentFamily.SVars).DoSetSVar(assigned);
            }
            else if (assigned.Parameter.ParameterType == typeof (int))
            {
                assigned.Parameter.Parameter = int.Parse(text);
                _owner.GetComponent<ISVarsComponent>(ComponentFamily.SVars).DoSetSVar(assigned);
            }
            else if (assigned.Parameter.ParameterType == typeof (float))
            {
                assigned.Parameter.Parameter = float.Parse(text);
                _owner.GetComponent<ISVarsComponent>(ComponentFamily.SVars).DoSetSVar(assigned);
            }
        }
Exemple #9
0
 private GuiComponent CreateEditField(MarshalComponentParameter compPar)
 {
     if (compPar.Parameter.ParameterType == typeof (float) || compPar.Parameter.ParameterType == typeof (int) ||
         compPar.Parameter.ParameterType == typeof (String))
     {
         var editTxt = new Textbox(100, _resourceManager);
         editTxt.ClearOnSubmit = false;
         editTxt.UserData = compPar;
         editTxt.Text = compPar.Parameter.Parameter.ToString();
         editTxt.OnSubmit += editTxt_OnSubmit;
         return editTxt;
     }
     else if (compPar.Parameter.ParameterType == typeof (Boolean))
     {
         var editBool = new Checkbox(_resourceManager);
         editBool.UserData = compPar;
         editBool.Value = ((Boolean) compPar.Parameter.Parameter);
         editBool.ValueChanged += editBool_ValueChanged;
         return editBool;
     }
     return null;
 }
Exemple #10
0
 private GuiComponent CreateEditField(object o, FieldInfo field)
 {
     if (o is String || o is string)
     {
         var editStr = new Textbox(100, _resourceManager);
         editStr.ClearOnSubmit = false;
         editStr.UserData = field;
         editStr.Text = ((string) o);
         editStr.OnSubmit += editStr_OnSubmit;
         return editStr;
     }
     else if (o is Enum)
     {
         var editEnum = new Listbox(100, 100, _resourceManager, Enum.GetNames(o.GetType()).ToList());
         editEnum.UserData = field;
         editEnum.SelectItem(o.ToString());
         editEnum.ItemSelected += editEnum_ItemSelected;
         return editEnum;
     }
     else if (o is float || o is int || o is Int16 || o is Int32 || o is Int64 || o is double || o is Double ||
              o is decimal || o is Decimal || o is Single)
     {
         var editNum = new Textbox(100, _resourceManager);
         editNum.ClearOnSubmit = false;
         editNum.UserData = field;
         editNum.Text = o.ToString();
         editNum.OnSubmit += editNum_OnSubmit;
         return editNum;
     }
     else if (o is bool || o is Boolean)
     {
         var editBool = new Checkbox(_resourceManager);
         editBool.UserData = field;
         editBool.Value = ((Boolean) o);
         editBool.ValueChanged += editBool_ValueChanged;
         return editBool;
     }
     return null;
 }
Exemple #11
0
 void input_OnSubmit(string text, Textbox sender)
 {
     AddLine(text, Color.FloralWhite);
     ProcessCommand(text);
 }
Exemple #12
0
 private void ConnectTextboxOnSubmit(string text, Textbox sender)
 {
     StartConnect(text);
 }
        public EntitySpawnPanel(Size size, IResourceManager resourceManager, IPlacementManager placementManager)
            : base("Entity Spawn Panel", size, resourceManager)
        {
            _resourceManager = resourceManager;
            _placementManager = placementManager;

            _entityList = new ScrollableContainer("entspawnlist", new Size(200, 400), _resourceManager)
                              {Position = new Point(5, 5)};
            components.Add(_entityList);

            var searchLabel = new Label("Entity Search:", "CALIBRI", _resourceManager) {Position = new Point(210, 0)};
            components.Add(searchLabel);

            _entSearchTextbox = new Textbox(125, _resourceManager) {Position = new Point(210, 20)};
            _entSearchTextbox.OnSubmit += entSearchTextbox_OnSubmit;
            components.Add(_entSearchTextbox);

            _clearLabel = new Label("[Clear Filter]", "CALIBRI", _resourceManager)
                              {
                                  DrawBackground = true,
                                  DrawBorder = true,
                                  Position = new Point(210, 55)
                              };

            _overLabel = new Label("Override Placement:", "CALIBRI", _resourceManager)
                             {
                                 Position = _clearLabel.Position + new Size(0, _clearLabel.ClientArea.Height + 15)
                             };

            components.Add(_overLabel);

            var initOpts = new List<string>();

            initOpts.AddRange(new[]
                                  {
                                      "None",
                                      "AlignNone",
                                      "AlignFree",
                                      "AlignSimilar",
                                      "AlignTileAny",
                                      "AlignTileEmpty",
                                      "AlignTileNonSolid",
                                      "AlignTileSolid",
                                      "AlignWall",
                                      "AlignWallTops"
                                  });

            _lstOverride = new Listbox(150, 125, resourceManager, initOpts);
            _lstOverride.SelectItem("None");
            _lstOverride.ItemSelected += _lstOverride_ItemSelected;
            _lstOverride.Position = _overLabel.Position + new Size(0, _overLabel.ClientArea.Height);
            components.Add(_lstOverride);

            _clearLabel.Clicked += ClearLabelClicked;
            _clearLabel.BackgroundColor = Color.Gray;
            components.Add(_clearLabel);

            _eraserButton = new ImageButton
                                {
                                    ImageNormal = "erasericon",
                                    Position =
                                        new Point(_clearLabel.Position.X + _clearLabel.ClientArea.Width + 5,
                                                  _clearLabel.Position.Y)
                                };

            //eraserButton.Position = new Point(clearLabel.ClientArea.Right + 5, clearLabel.ClientArea.Top); Clientarea not updating properly. FIX THIS
            _eraserButton.Clicked += EraserButtonClicked;
            components.Add(_eraserButton);

            BuildEntityList();

            Position = new Point((int) (Gorgon.CurrentRenderTarget.Width/2f) - (int) (ClientArea.Width/2f),
                                 (int) (Gorgon.CurrentRenderTarget.Height/2f) - (int) (ClientArea.Height/2f));
            _placementManager.PlacementCanceled += PlacementManagerPlacementCanceled;
        }
 private void entSearchTextbox_OnSubmit(string text, Textbox sender)
 {
     BuildEntityList(text);
 }
Exemple #15
0
 private void editStr_OnSubmit(string text, Textbox sender)
 {
     var field = (FieldInfo) sender.UserData;
     if (field.IsInitOnly || field.IsLiteral) return;
     field.SetValue(assigned, text);
 }
Exemple #16
0
        private void editNum_OnSubmit(string text, Textbox sender)
        {
            var field = (FieldInfo) sender.UserData;
            object set = null;

            if (field.GetValue(assigned) is float)
                set = float.Parse(text);
            else if (field.GetValue(assigned) is int || field.GetValue(assigned) is Int32)
                set = Int32.Parse(text);
            else if (field.GetValue(assigned) is Int16)
                set = Int16.Parse(text);
            else if (field.GetValue(assigned) is Int64)
                set = Int64.Parse(text);
            else if (field.GetValue(assigned) is double || field.GetValue(assigned) is Double)
                set = Double.Parse(text);
            else if (field.GetValue(assigned) is decimal || field.GetValue(assigned) is Decimal)
                set = Decimal.Parse(text);
            else if (field.GetValue(assigned) is Single)
                set = Single.Parse(text);

            if (field.IsInitOnly || field.IsLiteral) return;
            field.SetValue(assigned, set);
        }
Exemple #17
0
 private void tileSearchTextbox_OnSubmit(string text, Textbox sender)
 {
     BuildTileList(text);
 }
Exemple #18
0
 void input_OnSubmit(string text, Textbox sender)
 {
     AddLine(text, Color.FloralWhite);
     ProcessCommand(text);
 }