Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 private void RevealAllMines()
 {
     Panels.Where(x => x.IsMine).ToList().ForEach(x => x.IsRevealed = true);
 }
 /// <summary>
 /// Initialize the Shipyard tab
 /// </summary>
 /// <param name="m_oSummaryPanel">The summary panel from the economics handler.</param>
 public static void BuildShipyardTab(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation, BindingList<ShipClassTN> RetoolTargets)
 {
     MaxShipyardRows = 38;
     MaxShipyardTaskRows = 38;
     //m_oSummaryPanel.
     //Populate the datagrid
     //build the SYC Groupbox
     //build the create task groupbox
     //listen to the buttons
     BuildShipyardDataGrid(m_oSummaryPanel);
     BuildSYCGroupBox(m_oSummaryPanel, CurrentFaction, CurrentPopulation, RetoolTargets);
     BuildSYTaskGroupBox(m_oSummaryPanel, CurrentFaction, CurrentPopulation);
 }
Ejemplo n.º 3
0
        public GanPlanRhinoPanel()
        {
            _instance = this;

            Panels.RegisterPanel(PlugIn, typeof(MainPanel), LOC.STR("GanPlanRhinoPanel"), null);
        }
Ejemplo n.º 4
0
        // TODO: Icons
        void OnLoadComplete(object sender, EventArgs eventArgs)
        {
            if (Context.Executables?.Count > 0)
            {
                lblPanelName.Text    = "Please wait while reading executables found";
                prgProgress.MaxValue = Context.Executables.Count;
                prgProgress.MinValue = 0;
                prgProgress.Value    = 0;

                foreach (string file in Context.Executables)
                {
                    var         exeStream = new FileStream(file, FileMode.Open, FileAccess.Read);
                    var         mzExe     = new MZ(exeStream);
                    var         neExe     = new NE(exeStream);
                    var         stExe     = new AtariST(exeStream);
                    var         lxExe     = new LX(exeStream);
                    var         coffExe   = new COFF(exeStream);
                    var         peExe     = new PE(exeStream);
                    var         geosExe   = new Geos(exeStream);
                    var         elfExe    = new ELF(exeStream);
                    IExecutable recognizedExe;

                    if (neExe.Recognized)
                    {
                        recognizedExe = neExe;
                    }
                    else if (lxExe.Recognized)
                    {
                        recognizedExe = lxExe;
                    }
                    else if (peExe.Recognized)
                    {
                        recognizedExe = peExe;
                    }
                    else if (mzExe.Recognized)
                    {
                        recognizedExe = mzExe;
                    }
                    else if (coffExe.Recognized)
                    {
                        recognizedExe = coffExe;
                    }
                    else if (stExe.Recognized)
                    {
                        recognizedExe = stExe;
                    }
                    else if (elfExe.Recognized)
                    {
                        recognizedExe = elfExe;
                    }
                    else if (geosExe.Recognized)
                    {
                        recognizedExe = geosExe;
                    }
                    else
                    {
                        exeStream.Close();

                        continue;
                    }

                    if (recognizedExe.Strings != null)
                    {
                        strings.AddRange(recognizedExe.Strings);
                    }

                    foreach (Architecture exeArch in recognizedExe.Architectures)
                    {
                        ArchitecturesTypeArchitecture?arch = ExeArchToSchemaArch(exeArch);

                        if (arch.HasValue &&
                            !architectures.Contains($"{arch.Value}"))
                        {
                            architectures.Add($"{arch.Value}");
                        }
                    }

                    operatingSystems.Add(new TargetOsEntry
                    {
                        name    = recognizedExe.RequiredOperatingSystem.Name,
                        version =
                            $"{recognizedExe.RequiredOperatingSystem.MajorVersion}.{recognizedExe.RequiredOperatingSystem.MinorVersion}"
                    });

                    switch (recognizedExe)
                    {
                    case NE _:
                        if (neExe.Versions != null)
                        {
                            foreach (NE.Version exeVersion in neExe.Versions)
                            {
                                versions.Add(exeVersion.FileVersion);
                                versions.Add(exeVersion.ProductVersion);
                                version = exeVersion.ProductVersion;

                                foreach (KeyValuePair <string, Dictionary <string, string> > kvp in exeVersion.
                                         StringsByLanguage)
                                {
                                    if (kvp.Value.TryGetValue("CompanyName", out string tmpValue))
                                    {
                                        developer = tmpValue;
                                    }

                                    if (kvp.Value.TryGetValue("ProductName", out string tmpValue2))
                                    {
                                        product = tmpValue2;
                                    }
                                }
                            }
                        }

                        break;

                    case PE _:
                        if (peExe.Versions != null)
                        {
                            foreach (PE.Version exeVersion in peExe.Versions)
                            {
                                versions.Add(exeVersion.FileVersion);
                                versions.Add(exeVersion.ProductVersion);
                                version = exeVersion.ProductVersion;

                                foreach (KeyValuePair <string, Dictionary <string, string> > kvp in exeVersion.
                                         StringsByLanguage)
                                {
                                    if (kvp.Value.TryGetValue("CompanyName", out string tmpValue))
                                    {
                                        developer = tmpValue;
                                    }

                                    if (kvp.Value.TryGetValue("ProductName", out string tmpValue2))
                                    {
                                        product = tmpValue2;
                                    }
                                }
                            }
                        }

                        break;

                    case LX _:
                        if (lxExe.WinVersion != null)
                        {
                            versions.Add(lxExe.WinVersion.FileVersion);
                            versions.Add(lxExe.WinVersion.ProductVersion);
                            version = lxExe.WinVersion.ProductVersion;

                            foreach (KeyValuePair <string, Dictionary <string, string> > kvp in lxExe.WinVersion.
                                     StringsByLanguage)
                            {
                                if (kvp.Value.TryGetValue("CompanyName", out string tmpValue))
                                {
                                    developer = tmpValue;
                                }

                                if (kvp.Value.TryGetValue("ProductName", out string tmpValue2))
                                {
                                    product = tmpValue2;
                                }
                            }
                        }

                        break;
                    }

                    exeStream.Close();
                    prgProgress.Value++;
                }

                strings = strings.Distinct().ToList();
                strings.Sort();

                if (strings.Count == 0 &&
                    minimumPanel == Panels.Strings)
                {
                    minimumPanel = Panels.Versions;
                }
                else
                {
                    maximumPanel = Panels.Strings;
                }

                panelStrings.treeStrings.DataStore = strings;
                versions = versions.Distinct().ToList();
                versions.Sort();
                panelVersions.treeVersions.DataStore = versions;
                architectures = architectures.Distinct().ToList();
                architectures.Sort();
                panelVersions.treeArchs.DataStore = architectures;

                Dictionary <string, List <string> > osEntriesDictionary = new Dictionary <string, List <string> >();

                foreach (TargetOsEntry osEntry in operatingSystems)
                {
                    if (string.IsNullOrEmpty(osEntry.name))
                    {
                        continue;
                    }

                    osEntriesDictionary.TryGetValue(osEntry.name, out List <string> osvers);

                    if (osvers == null)
                    {
                        osvers = new List <string>();
                    }

                    osvers.Add(osEntry.version);
                    osEntriesDictionary.Remove(osEntry.name);
                    osEntriesDictionary.Add(osEntry.name, osvers);
                }

                operatingSystems = new List <TargetOsEntry>();

                foreach (KeyValuePair <string, List <string> > kvp in osEntriesDictionary.OrderBy(t => t.Key))
                {
                    kvp.Value.Sort();

                    foreach (string s in kvp.Value.Distinct())
                    {
                        operatingSystems.Add(new TargetOsEntry
                        {
                            name    = kvp.Key,
                            version = s
                        });
                    }
                }

                panelVersions.treeOs.DataStore = operatingSystems;

                if (versions.Count > 0 ||
                    architectures.Count > 0 ||
                    operatingSystems.Count > 0)
                {
                    maximumPanel = Panels.Versions;
                }
            }

            prgProgress.Visible = false;
            btnPrevious.Enabled = false;

            switch (minimumPanel)
            {
            case Panels.Description:
                pnlPanel.Content = panelDescription;
                currentPanel     = Panels.Description;

                break;

            case Panels.Strings:
                pnlPanel.Content = panelStrings;
                currentPanel     = Panels.Strings;

                break;

            case Panels.Versions:
                pnlPanel.Content = panelVersions;
                currentPanel     = Panels.Versions;

                break;
            }

            if (currentPanel == maximumPanel)
            {
                btnNext.Text = "Finish";
            }

            lblPanelName.Visible = false;
        }
        /// <summary>
        /// Build the Shipyard task required minerals box.
        /// </summary>
        /// <param name="m_oSummaryPanel">Panel from the economics handler</param>
        /// <param name="CurrentFaction">Currently selected faction.</param>
        /// <param name="CurrentPopulation">Currently selected population</param>
        /// <param name="SYInfo">Currently selected shipyard on currently selected population belonging to currently selected faction</param>
        /// <param name="EligibleClassList">List of shipclasses that this shipyard can produce.</param>
        /// <param name="DamagedShipList">List of damaged ships in orbit.</param>
        /// <param name="ClassesInOrbit">List of shipclasses in orbit around CurrentPopulation.</param>
        /// <param name="ShipsOfClassInOrbit">List of ships in the selected shipclass in orbit around CurrentPopulation.</param> 
        public static void BuildSYTRequiredMinerals(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation, Installation.ShipyardInformation SYInfo,
                                                    BindingList<ShipClassTN> EligibleClassList, BindingList<ShipTN> DamagedShipList, BindingList<ShipClassTN> ClassesInOrbit,
                                                    BindingList<ShipTN> ShipsOfClassInOrbit)
        {
            if (m_oSummaryPanel.SYTaskTypeComboBox.SelectedIndex != -1 && m_oSummaryPanel.SYTaskGroupComboBox.SelectedIndex != -1 && SYInfo != null &&
                (m_oSummaryPanel.SYNewClassComboBox.SelectedIndex != -1 || m_oSummaryPanel.RepairRefitScrapShipComboBox.SelectedIndex != -1))
            {
                m_oSummaryPanel.ShipRequiredMaterialsListBox.Items.Clear();

                Installation.ShipyardInformation CostPrototyper = new Installation.ShipyardInformation(CurrentFaction, SYInfo.ShipyardType,1);
                CostPrototyper.Tonnage = SYInfo.Tonnage;
                CostPrototyper.Slipways = SYInfo.Slipways;
                CostPrototyper.ModRate = SYInfo.ModRate;
                CostPrototyper.AssignedClass = SYInfo.AssignedClass;

                ShipTN CurrentShip = null;
                ShipClassTN ConstructRefit = null;
                TaskGroupTN TargetTG = null;
                int TGIndex = -1;

                /// <summary>
                /// I'm not storing a faction only list of taskgroups in orbit anywhere, so lets calculate that here.
                /// </summary>
                foreach (TaskGroupTN CurrentTaskGroup in CurrentPopulation.Planet.TaskGroupsInOrbit)
                {
                    if (CurrentTaskGroup.TaskGroupFaction == CurrentFaction)
                    {
                        if (TGIndex == m_oSummaryPanel.SYTaskGroupComboBox.SelectedIndex)
                        {
                            TargetTG = CurrentTaskGroup;
                            break;
                        }
                        TGIndex++;
                    }
                }

                /// <summary>
                /// No TG was found so create one, the shipyard will want a tg in any event.
                /// </summary>
                if (TGIndex == -1)
                {
                    CurrentFaction.AddNewTaskGroup("Shipyard TG", CurrentPopulation.Planet, CurrentPopulation.Planet.Position.System);

                    /// <summary>
                    /// Run this loop again as a different faction could have a taskgroup in orbit.
                    /// </summary>
                    foreach (TaskGroupTN CurrentTaskGroup in CurrentPopulation.Planet.TaskGroupsInOrbit)
                    {
                        if (CurrentTaskGroup.TaskGroupFaction == CurrentFaction)
                        {
                            TGIndex++;
                            if (TGIndex == m_oSummaryPanel.SYTaskGroupComboBox.SelectedIndex)
                            {
                                TargetTG = CurrentTaskGroup;
                                break;
                            }
                        }
                    }
                }

                Constants.ShipyardInfo.Task SYITask = (Constants.ShipyardInfo.Task)m_oSummaryPanel.SYTaskTypeComboBox.SelectedIndex;


                int BaseBuildRate = SYInfo.CalcShipBuildRate(CurrentFaction, CurrentPopulation);

                if ((int)SYITask != -1)
                {
                    switch (SYITask)
                    {
                        case Constants.ShipyardInfo.Task.Construction:
                            int newShipIndex = m_oSummaryPanel.SYNewClassComboBox.SelectedIndex;
                            if (newShipIndex != -1 && EligibleClassList.Count > newShipIndex)
                            {
                                ConstructRefit = EligibleClassList[newShipIndex];
                            }
                            break;
                        case Constants.ShipyardInfo.Task.Repair:
                            int CurrentShipIndex = m_oSummaryPanel.RepairRefitScrapShipComboBox.SelectedIndex;
                            if (CurrentShipIndex != -1 && DamagedShipList.Count > CurrentShipIndex)
                            {
                                CurrentShip = DamagedShipList[CurrentShipIndex];
                            }
                            break;
                        case Constants.ShipyardInfo.Task.Refit:
                            newShipIndex = m_oSummaryPanel.SYNewClassComboBox.SelectedIndex;
                            if (newShipIndex != -1 && EligibleClassList.Count > newShipIndex)
                            {
                                ConstructRefit = EligibleClassList[newShipIndex];
                            }

                            CurrentShipIndex = m_oSummaryPanel.RepairRefitScrapShipComboBox.SelectedIndex;
                            if (CurrentShipIndex != -1 && ShipsOfClassInOrbit.Count > CurrentShipIndex)
                            {
                                CurrentShip = ShipsOfClassInOrbit[CurrentShipIndex];
                            }
                            break;
                        case Constants.ShipyardInfo.Task.Scrap:
                            CurrentShipIndex = m_oSummaryPanel.RepairRefitScrapShipComboBox.SelectedIndex;
                            if (CurrentShipIndex != -1 && ShipsOfClassInOrbit.Count > CurrentShipIndex)
                            {
                                CurrentShip = ShipsOfClassInOrbit[CurrentShipIndex];
                            }
                            break;
                    }

                    /// <summary>
                    /// Faction swapping can cause some problems.
                    /// </summary>
                    if (CurrentShip == null && ConstructRefit == null)
                        return;

                    Installation.ShipyardInformation.ShipyardTask NewTask = new Installation.ShipyardInformation.ShipyardTask(CurrentShip, SYITask, TargetTG, BaseBuildRate, m_oSummaryPanel.SYShipNameTextBox.Text, ConstructRefit);
                    CostPrototyper.BuildingShips.Add(NewTask);

                    m_oSummaryPanel.SYTaskCostTextBox.Text = CostPrototyper.BuildingShips[0].Cost.ToString();
                    m_oSummaryPanel.SYTaskCompletionDateTextBox.Text = CostPrototyper.BuildingShips[0].CompletionDate.ToShortDateString();

                    for (int MineralIterator = 0; MineralIterator < Constants.Minerals.NO_OF_MINERIALS; MineralIterator++)
                    {

                        if (CostPrototyper.BuildingShips[0].minerialsCost[MineralIterator] != 0.0m)
                        {
                            string FormattedMineralTotal = CostPrototyper.BuildingShips[0].minerialsCost[MineralIterator].ToString("#,##0");

                            String CostString = String.Format("{0} {1} ({2})", (Constants.Minerals.MinerialNames)MineralIterator, FormattedMineralTotal, CurrentPopulation.Minerials[MineralIterator]);
                            m_oSummaryPanel.ShipRequiredMaterialsListBox.Items.Add(CostString);
                        }
                    }
                }
            }
            else
            {
                /// <summary>
                /// There is no cost to calculate so print this instead.
                /// </summary>
                m_oSummaryPanel.SYTaskCostTextBox.Text = "N/A";
                m_oSummaryPanel.SYTaskCompletionDateTextBox.Text = "N/A";
                m_oSummaryPanel.ShipRequiredMaterialsListBox.Items.Clear();
            }
        }
 private void InitializeComponent()
 {
     iconPanel     = new StatusBarPanel();
     textPanel     = new StatusBarPanel();
     progressPanel = new StatusBarPanel();
     locationPanel = new StatusBarPanel();
     sizePanel     = new StatusBarPanel();
     ((ISupportInitialize)(iconPanel)).BeginInit();
     ((ISupportInitialize)(textPanel)).BeginInit();
     ((ISupportInitialize)(progressPanel)).BeginInit();
     ((ISupportInitialize)(locationPanel)).BeginInit();
     ((ISupportInitialize)(sizePanel)).BeginInit();
     //
     // iconPanel
     //
     iconPanel.BorderStyle = StatusBarPanelBorderStyle.None;
     iconPanel.MinWidth    = 20;
     iconPanel.Style       = StatusBarPanelStyle.OwnerDraw;
     iconPanel.Width       = 20;
     //
     // textPanel
     //
     textPanel.AutoSize    = StatusBarPanelAutoSize.Spring;
     textPanel.BorderStyle = StatusBarPanelBorderStyle.None;
     textPanel.Text        = "Ready";
     textPanel.Width       = 10;
     //
     // progressPanel
     //
     progressPanel.BorderStyle = StatusBarPanelBorderStyle.None;
     progressPanel.MinWidth    = 0;
     progressPanel.Style       = StatusBarPanelStyle.OwnerDraw;
     progressPanel.Width       = 120;
     //
     // locationPanel
     //
     locationPanel.AutoSize    = StatusBarPanelAutoSize.Contents;
     locationPanel.BorderStyle = StatusBarPanelBorderStyle.None;
     locationPanel.MinWidth    = 1;
     locationPanel.Style       = StatusBarPanelStyle.OwnerDraw;
     locationPanel.Width       = 10;
     //
     // sizePanel
     //
     sizePanel.AutoSize    = StatusBarPanelAutoSize.Contents;
     sizePanel.BorderStyle = StatusBarPanelBorderStyle.None;
     sizePanel.Style       = StatusBarPanelStyle.OwnerDraw;
     sizePanel.Width       = 10;
     //
     // MpeStatusBar
     //
     Panels.AddRange(new StatusBarPanel[]
     {
         iconPanel,
         textPanel,
         locationPanel,
         sizePanel,
         progressPanel
     });
     ShowPanels  = true;
     PanelClick += new StatusBarPanelClickEventHandler(OnPanelClick);
     DrawItem   += new StatusBarDrawItemEventHandler(OnDrawItem);
     ((ISupportInitialize)(iconPanel)).EndInit();
     ((ISupportInitialize)(textPanel)).EndInit();
     ((ISupportInitialize)(progressPanel)).EndInit();
     ((ISupportInitialize)(locationPanel)).EndInit();
     ((ISupportInitialize)(sizePanel)).EndInit();
 }
