protected int SetupShipInfo(int layerIndex) { // right side group RelativeRect rect = new RelativeRect(RelativeLoc.XCenter, RelativeLoc.YUpper + RelativeLoc.BorderOffset, RelativeSize.ThreeColumnWidth, RelativeSize.SevenEightsHeight, OriginLocation.UpperCenter); GridLayoutGroup shipInfo = new GridLayoutGroup(rect, 15, 1); Columns[1] = shipInfo; shipInfo.MaxChildSize = ButtonHeight.Paramater; shipInfo.SetColSpan(4, 5); // Scenario header shipInfo.AddChild(new Header(new RelativeRect(), MenuRes.ShipInfoHeader)); ShipNameLabel = MakeGridLabel(MenuRes.ShipNameLabel, true); shipInfo.AddChild(ShipNameLabel); ShipTypeLabel = MakeGridLabel(MenuRes.ShipTypeLabel, true); shipInfo.AddChild(ShipTypeLabel); shipInfo.AddChild(new Header(new RelativeRect(), MenuRes.ShipStatsLabel)); ShipStatsTextArea = new TextArea(RelativeRect.Full, string.Empty, MenuManager.MainFont, ThemeManager.GetThemeAsset("ui/TextEntryBackground.png")); ShipStatsTextArea.DefaultMaterial.Color = Color.Gray; ShipStatsTextArea.DesiredRows = 9; ShipStatsTextArea.BorderPadding = 4; ShipStatsTextArea.MiniumElementHeight = 12; shipInfo.AddChild(ShipStatsTextArea); AddElement(Columns[1], layerIndex + 1); return(layerIndex + 1); }
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); }
protected int SetupConsoleSelector(int layerIndex) { // right side group RelativeRect rect = new RelativeRect(RelativeLoc.XRightBorder, RelativeLoc.YUpper + RelativeLoc.BorderOffset, RelativeSize.ThreeColumnWidth, RelativeSize.SevenEightsHeight, OriginLocation.UpperRight); GridLayoutGroup consoleList = new GridLayoutGroup(rect, 15, 2); Columns[2] = consoleList; consoleList.MaxChildSize = ButtonHeight.Paramater; consoleList.SetColSpan(0, 1); // Scenario header consoleList.AddChild(new Header(new RelativeRect(), MenuRes.ConsoleSelectorHeader)); AddElement(Columns[2], layerIndex + 1); return(layerIndex + 1); }
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); }
protected int SetupServerConfig(int layerIndex) { RelativeRect rect = new RelativeRect(RelativeLoc.XLeftBorder + RelativeLoc.BorderOffset, RelativeLoc.YUpper + RelativeLoc.BorderOffset, RelativeSize.TwoColumnWidth, RelativeSize.SevenEightsHeight, OriginLocation.UpperLeft); GridLayoutGroup serverSetupGrid = new GridLayoutGroup(rect, 15, 2); Columns[0] = serverSetupGrid; serverSetupGrid.MaxChildSize = MenuCommon.ButtonHeight.Paramater; serverSetupGrid.SetColSpan(0); serverSetupGrid.SetColSpan(6); serverSetupGrid.SetColSpan(9); serverSetupGrid.SetColSpan(11); // server config header serverSetupGrid.AddChild(new Header(new RelativeRect(), MenuRes.ServerConfiguration)); // name serverSetupGrid.AddChild(MakeGridLabel(MenuRes.ServerName)); var te = new MenuTextEntry(RelativeRect.FullLeft, StartupInfo.Name); te.TextChanged += ServerName_TextChanged; serverSetupGrid.AddChild(te); // password serverSetupGrid.AddChild(MakeGridLabel(MenuRes.ServerPassword)); te = new MenuTextEntry(RelativeRect.FullLeft, StartupInfo.Password); te.TextChanged += Password_TextChanged; serverSetupGrid.AddChild(te); // ip address serverSetupGrid.AddChild(MakeGridLabel(MenuRes.ServerLanIP)); var ip = MakeGridLabel(Core.GetLocalIPString()); ip.Rect.AnchorLocation = OriginLocation.MiddleLeft; serverSetupGrid.AddChild(ip); serverSetupGrid.AddChild(MakeGridLabel(MenuRes.ServerWANIP)); string wan = Core.GetWANIPString(); if (PreferencesManager.GetValueB(PrefNames.PublicHostName)) { wan = PreferencesManager.Get(PrefNames.PublicHostName); } var wanIP = MakeGridLabel(wan); wanIP.Rect.AnchorLocation = OriginLocation.MiddleLeft; serverSetupGrid.AddChild(wanIP); // public visibility (should this be a checkbox?) serverSetupGrid.AddChild(MakeGridLabel(MenuRes.ServerVis)); SpinSelector selector = new SpinSelector(new RelativeRect(), MenuRes.ServerVisModes.Split(";".ToCharArray()), StartupInfo.Public ? 1 : 0); selector.ValueChanged += ServerVis_ValueChanged; serverSetupGrid.AddChild(selector); // ship options section serverSetupGrid.AddChild(new Header(new RelativeRect(), MenuRes.PlayerShipOptions)); // FTL Drive type serverSetupGrid.AddChild(MakeGridLabel(MenuRes.FTLType)); selector = new SpinSelector(new RelativeRect(), MenuRes.FTLTypes.Split(";".ToCharArray()), (int)StartupInfo.FTL); selector.ValueChanged += FTLType_ValueChanged; serverSetupGrid.AddChild(selector); // sensor range serverSetupGrid.AddChild(MakeGridLabel(MenuRes.RadarRange)); List <string> radarRanges = new List <string>(); for (int i = 10; i <= 50; i += 5) { radarRanges.Add(i.ToString() + "u"); } selector = new SpinSelector(new RelativeRect(), radarRanges, ((int)StartupInfo.SensorRange / 5) - 2); selector.ValueChanged += RadarRange_ValueChanged; serverSetupGrid.AddChild(selector); // main screen display options (why are these not dynamic?) serverSetupGrid.AddChild(new Header(new RelativeRect(), MenuRes.MainScreenOptions)); // tactical radar button var cb = new MenuCheckButton(RelativeRect.Full, MenuRes.TacticalRadar); cb.ButtonCheckChanged += TacRadar_CheckChanged; if (StartupInfo.TacticalRadarMSD) { cb.Check(); } serverSetupGrid.AddChild(cb); // long range radar button cb = new MenuCheckButton(RelativeRect.Full, MenuRes.LongRangeRadar); cb.ButtonCheckChanged += LRRadar_CheckChanged; if (StartupInfo.LongRangeRadarMSD) { cb.Check(); } serverSetupGrid.AddChild(cb); // game rules section serverSetupGrid.AddChild(new Header(new RelativeRect(), MenuRes.GameRules)); // sensor scan complexity serverSetupGrid.AddChild(MakeGridLabel(MenuRes.ScanComplexity)); selector = new SpinSelector(new RelativeRect(), MenuRes.ScanTypes.Split(";".ToCharArray()), (int)StartupInfo.Scans); selector.ValueChanged += Scan_ValueChanged; serverSetupGrid.AddChild(selector); // use weapon frequencies cb = new MenuCheckButton(RelativeRect.Full, MenuRes.WeaponFrequencies); cb.ButtonCheckChanged += WeaponFreq_CheckChanged; if (StartupInfo.UseWeaponFrequencies) { cb.Check(); } serverSetupGrid.AddChild(cb); // use individual system damage cb = new MenuCheckButton(RelativeRect.Full, MenuRes.PerSystemDamage); cb.ButtonCheckChanged += SystemDamage_CheckChanged; if (StartupInfo.UseSystemDamage) { cb.Check(); } serverSetupGrid.AddChild(cb); // add the left side group to the main layout AddElement(Columns[0], layerIndex); return(layerIndex + 1); }