Example #1
0
        public AttackPane(AttackOrder Attack)
            : base("attack-pane")
        {
            this.Attack       = Attack;
            Attack.OnChanged += UpdateDescription;

            _CloseButton.Position = new Vector2f(Size.X - _CloseButton.Size.X - LeftPadding.X * 2, 0);
            _CloseButton.OnClick += HandleClose;

            foreach (var target in Enum.GetValues(typeof(AttackTarget)).Cast <AttackTarget>())
            {
                _AttackTargetSelect.Add(new SelectionOption <AttackTarget>("attack-target-select-option")
                {
                    DisplayedString = ObjectDescriber.Describe(target),
                    Value           = target
                });
            }
            _AttackTargetSelect.SetValue(i => i.Value == Attack.Target);
            _AttackTargetSelect.OnChange += HandleAttackTargetChanged;
            _OrderButton.Position         = new Vector2f(0, Size.Y - _OrderButton.Size.Y - 32);
            _OrderButton.OnClick         += (sender, e) => { if (OnExecute != null)
                                                             {
                                                                 OnExecute(this, EventArgs.Empty);
                                                             }
            };
            _Description.Position = new Vector2f(0, _AttackTargetSelect.Size.Y + 24);

            Add(_CloseButton);
            Add(_Description);
            Add(_AttackTargetSelect);
            Add(_OrderButton);

            UpdateDescription(null, EventArgs.Empty);
        }
Example #2
0
        public void SetScenario(
            Scenario Scenario, UnitConfigurationRenderer UnitRenderer, FactionRenderer FactionRenderer)
        {
            _ScenarioDisplay.Clear();
            foreach (ArmyConfiguration army in Scenario.ArmyConfigurations)
            {
                _ScenarioDisplay.Add(
                    new Button("scenario-army-header")
                {
                    DisplayedString = ObjectDescriber.Describe(army.Faction)
                });
                var      factionMount = new GuiContainer <GuiItem>("scenario-faction-mount");
                Vector2f size         = factionMount.Size - factionMount.LeftPadding * 2;
                var      faction      = new FactionView(army.Faction, FactionRenderer, Math.Min(size.X, size.Y));
                faction.Position = .5f * (factionMount.Size - faction.Size) - factionMount.LeftPadding;
                factionMount.Add(faction);
                _ScenarioDisplay.Add(factionMount);
                foreach (DeploymentConfiguration deployment in army.DeploymentConfigurations)
                {
                    _ScenarioDisplay.Add(new DeploymentRow(deployment, army.Faction, UnitRenderer));
                }
                foreach (ObjectiveSuccessTrigger trigger in army.VictoryCondition.Triggers)
                {
                    _ScenarioDisplay.Add(new VictoryConditionRow(trigger));
                }
            }

            _DetailDisplay.Clear();
            AddDetail("Environment", ObjectDescriber.Describe(Scenario.Environment));
            AddDetail("Turns", Scenario.TurnConfiguration.Turns.ToString());
            AddSequence("Deploy Order", Scenario.TurnConfiguration.DeploymentOrder, Scenario.ArmyConfigurations.ToArray());
            AddSequence("Turn Order", Scenario.TurnConfiguration.TurnOrder, Scenario.ArmyConfigurations.ToArray());
            AddDetail("Strength", Scenario.ArmyConfigurations.Select(i => DescribeStrength(i)).ToArray());
        }
        public VictoryConditionPane(Match Match, FactionRenderer FactionRenderer)
            : base("victory-condition-pane")
        {
            _CloseButton.Position = new Vector2f(Size.X - _CloseButton.Size.X - LeftPadding.X * 2, 0);
            _CloseButton.OnClick += HandleClose;

            _VictoryConditionDisplay.Position = new Vector2f(0, _CloseButton.Size.Y + 24);
            foreach (ArmyConfiguration army in Match.Scenario.ArmyConfigurations)
            {
                _VictoryConditionDisplay.Add(
                    new Button("scenario-army-header")
                {
                    DisplayedString = ObjectDescriber.Describe(army.Faction)
                });
                var      factionMount = new GuiContainer <GuiItem>("scenario-faction-mount");
                Vector2f size         = factionMount.Size - factionMount.LeftPadding * 2;
                var      faction      = new FactionView(army.Faction, FactionRenderer, Math.Min(size.X, size.Y));
                faction.Position = .5f * (factionMount.Size - faction.Size) - factionMount.LeftPadding;
                factionMount.Add(faction);
                _VictoryConditionDisplay.Add(factionMount);
                foreach (ObjectiveSuccessTrigger trigger in army.VictoryCondition.Triggers)
                {
                    _VictoryConditionDisplay.Add(new VictoryConditionRow(trigger));
                }
            }

            Add(_CloseButton);
            Add(_VictoryConditionDisplay);
        }
 public static string Describe(UnitHasEvacuated Matcher)
 {
     return(string.Format(
                "evacuated {0} through tiles {1}",
                ObjectDescriber.Describe(Matcher.Direction),
                Describe(Matcher.Matcher)));
 }
