コード例 #1
0
 public ResearchQItem(Vector2 Position, TreeNode Node, ResearchScreenNew screen)
 {
     this.pos = Position;
     this.screen = screen;
     this.container = new Rectangle((int)Position.X, (int)Position.Y, 320, 110);
     this.Node = new TreeNode(new Vector2((float)this.container.X, (float)this.container.Y) + new Vector2(100f, 20f), Node.tech, screen);
     this.Up = new Rectangle(this.container.X + 15, this.container.Y + this.container.Height / 2 - 33, 30, 30);
     this.Down = new Rectangle(this.container.X + 15, this.container.Y + this.container.Height / 2 - 33 + 36, 30, 30);
     this.Cancel = new Rectangle(this.container.X + 15 + 30 + 12, this.container.Y + this.container.Height / 2 - 15, 30, 30);
     this.bup = new TexturedButton(this.Up, "ResearchMenu/button_queue_up", "ResearchMenu/button_queue_up_hover", "ResearchMenu/button_queue_up_press");
     this.bdown = new TexturedButton(this.Down, "ResearchMenu/button_queue_down", "ResearchMenu/button_queue_down_hover", "ResearchMenu/button_queue_down_press");
     this.bcancel = new TexturedButton(this.Cancel, "ResearchMenu/button_queue_cancel", "ResearchMenu/button_queue_cancel_hover", "ResearchMenu/button_queue_cancel_press");
 }
コード例 #2
0
 public QueueComponent(Ship_Game.ScreenManager ScreenManager, Rectangle container, ResearchScreenNew screen)
 {
     this.container = container;
     this.screen = screen;
     this.ScreenManager = ScreenManager;
     this.Current = new Rectangle(container.X, container.Y, container.Width, 150);
     this.ShowQueue = new DanButton(new Vector2((float)(container.X + container.Width - 192), (float)(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 55)), Localizer.Token(2136));
     this.TimeLeft = new Rectangle(this.Current.X + this.Current.Width - 119, this.Current.Y + this.Current.Height - 24, 111, 20);
     this.csub = new Submenu(true, ScreenManager, this.Current);
     this.csub.AddTab(Localizer.Token(1405));
     this.Queue = new Rectangle(this.Current.X, this.Current.Y + 165, container.Width, container.Height - 165);
     this.qsub = new Submenu(true, ScreenManager, this.Queue);
     this.qsub.AddTab(Localizer.Token(1404));
     this.QSL = new ScrollList(this.qsub, 125);
 }
