public PlayerSettingRowComponent(Game game, int x, int y, SpriteFont font, int width, int height, Color c,String name, int changeState) : base(game,x,y,font,width,height,null) { playerColorTexture = game.Content.Load<Texture2D>("pcolor"); playerColor = c; this.name = name; playerState = new ButtonComponent(game, x + 500, y - 6, font, Settings.scaleW(200), Settings.scaleH(45), null, Settings.PlayerState); playerState.Actions += PlayerStateButtonAction; for(int loop1 = 0; loop1 < changeState; loop1++) playerState.nextText(); playerState.Initialize(); playerState.LoadContent(); addButton = new ButtonComponent(game, x, y, new Rectangle(), font, 34, 32, "HUD/hotseat_plus"); addButton.Actions += AddButtonAction; addButton.Initialize(); addButton.LoadContent(); remButton = new ButtonComponent(game, x, y, new Rectangle(), font, 34, 32, "HUD/hotseat_minus"); remButton.Actions += RemButtonAction; remButton.Initialize(); remButton.LoadContent(); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) { content = new ContentManager(ScreenManager.Game.Services, "Content"); } else { GameMaster.Inst().DeleteAllPlayers(); return; } startGameButton = new ButtonComponent(ScreenManager.Game, (int)(Settings.maximumResolution.X - 150), (int)(Settings.maximumResolution.Y - 200), new Rectangle(), GameResources.Inst().GetFont(EFont.MedievalBig), Settings.scaleW(79), Settings.scaleH(66), "HUD/hotseat_hra_button"); startGameButton.Actions += StartGameSelected; //guiComponents.Add(changeTurnButton); ButtonComponent backButton = new ButtonComponent(ScreenManager.Game, 60, (int)(Settings.maximumResolution.Y - 200), new Rectangle(), GameResources.Inst().GetFont(EFont.MedievalBig), Settings.scaleW(79), Settings.scaleH(66), "HUD/hotseat_back"); backButton.Actions += BackSelected; guiComponents.Add(backButton); int counter = 0; /* * Loading AI */ List<String> AIname = new List<String>(); AIname.Add(Strings.MENU_HOT_SEAT_NO_AI); foreach (IComponentAI AI in CoreProviderAI.AI) { AIname.Add(AI.GetAIName()); } Settings.PlayerState = AIname; /* * */ foreach (Color c in Settings.playerColors) { int playerNameID = GetRandomPlayerID(); PlayerSettingRowComponent pSwitch = new PlayerSettingRowComponent(ScreenManager.Game, (int)colorPosition.X, (int)colorPosition.Y, GameResources.Inst().GetFont(EFont.PlayerNameFont), 200, 200, c, Strings.MENU_HOT_SEAT_NAMES[playerNameID], (counter == 0 || counter ==2) ? 1 : 0); playersSettings.Add(pSwitch); colorPosition.Y += playerSpace; if (counter <= 2) { // first two users are active pSwitch.setActive(true); } counter++; } //margin betweent sections colorPosition.Y += 80; points = new MapSettingRowComponent(ScreenManager.Game, (int)colorPosition.X, (int)colorPosition.Y, GameResources.Inst().GetFont(EFont.MedievalBig), 400, 200, Strings.MENU_HOT_SEAT_POINTS, new List<String>() { Settings.winPoints[0].ToString(), Settings.winPoints[1].ToString(), Settings.winPoints[2].ToString() }); mapType = new MapSettingRowComponent(ScreenManager.Game, (int)colorPosition.X, (int)colorPosition.Y + 50, GameResources.Inst().GetFont(EFont.MedievalBig), 400, 200, Strings.MENU_HOT_SEAT_MAP_TYPE, new List<String>() { Strings.GAME_SETTINGS_MAP_TYPE_LOWLAND, Strings.GAME_SETTINGS_MAP_TYPE_NORMAL, Strings.GAME_SETTINGS_MAP_TYPE_WASTELAND }); mapSize = new MapSettingRowComponent(ScreenManager.Game, (int)colorPosition.X, (int)colorPosition.Y + 100, GameResources.Inst().GetFont(EFont.MedievalBig), 400, 200, Strings.MENU_HOT_SEAT_MAP_SIZE, new List<String>() { Strings.GAME_SETTINGS_MAP_SIZE_SMALL, Strings.GAME_SETTINGS_MAP_SIZE_MEDIUM, Strings.GAME_SETTINGS_MAP_SIZE_BIG }); wealth = new MapSettingRowComponent(ScreenManager.Game, (int)colorPosition.X, (int)colorPosition.Y + 150, GameResources.Inst().GetFont(EFont.MedievalBig), 400, 200, Strings.MENU_HOT_SEAT_MAP_WEALTH, new List<String>() { Strings.GAME_SETTINGS_MAP_WEALTH_LOW, Strings.GAME_SETTINGS_MAP_WEALTH_MEDIUM, Strings.GAME_SETTINGS_MAP_WEALTH_HIGH }); guiComponents.Add(points); guiComponents.Add(mapType); guiComponents.Add(mapSize); guiComponents.Add(wealth); foreach (GuiComponent guiComponent in guiComponents) { guiComponent.Initialize(); guiComponent.LoadContent(); } foreach( PlayerSettingRowComponent p in playersSettings ) { p.Initialize(); p.LoadContent(); } foreach (ButtonComponent p in addButtons) { p.Initialize(); p.LoadContent(); } foreach (ButtonComponent p in remButtons) { p.Initialize(); p.LoadContent(); } playerColorTexture = ScreenManager.Game.Content.Load<Texture2D>("pcolor"); startGameButton.Initialize(); startGameButton.LoadContent(); ScreenManager.Game.ResetElapsedTime(); }