예제 #1
0
        void DisplayPlayers()
        {
            _Display.Clear();
            _Display.Add(new Button("header-1")
            {
                DisplayedString = _Host ? "Host Match" : "Remote Match"
            });
            _Display.Add(new Button("header-2")
            {
                DisplayedString = "Scenario"
            });
            _Display.Add(new GuiContainer <Pod>("regular")
            {
                _ScenarioSelect
            });
            _Display.Add(new Button("header-2")
            {
                DisplayedString = "Player Setup"
            });

            if (_Host)
            {
                if (_ScenarioSelect.Count() == 0)
                {
                    foreach (Scenario s in _Scenarios)
                    {
                        _ScenarioSelect.Add(new SelectionOption <Scenario>("match-lobby-player-section-select-option")
                        {
                            DisplayedString = s.Name,
                            Value           = s
                        });
                    }
                }
            }
            else
            {
                _ScenarioSelect.Clear();
                _ScenarioSelect.Add(new SelectionOption <Scenario>("match-lobby-player-section-select-option")
                {
                    DisplayedString = _Lobby.Scenario.Name,
                    Value           = _Lobby.Scenario
                });
            }
            _ScenarioSelect.Enabled = _Host;

            foreach (Player p in _Lobby.Players)
            {
                var section = new MatchLobbyPlayerSection(p, _Lobby, p == _Player);
                section.OnArmyConfigurationSelected += HandleArmyConfigurationSelected;
                section.OnPlayerReadyStateChanged   += HandlePlayerReadyStateChanged;
                _Display.Add(section);
            }
            _Dirty = false;

            OnPulse += HandlePulse;
            _Items.Add(_Pane);
        }
        void MakeSection(string SectionName, GuiItem Input, SingleColumnTable Display)
        {
            var header = new Button("header-2")
            {
                DisplayedString = SectionName
            };
            var container = new GuiContainer <Pod>("scenario-builder-parameters-section");

            container.Add(Input);

            Display.Add(header);
            Display.Add(container);
        }
예제 #3
0
 void AddDetail(string Attribute, params string[] Values)
 {
     _DetailDisplay.Add(new Button("header-2")
     {
         DisplayedString = Attribute
     });
     foreach (string value in Values)
     {
         _DetailDisplay.Add(new Button("regular")
         {
             DisplayedString = value
         });
     }
 }
예제 #4
0
 public void SetTurn(Turn Turn)
 {
     _InfoDisplay.Clear();
     _InfoDisplay.Add(
         new Button("info-display-header")
     {
         DisplayedString = ObjectDescriber.Describe(Turn.TurnInfo.Army)
     });
     _InfoDisplay.Add(
         new Button("info-display-info")
     {
         DisplayedString = ObjectDescriber.Describe(Turn.TurnInfo.TurnComponent)
     });
 }
예제 #5
0
        public MatchEndScreen(Match Match, Vector2f WindowSize, FactionRenderer FactionRenderer)
            : base(WindowSize)
        {
            _Table.Position = .5f * (WindowSize - _Table.Size);
            foreach (Army a in Match.Armies)
            {
                _Table.Add(new MatchEndArmyRow(a, FactionRenderer));
            }

            _SaveButton.Position = new Vector2f(_Table.Size.X - _SaveButton.Size.X, 0);
            _SaveButton.OnClick += HandleSaveClicked;
            _Table.Add(_SaveButton);

            _Items.Add(_Table);
        }
예제 #6
0
 public void SetActions(Func <Button, bool> Selector)
 {
     _ActionDisplay.Clear();
     foreach (Button button in ActionButtons.Where(Selector))
     {
         _ActionDisplay.Add(button);
     }
 }
