Ejemplo n.º 1
0
        private void ActiveShipClient_ShipListUpdated(object sender, LunarLambda.Messges.Ship.Game.UpdateShipList e)
        {
            if (ActiveShipList == null || NewShipList == null)
            {
                return;
            }

            ActiveShipList.ClearItems();
            NewShipList.ClearItems();
            NewShipList.AddItem(MenuRes.DefaultShipSelection, DefaultShipInfo);

            // load the ship list
            foreach (var ship in e.Ships)
            {
                if (ship.Spawned)
                {
                    ActiveShipList.AddItem(ship.Name, ship);
                }
                else
                {
                    NewShipList.AddItem(ship.Name, ship);
                }
            }

            NewShipList.SetSelectedIndex(0);

            NewShipList.ForceRefresh();
            ActiveShipList.ForceRefresh();
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }