private void NewShipList_SelectedIndexChanged(object sender, ButtonScrollList e)
        {
            if (ShipNameLabel == null)
            {
                return;
            }

            if (e.SelectedItemTag as UpdateShipList.ShipInfo == null)
            {
                ShipNameLabel.Text = MenuRes.ShipNameLabel;
                ShipTypeLabel.Text = MenuRes.ShipTypeLabel;
                ShipStatsTextArea.SetText(string.Empty);
            }
            else
            {
                UpdateShipList.ShipInfo ship = e.SelectedItemTag as UpdateShipList.ShipInfo;
                ShipNameLabel.Text = MenuRes.ShipNameLabel + ship.Name;
                ShipTypeLabel.Text = MenuRes.ShipTypeLabel + ship.TypeName;

                StringBuilder sb = new StringBuilder();
                foreach (var stat in ship.Stats)
                {
                    sb.AppendLine(stat.Item1 + " : " + stat.Item2);
                }

                ShipStatsTextArea.SetText(sb.ToString());
            }
            ShipTypeLabel.ForceRefresh();
            ShipNameLabel.ForceRefresh();
        }
Exemple #2
0
        private void ScenarioList_SelectedIndexChanged(object sender, ButtonScrollList e)
        {
            if (e.SelectedIndex < 0)
            {
                return;
            }

            StartupInfo.SelectedScenario  = Scenarios.GetScenarioList()[e.SelectedIndex];
            StartupInfo.SelectedVariation = null;

            API.Events.CallGetServerInfoForScenario(StartupInfo);

            SecenarioText.SetText(StartupInfo.SelectedScenario.Description);

            List <string> names = new List <string>();

            names.Add(MenuRes.NoVariatioName);
            foreach (var vars in StartupInfo.SelectedScenario.Variations)
            {
                names.Add(vars.DisplayName);
            }

            VariationList.SetLabels(names);
            VariationList.SetSelectedIndex(0);
        }
        protected int SetupShipList(int layerIndex)
        {
            // right side group
            RelativeRect rect = new RelativeRect(RelativeLoc.XLeftBorder, RelativeLoc.YUpper + RelativeLoc.BorderOffset, RelativeSize.ThreeColumnWidth, RelativeSize.SevenEightsHeight, OriginLocation.UpperLeft);

            GridLayoutGroup shipList = new GridLayoutGroup(rect, 15, 2);

            Columns[0] = shipList;

            shipList.MaxChildSize = MenuCommon.ButtonHeight.Paramater;

            shipList.SetColSpan(0, 1);
            shipList.SetColSpan(1, 6);
            shipList.SetColSpan(7, 1);
            shipList.SetColSpan(8, 5);

            // Scenario header
            shipList.AddChild(new Header(new RelativeRect(), MenuRes.ShipListHeader));

            ActiveShipList             = new ButtonScrollList(RelativeRect.Full, -1, ThemeManager.GetThemeAsset("ui/TextEntryBackground.png"));
            ActiveShipList.DesiredRows = 8;


            ActiveShipList.FillMode = UIFillModes.Stretch4Quad;
            shipList.AddChild(ActiveShipList);


            shipList.AddChild(new Header(new RelativeRect(), MenuRes.NewShipHeader));

            NewShipList             = new ButtonScrollList(RelativeRect.Full, -1, ThemeManager.GetThemeAsset("ui/TextEntryBackground.png"));
            NewShipList.DesiredRows = 8;

            NewShipList.AddItem(MenuRes.DefaultShipSelection, DefaultShipInfo);

            NewShipList.FillMode = UIFillModes.Stretch4Quad;
            shipList.AddChild(NewShipList);


            AddElement(Columns[0], layerIndex + 1);

            NewShipList.SelectedIndexChanged += NewShipList_SelectedIndexChanged;

            NewShipList.SetSelectedIndex(0);

            return(layerIndex + 1);
        }
Exemple #4
0
        protected int SetupScenarioList(int layerIndex)
        {
            // right side group
            RelativeRect rect = new RelativeRect(RelativeLoc.XRightBorder + RelativeLoc.BorderOffset, RelativeLoc.YUpper + RelativeLoc.BorderOffset, RelativeSize.TwoColumnWidth, RelativeSize.SevenEightsHeight, OriginLocation.UpperRight);

            GridLayoutGroup scenarioGrid = new GridLayoutGroup(rect, 15, 2);

            Columns[1] = scenarioGrid;

            scenarioGrid.MaxChildSize = MenuCommon.ButtonHeight.Paramater;

            scenarioGrid.SetColSpan(0, 1);
            scenarioGrid.SetColSpan(1, 6);
            scenarioGrid.SetColSpan(7, 4);
            scenarioGrid.SetColSpan(12, 3);

            // Scenario header
            scenarioGrid.AddChild(new Header(new RelativeRect(), MenuRes.Scenario));

            ButtonScrollList scenarioList = new ButtonScrollList(RelativeRect.Full);

            scenarioList.DesiredRows = 6;

            foreach (var scenario in Scenarios.GetScenarioList())
            {
                scenarioList.AddItem(scenario.Name, scenario);
            }

            scenarioList.SelectedIndexChanged += ScenarioList_SelectedIndexChanged;
            scenarioList.FillMode              = UIFillModes.Stretch4Quad;
            scenarioGrid.AddChild(scenarioList);


            SecenarioText = new TextArea(RelativeRect.Full, string.Empty, MenuManager.MainFont, ThemeManager.GetThemeAsset("ui/TextEntryBackground.png"));
            SecenarioText.DefaultMaterial.Color = Color.Gray;
            SecenarioText.DesiredRows           = 8;
            SecenarioText.BorderPadding         = 4;
            SecenarioText.MiniumElementHeight   = 20;

            scenarioGrid.AddChild(SecenarioText);

            // sensor scan complexity
            // get data from selected scenario
            scenarioGrid.AddChild(MakeGridLabel(MenuRes.Variation));
            VariationList = new SpinSelector(new RelativeRect(), MenuRes.DefaultVariation.Split(";".ToCharArray()), 0);
            VariationList.ValueChanged += ScenarioVariation_ValueChanged;
            scenarioGrid.AddChild(VariationList);

            // replace with variation info
            VariationText = new TextArea(RelativeRect.Full, string.Empty, MenuManager.MainFont, ThemeManager.GetThemeAsset("ui/TextEntryBackground.png"));
            VariationText.DefaultMaterial.Color = Color.Gray;
            VariationText.DesiredRows           = 6;
            VariationText.BorderPadding         = 4;
            VariationText.MiniumElementHeight   = 20;
            scenarioGrid.AddChild(VariationText);

            AddElement(Columns[1], layerIndex + 1);

            scenarioList.SetSelectedIndex(0);

            return(layerIndex + 1);
        }