Ejemplo n.º 7
0
 public List <Coordinates> GetOpenRandomPanels()
 {
     return(Panels.Where(w => w.PanelType == PanelType.Empty && w.IsRandomAvailable)
            .Select(s => s.Coordinates).ToList());
 }
        /// <summary>
        /// Refreshing the shipyard task groupbox will be necessary on player input.
        /// </summary>
        /// <param name="m_oSummaryPanel">The economics handler panel.</param>
        /// <param name="CurrentFaction">Selected faction from the economics handler.</param>
        /// <param name="CurrentPopulation">Selected population from the economics handler.</param>
        /// <param name="SYInfo">Shipyard information from the economics handler.</param>
        /// <param name="EligibleClassList">List of shipclasses that this shipyard can produce.</param>
        /// <param name="DamagedShipList">List of damaged ships in orbit.</param>
        /// <param name="ClassesInOrbit">List of shipclasses in orbit around CurrentPopulation.</param>
        /// <param name="ShipsOfClassInOrbit">List of ships in the selected shipclass in orbit around CurrentPopulation.</param>
        public static void RefreshSYTaskGroupBox(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation, Installation.ShipyardInformation SYInfo,
                                                 ref BindingList<ShipClassTN> EligibleClassList, ref BindingList<ShipTN> DamagedShipList, ref BindingList<ShipClassTN> ClassesInOrbit,
                                                 ref BindingList<ShipTN>ShipsOfClassInOrbit)
        {
            if(m_oSummaryPanel.SYTaskTypeComboBox.SelectedIndex != -1)
            {
                Constants.ShipyardInfo.Task CurrentSYTask = (Constants.ShipyardInfo.Task)m_oSummaryPanel.SYTaskTypeComboBox.SelectedIndex;

                switch (CurrentSYTask)
                {
                    case Constants.ShipyardInfo.Task.Construction:                        
                        /// <summary>
                        /// Fill the taskgroups in orbit combo box.
                        /// </summary>
                        m_oSummaryPanel.SYTaskGroupComboBox.Items.Clear();
                        foreach (TaskGroupTN CurrentTaskGroup in CurrentPopulation.Planet.TaskGroupsInOrbit)
                        {
                            if(CurrentTaskGroup.TaskGroupFaction == CurrentFaction)
                                m_oSummaryPanel.SYTaskGroupComboBox.Items.Add(CurrentTaskGroup);
                        }
#warning later on look for Shipyard TG? and should shipyard TG be "special"?
                        if (m_oSummaryPanel.SYTaskGroupComboBox.Items.Count != 0)
                            m_oSummaryPanel.SYTaskGroupComboBox.SelectedIndex = 0;

                        if (SYInfo.AssignedClass != null)
                        {
                            m_oSummaryPanel.SYNewClassComboBox.Items.Clear();

                            GetEligibleClassList(CurrentFaction, SYInfo, ref EligibleClassList);

                            foreach (ShipClassTN CurrentClass in EligibleClassList)
                            {
                                m_oSummaryPanel.SYNewClassComboBox.Items.Add(CurrentClass);
                            }
                            if (m_oSummaryPanel.SYNewClassComboBox.Items.Count != 0)
                                m_oSummaryPanel.SYNewClassComboBox.SelectedIndex = 0;

                            int index = CurrentFaction.ShipDesigns.IndexOf(EligibleClassList[0]);
                            String Entry = String.Format("{0} {1}", CurrentFaction.ShipDesigns[index].Name,
                                                         (CurrentFaction.ShipDesigns[index].ShipsInClass.Count + CurrentFaction.ShipDesigns[index].ShipsUnderConstruction + 1));
                            m_oSummaryPanel.SYShipNameTextBox.Text = Entry;
                        }
                        break;
                    case Constants.ShipyardInfo.Task.Repair:
                        m_oSummaryPanel.RepairRefitScrapLabel.Text = "Repair";
                        GetDamagedShipList(CurrentFaction, CurrentPopulation, ref DamagedShipList);
                        m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Clear();
                        foreach (ShipTN CurrentShip in DamagedShipList)
                        {
                            m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Add(CurrentShip);
                        }
                        if (m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Count != 0)
                            m_oSummaryPanel.RepairRefitScrapShipComboBox.SelectedIndex = 0;
                        break;
                    case Constants.ShipyardInfo.Task.Refit:
                        m_oSummaryPanel.RepairRefitScrapLabel.Text = "Refit";
                        GetShipClassesInOrbit(CurrentFaction, CurrentPopulation, ref ClassesInOrbit);
                        m_oSummaryPanel.RepairRefitScrapClassComboBox.Items.Clear();
                        foreach (ShipClassTN CurrentClass in ClassesInOrbit)
                        {
                            m_oSummaryPanel.RepairRefitScrapClassComboBox.Items.Add(CurrentClass);
                        }
                        ShipClassTN CurrentRRSClass = null;
                        if (m_oSummaryPanel.RepairRefitScrapClassComboBox.Items.Count != 0)
                        {
                            m_oSummaryPanel.RepairRefitScrapClassComboBox.SelectedIndex = 0;
                            CurrentRRSClass = ClassesInOrbit[m_oSummaryPanel.RepairRefitScrapClassComboBox.SelectedIndex];
                        }

                        if (CurrentRRSClass != null)
                        {
                            GetShipsOfClassInOrbit(CurrentFaction, CurrentPopulation, CurrentRRSClass, ref ShipsOfClassInOrbit);
                            m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Clear();
                            foreach (ShipTN CurrentShip in ShipsOfClassInOrbit)
                            {
                                m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Add(CurrentShip);
                            }
                            if (m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Count != 0)
                                m_oSummaryPanel.RepairRefitScrapShipComboBox.SelectedIndex = 0;
                        }
                        break;
                    case Constants.ShipyardInfo.Task.Scrap:
                        m_oSummaryPanel.RepairRefitScrapLabel.Text = "Scrap";
                        GetShipClassesInOrbit(CurrentFaction, CurrentPopulation, ref ClassesInOrbit);
                        m_oSummaryPanel.RepairRefitScrapClassComboBox.Items.Clear();
                        foreach (ShipClassTN CurrentClass in ClassesInOrbit)
                        {
                            m_oSummaryPanel.RepairRefitScrapClassComboBox.Items.Add(CurrentClass);
                        }
                        CurrentRRSClass = null;
                        if (m_oSummaryPanel.RepairRefitScrapClassComboBox.Items.Count != 0)
                        {
                            m_oSummaryPanel.RepairRefitScrapClassComboBox.SelectedIndex = 0;
                            CurrentRRSClass = ClassesInOrbit[m_oSummaryPanel.RepairRefitScrapClassComboBox.SelectedIndex];
                        }

                        if(CurrentRRSClass != null)
                        {
                            GetShipsOfClassInOrbit(CurrentFaction, CurrentPopulation, CurrentRRSClass, ref ShipsOfClassInOrbit);
                            m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Clear();
                            foreach (ShipTN CurrentShip in ShipsOfClassInOrbit)
                            {
                                m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Add(CurrentShip);
                            }
                            if (m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Count != 0)
                                m_oSummaryPanel.RepairRefitScrapShipComboBox.SelectedIndex = 0;
                        }
                        break;
                }
            }
        }