Example #5
0
        string DescribeStrength(ArmyConfiguration Configuration)
        {
            var unitList = Configuration.BuildUnitConfigurationList().ToList();

            return(string.Format(
                       "{0} - {1} Points / {2} Units",
                       ObjectDescriber.Describe(Configuration.Faction),
                       unitList.Sum(i => i.GetPointValue(Configuration.Faction.HalfPriceTrucks)),
                       unitList.Count));
        }
Example #6
0
 public static string Describe(LineOfFireObjective Objective)
 {
     return(string.Format(
                "{0} {1} {2} {3} hexes wide from {4} to {5}",
                Objective.BreakThrough ? "create a corridor clear of" : "establish an unbroken line of",
                Objective.Friendly ? "friendly" : "enemy",
                Objective.IncludeFieldOfSight ? "fire" : "units",
                Objective.Width,
                ObjectDescriber.Describe(Objective.Vertical ? Direction.NORTH : Direction.EAST),
                ObjectDescriber.Describe(Objective.Vertical ? Direction.SOUTH : Direction.WEST)));
 }
Example #7
0
 public VictoryConditionRow(ObjectiveSuccessTrigger Trigger)
     : base("scenario-victory-condition-row")
 {
     Add(new Button("scenario-victory-condition-header")
     {
         DisplayedString = ObjectDescriber.Describe(Trigger.SuccessLevel)
     });
     Add(new Button("scenario-victory-condition")
     {
         DisplayedString = ObjectDescriber.Describe(Trigger)
     });
 }
Example #8
0
 void AddSequence <T>(string SequenceName, Sequence Sequence, T[] Source)
 {
     if (Sequence is StaticSequence)
     {
         AddDetail(
             SequenceName, Sequence.Get(null, 1).Select(i => ObjectDescriber.Describe(Source[i])).ToArray());
     }
     else if (Sequence is RandomSequence)
     {
         AddDetail(SequenceName, "Random");
     }
 }
Example #9
0
        public ScenarioBuilderArmySection(ArmyBuilder ArmyBuilder, IEnumerable <Faction> Factions)
            : base("scenario-builder-army-section")
        {
            this.ArmyBuilder = ArmyBuilder;

            foreach (Faction faction in Factions)
            {
                _FactionSelect.Add(
                    new SelectionOption <Faction>("scenario-builder-army-section-faction-select-option")
                {
                    DisplayedString = ObjectDescriber.Describe(faction),
                    Value           = faction
                });
            }
            _FactionSelect.SetValue(i => i.Value == ArmyBuilder.Parameters.Faction);

            _PointsInput.Value = ArmyBuilder.Parameters.Points.ToString();

            for (byte i = 1; i <= 3; ++i)
            {
                _TeamSelect.Add(
                    new SelectionOption <byte>("scenario-builder-army-section-team-select-option")
                {
                    DisplayedString = i.ToString(),
                    Value           = i
                });
            }
            _TeamSelect.SetValue(i => i.Value == ArmyBuilder.Parameters.Team);

            var removeButton = new Button("scenario-builder-army-section-remove-button")
            {
                DisplayedString = "X"
            };

            _FactionSelect.OnChange += HandleChange;
            _PointsInput.OnLeave    += HandleChange;
            _TeamSelect.OnChange    += HandleChange;
            removeButton.OnClick    += HandleRemove;

            Add(new GuiContainer <GuiItem>("scenario-builder-army-section-faction-cell")
            {
                _FactionSelect
            });
            Add(new GuiContainer <GuiItem>("scenario-builder-army-section-points-cell")
            {
                _PointsInput
            });
            Add(new GuiContainer <GuiItem>("scenario-builder-army-section-team-cell")
            {
                _TeamSelect
            });
            Add(removeButton);
        }