예제 #7
0
        public NewMapPane()
            : base("new-map-pane")
        {
            _CreateButton.Position = Size - new Vector2f(_CreateButton.Size.X + 32, _CreateButton.Size.Y + 32);
            _CancelButton.Position = _CreateButton.Position - new Vector2f(_CancelButton.Size.X + 4, 0);

            _CancelButton.OnClick += HandleCancelClicked;
            _CreateButton.OnClick += HandleCreateClicked;

            foreach (var matchSetting in GameData.MatchSettings.Values)
            {
                _MatchSettingsSelect.Add(
                    new SelectionOption <MatchSetting>("new-map-parameters-section-select-option")
                {
                    Value           = matchSetting,
                    DisplayedString = ObjectDescriber.Describe(matchSetting)
                });
            }

            _Display.Add(new Button("new-map-header-1")
            {
                DisplayedString = "New Map"
            });
            _Display.Add(new Button("new-map-header-2")
            {
                DisplayedString = "Height"
            });
            _Display.Add(_HeightInput);
            _Display.Add(new Button("new-map-header-2")
            {
                DisplayedString = "Width"
            });
            _Display.Add(_WidthInput);
            _Display.Add(new Button("new-map-header-2")
            {
                DisplayedString = "Random Map Generation"
            });
            _Display.Add(_GenerateRandomCheckbox);
            _Display.Add(new GuiContainer <Pod>("new-map-parameters-section")
            {
                _MatchSettingsSelect
            });

            Add(_CancelButton);
            Add(_CreateButton);
            Add(_Display);
        }
예제 #8
0
 public void SetVictoryCondition(VictoryCondition Condition, Army ForArmy, Match Match)
 {
     _Display.Clear();
     foreach (var objective in Condition.Scorers)
     {
         _Display.Add(
             new Button("objective-header")
         {
             DisplayedString =
                 string.Format(
                     "{0}/{1}",
                     objective.CalculateScore(ForArmy, Match, new Dictionary <Objective, int>()),
                     Condition.GetMaximumScore(objective, ForArmy, Match))
         });
         _Display.Add(
             new Button("objective-regular")
         {
             DisplayedString =
                 ObjectDescriber.Sentencify(
                     ObjectiveDescriber.RemoveScore(ObjectiveDescriber.Describe(objective)))
         });
     }
 }
예제 #9
0
        public TextPane(string Title, string Subtitle, string ButtonString)
            : base("text-pane")
        {
            _Button.Position =
                new Vector2f(Size.X - _Button.Size.X - 32, Size.Y - _Button.Size.Y - 32);
            _Button.OnClick      += HandleConnectButtonClick;
            _IPInput.OnSubmitted += HandleConnectButtonClick;

            _Display.Add(new Button("header-1")
            {
                DisplayedString = Title
            });
            _Display.Add(new Button("header-2")
            {
                DisplayedString = Subtitle
            });
            _Display.Add(_IPInput);

            _Button.DisplayedString = ButtonString;

            Add(_Display);
            Add(_Button);
        }
예제 #10
0
        public LogInPlayerScreen(Vector2f WindowSize)
            : base(WindowSize)
        {
            _Display.Add(new Button("join-server-header-1")
            {
                DisplayedString = "Log In"
            });
            _Display.Add(new Button("join-server-header-2")
            {
                DisplayedString = "Server IP"
            });
            _Display.Add(_ServerInput);
            _Display.Add(new Button("join-server-header-2")
            {
                DisplayedString = "Username"
            });
            _Display.Add(_UsernameInput);
            _Display.Add(new Button("join-server-header-2")
            {
                DisplayedString = "Password"
            });
            _Display.Add(_PasswordInput);

            _RegisterButton.Position = new Vector2f(0, _Pane.Size.Y - _RegisterButton.Size.Y - 32);
            _RegisterButton.OnClick += HandleRegister;

            _LogInButton.Position = new Vector2f(0, _RegisterButton.Position.Y - _LogInButton.Size.Y - 4);
            _LogInButton.OnClick += HandleLogIn;

            _Pane.Position = .5f * (WindowSize - _Pane.Size);
            _Pane.Add(_Display);
            _Pane.Add(_LogInButton);
            _Pane.Add(_RegisterButton);

            _Items.Add(_Pane);
        }
 public void Alert(string Alert)
 {
     _Error.DisplayedString = Alert;
     _LeftDisplay.Remove(_Error);
     _LeftDisplay.Add(_Error);
 }