Ejemplo n.º 9
0
 public BsPanelHtmlBuilder GetPanel(object id)
 {
     return(Panels.FirstOrDefault(p => p._id.Equals(id)));
 }
Ejemplo n.º 10
0
        public DotNetStatusBar()
        {
            // This call is required by the Windows.Forms Form Designer.

            try
            {
                InitializeComponent();
                textFont = new Font("Arial", 8, FontStyle.Bold);

                textBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Gray);
                backBrush = new System.Drawing.SolidBrush(Info.getInstance().backColor);              //.SystemBrushes.InactiveBorder;
                // change the style to double buffering to avoid flickering
                this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint |
                              ControlStyles.DoubleBuffer, true);
                ShowPanels      = true;
                this.SizingGrip = false;

                // assign the same font as the Visual Studio .Net Statusbar ( on my machine :-> )
                Font = new Font("Arial", 8);

                // create all the panels
                _MessagePanel      = new System.Windows.Forms.StatusBarPanel();
                _CenterImagePanel  = new System.Windows.Forms.StatusBarPanel();
                _RightMessagePanel = new System.Windows.Forms.StatusBarPanel();
                _RightImagePanel   = new System.Windows.Forms.StatusBarPanel();



                Panels.AddRange(new StatusBarPanel[] { _MessagePanel, _CenterImagePanel, _RightMessagePanel });


                // calculate a proper height according the height of the font
                Size = new System.Drawing.Size(292, FontHeight + 7);

                // calculate the width of the overwrite/insert/capslock panel
                Graphics  g    = this.CreateGraphics();
                string [] aStr = new string[] { "CAP", "INS", "OVR", "NUM" };
                float     fMax = 0f;
                foreach (string str in aStr)
                {
                    System.Drawing.SizeF size = g.MeasureString(str, Font);
                    if (size.Width > fMax)
                    {
                        fMax = size.Width;
                    }
                }
                int width = Convert.ToInt32(fMax + 2.5f);

                // _MessagePanel
                _MessagePanel.BorderStyle = StatusBarPanelBorderStyle.None;
                _MessagePanel.AutoSize    = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
                _MessagePanel.Width       = 10;
                _MessagePanel.Style       = StatusBarPanelStyle.OwnerDraw;
                _MessagePanel.Text        = "Ready";
                // _CenterImagePanel
                _CenterImagePanel.BorderStyle = StatusBarPanelBorderStyle.None;
                _CenterImagePanel.AutoSize    = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
                _CenterImagePanel.Width       = 100;
                _CenterImagePanel.Alignment   = HorizontalAlignment.Center;


                _RightMessagePanel.BorderStyle = StatusBarPanelBorderStyle.None;
                _RightMessagePanel.AutoSize    = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
                _RightMessagePanel.Text        = "Connecting";
                //_RightMessagePanel.Width=50;
                _RightMessagePanel.Alignment = HorizontalAlignment.Right;

                ///////_RightImagePanel
                _RightImagePanel.BorderStyle = StatusBarPanelBorderStyle.Raised;
                _RightImagePanel.AutoSize    = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
                _RightImagePanel.Width       = 10;
                _RightImagePanel.Alignment   = HorizontalAlignment.Center;
                //_RightImagePanel.Style = StatusBarPanelStyle.OwnerDraw;
                //this.Controls.Add(synchButton);
                comboMood.Visible = false;
                this.Controls.Add(comboMood);
                comboMood.DropDownStyle = ComboBoxStyle.DropDownList;
                comboMood.Items.Add("Yellow");
                comboMood.Items.Add("Blue");
                comboMood.Items.Add("Green");
                comboMood.Items.Add("Red");
                comboMood.Items.Add("Orange");

                comboMood.SelectedIndexChanged += new EventHandler(comboMood_SelectedIndexChanged);
                comboMood.SelectedIndex         = 2;

                /*
                 * synchButton.Text = "Synchronize All";
                 * synchButton.Click+=new EventHandler(synchButton_Click);
                 * synchButton.Visible =false;
                 */
                g.Dispose();
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Exception at the place of status bar contructor :" + ex.ToString());
                ex = ex;
            }
        }
        /// <summary>
        /// Add stack panel on top of client.
        /// </summary>
        /// <param name="userControlPanel">Panel to add</param>
        public static void AddPanel(Panels.UIPanel userControlPanel)
        {
            Contract.Requires(userControlPanel != null);

            _uiClient.AddPanel(userControlPanel);
        }
Ejemplo n.º 12
0
    private void AddButton(string text, Panels panel, UnityEngine.Events.UnityAction action)
    {
        Button button = Instantiate(PrefabButton);
        button.GetComponentInChildren<Text>().text = text;
        button.transform.SetParent(ButtonPanels[(int)panel].ButtonGrid.transform, false);
        button.transform.localScale = Vector3.one;
        button.onClick.AddListener(action);

        ButtonPanels[(int)panel].GridButtons.Add(button);
    }
Ejemplo n.º 13
0
    private void SetActiveTab(Panels panel)
    {
        // Set it
        ActivePanel = panel;
        timeLastQuery = DateTime.MinValue;

        // Colors
        Update_Colors();
    }
Ejemplo n.º 14
0
        /// <summary>
        /// Need an updater function for this groupbox since the retool list can and will change.
        /// </summary>
        /// <param name="m_oSummaryPanel">Panel from economics</param>
        /// <param name="CurrentFaction">Current Faction</param>
        /// <param name="CurrentPopulation">Current Population</param>
        /// <param name="SYInfo">Shipyard information for the selected shipyard.</param>
        /// <param name="RetoolList">List of ships that this shipyard can be retooled to.</param>
        private static void RefreshSYCGroupBox(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation, 
                                               Installation.ShipyardInformation SYInfo, BindingList<ShipClassTN> RetoolList)
        {
#warning this doesn't update when a new shipclass is added on its own. the econ page is "shared" by all factions so an event may not be possible there.
            if (RetoolList != null && CurrentFaction != null && SYInfo != null)
            {

                m_oSummaryPanel.NewShipClassComboBox.Items.Clear();
                RetoolList.Clear();
                foreach (ShipClassTN Ship in CurrentFaction.ShipDesigns)
                {
                    /// <summary>
                    /// Ships that are too big may not be in the retool list, and military ships may not be built at commercial yards.
                    /// Naval yards may build all classes of ships, but cap expansion for naval yards is very expensive.
                    /// </summary>
                    if (Ship.SizeTons <= SYInfo.Tonnage && !(Ship.IsMilitary == true && SYInfo.ShipyardType == Constants.ShipyardInfo.SYType.Commercial))
                    {
                        RetoolList.Add(Ship);
                    }
                }

                foreach (ShipClassTN Ship in RetoolList)
                {
                    m_oSummaryPanel.NewShipClassComboBox.Items.Add(Ship);
                }
                if (RetoolList.Count != 0)
                    m_oSummaryPanel.NewShipClassComboBox.SelectedIndex = 0;
            }
        }