Example #10
0
        void DescribeOddsCalculation(OddsCalculation OddsCalculation)
        {
            _Description.Add(new Button("attack-odds-box")
            {
                DisplayedString = OddsString(OddsCalculation)
            });

            var p = Attack.CombatResultsTable.GetCombatResultProbabilities(OddsCalculation);

            for (int i = 0; i < p.Length; ++i)
            {
                if (p[i] > 0)
                {
                    _Description.Add(new Button("attack-factor-box")
                    {
                        DisplayedString = string.Format(
                            "{0} - {1}%", ObjectDescriber.Describe((CombatResult)i), Math.Round(p[i] * 100))
                    });
                }
            }

            _Description.Add(new Button("attack-odds-section")
            {
                DisplayedString = string.Format("{0} Total Attack Factor", OddsCalculation.TotalAttack)
            });
            foreach (var a in OddsCalculation.AttackFactorCalculations)
            {
                DescribeAttackFactorCalculation(a.Item1, a.Item2);
            }
            _Description.Add(new Button("attack-odds-section")
            {
                DisplayedString = string.Format("{0} Total Defense Factor", OddsCalculation.TotalDefense)
            });
            foreach (Unit d in OddsCalculation.Defenders)
            {
                _Description.Add(new Button("attack-part-box")
                {
                    DisplayedString = string.Format("+{0} {1}", d.Configuration.Defense, d.Configuration.Name)
                });
            }
            _Description.Add(new Button("odds-factor-box")
            {
                DisplayedString = OddsCalculation.StackArmored ? "Armored Target" : "Unarmored Target"
            });
            foreach (OddsCalculationFactor o in OddsCalculation.OddsCalculationFactors)
            {
                _Description.Add(new Button("odds-factor-box")
                {
                    DisplayedString = ObjectDescriber.Describe(o)
                });
            }
        }
Example #11
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)
     });
 }
 protected void AddMountedInfantryAttributes()
 {
     if (_UnitConfiguration.DismountAs != null || _UnitConfiguration.CanRemount)
     {
         AddSection("Mounted Infantry");
     }
     if (_UnitConfiguration.DismountAs != null)
     {
         AddAttribute(ObjectDescriber.Describe(_UnitConfiguration.DismountAs));
     }
     if (_UnitConfiguration.CanRemount)
     {
         AddAttribute("Can Re-mount");
     }
 }
Example #13
0
        public UnitInfoPane(Unit Unit, UnitConfigurationRenderer Renderer)
            : base(Unit.Configuration, Unit.Army.Configuration.Faction, Renderer)
        {
            _Info.Add(new Button("unit-info-header")
            {
                DisplayedString = ObjectDescriber.Describe(Unit)
            });

            AddBasicAttributes();
            AddComposition();
            AddCombatCapabilities();
            AddSightCapabilities();
            AddTransportCapabilities();
            AddMovementAttributes();
            AddMountedInfantryAttributes();
        }
 public MatchEndArmyRow(Army Army, FactionRenderer FactionRenderer)
     : base("match-end-army-row")
 {
     _FactionView = new FactionView(Army.Configuration.Faction, FactionRenderer, 128)
     {
         Position = LeftPadding
     };
     Add(new Button("match-end-army-header")
     {
         DisplayedString = ObjectDescriber.Describe(Army.Configuration.Faction)
     });
     Add(new Button("match-end-army-success")
     {
         DisplayedString = ObjectDescriber.Describe(Army.GetObjectiveSuccessLevel())
     });
 }
Example #15
0
 string PackName(Faction Faction, UnitClass UnitClass)
 {
     if (Faction == null && UnitClass == UnitClass.NONE)
     {
         return("Random Pack");
     }
     if (Faction == null)
     {
         return(string.Format("{0} Pack", ObjectDescriber.Describe(UnitClass)));
     }
     if (UnitClass == UnitClass.NONE)
     {
         return(string.Format("{0} Pack", Faction.Name));
     }
     return(string.Format("{0} {1} Pack", Faction.Name, ObjectDescriber.Describe(UnitClass)));
 }
