private void Game_OnCurrencyChange(int hardCurrency) { m_Coins.SetCoins(hardCurrency); }
public HubScene(Happiness game) : base(game) { InputController.IC.OnClick += IC_OnClick; InputController.IC.OnDragBegin += IC_OnDragBegin; InputController.IC.OnDrag += IC_OnDrag; InputController.IC.OnScroll += IC_OnScroll; InputController.IC.OnKeyDown += IC_OnKeyDown; SoundManager.Inst.PlayMainMenuMusic(); //m_SoundDialog = new SoundDialog(game.ScreenWidth, game.ScreenHeight, game); //game.SoundManager.StopMusic(); // Setup Towers int centerX = Game.ScreenWidth >> 1; int centerY = Game.ScreenHeight >> 1; int towerSize = (int)(Constants.HubScene_TowerSize * Game.ScreenHeight); int towerTop = (int)(Constants.HubScene_TowerAreaTop * Game.ScreenHeight); int leftX = centerX - towerSize - towerSize; int midX = centerX - (towerSize >> 1); int rightX = centerX + towerSize; m_Towers = new Tower[6]; m_Towers[0] = new Tower(3, game.TheGameInfo.GameData.TowerFloors[0], new Rectangle(leftX, towerTop, towerSize, towerSize), Assets.Towers[0]); m_Towers[1] = new Tower(4, game.TheGameInfo.GameData.TowerFloors[1], new Rectangle(midX, towerTop, towerSize, towerSize), Assets.Towers[1]); m_Towers[2] = new Tower(5, game.TheGameInfo.GameData.TowerFloors[2], new Rectangle(rightX, towerTop, towerSize, towerSize), Assets.Towers[2]); m_Towers[3] = new Tower(6, game.TheGameInfo.GameData.TowerFloors[3], new Rectangle(leftX, centerY, towerSize, towerSize), Assets.Towers[3]); m_Towers[4] = new Tower(7, game.TheGameInfo.GameData.TowerFloors[4], new Rectangle(midX, centerY, towerSize, towerSize), Assets.Towers[0]); m_Towers[5] = new Tower(8, game.TheGameInfo.GameData.TowerFloors[5], new Rectangle(rightX, centerY, towerSize, towerSize), Assets.Towers[0]); // Level/Exp display int expBarWidth = (int)(Constants.HubScene_ExpBarWidth * Game.ScreenWidth); int expBarHeight = (int)(Constants.HubScene_ExpBarHeight * Game.ScreenHeight); int marginLeftRight = (int)(Constants.HubScene_MarginLeftRight * Game.ScreenWidth); int levelY = (int)(Constants.HubScene_MarginTopBottom * Game.ScreenHeight); m_LevelLabel = new UILabel("Level: ", marginLeftRight, levelY, Color.Goldenrod, Assets.HelpFont, UILabel.XMode.Left); m_Level = new UILabel(game.TheGameInfo.GameData.Level.ToString(), marginLeftRight + m_LevelLabel.Width, levelY, Color.White, Assets.HelpFont, UILabel.XMode.Left); m_ExpBar = new UIProgressBar(new Rectangle(marginLeftRight, levelY + m_Level.Height, expBarWidth, expBarHeight)); m_ExpBar.ProgressColor = Color.Yellow; m_ExpBar.Progress = (float)game.TheGameInfo.GameData.Exp / Balance.ExpForNextLevel(game.TheGameInfo.GameData.Level); SetupTutorial(); int buttonWidth = (int)(Constants.HubScene_ButtonWidth * Game.ScreenWidth); int buttonHeight = (int)(Constants.HubScene_ButtonHeight * Game.ScreenHeight); int buttonY = Game.ScreenHeight - levelY - buttonHeight; m_ResetTutorial = new UIButton(0, "Reset Tutorial", Assets.HelpFont, new Rectangle(marginLeftRight, buttonY, buttonWidth, buttonHeight), Assets.ScrollBar); m_Options = new UIButton(0, "Options", Assets.HelpFont, new Rectangle((marginLeftRight * 2) + buttonWidth, buttonY, buttonWidth, buttonHeight), Assets.ScrollBar); m_BuyCoins = new UIButton(0, "Buy Coins", Assets.HelpFont, new Rectangle((marginLeftRight * 3) + (buttonWidth * 2), buttonY, buttonWidth, buttonHeight), Assets.ScrollBar); int buttonRight = Game.ScreenWidth - marginLeftRight - buttonWidth; m_Exit = new UIButton(0, "Exit", Assets.HelpFont, new Rectangle(buttonRight, buttonY, buttonWidth, buttonHeight), Assets.ScrollBar); m_SignOut = new UIButton(0, "Sign Out", Assets.HelpFont, new Rectangle(buttonRight - marginLeftRight - buttonWidth, buttonY, buttonWidth, buttonHeight), Assets.ScrollBar); int startY = (int)(Constants.HelpPanel_Height * Game.ScreenHeight); int coinsWidth = (int)(Constants.HubScene_CoinsWidth * Game.ScreenWidth); int coinsLeft = Game.ScreenWidth - (coinsWidth + marginLeftRight); m_Coins = new UICoinsDisplay(startY, coinsLeft, levelY, coinsWidth); m_Coins.SetCoins(Game.TheGameInfo.HardCurrency); Game.OnCurrencyChange += Game_OnCurrencyChange; Game.OnVipDataChange += Game_OnVipDataChange; int vipTop = (levelY * 2) + m_Coins.Height; m_VIP = new UIVIPDisplay(coinsLeft + marginLeftRight, vipTop, coinsWidth - marginLeftRight); game.ValidateVIPSettings(); }
public void SetCoins(int coins) { m_Coins.SetCoins(coins); }