public Chest(Rectangle r,Map m) : base(m) { Body BodyDec = new Body(m.PhysicalWorld); BodyDec.BodyType = BodyType.Static; PolygonShape S = new PolygonShape(1f); S.SetAsBox(r.Width / 2, r.Height / 2); Fixture = BodyDec.CreateFixture(S); Fixture.Restitution = 1f; Fixture.Friction = 10f; Position = r; SetName("Chest"); items = new List<Item>(); ChestWindow = new Window(GeneralManager.GetPartialRect(0.4f, 0.2f, 0.2f, 0.6f)); ChestWindow.BgTex = GeneralManager.Textures["GUI/InGameGUI/ChestMenuBg"]; ChestWindow.Visible = false; CloseButton = new Button(new Rectangle(ChestWindow.Position.Width - 32, 8, 24, 24), "", GeneralManager.Textures["GUI/InGameGUI/CloseButton"], Color.Gray, Color.White, null); CloseButton.Action = CloseChestWindow; ChestWindow.AddGUI(CloseButton ); list = new ListBox(new Rectangle(16,16,ChestWindow.Position.Width - 24,ChestWindow.Position.Height - 32)); ChestWindow.AddGUI(list); Map.Parent.AddGUI(ChestWindow); }
public ProfileCreationScreen(Game Game, int x, int y) : base(Game, x, y) { NameBox = new TextBox(GeneralManager.GetPartialRect(0.4f,0.45f,0.2f,0.1f), "Textures/GUI/Frame", "Fonts/SteamWreck"); AddGUI(NameBox); Button CreateButton = new Button(GeneralManager.GetPartialRect(0.4f, 0.6f, 0.2f, 0.1f), "Create", GeneralManager.Textures["Textures/GUI/Frame"], Color.Gray, Color.White, "Fonts/SteamWreck"); AddGUI(CreateButton); }
public WorldScreen(Game Game, int SizeX, int SizeY) : base(Game, SizeX, SizeY) { EqHud = new Window(new Rectangle(GeneralManager.HalfWidth - 175, GeneralManager.HalfHeight - 146, 350, 146), "Textures/Hud/EqBack"/*new Color(0, 0, 0, 0.4f)*/); Button CloseButton = new Button(new Rectangle(GeneralManager.HalfWidth, GeneralManager.HalfHeight,32, 32), "", GeneralManager.Textures["Textures/GUI/CloseButton"], Color.Gray, Color.White, null); EqHud.AddGUI(CloseButton); this.AddGUI(EqHud); CraftingHud = new Window(new Rectangle(GeneralManager.HalfWidth - 175 - 180, GeneralManager.HalfHeight - 146, 180, 216), "Textures/Hud/CraftingBack"); this.AddGUI(CraftingHud); ArmorHud = new Window(new Rectangle(GeneralManager.HalfWidth + 175, GeneralManager.HalfHeight - 146, 112, 180), "Textures/Hud/ArmorBack"); this.AddGUI(ArmorHud); ChatHud = new Window(new Rectangle(50, GeneralManager.ScreenY - 300, 400, 300), "Textures/Hud/Chat"); this.AddGUI(ChatHud); DebugHud = new Window(new Rectangle(GeneralManager.ScreenX - 400 - 50, GeneralManager.ScreenY - 300, 400, 300), "Textures/Hud/Debug"); this.AddGUI(DebugHud); ExternalGUIHud = new Window(new Rectangle(GeneralManager.HalfWidth - 175, GeneralManager.HalfHeight, 350, 200), "Textures/Hud/ExternalEqBack"); this.AddGUI(ExternalGUIHud); HotbarHud = new Window(new Rectangle(GeneralManager.HalfWidth - 175, GeneralManager.ScreenY - 44, 350, 44), "Textures/Hud/HotbarBack"); this.AddGUI(HotbarHud); HpBar = new Window(new Rectangle(0, GeneralManager.ScreenY - 400, 50, 400), "Textures/Hud/HpBar"); this.AddGUI(HpBar); ManaBar = new Window(new Rectangle(GeneralManager.ScreenX - 50, GeneralManager.ScreenY - 400, 50, 400), "Textures/Hud/ManaBar"); this.AddGUI(ManaBar); MinimapHud = new Window(new Rectangle(GeneralManager.ScreenX - 300, 0, 300, 300), "Textures/Hud/MinimapBack"); this.AddGUI(MinimapHud); TooltipHud = new Window(new Rectangle(GeneralManager.HalfWidth - 100,0, 200, 50), "Textures/Hud/Tooltip"); this.AddGUI(TooltipHud); World = new GameWorld(this); foreach (BaseMod Mod in SteamAge.Mods) { Mod.Initalize(World); } Debug = new FarseerPhysics.DebugViews.DebugViewXNA(World.PhysicalWorld); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.Shape); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.AABB); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.PerformanceGraph); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.Joint); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.ContactPoints); Debug.DefaultShapeColor = Color.White; Debug.SleepingShapeColor = Color.LightGray; Debug.LoadContent(Parent.GraphicsDevice, Parent.Content); World.PostInit(); }
public MenuComponent(string[] Values, Rectangle Position, string ButtonBgName, Color UnActiveColor, Color ActiveColor, string FontName, Vector2 LabelOffset) { Buttons = new List<Button>(); Labels = new List<Label>(); //this.Values = Values; this.Position = Position; for (int i = 0; i < Values.Length; i++) { Rectangle ButtonPos = new Rectangle((int)(Position.X), (int)(Position.Y + i * Position.Height / Values.Length), (int)(Position.Width), (int)(Position.Height / Values.Length)); Button Button = new Button(ButtonPos, "", GeneralManager.Textures[ButtonBgName], UnActiveColor, ActiveColor, FontName); Buttons.Add(Button); Label L = new Label(); L.Font = GeneralManager.Fonts[FontName]; L.Name = Values[i]; L.Position = new Rectangle(ButtonPos.X + (int)LabelOffset.X, ButtonPos.Y + (int)LabelOffset.Y, ButtonPos.Width - 2 * (int)LabelOffset.X, ButtonPos.Height - 2 * (int)LabelOffset.Y); Labels.Add(L); } }
public ProfileSelectionScreen(Game Game, int x, int y) : base(Game, x, y) { float i = 0.1f; Buttons = new List<Button>(); foreach (string P in Profile.AvalibleProfiles()) { Button TmpButton = new Button(GeneralManager.GetPartialRect(0.3f, i, 0.3f, 0.14f), "", GeneralManager.Textures["Textures/GUI/Frame"], Color.Gray, Color.White, "Fonts/SteamWreck"); AddGUI(TmpButton); Buttons.Add(TmpButton); Label TmpLabel = new Label(); TmpLabel.Font = GeneralManager.Fonts["Fonts/SteamWreck"]; TmpLabel.Name = P; TmpLabel.Position =GeneralManager.GetPartialRect(0.38f, i + 0.04f, 0.12f, 0.06f); AddGUI(TmpLabel); //SpriteBatch.Draw(Generanew Button(GeneralManager.GetPartialRect(0.3f, i, 0.3f, 0.14f)lManager.Textures["Textures/GUI/Frame"], GeneralManager.GetPartialRect(0.3f, i, 0.3f, 0.14f), Color.White); i += 0.15f; } Button ChooseButton = new Button(GeneralManager.GetPartialRect(0.15f, 0.85f, 0.3f, 0.14f), "", GeneralManager.Textures["Textures/GUI/Frame"], Color.Gray, Color.White, "Fonts/SteamWreck"); ChooseButton.Action += Choose; AddGUI(ChooseButton); Label TmpLabel2 = new Label(); TmpLabel2.Font = GeneralManager.Fonts["Fonts/SteamWreck"]; TmpLabel2.Name = "Choose"; TmpLabel2.Position = GeneralManager.GetPartialRect(0.23f,0.89f, 0.12f, 0.06f); AddGUI(TmpLabel2); Button NewButton = new Button(GeneralManager.GetPartialRect(0.45f, 0.85f, 0.3f, 0.14f), "", GeneralManager.Textures["Textures/GUI/Frame"], Color.Gray, Color.White, "Fonts/SteamWreck"); NewButton.Action += ToNewProfile; AddGUI(NewButton); Label TmpLabel3 = new Label(); TmpLabel3.Font = GeneralManager.Fonts["Fonts/SteamWreck"]; TmpLabel3.Name = "New Profile"; TmpLabel3.Position = GeneralManager.GetPartialRect(0.53f, 0.89f, 0.12f, 0.06f); AddGUI(TmpLabel3); }