Exemplo n.º 1
0
 private void CheckIntercepts()
 {
     // check for intercepts
     // List them in a dropdown and allow user to click an intercept to select it
     intercepts = MarkIntercepts(spaceship, target);
     if (intercepts.Count > 0)
     {
         InactivatePanels();
         interceptPanel.SetActive(true);
         // populate the intercept drop down.
         interceptSelectionPanel.Clear();
         int count = 0;
         // With long trajectory times can get same point on multiple orbits.
         // Just take the first two intercepts
         foreach (TrajectoryData.Intercept t in intercepts)
         {
             if (count >= 2)
             {
                 break;
             }
             int    _count = count++;
             string label  = string.Format("@t={0:00.0}\ndV={1:00.0} dT={2:00.0}", t.tp1.t, t.dV, t.dT);
             interceptSelectionPanel.AddButton(label, () => InterceptSelected(_count));
             // t.Log();
         }
     }
     else
     {
         InactivatePanels();
         manualPanel.SetActive(true);
     }
 }
Exemplo n.º 2
0
        private void SelectSubListChanged(object sender, EventArgs e)
        {
            if (SelectProperties.SelectedIndex > 0)
            {
                SelectionPanel.Visible = true;
                if (SelectionPanel.Criteria.Count == 0)
                {
                    SelectionPanel.AddNew();
                }
            }
            else
            {
                SelectionPanel.Visible = false; SelectionPanel.Clear();
            }

            Type selectedType = SelectProperties.GetLowestPropertyType();

            if (selectedType.IsGenericType)
            {
                selectedType = selectedType.GetGenericArguments()[0];
            }

            SearchPanel.Clear();
            SearchPanel.CriteriaType = selectedType;
            SearchPanel.AddNew();

            OrderByPanel.Clear();
            OrderByPanel.CriteriaType = selectedType;
            OrderByPanel.AddNew();
            PanelResized(this, null);

            if (SelectProperties.SelectedIndex > 0)
            {
                if (selectedType == typeof(Site) || selectedType == typeof(Battle))
                {
                    btnMapResults.Visible = true;
                }
                else
                {
                    btnMapResults.Visible = false;
                }
            }
            else if (SelectProperties.ParentType == typeof(Site) || SelectProperties.ParentType == typeof(Battle))
            {
                btnMapResults.Visible = true;
            }
            else
            {
                btnMapResults.Visible = false;
            }

            //if (SelectProperties.SelectedIndex != 0)
            //    lblSearchCriteria.Text = "Search " + SelectProperties.Text + " Where:";
            //else
            //    lblSearchCriteria.Text = "Search " + SelectList.Text + " Where:";
        }
Exemplo n.º 3
0
    private void SetObjectiveOptions(NBody[] targets)
    {
        int count = 0;

        objectiveSelectionPanel.Clear();
        foreach (NBody nbody in targets)
        {
            int _count = count++;
            objectiveSelectionPanel.AddButton(nbody.gameObject.name, () => ObjectiveSelected(_count));
        }
    }
Exemplo n.º 4
0
    private void CalculateTransfers()
    {
        // Find xfer choices and present to user
        transferCalc = new TransferCalc(spaceship.GetNBody(), target, centralMass);
        transfers    = transferCalc.FindTransfers();
        orbitSelectionPanel.Clear();
        int count = 0;

        foreach (OrbitTransfer t in transfers)
        {
            // need a new variable for each lambda
            int _count = count++;
            orbitSelectionPanel.AddButton(t.ToString(), () => OrbitSelected(_count));
        }
    }