Example #16
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);
        }
 protected void AddComposition()
 {
     AddSection("Composition");
     AddAttribute(string.Format("Weight - {0}", _UnitConfiguration.UnitWeight));
     if (_UnitConfiguration.IsVehicle)
     {
         AddAttribute("Vehicular");
     }
     if (_UnitConfiguration.IsArmored)
     {
         AddAttribute("Armored");
     }
     if (_UnitConfiguration.WrecksAs != null)
     {
         AddAttribute(string.Format("Wrecks As - {0}", ObjectDescriber.Describe(_UnitConfiguration.WrecksAs)));
     }
 }
 protected void AddBasicAttributes()
 {
     AddSection("Basic Attributes");
     AddAttribute(string.Format(
                      "Unit Class - {0}", ObjectDescriber.Describe(_UnitConfiguration.UnitClass)));
     AddAttribute(
         string.Format(
             "Weapon Class - {0}", ObjectDescriber.Describe(_UnitConfiguration.PrimaryWeapon.WeaponClass)));
     AddAttribute(string.Format("Attack - {0}", _UnitConfiguration.PrimaryWeapon.Attack));
     AddAttribute(string.Format("Range - {0}", _UnitConfiguration.PrimaryWeapon.Range));
     AddAttribute(string.Format("Defense - {0}", _UnitConfiguration.Defense));
     AddAttribute(
         string.Format(
             "Movement - {0}",
             _UnitConfiguration.HasUnlimitedMovement() ? "Unlimited" : _UnitConfiguration.Movement.ToString()));
     AddAttribute(
         string.Format("Point Value - {0}", _UnitConfiguration.GetPointValue(_Faction.HalfPriceTrucks)));
 }
Example #19
0
 void DescribeAttackFactorCalculation(
     SingleAttackOrder Attacker, AttackFactorCalculation AttackFactorCalculation)
 {
     _Description.Add(new Button("attack-part-box")
     {
         DisplayedString = string.Format(
             "+{0} {1}", AttackFactorCalculation.Attack, ObjectDescriber.Describe(Attacker.Attacker))
     });
     _Description.Add(new Button("attack-factor-box")
     {
         DisplayedString = string.Format(
             "{0} Base Attack Factor",
             Attacker.Attacker.Configuration.GetWeapon(Attacker.UseSecondaryWeapon).Attack)
     });
     foreach (AttackFactorCalculationFactor a in AttackFactorCalculation.Factors)
     {
         _Description.Add(new Button("attack-factor-box")
         {
             DisplayedString = ObjectDescriber.Describe(a)
         });
     }
 }
Example #20
0
        public SelectPane(string Title, IEnumerable <T> Items)
            : base("select-pane")
        {
            var header = new Button("select-pane-header")
            {
                DisplayedString = Title
            };

            Add(header);

            _UnitSelect.Position = new Vector2f(0, header.Size.Y + 6);
            foreach (T item in Items)
            {
                var option = new SelectionOption <T>("select-option")
                {
                    Value           = item,
                    DisplayedString = ObjectDescriber.Describe(item)
                };
                _UnitSelect.Add(option);
            }
            _UnitSelect.OnChange += HandleChange;
            Add(_UnitSelect);
        }
 public static string Describe(TileHasEdge Matcher)
 {
     return(string.Format("next to {0}", ObjectDescriber.Describe(Matcher.Edge)));
 }
 public static string Describe(TileHasBase Matcher)
 {
     return(string.Format("in {0}", ObjectDescriber.Describe(Matcher.TileBase)));
 }
 public static string Describe(TileHasCoordinate Matcher)
 {
     return(string.Format("at {0}", ObjectDescriber.Describe(Matcher.Coordinate)));
 }
 public static string Describe(UnitHasStatus Matcher)
 {
     return(ObjectDescriber.Describe(Matcher.Status));
 }
 public static string Describe(UnitHasReconned Matcher)
 {
     return(string.Format("reconned {0}", ObjectDescriber.Describe(Matcher.Direction)));
 }
 public static string Describe(UnitHasConfiguration Matcher)
 {
     return(string.Format("of type {0}", ObjectDescriber.Describe(Matcher.UnitConfiguration)));
 }
 public static string Describe(UnitHasClass Matcher)
 {
     return(string.Format("of class {0}", ObjectDescriber.Describe(Matcher.UnitClass)));
 }
 public static string Describe(TileWithin Matcher)
 {
     return(string.Format("within the bounds {0}", ObjectDescriber.Describe(Matcher.Zone)));
 }
 public static string Describe(TileOnEdge Matcher)
 {
     return(string.Format("on {0} edge of the board", ObjectDescriber.Describe(Matcher.Edge)));
 }
 public static string Describe(TileInRegion Matcher)
 {
     return(string.Format("within {0}", ObjectDescriber.Describe(Matcher.NormalizedRegionName, '-')));
 }