//----------------------------------------------------------------------------- // Accessors //----------------------------------------------------------------------------- public void Begin(GameManager gameManager) { if (!isActive) { this.gameManager = gameManager; isActive = true; OnBegin(); } }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public Menu(GameManager gameManager) { this.gameManager = gameManager; this.backgroundSprite = null; this.currentSlotGroup = null; this.slotGroups = new List<SlotGroup>(); this.drawHUD = false; }
private int viewFloorIndex; // Which floor wer are currently viewing. #endregion Fields #region Constructors //----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public ScreenDungeonMap(GameManager gameManager) { this.gameManager = gameManager; this.backgroundImage = Resources.GetImage("screen_dungeon_map"); this.dungeon = null; this.floors = new List<DungeonMapFloor>(); this.discoveredFloors = new List<DungeonMapFloor>(); }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public InventoryMenu(GameManager gameManager) : base(gameManager) { this.previousMenu = null; this.nextMenu = null; this.drawHUD = true; this.description = new LetterString(); this.textPosition = 0; this.textTimer = 0; this.textStart = 0; this.inSubMenu = false; }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public MenuSecondaryItems(GameManager gameManager) : base(gameManager) { this.backgroundSprite = Resources.GetImage("UI/menu_key_items_a"); SlotGroup group = new SlotGroup(); currentSlotGroup = group; this.slotGroups.Add(group); Slot[,] slots = new Slot[5, 4]; Slot ringBagSlot = null; Point2I gridSize = new Point2I(5, 4); for (int y = 0; y < gridSize.Y; y++) { for (int x = 0; x < gridSize.X; x++) { if (y == gridSize.Y - 1) { if (x == 0) ringBagSlot = group.AddSlot(new Point2I(12, 80), 16); slots[x, y] = group.AddSlot(new Point2I(32 + 24 * x, 80), 16); } else { slots[x, y] = group.AddSlot(new Point2I(24 + 24 * x, 8 + 24 * y), (x == (gridSize.X - 1) ? 24 : 16)); group.GetSlotAt(group.NumSlots - 1); } } } for (int y = 0; y < gridSize.Y; y++) { for (int x = 0; x < gridSize.X; x++) { if (x == 0 && y == gridSize.Y - 1) slots[x, y].SetConnection(Directions.Left, ringBagSlot); else if (x == 0) slots[x, y].SetConnection(Directions.Left, slots[gridSize.X - 1, (y + gridSize.Y - 1) % gridSize.Y]); else slots[x, y].SetConnection(Directions.Left, slots[x - 1, y]); if (x == gridSize.X - 1 && y == gridSize.Y - 2) slots[x, y].SetConnection(Directions.Right, ringBagSlot); else if (x == gridSize.X - 1) slots[x, y].SetConnection(Directions.Right, slots[0, (y + 1) % gridSize.Y]); else slots[x, y].SetConnection(Directions.Right, slots[x + 1, y]); slots[x, y].SetConnection(Directions.Up, slots[x, (y + gridSize.Y - 1) % gridSize.Y]); slots[x, y].SetConnection(Directions.Down, slots[x, (y + 1) % gridSize.Y]); } } ringBagSlot.SetConnection(Directions.Left, slots[gridSize.X - 1, gridSize.Y - 2]); ringBagSlot.SetConnection(Directions.Right, slots[0, gridSize.Y - 1]); ringBagSlot.SetConnection(Directions.Up, slots[0, gridSize.Y - 2]); ringBagSlot.SetConnection(Directions.Down, slots[0, 0]); }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public MenuEssences(GameManager gameManager) : base(gameManager) { this.backgroundSprite = Resources.GetImage("UI/menu_essences_a"); SlotGroup group1 = new SlotGroup(); SlotGroup group2 = new SlotGroup(); currentSlotGroup = group1; this.slotGroups.Add(group1); this.slotGroups.Add(group2); Point2I[] essencePoints = new Point2I[]{ new Point2I(32, 16), new Point2I(56, 16), new Point2I(72, 32), new Point2I(72, 56), new Point2I(56, 72), new Point2I(32, 72), new Point2I(16, 56), new Point2I(16, 32) }; for (int i = 0; i < 8; i++) { group1.AddSlot(essencePoints[i], 16); } for (int i = 0; i < 8; i++) { group1.GetSlotAt(i).SetConnection(Directions.Up, group1.GetSlotAt((i + 7) % 8)); group1.GetSlotAt(i).SetConnection(Directions.Down, group1.GetSlotAt((i + 1) % 8)); group1.GetSlotAt(i).SetConnection(Directions.Left, group2); group1.GetSlotAt(i).SetConnection(Directions.Right, group2); } //group2.AddSlot(new Point2I(112, 8), 32); //group2.AddSlot(new Point2I(112, 56), 32); group2.AddSlot(new Point2I(112, 32), 32); group2.GetSlotAt(0).SlotItem = new CustomSlotItem("Pieces of Heart", "4 more makes a Heart Container.", null); group2.AddSlot(new Point2I(112, 80), 32); group2.GetSlotAt(1).SlotItem = new CustomSlotItem("Save Screen", "Go to the Save Screen.", GameData.SPR_HUD_SAVE_BUTTON); for (int i = 0; i < 2; i++) { group2.GetSlotAt(i).SetConnection(Directions.Up, group2.GetSlotAt((i + 1) % 2)); group2.GetSlotAt(i).SetConnection(Directions.Down, group2.GetSlotAt((i + 1) % 2)); group2.GetSlotAt(i).SetConnection(Directions.Left, group1); group2.GetSlotAt(i).SetConnection(Directions.Right, group1); } }
//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public GameControl(GameManager gameManager) { this.gameManager = gameManager; this.roomStateStack = null; this.roomControl = null; this.world = null; this.player = null; this.hud = null; this.inventory = null; this.rewardManager = null; this.isAdvancedGame = false; this.updateRoom = true; this.animateRoom = true; this.menuWeapons = null; this.menuSecondaryItems = null; this.menuEssences = null; }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public MenuWeapons(GameManager gameManager) : base(gameManager) { this.backgroundSprite = Resources.GetImage("UI/menu_weapons_a"); this.ammoSlot = 0; this.ammoMenuSize = new Point2I(16, 8); this.ammoSlotGroup = null; this.oldEquippedWeapons = new ItemWeapon[2]; SlotGroup group = new SlotGroup(); currentSlotGroup = group; this.slotGroups.Add(group); Slot[,] slots = new Slot[4, 4]; Point2I gridSize = new Point2I(4, 4); for (int y = 0; y < gridSize.Y; y++) { for (int x = 0; x < gridSize.X; x++) { slots[x, y] = group.AddSlot(new Point2I(24 + 32 * x, 8 + 24 * y), 24); } } for (int y = 0; y < gridSize.Y; y++) { for (int x = 0; x < gridSize.X; x++) { if (x == 0) slots[x, y].SetConnection(Directions.Left, slots[gridSize.X - 1, (y + gridSize.Y - 1) % gridSize.Y]); else slots[x, y].SetConnection(Directions.Left, slots[x - 1, y]); if (x == gridSize.X - 1) slots[x, y].SetConnection(Directions.Right, slots[0, (y + 1) % gridSize.Y]); else slots[x, y].SetConnection(Directions.Right, slots[x + 1, y]); slots[x, y].SetConnection(Directions.Up, slots[x, (y + gridSize.Y - 1) % gridSize.Y]); slots[x, y].SetConnection(Directions.Down, slots[x, (y + 1) % gridSize.Y]); } } }
/** <summary> Constructs the game debugger. </summary> */ public DebugController(GameManager game) { this.game = game; this.nextStep = false; }
//----------------------------------------------------------------------------- // Initialization //----------------------------------------------------------------------------- // Constructs the game base class. public GameBase(string[] launchParameters) { // Graphics this.graphics = new GraphicsDeviceManager(this); this.spriteBatch = null; this.Content.RootDirectory = "Content"; this.fullScreen = false; this.windowSize = new Point2I(160 * 4, 144 * 4); this.windowSizeChanged = false; this.isContentLoaded = true; this.launchParameters = launchParameters; // Game this.game = null; this.screenShotRequested = false; this.screenShotName = ""; // Frame Rate this.totalFrames = 0; this.elapsedTime = 0.0; this.fps = 0.0; // Setup this.IsMouseVisible = true; this.Window.AllowUserResizing = false; this.graphics.PreferMultiSampling = true; this.graphics.PreferredBackBufferWidth = windowSize.X; this.graphics.PreferredBackBufferHeight = windowSize.Y; Form.Icon = new Icon("Game.ico"); Form.MinimumSize = new System.Drawing.Size(32, 32); }
// Allows the game to perform any initialization it needs to before starting to run. // This is where it can query for any required services and load any non-graphic // related content. Calling base.Initialize will enumerate through any components // and initialize them as well. protected override void Initialize() { Console.WriteLine("Begin Initialize"); Console.WriteLine("Initializing Input"); Keyboard.Initialize(); Mouse.Initialize(); GamePad.Initialize(); game = new GameManager(launchParameters); base.Initialize(); if (!isContentLoaded) { // BAD STUFF. Exit(); return; } // Create and initialize the game. game.Initialize(this); Window.ClientSizeChanged += OnClientSizeChanged; Console.WriteLine("End Initialize"); }