Exemplo n.º 5
0
        private void SelectList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (SelectProperties != null)
            {
                SelectProperties.Remove();
            }
            SelectProperties                       = new PropertyBox();
            SelectProperties.Location              = new Point(SelectList.Right + 3, SelectList.Top);
            SelectProperties.ListPropertiesOnly    = true;
            SelectProperties.SelectedIndexChanged += new EventHandler(SelectSubListChanged);
            this.Controls.Add(SelectProperties);

            switch (SelectList.SelectedItem.ToString())
            {
            case "Historical Figures":
                SearchList = new SearchList <HistoricalFigure>(World.HistoricalFigures);
                SelectProperties.ParentType = typeof(HistoricalFigure);
                break;

            case "Entities":
                SearchList = new SearchList <Entity>(World.Entities);
                SelectProperties.ParentType = typeof(Entity);
                break;

            case "Sites":
                SearchList = new SearchList <Site>(World.Sites);
                SelectProperties.ParentType = typeof(Site);
                break;

            case "Regions":
                SearchList = new SearchList <WorldRegion>(World.Regions);
                SelectProperties.ParentType = typeof(WorldRegion);
                break;

            case "Underground Regions":
                SearchList = new SearchList <UndergroundRegion>(World.UndergroundRegions);
                SelectProperties.ParentType = typeof(UndergroundRegion);
                break;

            case "Wars":
                SearchList = new SearchList <War>(World.Wars);
                SelectProperties.ParentType = typeof(War);
                break;

            case "Battles":
                SearchList = new SearchList <Battle>(World.Battles);
                SelectProperties.ParentType = typeof(Battle);
                break;

            case "Conquerings":
                SearchList = new SearchList <SiteConquered>(World.EventCollections.OfType <SiteConquered>().ToList());
                SelectProperties.ParentType = typeof(SiteConquered);
                break;

            case "Beast Attacks":
                SearchList = new SearchList <BeastAttack>(World.BeastAttacks);
                SelectProperties.ParentType = typeof(BeastAttack);
                break;

            case "Artifacts":
                SearchList = new SearchList <Artifact>(World.Artifacts);
                SelectProperties.ParentType = typeof(Artifact);
                break;
            }

            if (SelectProperties.ParentType == typeof(Site) || SelectProperties.ParentType == typeof(Battle))
            {
                btnMapResults.Visible = true;
            }

            SelectionPanel.Clear();

            SelectionPanel.CriteriaType = SearchList.GetMainListType();
            SearchPanel.CriteriaType    = SelectProperties.GetLowestPropertyType();
            OrderByPanel.CriteriaType   = SelectProperties.GetLowestPropertyType();

            SelectSubListChanged(this, null);


            //lblSelectCriteria.Text = "Select " + SelectList.Text + " Where:";
            //lblSearchCriteria.Text = "Search " + SelectList.Text + " Where:";
            //lblOrderCriteria.Text = "Order " + SelectList.Text + " By:";
        }
Exemplo n.º 6
0
        private void SelectList_SelectedIndexChanged(object sender, EventArgs e)
        {
            _selectProperties?.Remove();

            _selectProperties = new PropertyBox
            {
                Location           = new Point(SelectList.Right + 3, SelectList.Top),
                ListPropertiesOnly = true
            };
            _selectProperties.SelectedIndexChanged += SelectSubListChanged;
            Controls.Add(_selectProperties);

            switch (SelectList.SelectedItem.ToString())
            {
            case "Historical Figures":
                _searchList = new SearchList <HistoricalFigure>(World.HistoricalFigures);
                _selectProperties.ParentType = typeof(HistoricalFigure);
                break;

            case "Entities":
                _searchList = new SearchList <Entity>(World.Entities);
                _selectProperties.ParentType = typeof(Entity);
                break;

            case "Sites":
                _searchList = new SearchList <Site>(World.Sites);
                _selectProperties.ParentType = typeof(Site);
                break;

            case "Regions":
                _searchList = new SearchList <WorldRegion>(World.Regions);
                _selectProperties.ParentType = typeof(WorldRegion);
                break;

            case "Underground Regions":
                _searchList = new SearchList <UndergroundRegion>(World.UndergroundRegions);
                _selectProperties.ParentType = typeof(UndergroundRegion);
                break;

            case "Structures":
                _searchList = new SearchList <Structure>(World.Structures);
                _selectProperties.ParentType = typeof(Structure);
                break;

            case "Wars":
                _searchList = new SearchList <War>(World.Wars);
                _selectProperties.ParentType = typeof(War);
                break;

            case "Battles":
                _searchList = new SearchList <Battle>(World.Battles);
                _selectProperties.ParentType = typeof(Battle);
                break;

            case "Conquerings":
                _searchList = new SearchList <SiteConquered>(World.EventCollections.OfType <SiteConquered>().ToList());
                _selectProperties.ParentType = typeof(SiteConquered);
                break;

            case "Rampages":
                _searchList = new SearchList <BeastAttack>(World.BeastAttacks);
                _selectProperties.ParentType = typeof(BeastAttack);
                break;

            case "Raids":
                _searchList = new SearchList <Raid>(World.EventCollections.OfType <Raid>().ToList());
                _selectProperties.ParentType = typeof(Raid);
                break;

            case "Artifacts":
                _searchList = new SearchList <Artifact>(World.Artifacts);
                _selectProperties.ParentType = typeof(Artifact);
                break;

            case "Written Content":
                _searchList = new SearchList <WrittenContent>(World.WrittenContents);
                _selectProperties.ParentType = typeof(WrittenContent);
                break;
            }

            if (_selectProperties.ParentType == typeof(Site) || _selectProperties.ParentType == typeof(Battle))
            {
                btnMapResults.Visible = true;
            }

            SelectionPanel.Clear();

            SelectionPanel.CriteriaType = _searchList.GetMainListType();
            SearchPanel.CriteriaType    = _selectProperties.GetLowestPropertyType();
            OrderByPanel.CriteriaType   = _selectProperties.GetLowestPropertyType();

            SelectSubListChanged(this, null);
        }
Exemplo n.º 7
0
 void Start()
 {
     playerInput.DeactivateInput();
     dialogPanel.Clear();
     queryPanel.Clear();
 }