コード例 #3
0
        public TreeNode(Vector2 Position, TechEntry Tech, ResearchScreenNew screen)
        {
            if (GlobalStats.Config.Language == "Russian" || GlobalStats.Config.Language == "Polish")
            {
                this.TitleFont = Fonts.Arial10;
            }
            this.screen = screen;
            this.tech = Tech;
            this.TechName = string.Concat(Localizer.Token(ResourceManager.TechTree[Tech.UID].NameIndex), ResourceManager.TechTree[Tech.UID].MaxLevel > 1 ? " " + NumberToRomanConvertor.NumberToRoman(Tech.level) + "/" + NumberToRomanConvertor.NumberToRoman(ResourceManager.TechTree[Tech.UID].MaxLevel) : "");
            this.BaseRect.X = (int)Position.X;
            this.BaseRect.Y = (int)Position.Y;
            this.progressRect = new Rectangle(this.BaseRect.X + 14, this.BaseRect.Y + 21, 1, 34);
            int numUnlocks = 0;
            for (int i = 0; i < ResourceManager.TechTree[this.tech.UID].ModulesUnlocked.Count; i++)
            {
                if (numUnlocks > 3) break;
                if (ResourceManager.TechTree[this.tech.UID].ModulesUnlocked[i].Type == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).data.Traits.ShipType || ResourceManager.TechTree[this.tech.UID].ModulesUnlocked[i].Type == null || ResourceManager.TechTree[this.tech.UID].ModulesUnlocked[i].Type == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).GetTDict()[this.tech.UID].AcquiredFrom)
                {
                    UnlockItem unlock = new UnlockItem();
                    unlock.module = ResourceManager.ShipModulesDict[ResourceManager.TechTree[this.tech.UID].ModulesUnlocked[i].ModuleUID];
                    unlock.privateName = Localizer.Token(unlock.module.NameIndex);
                    unlock.Description = Localizer.Token(unlock.module.DescriptionIndex);
                    unlock.Type = "SHIPMODULE";
                    this.Unlocks.Add(unlock);
                    numUnlocks++;
                }
            }
            for (int i = 0; i < ResourceManager.TechTree[this.tech.UID].BonusUnlocked.Count; i++)
            {
                if (numUnlocks > 3) break;
                if (ResourceManager.TechTree[this.tech.UID].BonusUnlocked[i].Type == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).data.Traits.ShipType || ResourceManager.TechTree[this.tech.UID].BonusUnlocked[i].Type == null || ResourceManager.TechTree[this.tech.UID].BonusUnlocked[i].Type == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).GetTDict()[this.tech.UID].AcquiredFrom)
                {
                    UnlockItem unlock = new UnlockItem()
                    {
                        privateName = ResourceManager.TechTree[this.tech.UID].BonusUnlocked[i].Name,
                        Description = Localizer.Token(ResourceManager.TechTree[this.tech.UID].BonusUnlocked[i].BonusIndex),
                        Type = "ADVANCE"
                    };
                    numUnlocks++;
                    this.Unlocks.Add(unlock);
                }
            }
            for (int i = 0; i < ResourceManager.TechTree[this.tech.UID].BuildingsUnlocked.Count; i++)
            {
                if (numUnlocks > 3) break;
                if (ResourceManager.TechTree[this.tech.UID].BuildingsUnlocked[i].Type == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).data.Traits.ShipType || ResourceManager.TechTree[this.tech.UID].BuildingsUnlocked[i].Type == null || ResourceManager.TechTree[this.tech.UID].BuildingsUnlocked[i].Type == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).GetTDict()[this.tech.UID].AcquiredFrom)
                {
                    UnlockItem unlock = new UnlockItem();
                    unlock.building = ResourceManager.BuildingsDict[ResourceManager.TechTree[this.tech.UID].BuildingsUnlocked[i].Name];
                    unlock.privateName = Localizer.Token(unlock.building.NameTranslationIndex);
                    unlock.Description = Localizer.Token(unlock.building.DescriptionIndex);
                    unlock.Type = "BUILDING";
                    numUnlocks++;
                    this.Unlocks.Add(unlock);
                }
            }
            for (int i = 0; i < ResourceManager.TechTree[this.tech.UID].HullsUnlocked.Count; i++)
            {
                if (numUnlocks > 3) break;
                if (ResourceManager.TechTree[this.tech.UID].HullsUnlocked[i].ShipType == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).data.Traits.ShipType || ResourceManager.TechTree[this.tech.UID].HullsUnlocked[i].ShipType == null || ResourceManager.TechTree[this.tech.UID].HullsUnlocked[i].ShipType == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).GetTDict()[this.tech.UID].AcquiredFrom)
                {
                    UnlockItem unlock = new UnlockItem()
                    {
                        HullUnlocked = ResourceManager.TechTree[this.tech.UID].HullsUnlocked[i].Name,
                        privateName = ResourceManager.TechTree[this.tech.UID].HullsUnlocked[i].Name,
                        Description = "",
                        Type = "HULL"
                    };
                    numUnlocks++;
                    this.Unlocks.Add(unlock);
                }
            }
            for (int i = 0; i < ResourceManager.TechTree[this.tech.UID].TroopsUnlocked.Count; i++)
            {
                if (numUnlocks > 3) break;
                if (ResourceManager.TechTree[this.tech.UID].TroopsUnlocked[i].Type == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).data.Traits.ShipType || ResourceManager.TechTree[this.tech.UID].TroopsUnlocked[i].Type == "ALL" || ResourceManager.TechTree[this.tech.UID].TroopsUnlocked[i].Type == null || ResourceManager.TechTree[this.tech.UID].TroopsUnlocked[i].Type == EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty).GetTDict()[this.tech.UID].AcquiredFrom)
                {
                    UnlockItem unlock = new UnlockItem();
                    //{
                        unlock.troop = ResourceManager.TroopsDict[ResourceManager.TechTree[this.tech.UID].TroopsUnlocked[i].Name];
                        unlock.privateName = ResourceManager.TechTree[this.tech.UID].TroopsUnlocked[i].Name;
                        unlock.Description = unlock.troop.Description;
                        unlock.Type = "TROOP";
                    //};
                    numUnlocks++;
                    this.Unlocks.Add(unlock);
                }
            }
            int numColumns = numUnlocks / 2 + numUnlocks % 2;
            this.IconRect = new Rectangle(this.BaseRect.X + this.BaseRect.Width / 2 - 29, this.BaseRect.Y + this.BaseRect.Height / 2 - 24 - 10, 58, 49);
            if (numUnlocks <= 1)
            {
                this.UnlocksRect = new Rectangle(this.IconRect.X + this.IconRect.Width, this.IconRect.Y + this.IconRect.Height - 5, 35, 32);

                this.UnlocksRect.Y = this.UnlocksRect.Y - this.UnlocksRect.Height;

                Rectangle drawRect = this.UnlocksRect;
                drawRect.X = drawRect.X + 3;
                this.grid = new UnlocksGrid(this.Unlocks, drawRect);
            }
            else
            {
                this.UnlocksRect = new Rectangle(this.IconRect.X + this.IconRect.Width, this.IconRect.Y + this.IconRect.Height - 5, 13 + numColumns * 32, (numUnlocks == 1 ? 32 : 64));

                    this.UnlocksRect.Y = this.UnlocksRect.Y - this.UnlocksRect.Height;

                Rectangle drawRect = this.UnlocksRect;
                drawRect.X = drawRect.X + 13;
                this.grid = new UnlocksGrid(this.Unlocks, drawRect);
            }
            this.UnlocksRect.X = this.UnlocksRect.X - 2;
            this.UnlocksRect.Width = this.UnlocksRect.Width + 4;
            this.UnlocksRect.Y = this.UnlocksRect.Y - 2;
            this.UnlocksRect.Height = this.UnlocksRect.Height + 4;
            this.TitleRect = new Rectangle(this.BaseRect.X + 8, this.BaseRect.Y - 15, 82, 29);
            if (GlobalStats.Config.Language == "German" || GlobalStats.Config.Language == "Polish")
            {
                this.TitleRect.X = this.TitleRect.X - 5;
                this.TitleRect.Width = this.TitleRect.Width + 5;
                TreeNode titleWidth = this;
                titleWidth.TitleWidth = titleWidth.TitleWidth + 10f;
            }
            this.CostPos = new Vector2(65f, 70f) + new Vector2((float)this.BaseRect.X, (float)this.BaseRect.Y);
            float x = this.CostPos.X;
            SpriteFont titleFont = this.TitleFont;
            float cost = (float)((int)EmpireManager.GetEmpireByName(this.screen.empireUI.screen.PlayerLoyalty).TechnologyDict[this.tech.UID].GetTechCost()) * UniverseScreen.GamePaceStatic;
            this.CostPos.X = x - titleFont.MeasureString(cost.ToString()).X;
            this.CostPos.X = (float)((int)this.CostPos.X);
            this.CostPos.Y = (float)((int)this.CostPos.Y - 3);
        }