Ejemplo n.º 15
0
 protected override LoadReturnCode OnLoad(ref string errorMessage)
 {
     System.Type panel_type = typeof(SampleCsWpfPanelHost);
     Panels.RegisterPanel(this, panel_type, "SampleWpf", Properties.Resources.SampleCsWpfPanel);
     return(LoadReturnCode.Success);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// This builds the Shipyard complex groupbox, which controls how the shipyards themselves are modified. Shipyard tasks(such as ship building) are handled elsewhere.
        /// </summary>
        /// <param name="m_oSummaryPanel">The summary panel from the economics handler.</param>
        private static void BuildSYCGroupBox(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation, BindingList<ShipClassTN> RetoolList)
        {
            m_oSummaryPanel.SYCTaskTypeComboBox.Items.Clear();
            m_oSummaryPanel.SYCTaskTypeComboBox.DataSource = Constants.ShipyardInfo.ShipyardTasks;
            m_oSummaryPanel.SYCTaskTypeComboBox.SelectedIndex = 0;

#warning this doesn't update when a new shipclass is added on its own. the econ page is "shared" by all factions so an event may not be possible there.
            m_oSummaryPanel.NewShipClassComboBox.Items.Clear();
            foreach (ShipClassTN Ship in RetoolList)
            {
                m_oSummaryPanel.NewShipClassComboBox.Items.Add(Ship);
            }
            if (RetoolList.Count != 0)
                m_oSummaryPanel.NewShipClassComboBox.SelectedIndex = 0;
        }
Ejemplo n.º 17
0
 public RhinoWpfIntroPanelCommand()
 {
     Instance = this;
     Panels.RegisterPanel(RhinoWpfIntroPlugIn.Instance, typeof(RhinoWpfIntroPlanelHost), "MyUIPanel", System.Drawing.SystemIcons.WinLogo);
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Populate the rows of the Shipyard datagrid with the various shipyard complex data items.
        /// </summary>
        /// <param name="m_oSummaryPanel"></param>
        /// <param name="CurrentFaction">Faction Currently selected</param>
        /// <param name="CurrentPopulation">Population Currently selected</param>
        private static void RefreshShipyardDataGrid(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation)
        {
            if (m_oSummaryPanel.ShipyardDataGrid.Rows.Count != 0)
            {

                int row = 0;

                /// <summary>
                /// Populate the Naval shipyard info.
                /// </summary>
                int NavalYards = (int)Math.Floor(CurrentPopulation.Installations[(int)Installation.InstallationType.NavalShipyardComplex].Number);
                for (int ShipyardIterator = 0; ShipyardIterator < NavalYards; ShipyardIterator++)
                {
                    m_oSummaryPanel.ShipyardDataGrid.Rows[row].Visible = true;
                    row++;

                    if (row == MaxShipyardRows)
                    {
                        using (DataGridViewRow NewRow = new DataGridViewRow())
                        {
                            // setup row height. note that by default they are 22 pixels in height!
                            NewRow.Height = 18;
                            NewRow.Visible = false;
                            m_oSummaryPanel.ShipyardDataGrid.Rows.Add(NewRow);
                        }
                        MaxShipyardRows++;
                    }

                    Installation.ShipyardInformation SYI = CurrentPopulation.Installations[(int)Installation.InstallationType.NavalShipyardComplex].SYInfo[ShipyardIterator];
                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[0].Value = SYI.Name;
                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[1].Value = "N";
                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[2].Value = SYI.Slipways;
                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[3].Value = SYI.Tonnage;

                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[4].Value = (SYI.Slipways - SYI.BuildingShips.Count());

                    if (SYI.AssignedClass != null)
                    {
                        m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[5].Value = SYI.AssignedClass.Name;
                    }
                    else
                    {
                        m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[5].Value = "No Assigned Class";
                    }

                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[6].Value = Constants.ShipyardInfo.ShipyardTasks[(int)SYI.CurrentActivity.Activity];


                    String ProgString = String.Format("{0:N2}", (SYI.CurrentActivity.Progress * 100.0m));

                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[7].Value = ProgString;
                    if (SYI.CurrentActivity.Activity == Constants.ShipyardInfo.ShipyardActivity.NoActivity)
                    {
                        m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[8].Value = "N/A";
                    }
                    else
                    {
                        float YearsOfProduction = (float)SYI.CurrentActivity.CostOfActivity / SYI.CalcAnnualSYProduction();
                        if (YearsOfProduction < Constants.Colony.TimerYearMax)
                        {
                            m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[8].Value = SYI.CurrentActivity.CompletionDate;
                        }
                        else
                        {
                            m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[8].Value = "N/A";
                        }
                    }

                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator].Cells[9].Value = SYI.ModRate;


                }

                /// <summary>
                /// Populate the commercial yard information.
                /// </summary>
                int CommercialYards = (int)Math.Floor(CurrentPopulation.Installations[(int)Installation.InstallationType.CommercialShipyard].Number);
                for (int ShipyardIterator = 0; ShipyardIterator < CommercialYards; ShipyardIterator++)
                {
                    m_oSummaryPanel.ShipyardDataGrid.Rows[row].Visible = true;
                    

                    if (row == MaxShipyardRows)
                    {
                        using (DataGridViewRow NewRow = new DataGridViewRow())
                        {
                            // setup row height. note that by default they are 22 pixels in height!
                            NewRow.Height = 18;
                            NewRow.Visible = false;
                            m_oSummaryPanel.ShipyardDataGrid.Rows.Add(NewRow);
                        }
                        MaxShipyardRows++;
                    }

                    Installation.ShipyardInformation SYI = CurrentPopulation.Installations[(int)Installation.InstallationType.CommercialShipyard].SYInfo[ShipyardIterator];
                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[0].Value = SYI.Name;
                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[1].Value = "C";
                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[2].Value = SYI.Slipways;
                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[3].Value = SYI.Tonnage;

                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[4].Value = (SYI.Slipways - SYI.BuildingShips.Count());

                    if (SYI.AssignedClass != null)
                    {
                        m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[5].Value = SYI.AssignedClass.Name;
                    }
                    else
                    {
                        m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[5].Value = "No Assigned Class";
                    }

                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[6].Value = Constants.ShipyardInfo.ShipyardTasks[(int)SYI.CurrentActivity.Activity];

                    String ProgString = String.Format("{0:N2}",(SYI.CurrentActivity.Progress * 100.0m));

                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[7].Value = ProgString;
                    if (SYI.CurrentActivity.Activity == Constants.ShipyardInfo.ShipyardActivity.NoActivity)
                    {
                        m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[8].Value = "N/A";
                    }
                    else
                    {
                        m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[8].Value = SYI.CurrentActivity.CompletionDate;
                    }

                    m_oSummaryPanel.ShipyardDataGrid.Rows[ShipyardIterator + row].Cells[9].Value = SYI.ModRate;

                    row++;
                }

                /// <summary>
                /// Do not display any rows after this.
                /// </summary>
                for (int rowIterator = row; rowIterator < MaxShipyardRows; rowIterator++)
                {
                    m_oSummaryPanel.ShipyardDataGrid.Rows[rowIterator].Visible = false;
                }
            }
        }
Ejemplo n.º 19
0
        /* Constructor */

        public LogInPanel()
        {
            controller = new LogInController(this);

            // Init dimensions
            this.formComponentWidth = this.formContainerWidth - 2 * this.formContainerPadding;
            Padding headerLabelMargins = new Padding(this.formContainerPadding);
            Padding txtBoxMargins      = new Padding(this.formContainerPadding, this.formContainerPadding, 0, 0);
            Padding labelMargins       = new Padding(this.formContainerPadding, this.formContainerPadding, 0, 0);

            // Init Panel
            this.Panel           = new Panel();
            this.Panel.AutoSize  = true;
            this.Panel.Location  = new Point(0, 0);
            this.Panel.Name      = "logInPanel";
            this.Panel.Size      = new Size(Dimensions.PANEL_WIDTH, Dimensions.PANEL_HEIGHT);
            this.Panel.BackColor = Colors.ALTO;
            this.Panel.Visible   = true;

            // Init log in form container
            int formContainerX = Panels.getComponentStartingPositionX(Dimensions.PANEL_WIDTH, formContainerWidth);
            int formContainerY = Panels.getComponentStartingPositionY(Dimensions.PANEL_HEIGHT, formContainerHeight);

            this.formContainer           = new TableLayoutPanel();
            this.formContainer.Location  = new Point(formContainerX, formContainerY);
            this.formContainer.Name      = "formContainer";
            this.formContainer.Size      = new Size(formContainerWidth, formContainerHeight);
            this.formContainer.BackColor = Colors.WHITE;

            this.Panel.Controls.Add(this.formContainer);

            // Init header label
            this.headerLabel           = new Label();
            this.headerLabel.Width     = this.formComponentWidth;
            this.headerLabel.Height    = 60;
            this.headerLabel.Text      = "Identifikimi";
            this.headerLabel.Font      = new Font(Fonts.primary, 32, FontStyle.Bold);
            this.headerLabel.ForeColor = Colors.MALACHITE;
            this.headerLabel.TextAlign = ContentAlignment.MiddleCenter;
            this.headerLabel.Margin    = headerLabelMargins;

            this.formContainer.Controls.Add(headerLabel, 0, 0);

            // Init email label
            this.emailLabel           = new Label();
            this.emailLabel.Width     = this.formComponentWidth;
            this.emailLabel.Height    = this.labelHeight;
            this.emailLabel.Text      = "Email";
            this.emailLabel.Font      = new Font(Fonts.primary, 12, FontStyle.Regular);
            this.emailLabel.ForeColor = Colors.DOVE_GRAY;
            this.emailLabel.TextAlign = ContentAlignment.BottomLeft;
            this.emailLabel.Margin    = labelMargins;

            this.formContainer.Controls.Add(emailLabel, 0, 1);

            // Init email text box
            this.EmailTextBox        = new TextBox();
            this.EmailTextBox.Width  = this.formComponentWidth;
            this.EmailTextBox.Font   = new Font(Fonts.primary, 12, FontStyle.Regular);
            this.EmailTextBox.Margin = txtBoxMargins;

            this.formContainer.Controls.Add(EmailTextBox, 0, 2);

            // Init password label
            this.passwordLabel           = new Label();
            this.passwordLabel.Width     = this.formComponentWidth;
            this.passwordLabel.Height    = this.labelHeight;
            this.passwordLabel.Text      = "Fjalëkalimi";
            this.passwordLabel.Font      = new Font(Fonts.primary, 12, FontStyle.Regular);
            this.passwordLabel.ForeColor = Colors.DOVE_GRAY;
            this.passwordLabel.TextAlign = ContentAlignment.BottomLeft;
            this.passwordLabel.Margin    = labelMargins;

            this.formContainer.Controls.Add(passwordLabel, 0, 3);

            // Init password text box
            Padding passwordTxtBoxMargins = new Padding(this.formContainerPadding, this.formContainerPadding, 0, 50);

            this.PasswordTxtBox = new TextBox();
            this.PasswordTxtBox.PasswordChar = '*';
            this.PasswordTxtBox.Width        = this.formComponentWidth;
            this.PasswordTxtBox.Font         = new Font(Fonts.primary, 12, FontStyle.Regular);
            this.PasswordTxtBox.Margin       = passwordTxtBoxMargins;

            this.formContainer.Controls.Add(PasswordTxtBox, 0, 4);

            // Init log in button
            Padding logInButtonMargins = new Padding(this.formContainerPadding, this.formContainerPadding, 100, 0);

            this.logInBtn      = new Button();
            this.logInBtn.Name = "logInBtn";
            this.logInBtn.Size = new Size(formComponentWidth, 60);
            this.logInBtn.Text = "HYR";
            this.logInBtn.UseVisualStyleBackColor = true;
            this.logInBtn.Font       = new Font(Fonts.primary, 12, FontStyle.Bold);
            this.logInBtn.ForeColor  = Colors.WHITE;
            this.logInBtn.BackColor  = Colors.MALACHITE;
            this.logInBtn.FlatStyle  = FlatStyle.Flat;
            this.logInBtn.Margin     = logInButtonMargins;
            this.logInBtn.Image      = Image.FromFile("../../Resources/done.png");
            this.logInBtn.ImageAlign = ContentAlignment.MiddleLeft;
            this.logInBtn.Click     += new EventHandler(onLogInBtnClicked);

            this.formContainer.Controls.Add(this.logInBtn, 0, 6);
        }
Ejemplo n.º 20
0
        public void testsInitialize()
        {
            cupboard1 = new Cupboard();
            cupboard2 = new Cupboard();

            angleBracketParam1 = new AngleBracket(100, "null", "0000", new ComponentSize(45, 0, 0), false, ComponentColor.white);
            angleBracketParam2 = new AngleBracket(25, "null", "0000", new ComponentSize(0, 0, 0), false, ComponentColor.white);

            locker1 = new Locker();
            locker2 = new Locker();
            locker3 = new Locker();
            locker4 = new Locker();

            crossBar1          = new CrossBar();
            crossBar2          = new CrossBar();
            crossBar3          = new CrossBar();
            crossBar4          = new CrossBar();
            crossBar5          = new CrossBar();
            crossBar6          = new CrossBar();
            crossBar7          = new CrossBar();
            crossBar8          = new CrossBar();
            crossBarWithParam1 = new CrossBar(10, "referenceTest", "1", new ComponentSize(21, 0, 0), false, CrossBarType.F);
            crossBarWithParam2 = new CrossBar(20, "referenceTest", "2", new ComponentSize(11, 0, 0), false, CrossBarType.F);
            crossBarWithParam3 = new CrossBar(20, "referenceTest", "3", new ComponentSize(8, 0, 0), false, CrossBarType.F);

            pannel1         = new Panels();
            pannel2         = new Panels();
            pannel3         = new Panels();
            pannel4         = new Panels();
            pannel5         = new Panels();
            pannelWithPara1 = new Panels(10, "referenceTest", "1", new ComponentSize(23, 0, 0), false, ComponentColor.white, PanelsType.B);

            cleat1         = new Cleat();
            cleat2         = new Cleat();
            cleat3         = new Cleat();
            cleat4         = new Cleat();
            cleatWithPara1 = new Cleat(10, "referenceTest", "1", new ComponentSize(10, 0, 0), false);

            catalogueComponentsListFull = new List <CatalogueComponents>()
            {
                crossBar1, crossBar2, crossBar3, crossBar4, crossBar5, crossBar6, crossBar7, crossBar8,
                cleat1, cleat2, cleat3, cleat4,
                pannel1, pannel2, pannel3, pannel4, pannel5
            };

            catalogueComponentsListWith13 = new List <CatalogueComponents>()
            {
                crossBar1, crossBar2, crossBar3, crossBar4, crossBar5, crossBar6, crossBar7, crossBar8,
                cleat1, cleat2, cleat3, cleat4,
                pannel1
            };

            catalogueComponentsListWith5WithParam = new List <CatalogueComponents>()
            {
                crossBarWithParam1, crossBarWithParam2, crossBarWithParam3,
                cleatWithPara1,
                pannelWithPara1
            };

            catalogueComponentsListWith2WithParam = new List <CatalogueComponents>()
            {
                cleatWithPara1, pannelWithPara1
            };

            cupboardComponentsListWith3 = new List <ICupboardComponents>()
            {
                locker1, locker2, locker3
            };
        }
Ejemplo n.º 21
0
        public override void Reorder(List <Panel> panels, List <int> indexes)
        {
            SuspendLayout();

            for (int i = 0; i < panels.Count; i++)
            {
                int      panelIndex = this.Controls.GetChildIndex(panels[i]);
                Splitter splitter   = this.Controls[panelIndex + noOfControlsCreatedForEachPanel - 1] as Splitter; // get the panel below splitter

                int newIndex = GetChildIndexByPanelIndex(Panels.Count - 1, indexes[i]);

                // when new position is below the current position, need to insert at new positon + 1
                // i.e when splitter is moved from 2 to 8 it should be inserted at 9
                // but when  it is moved from 8 to 2 it should be inserted at 2 .

                // Some explanation ...(Strange .net behavior !!)

                //Say that we have 5 splitter(s1..s5)  and panels (p1…p5) , with z order as shown

                // Move from 2 to 8 :
                // p1, s1, p2 , s2 ..... p5, s5
                // Now when we move p2 (at 2) to index 8 , all the controls after index 3(s2) to index 8(p5) will be moved upward by 1.
                // p1, s1, s2, p3, s3, p4, s4, p5, p2 ,s5  (not expected behavior)
                // Now as you can see when we move from 2 to 8 ,  P2 is inserted between P5 and S5 which is not desired behavior for us.
                //So, we need to insert P2 at index 9 and then S2 at 9  again  so that splitter and panels remain together.


                //Now consider the case when we move from 8 to 2.
                //When we move from 8 to 2, all controls from 2 to 7 are moved downwards.
                // So controls are :
                // p1, s1, p5, p2, s2, p3, s3, p4, s4, s5 (expected behavior )
                // (If we will move at 3 using +1 logic it will result in incorrect behavior )


                if (newIndex > panelIndex)
                {
                    newIndex += noOfControlsCreatedForEachPanel - 1;
                }

                if (newIndex != panelIndex)
                {
                    Controls.SetChildIndex(splitter, newIndex); // add splitter at

                    //correct position
                    Splitters.Remove(splitter);
                    Splitters.Insert(indexes[i], splitter);

                    if (newIndex > panelIndex)
                    {
                        newIndex -= noOfControlsCreatedForEachPanel - 1;
                    }
                    Controls.SetChildIndex(panels[i], newIndex); // add panel at correct

                    //position
                    Panels.Remove(panels[i]);
                    Panels.Insert(indexes[i], panels[i]);
                }
            }

            ResumeLayout();
        }
Ejemplo n.º 22
0
    public static void OnMouseButtonReleased(object sender, MouseButtonEventArgs e)
    {
        // Contagem do clique duplo
        DoubleClick_Timer = Environment.TickCount;

        // Percorre toda a árvore de ordem para executar o comando
        Stack <List <Tools.Order_Structure> > Stack = new Stack <List <Tools.Order_Structure> >();

        Stack.Push(Tools.Order);
        while (Stack.Count != 0)
        {
            List <Tools.Order_Structure> Top = Stack.Pop();

            for (byte i = 0; i < Top.Count; i++)
            {
                if (Top[i].Data.Visible)
                {
                    // Executa o comando
                    if (Top[i].Data is Buttons.Structure)
                    {
                        ((Buttons.Structure)Top[i].Data).MouseUp();
                    }
                    else if (Top[i].Data is CheckBoxes.Structure)
                    {
                        ((CheckBoxes.Structure)Top[i].Data).MouseUp();
                    }
                    else if (Top[i].Data is TextBoxes.Structure)
                    {
                        ((TextBoxes.Structure)Top[i].Data).MouseUp(Top[i]);
                    }
                    Stack.Push(Top[i].Nodes);
                }
            }
        }

        // Eventos em jogo
        if (Tools.CurrentWindow == Tools.Windows.Game)
        {
            // Muda o slot do item
            if (Player.Inventory_Change > 0)
            {
                if (Panels.Inventory_Mouse() > 0)
                {
                    Send.Inventory_Change(Player.Inventory_Change, Panels.Inventory_Mouse());
                }
            }

            // Muda o slot da hotbar
            if (Panels.Hotbar_Mouse() > 0)
            {
                if (Player.Hotbar_Change > 0)
                {
                    Send.Hotbar_Change(Player.Hotbar_Change, Panels.Hotbar_Mouse());
                }
                if (Player.Inventory_Change > 0)
                {
                    Send.Hotbar_Add(Panels.Hotbar_Mouse(), (byte)Game.Hotbar.Item, Player.Inventory_Change);
                }
            }

            // Reseta a movimentação
            Player.Inventory_Change = 0;
            Player.Hotbar_Change    = 0;
        }
    }
Ejemplo n.º 23
0
 public void createComponentTest4()
 {
     panel1 = (Panels)catalogueDB.createComponents(32, 100, 0, ComponentColor.brown, PanelsType.B, "Panel");
     Assert.AreEqual(12, 8, panel1.price);
 }
	/// <summary>
	/// This is for test at the moment, acting as the test trigger.
    /// 
    /// Alex Reiss
	/// </summary>

	void Update () 
    {
        if (currentTalkingEvent < currentTalkingEventChain.Count || activePanels)
        {
            
            if (!activePanels && !playingEvent)
            {
                //Debug.Log("Hi");
                if (currentTalkingEventChain[currentTalkingEvent].selectedPanel == Panels.UpperLeft)
                {
                    textBox[1].transform.renderer.enabled = true;
                    talkers[2].transform.renderer.enabled = true;
                    activePanels = true;
                    currentPanel = Panels.UpperLeft;
                    textBox[1].startTalkingEvent(currentTalkingEventChain[currentTalkingEvent].normalText, currentTalkingEventChain[currentTalkingEvent].annoyText, currentTalkingEventChain[currentTalkingEvent].name);
                    talkers[2].SetTalker(currentTalkingEventChain[currentTalkingEvent].theTalker);
                }
                else if (currentTalkingEventChain[currentTalkingEvent].selectedPanel == Panels.UpperRight)
                {
                    textBox[1].transform.renderer.enabled = true;
                    talkers[3].transform.renderer.enabled = true;
                    activePanels = true;
                    currentPanel = Panels.UpperRight;
                    textBox[1].startTalkingEvent(currentTalkingEventChain[currentTalkingEvent].normalText, currentTalkingEventChain[currentTalkingEvent].annoyText, currentTalkingEventChain[currentTalkingEvent].name);
                    talkers[3].SetTalker(currentTalkingEventChain[currentTalkingEvent].theTalker);
                }
                else if (currentTalkingEventChain[currentTalkingEvent].selectedPanel == Panels.LowerLeft)
                {
                    
                    textBox[0].transform.renderer.enabled = true;
                    talkers[0].transform.renderer.enabled = true;
                    activePanels = true;
                    currentPanel = Panels.LowerLeft;
                    textBox[0].startTalkingEvent(currentTalkingEventChain[currentTalkingEvent].normalText, currentTalkingEventChain[currentTalkingEvent].annoyText, currentTalkingEventChain[currentTalkingEvent].name);
                    talkers[0].SetTalker(currentTalkingEventChain[currentTalkingEvent].theTalker);
                }
                else if (currentTalkingEventChain[currentTalkingEvent].selectedPanel == Panels.LowerRight)
                {
                    textBox[0].transform.renderer.enabled = true;
                    talkers[1].transform.renderer.enabled = true;
                    activePanels = true;
                    currentPanel = Panels.LowerRight;
                    textBox[0].startTalkingEvent(currentTalkingEventChain[currentTalkingEvent].normalText, currentTalkingEventChain[currentTalkingEvent].annoyText, currentTalkingEventChain[currentTalkingEvent].name);
                    talkers[1].SetTalker(currentTalkingEventChain[currentTalkingEvent].theTalker);
                }
                currentTalkingEvent++;
            }
            else if (!playingEvent)
            {
                switch (currentPanel)
                {
                    case Panels.LowerLeft:
                        textBox[0].transform.renderer.enabled = false;
                        talkers[0].transform.renderer.enabled = false;
                        activePanels = false;
                        currentPanel = Panels.None;
                        break;
                    case Panels.LowerRight:
                        textBox[0].transform.renderer.enabled = false;
                        talkers[1].transform.renderer.enabled = false;
                        activePanels = false;
                        currentPanel = Panels.None;
                        break;
                    case Panels.UpperRight:
                        textBox[1].transform.renderer.enabled = false;
                        talkers[3].transform.renderer.enabled = false;
                        activePanels = false;
                        currentPanel = Panels.None;
                        break;
                    case Panels.UpperLeft:
                        textBox[1].transform.renderer.enabled = false;
                        talkers[2].transform.renderer.enabled = false;
                        activePanels = false;
                        currentPanel = Panels.None;
                        break;
                }
            }
        }
	}
Ejemplo n.º 25
0
        /// <summary>
        /// Sets the value of the Owner Property
        /// </summary>
        internal void SetOwner(Ribbon owner)
        {
            _owner = owner;

            Panels.SetOwner(owner);
        }
Ejemplo n.º 26
0
 public IEnumerable <Component> GetAllChildComponents()
 {
     return(Panels.ToArray());
 }
Ejemplo n.º 27
0
        // handle actions triggered by the welome panel
        void welcomePanel_ActionSelected(Panels.LoginWelcomePanel.Action action)
        {
            welcomePanel.Visible = false;

            switch (action) {
                case LoginWelcomePanel.Action.EXISTING_USER:
                    existingUserPanel.Visible = true;
                    break;
                case LoginWelcomePanel.Action.NEW_USER:
                    newUserPanel.Visible = true;
                    break;
            }
        }
Ejemplo n.º 28
0
    public static void Type()
    {
        TextBoxes.Structure Tool  = TextBoxes.Get("Chat");
        Panels.Structure    Panel = Panels.Get("Chat");

        // Somente se necessário
        if (!Player.IsPlaying(Player.MyIndex))
        {
            return;
        }

        // Altera a visiblidade da caixa
        Panel.Visible = !Panel.Visible;

        // Altera o foco do digitalizador
        if (Panel.Visible)
        {
            Loop.Chat_Timer   = System.Environment.TickCount + Sleep_Timer;
            TextBoxes.Focused = Tools.Get(Tool);
            return;
        }
        else
        {
            TextBoxes.Focused = null;
        }

        // Dados
        string Message = Tool.Text;

        // Somente se necessário
        if (Message.Length < 3)
        {
            Tool.Text = string.Empty;
            return;
        }

        // Limpa a caixa de texto
        Tool.Text = string.Empty;

        // Separa as mensagens em partes
        string[] Parts = Message.Split(' ');

        // Comandos
        switch (Parts[0].ToLower())
        {
        case "/party":
            if (Parts.Length > 1)
            {
                Send.Party_Invite(Parts[1]);
            }
            break;

        case "/partyleave":
            Send.Party_Leave();
            break;

        default:
            // Mensagem lobal
            if (Message.Substring(0, 1) == "'")
            {
                Send.Message(Message.Substring(1), Game.Messages.Global);
            }
            // Mensagem particular
            else if (Message.Substring(0, 1) == "!")
            {
                // Previne erros
                if (Parts.GetUpperBound(0) < 1)
                {
                    AddText("Use: '!' + Addressee + 'Message'", Color.White);
                }
                else
                {
                    // Dados
                    string Destiny = Message.Substring(1, Parts[0].Length - 1);
                    Message = Message.Substring(Parts[0].Length + 1);

                    // Envia a mensagem
                    Send.Message(Message, Game.Messages.Private, Destiny);
                }
            }
            // Mensagem mapa
            else
            {
                Send.Message(Message, Game.Messages.Map);
            }
            break;
        }
    }
 private void Start()
 {
     _activePanel    = Panels.None;
     cashActivePanel = null;
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Refresh the shipyard tab.
        /// </summary>
        /// <param name="m_oSummaryPanel">The summary panel from the economics handler.</param>
        /// <param name="EligibleClassList">List of shipclasses that this shipyard can produce.</param>
        /// <param name="DamagedShipList">List of damaged ships in orbit.</param>
        /// <param name="ClassesInOrbit">List of shipclasses in orbit around CurrentPopulation.</param>
        /// <param name="ShipsOfClassInOrbit">List of ships in the selected shipclass in orbit around CurrentPopulation.</param>
        public static void RefreshShipyardTab(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation, Installation.ShipyardInformation SYInfo,
                                              BindingList<ShipClassTN> RetoolTargets, ref BindingList<ShipClassTN> EligibleClassList, ref BindingList<ShipTN> DamagedShipList, 
                                              ref BindingList<ShipClassTN> ClassesInOrbit, ref BindingList<ShipTN> ShipsOfClassInOrbit)
        {
            /// <summary>
            /// Yeah, just going to constantly declare new variables to pass these along...
            /// </summary>
            ShipsOfClassInOrbit = new BindingList<ShipTN>();
            EligibleClassList = new BindingList<ShipClassTN>();
            DamagedShipList = new BindingList<ShipTN>();
            ClassesInOrbit = new BindingList<ShipClassTN>();

            if (CurrentFaction != null && CurrentPopulation != null && SYInfo != null)
            {
                RefreshShipyardDataGrid(m_oSummaryPanel, CurrentFaction, CurrentPopulation);
                RefreshSYCGroupBox(m_oSummaryPanel, CurrentFaction, CurrentPopulation, SYInfo, RetoolTargets);
                BuildSYCRequiredMinerals(m_oSummaryPanel, CurrentFaction, CurrentPopulation, SYInfo, RetoolTargets);
                RefreshSYTaskGroupBox(m_oSummaryPanel, CurrentFaction, CurrentPopulation, SYInfo, ref EligibleClassList, ref DamagedShipList, ref ClassesInOrbit,
                                                 ref ShipsOfClassInOrbit);
                BuildSYTRequiredMinerals(m_oSummaryPanel, CurrentFaction, CurrentPopulation, SYInfo, EligibleClassList, DamagedShipList, ClassesInOrbit,
                                                 ShipsOfClassInOrbit);

                String Entry = String.Format("Shipyard Complex Activity({0})", SYInfo.Name);
                m_oSummaryPanel.ShipyardTaskGroupBox.Text = Entry;

                Entry = String.Format("Create Task({0})", SYInfo.Name);
                m_oSummaryPanel.ShipyardCreateTaskGroupBox.Text = Entry;

                RefreshShipyardTasksTab(m_oSummaryPanel, CurrentFaction, CurrentPopulation);
            }
        }
Ejemplo n.º 31
0
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            if (!(RhinoApp.GetPlugInObject("Grasshopper") is GH_RhinoScriptInterface Grasshopper))
            {
                return(Result.Cancel);
            }

            GetOption go = null;

            while (true)
            {
                var port     = new OptionInteger(Port, 1024, 65535);
                var toggle   = new OptionToggle(ShowEditor, "Hide", "Show");
                var debugger = new OptionToggle(Debug, "Off", "On");

                go = new GetOption();

                go.SetCommandPrompt("Noah Server");
                go.AddOption("Connect");
                go.AddOption("Stop");
                go.AddOption("Observer");
                go.AddOptionInteger("Port", ref port);
                go.AddOptionToggle("Editor", ref toggle);
                go.AddOptionToggle("Debug", ref debugger);
                go.AddOption("Workspace");

                GetResult result = go.Get();
                if (result != GetResult.Option)
                {
                    break;
                }

                ShowEditor = toggle.CurrentValue;
                Debug      = debugger.CurrentValue;

                string whereToGo = go.Option().EnglishName;

                if (whereToGo == "Connect")
                {
                    if (Port == 0)
                    {
                        RhinoApp.WriteLine("Please set Port you want to connect!");
                        continue;
                    }

                    if (WorkDir == null)
                    {
                        RhinoApp.WriteLine("Noah can not work without workspace!");
                        continue;
                    }

                    if (Client == null)
                    {
                        try
                        {
                            Grasshopper.DisableBanner();

                            if (!Grasshopper.IsEditorLoaded())
                            {
                                Grasshopper.LoadEditor();
                            }

                            Client               = new NoahClient(Port, WorkDir);
                            Client.InfoEvent    += Client_MessageEvent;
                            Client.ErrorEvent   += Client_ErrorEvent;
                            Client.WarningEvent += Client_WarningEvent;
                            Client.DebugEvent   += Client_DebugEvent;
                        }
                        catch (Exception ex)
                        {
                            RhinoApp.WriteLine("Error: " + ex.Message);
                        }

                        Client.Connect();
                    }
                    else
                    {
                        Client.Reconnect();
                    }

                    if (Debug)
                    {
                        try
                        {
                            if (Logger == null)
                            {
                                Panels.OpenPanel(LoggerPanel.PanelId);
                            }
                            Logger = Panels.GetPanel <LoggerPanel>(doc);
                        }
                        catch (Exception ex)
                        {
                            RhinoApp.WriteLine("Error: " + ex.Message);
                        }
                    }

                    if (ShowEditor)
                    {
                        Grasshopper.ShowEditor();
                    }

                    break;
                }

                if (whereToGo == "Stop")
                {
                    if (Port == 0)
                    {
                        continue;
                    }

                    if (Client != null)
                    {
                        Client.Close();
                    }
                    break;
                }

                if (whereToGo == "Workspace")
                {
                    RhinoGet.GetString("Noah Workspace", false, ref WorkDir);
                }

                if (whereToGo == "Observer")
                {
                    if (Port == 0)
                    {
                        RhinoApp.WriteLine("Server connecting need a port!");
                        continue;
                    }

                    Process.Start("http://localhost:" + Port + "/data/center");
                    break;
                }

                if (whereToGo == "Port")
                {
                    Port = port.CurrentValue;
                    RhinoApp.WriteLine("Port is set to " + Port.ToString());
                    continue;
                }
            }

            return(Result.Nothing);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Populate the Datagrid
        /// </summary>
        /// <param name="m_oSummaryPanel">The summary panel from the economics handler.</param>
        private static void BuildShipyardDataGrid(Panels.Eco_Summary m_oSummaryPanel)
        {
            try
            {
                // Add coloums:
                Padding newPadding = new Padding(2, 0, 2, 0);
                AddColumn("Name", newPadding, m_oSummaryPanel.ShipyardDataGrid, 0);
                AddColumn("Ty", newPadding, m_oSummaryPanel.ShipyardDataGrid, 3);
                AddColumn("Total Slipways", newPadding, m_oSummaryPanel.ShipyardDataGrid, 3);
                AddColumn("Capacity per Slipway", newPadding, m_oSummaryPanel.ShipyardDataGrid, 3);
                AddColumn("Available Slipways", newPadding, m_oSummaryPanel.ShipyardDataGrid,3);
                AddColumn("Assigned Class", newPadding, m_oSummaryPanel.ShipyardDataGrid, 3);
                AddColumn("Current Complex Activity", newPadding, m_oSummaryPanel.ShipyardDataGrid, 3);
                AddColumn("Progress", newPadding, m_oSummaryPanel.ShipyardDataGrid, 3);
                AddColumn("Completion Date", newPadding, m_oSummaryPanel.ShipyardDataGrid, 3);
                AddColumn("Mod Rate", newPadding, m_oSummaryPanel.ShipyardDataGrid, 3);

                AddColumn("Yard", newPadding, m_oSummaryPanel.ShipyardTaskDataGrid, 0);
                AddColumn("TaskDescription", newPadding, m_oSummaryPanel.ShipyardTaskDataGrid, 0);
                AddColumn("Unit Name", newPadding, m_oSummaryPanel.ShipyardTaskDataGrid, 3);
                AddColumn("Progress", newPadding, m_oSummaryPanel.ShipyardTaskDataGrid, 3);
                AddColumn("Assigned Task Group", newPadding, m_oSummaryPanel.ShipyardTaskDataGrid, 3);
                AddColumn("Completion Date", newPadding, m_oSummaryPanel.ShipyardTaskDataGrid, 3);
                AddColumn("ABR", newPadding, m_oSummaryPanel.ShipyardTaskDataGrid, 3);
                AddColumn("Priority", newPadding, m_oSummaryPanel.ShipyardTaskDataGrid, 3);


                // Add Rows:
                for (int i = 0; i < MaxShipyardRows; ++i)
                {
                    using (DataGridViewRow row = new DataGridViewRow())
                    {
                        // setup row height. note that by default they are 22 pixels in height!
                        row.Height = 18;
                        row.Visible = false;
                        m_oSummaryPanel.ShipyardDataGrid.Rows.Add(row);
                    }

                    using (DataGridViewRow row = new DataGridViewRow())
                    {
                        // setup row height. note that by default they are 22 pixels in height!
                        row.Height = 18;
                        row.Visible = false;
                        m_oSummaryPanel.ShipyardTaskDataGrid.Rows.Add(row);
                    }
                }


            }
            catch
            {
#if LOG4NET_ENABLED
                logger.Error("Something whent wrong Creating ShipyardDataGrid Columns for Eco_ShipyardTabHandler.cs");
#endif
            }
        }
 public void SortDevices()
 {
     Panels.Sort();
 }
Ejemplo n.º 34
0
 /// <summary>
 /// This builds the Shipyard tasks groupbox, which controls the building/repairing/refitting/scrapping of ships. said ships must be in orbit and taskgroups connected to them may not
 /// move while this process is underway.
 /// </summary>
 /// <param name="m_oSummaryPanel">The summary panel from the economics handler.</param>
 private static void BuildSYTaskGroupBox(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation)
 {
     m_oSummaryPanel.SYTaskTypeComboBox.Items.Clear();
     m_oSummaryPanel.SYTaskTypeComboBox.DataSource = Constants.ShipyardInfo.ShipyardTaskType;
     m_oSummaryPanel.SYTaskTypeComboBox.SelectedIndex = 0;
 }
Ejemplo n.º 35
0
 public rbManager()
 {
     _instance = this;
     Panels.RegisterPanel(RealBlocksUIPlugIn.Instance, typeof(WpfManagerHost), "Block Manager", null);
 }
Ejemplo n.º 36
0
        /// <summary>
        /// Update just the RRSShipComboBox since a full refresh will cause issues with constantly prompting more refreshes.
        /// </summary>
        /// <param name="m_oSummaryPanel">Current economics handler</param>
        /// <param name="CurrentFaction">Selected faction</param>
        /// <param name="CurrentPopulation">Selected population</param>
        /// <param name="ClassesInOrbit">List of shipclasses in orbit around CurrentPopulation.</param>
        /// <param name="ShipsOfClassInOrbit">List of ships in the selected shipclass in orbit around CurrentPopulation.</param>
        public static void RefreshRRSShipComboBox(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation, BindingList<ShipClassTN> ClassesInOrbit,
                                                  ref BindingList<ShipTN> ShipsOfClassInOrbit)
        {
            if (m_oSummaryPanel.RepairRefitScrapClassComboBox.SelectedIndex != -1)
            {
                ShipClassTN CurrentRRSClass = ClassesInOrbit[m_oSummaryPanel.RepairRefitScrapClassComboBox.SelectedIndex];

                GetShipsOfClassInOrbit(CurrentFaction, CurrentPopulation, CurrentRRSClass, ref ShipsOfClassInOrbit);

                m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Clear();
                foreach (ShipTN CurrentShip in ShipsOfClassInOrbit)
                {
                    m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Add(CurrentShip);
                    if (m_oSummaryPanel.RepairRefitScrapShipComboBox.Items.Count != 0)
                    {
                        m_oSummaryPanel.RepairRefitScrapShipComboBox.SelectedIndex = 0;
                    }
                }
            }
        }
Ejemplo n.º 37
0
 private void DefineMinMax()
 {
     XMin = Panels.Min(p => p.ExtTransToModel.MinPoint.X);
     XMax = Panels.Max(p => p.ExtTransToModel.MaxPoint.X);
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Every task will cost resources, and this program will populate the required resources listbox.
        /// </summary>
        /// <param name="m_oSummaryPanel">Panel the economics handler will pass to us</param>
        /// <param name="CurrentFaction">Current Faction</param>
        /// <param name="CurrentPopulation">Currently selected population</param>
        /// <param name="SYInfo">Current Shipyard</param>
        /// <param name="Retool">Retool target if any</param>
        /// <param name="CapLimit">Cap expansion limit if any</param>
        public static void BuildSYCRequiredMinerals(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation, Installation.ShipyardInformation SYInfo,
                                                    BindingList<ShipClassTN> PotentialRetoolTargets)
        {
            if (m_oSummaryPanel.SYCTaskTypeComboBox.SelectedIndex != -1  && SYInfo != null)
            {
                m_oSummaryPanel.SYCRequiredMaterialsListBox.Items.Clear();
                Constants.ShipyardInfo.ShipyardActivity Activity = (Constants.ShipyardInfo.ShipyardActivity)m_oSummaryPanel.SYCTaskTypeComboBox.SelectedIndex;

                if (Activity != Constants.ShipyardInfo.ShipyardActivity.CapExpansion && Activity != Constants.ShipyardInfo.ShipyardActivity.NoActivity)
                {
                    Installation.ShipyardInformation CostPrototyper = new Installation.ShipyardInformation(CurrentFaction, SYInfo.ShipyardType, 1);
                    CostPrototyper.Tonnage = SYInfo.Tonnage;
                    CostPrototyper.Slipways = SYInfo.Slipways;
                    CostPrototyper.ModRate = SYInfo.ModRate;
                    CostPrototyper.AssignedClass = SYInfo.AssignedClass;
                    ShipClassTN RetoolTarget = null;
                    if (PotentialRetoolTargets.Count != 0 && m_oSummaryPanel.NewShipClassComboBox.SelectedIndex != -1)
                    {
                        RetoolTarget = PotentialRetoolTargets[m_oSummaryPanel.NewShipClassComboBox.SelectedIndex];
                    }
                    int NewCapLimit = -1;
                    bool r = Int32.TryParse(m_oSummaryPanel.ExpandCapUntilXTextBox.Text, out NewCapLimit);

                    CostPrototyper.SetShipyardActivity(CurrentFaction, Activity, RetoolTarget, NewCapLimit);

                    for (int MineralIterator = 0; MineralIterator < Constants.Minerals.NO_OF_MINERIALS; MineralIterator++)
                    {

                        if (CostPrototyper.CurrentActivity.minerialsCost[MineralIterator] != 0.0m)
                        {
                            string FormattedMineralTotal = CostPrototyper.CurrentActivity.minerialsCost[MineralIterator].ToString("#,##0");

                            String CostString = String.Format("{0} {1} ({2})", (Constants.Minerals.MinerialNames)MineralIterator, FormattedMineralTotal, CurrentPopulation.Minerials[MineralIterator]);
                            m_oSummaryPanel.SYCRequiredMaterialsListBox.Items.Add(CostString);
                        }
                    }

                    m_oSummaryPanel.SYCBuildCostTextBox.Text = CostPrototyper.CurrentActivity.CostOfActivity.ToString();

                    float YearsOfProduction = (float)CostPrototyper.CurrentActivity.CostOfActivity / CostPrototyper.CalcAnnualSYProduction();
                    if (YearsOfProduction < Constants.Colony.TimerYearMax)
                    {
                        m_oSummaryPanel.SYCCompletionDateTextBox.Text = CostPrototyper.CurrentActivity.CompletionDate.ToShortDateString();
                    }
                    else
                    {
                        m_oSummaryPanel.SYCCompletionDateTextBox.Text = "N/A";
                    }

                    if ((Activity == Constants.ShipyardInfo.ShipyardActivity.Retool && RetoolTarget == null) ||
                        (Activity == Constants.ShipyardInfo.ShipyardActivity.CapExpansionUntilX && (r == false || (NewCapLimit <= SYInfo.Tonnage))))
                    {
                        m_oSummaryPanel.SYCCompletionDateTextBox.Text = "N/A";
                        m_oSummaryPanel.SYCRequiredMaterialsListBox.Items.Clear();
                    }

                    /// <summary>
                    /// This retool is free. or not necessary.
                    /// </summary>
                    if (Activity == Constants.ShipyardInfo.ShipyardActivity.Retool && ((RetoolTarget != null && SYInfo.AssignedClass == null) || RetoolTarget == SYInfo.AssignedClass))
                    {
                        m_oSummaryPanel.SYCBuildCostTextBox.Text = "N/A";
                        m_oSummaryPanel.SYCCompletionDateTextBox.Text = "N/A";
                        m_oSummaryPanel.SYCRequiredMaterialsListBox.Items.Clear();
                    }
                }
                else
                {
                    m_oSummaryPanel.SYCBuildCostTextBox.Text = "N/A";
                    m_oSummaryPanel.SYCCompletionDateTextBox.Text = "N/A";
                    m_oSummaryPanel.SYCRequiredMaterialsListBox.Items.Clear();
                }
            }
        }
Ejemplo n.º 39
0
 public Panel GetPanel(int x, int y)
 {
     return(Panels.First(z => z.X == x && z.Y == y));
 }
Ejemplo n.º 40
0
        /// <summary>
        /// Build the list of shipyard tasks at this population.
        /// </summary>
        /// <param name="m_oSummaryPanel"></param>
        /// <param name="CurrentFaction"></param>
        /// <param name="CurrentPopulation"></param>
        public static void RefreshShipyardTasksTab(Panels.Eco_Summary m_oSummaryPanel, Faction CurrentFaction, Population CurrentPopulation)
        {

            List<Installation.ShipyardInformation.ShipyardTask> SortedList = CurrentPopulation.ShipyardTasks.Keys.ToList().OrderBy(o => o.Priority).ToList();

            int row = 0;
            foreach (Installation.ShipyardInformation.ShipyardTask Task in SortedList)
            {
                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Visible = true;

                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[0].Value = CurrentPopulation.ShipyardTasks[Task].Name;

                String Entry = "N/A";

                switch (Task.CurrentTask)
                {
                    case Constants.ShipyardInfo.Task.Construction:
                        Entry = String.Format("Build {0}", Task.ConstructRefitTarget);
                        break;
                    case Constants.ShipyardInfo.Task.Repair:
                        Entry = String.Format("Repair {0}", Task.CurrentShip);
                        break;
                    case Constants.ShipyardInfo.Task.Refit:
                        Entry = String.Format("Refit {0} to {1}", Task.CurrentShip, Task.ConstructRefitTarget);
                        break;
                    case Constants.ShipyardInfo.Task.Scrap:
                        Entry = String.Format("Scrap {0}", Task.CurrentShip);
                        break;
                }

                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[1].Value = Entry;

                switch (Task.CurrentTask)
                {
                    case Constants.ShipyardInfo.Task.Construction:
                        Entry = String.Format("{0}", Task.Title);
                        break;
                    case Constants.ShipyardInfo.Task.Repair:
                        Entry = String.Format("{0}", Task.CurrentShip);
                        break;
                    case Constants.ShipyardInfo.Task.Refit:
                        Entry = String.Format("{0}", Task.CurrentShip);
                        break;
                    case Constants.ShipyardInfo.Task.Scrap:
                        Entry = String.Format("{0}", Task.CurrentShip);
                        break;
                }

                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[2].Value = Entry;

                String ProgString = String.Format("{0:N2}", (Task.Progress * 100.0m));

                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[3].Value = ProgString;
                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[4].Value = Task.AssignedTaskGroup;
                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[5].Value = Task.CompletionDate.ToShortDateString();
                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[6].Value = Task.ABR;

                if (Task.IsPaused() == true)
                    m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[7].Value = "Paused";
                else
                    m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Cells[7].Value = Task.Priority;


                row++;

                if (row == MaxShipyardTaskRows)
                {
                    using (DataGridViewRow NewRow = new DataGridViewRow())
                    {
                        // setup row height. note that by default they are 22 pixels in height!
                        NewRow.Height = 18;
                        NewRow.Visible = false;
                        m_oSummaryPanel.ShipyardTaskDataGrid.Rows.Add(NewRow);
                    }
                    MaxShipyardTaskRows++;
                }
            }

            /// <summary>
            /// Any rows that aren't being used should be set to invisible. They will still have data from previous ship tasks that I don't care to clear out since the user can't see the rows anyway.
            /// </summary>
            for (int rowIterator = row; row < MaxShipyardTaskRows; row++)
            {
                m_oSummaryPanel.ShipyardTaskDataGrid.Rows[row].Visible = false;
            }
        }
Ejemplo n.º 41
0
 public fmManager()
 {
     // register clipping plane manager panel
     Panels.RegisterPanel(PlugIn, typeof(UI.Views.ParticleSystemManager), "FaceMe", null);
     _instance = this;
 }
Ejemplo n.º 42
0
 public TaskThumbnailPanel FindPanel(WorkerTask task)
 {
     return(Panels.FirstOrDefault(x => x.Task == task));
 }
Ejemplo n.º 43
0
        public void testsInitialize()
        {
            flag = false;

            locker1 = new Locker();
            locker2 = new Locker();
            locker3 = new Locker();

            crossBar1          = new CrossBar();
            crossBar2          = new CrossBar();
            crossBar3          = new CrossBar();
            crossBar4          = new CrossBar();
            crossBar5          = new CrossBar();
            crossBar6          = new CrossBar();
            crossBar7          = new CrossBar();
            crossBar8          = new CrossBar();
            crossBarWithParam1 = new CrossBar(10, "referenceTest", "1", new ComponentSize(4, 10, 10), false, CrossBarType.LR);
            crossBarWithParam2 = new CrossBar(10, "referenceTest", "1", new ComponentSize(4, 20, 20), false, CrossBarType.LR);

            pannel1 = new Panels();
            pannel2 = new Panels();
            pannel3 = new Panels();
            pannel4 = new Panels();
            pannel5 = new Panels();

            cleat1          = new Cleat();
            cleat2          = new Cleat();
            cleat3          = new Cleat();
            cleat4          = new Cleat();
            cleatWithParam1 = new Cleat(50, "referenceTest", "1", new ComponentSize(11, 7, 8), false);
            cleatWithParam2 = new Cleat(50, "referenceTest", "1", new ComponentSize(17, 3, 5), false);

            door1          = new Door();
            doorWithParam1 = new Door(40, "referenceTest", "1", new ComponentSize(32, 0, 0), false, ComponentColor.white);
            doorWithParam2 = new Door(40, "referenceTest", "1", new ComponentSize(4, 6, 5), false, ComponentColor.white);

            catalogueComponentsListEmpty = new List <CatalogueComponents>();
            catalogueComponentsListWith3 = new List <CatalogueComponents>()
            {
                crossBar1, cleat1, door1
            };
            catalogueComponentsListWith6 = new List <CatalogueComponents>()
            {
                crossBar1, crossBar2, crossBar3,
                cleat1,
                pannel1, pannel2
            };
            catalogueComponentsListWith10 = new List <CatalogueComponents>()
            {
                crossBar1, crossBar2, crossBar3, crossBar4, crossBar5,
                cleat1, cleat2, cleat3,
                pannel1, pannel2
            };
            catalogueComponentsListWith14 = new List <CatalogueComponents>()
            {
                crossBar1, crossBar2, crossBar3, crossBar4, crossBar5, crossBar6, crossBar7, crossBar8,
                cleat1,
                pannel1, pannel2, pannel3, pannel4, pannel5
            };
            catalogueComponentsListFull = new List <CatalogueComponents>()
            {
                crossBar1, crossBar2, crossBar3, crossBar4, crossBar5, crossBar6, crossBar7, crossBar8,
                cleat1, cleat2, cleat3, cleat4,
                pannel1, pannel2, pannel3, pannel4, pannel5
            };

            catalogueComponentsListWith6WithParam = new List <CatalogueComponents>()
            {
                crossBarWithParam1, crossBarWithParam2, crossBar3,
                cleatWithParam1, cleatWithParam2,
                pannel1, pannel2,
                doorWithParam1, doorWithParam2
            };
        }
Ejemplo n.º 44
0
    public static void OnMouseButtonPressed(object sender, MouseButtonEventArgs e)
    {
        // Clique duplo
        if (Environment.TickCount < DoubleClick_Timer + 142)
        {
            if (Tools.CurrentWindow == Tools.Windows.Game)
            {
                // Usar item
                byte Slot = Panels.Inventory_Mouse();
                if (Slot > 0)
                {
                    if (Player.Inventory[Slot].Item_Num > 0)
                    {
                        Send.Inventory_Use(Slot);
                    }
                }

                // Usar o que estiver na hotbar
                Slot = Panels.Hotbar_Mouse();
                if (Slot > 0)
                {
                    if (Player.Hotbar[Slot].Slot > 0)
                    {
                        Send.Hotbar_Use(Slot);
                    }
                }
            }
        }
        // Clique único
        else
        {
            // Percorre toda a árvore de ordem para executar o comando
            Stack <List <Tools.Order_Structure> > Stack = new Stack <List <Tools.Order_Structure> >();
            Stack.Push(Tools.Order);
            while (Stack.Count != 0)
            {
                List <Tools.Order_Structure> Top = Stack.Pop();

                for (byte i = 0; i < Top.Count; i++)
                {
                    if (Top[i].Data.Visible)
                    {
                        // Executa o comando
                        if (Top[i].Data is Buttons.Structure)
                        {
                            ((Buttons.Structure)Top[i].Data).MouseDown(e);
                        }
                        Stack.Push(Top[i].Nodes);
                    }
                }
            }

            // Eventos em jogo
            if (Tools.CurrentWindow == Tools.Windows.Game)
            {
                Panels.Inventory_MouseDown(e);
                Panels.Equipment_MouseDown(e);
                Panels.Hotbar_MouseDown(e);
            }
        }
    }
Ejemplo n.º 45
0
 private static void OnCloseIPanel(Guid panelTypeGuid, uint documentSerailNumber, PanelInstance instance, IPanel panel, bool onCloseDocument)
 {
     Panels.OnClosePanel(panelTypeGuid, documentSerailNumber);
     panel?.PanelClosing(documentSerailNumber, onCloseDocument);
 }
Ejemplo n.º 46
0
 public static void AddChangePanel(Panels.Panel panelAkr, PanelLibrary.MountingPanel panelMount)
 {
     var chPanel = new ChangePanel(panelAkr, panelMount);
     ChangePanels.Add(chPanel);
 }
Ejemplo n.º 47
0
        void OnBtnNextClick(object sender, EventArgs eventArgs)
        {
            if (currentPanel != maximumPanel)
            {
                switch (currentPanel)
                {
                case Panels.Description:
                    if (maximumPanel == Panels.Description)
                    {
                        return;
                    }

                    pnlPanel.Content = panelStrings;
                    currentPanel     = Panels.Strings;

                    btnPrevious.Enabled = currentPanel != minimumPanel;

                    break;

                case Panels.Strings:
                    if (maximumPanel == Panels.Strings)
                    {
                        return;
                    }

                    pnlPanel.Content = panelVersions;
                    currentPanel     = Panels.Versions;

                    btnPrevious.Enabled = currentPanel != minimumPanel;

                    break;

                case Panels.Versions:
                    if (minimumPanel == Panels.Versions)
                    {
                        return;
                    }

                    pnlPanel.Content = panelStrings;
                    currentPanel     = Panels.Strings;

                    btnPrevious.Enabled = currentPanel != minimumPanel;

                    break;
                }

                if (currentPanel == maximumPanel)
                {
                    btnNext.Text = "Finish";
                }

                return;
            }

            if (Context.Readmes?.Count > 0 &&
                !string.IsNullOrWhiteSpace(panelDescription.description))
            {
                description = panelDescription.description;
            }

            if (!(Context.Executables?.Count > 0))
            {
                return;
            }

            if (!string.IsNullOrWhiteSpace(panelStrings.txtDeveloper.Text))
            {
                developer = panelStrings.txtDeveloper.Text;
            }

            if (!string.IsNullOrWhiteSpace(panelStrings.txtPublisher.Text))
            {
                publisher = panelStrings.txtPublisher.Text;
            }

            if (!string.IsNullOrWhiteSpace(panelStrings.txtProduct.Text))
            {
                product = panelStrings.txtProduct.Text;
            }

            if (!string.IsNullOrWhiteSpace(panelStrings.txtVersion.Text))
            {
                version = panelStrings.txtVersion.Text;
            }

            foreach (object archsSelectedItem in panelVersions.treeArchs.SelectedItems)
            {
                if (!(archsSelectedItem is string arch))
                {
                    continue;
                }

                if (Enum.TryParse(arch, true, out ArchitecturesTypeArchitecture realArch))
                {
                    chosenArchitectures.Add(realArch);
                }
            }

            foreach (object osesSelectedItem in panelVersions.treeOs.SelectedItems)
            {
                if (!(osesSelectedItem is TargetOsEntry os))
                {
                    continue;
                }

                chosenOses.Add(os);
            }

            if (panelVersions.treeVersions.SelectedItem is string chosenVersion)
            {
                version = chosenVersion;
            }

            canceled = false;
            Close();
        }
Ejemplo n.º 48
0
 protected override Result RunCommand(RhinoDoc doc, RunMode mode)
 {
     Panels.OpenPanel(typeof(MainPanel).GUID);
     return(Rhino.Commands.Result.Success);
 }
        /// <summary>
        /// Add a panel dynamically over the panel currently shown.
        /// </summary>
        /// <remarks>
        /// This method allows to create a stack of panels in way to navigate on the panels in a similar manner on the web page browsing.
        /// </remarks>
        /// <param name="panel">The panel to add.</param>
        internal void AddPanel(Panels.UIPanel panel)
        {
            Contract.Requires(panel != null);

            panels[_lastCheckedButton].Visibility = Visibility.Hidden;

            if (_dynamicPanelsStack.Count == 0)
                panels[_lastCheckedButton].Close();
            else
                _dynamicPanelsStack.Peek().Close();

            _lastCheckedButton.IsChecked = false;
            ContentGrid.Children.Add(panel);
            _dynamicPanelsStack.Push(panel);
            panel.Open();
            DynamicToolbar.Visibility = Visibility.Visible;
        }