internal void init(TeamBrookvale.Game.IInventoryModel inventoryModel, TeamBrookvale.Game.IGameModel gameModel, Font font) { this.inventoryModel = inventoryModel; this.gameModel = gameModel; _guiElemRectRegisterSignal.Dispatch(iconRect, true); counterIcon = Resources.Load <Texture2D> ("UI/Counters/InventoryCounterBackgroundIcon"); // this one is used as a background for the counter if (counterIcon == null) { Debug.LogError("InventoryCounterBackgroundIcon not found"); } // initialize text textGuiStyle.font = font; textGuiStyle.alignment = TextAnchor.MiddleCenter; textGuiStyle.normal.textColor = Color.white; textGuiStyle.fontSize = TeamBrookvale.Game.TBUtil.CalcFontSize(30); // move the text a few pixels up from the middle of the circle textRect = new Rect( iconRect.xMin, iconRect.yMin - 20 * Screen.height / 640, iconRect.width, iconRect.height); }
internal void init( TeamBrookvale.Game.IGameModel gameModel, Font font, Func <int> numberOfTimeBombsMounted, Func <int> numberOfShips, Func <int> numberOfShipsSunk) { this.gameModel = gameModel; this.numberOfTimeBombsMounted = numberOfTimeBombsMounted; this.numberOfShips = numberOfShips; this.numberOfShipsSunk = numberOfShipsSunk; // initialize text textGuiStyle.font = font; textGuiStyle.alignment = TextAnchor.MiddleCenter; textGuiStyle.normal.textColor = Color.white; textGuiStyle.fontSize = TeamBrookvale.Game.TBUtil.CalcFontSize(30); iconPressTextRect = new Rect (iconRect.xMin - Screen.width * .55f, iconRect.yMin, Screen.width / 2, iconRect.height); // decide which icon to use based on the level type switch (gameModel.currentLevelType) { case TeamBrookvale.Game.LevelType.NothingToDemolish: counterIcon = null; break; case TeamBrookvale.Game.LevelType.Dam: case TeamBrookvale.Game.LevelType.Buoy: case TeamBrookvale.Game.LevelType.Bridge: counterIcon = Resources.Load <Texture2D> ("UI/Counters/TimeBombCounterIcon"); // this one is used as a background for the counter if (counterIcon == null) { Debug.LogError("TimeBombCounterIcon not found"); } break; case TeamBrookvale.Game.LevelType.ShipDrill: counterIcon = Resources.Load <Texture2D> ("UI/Counters/SunkShipCounterIcon"); // this one is used as a background for the counter if (counterIcon == null) { Debug.LogError("SunkShipCounterIcon not found"); } break; default: break; } if (counterIcon != null) { _guiElemRectRegisterSignal.Dispatch(iconRect, true); } getIconRect = iconRect; }
internal void init(TeamBrookvale.Game.IInventoryModel inventoryModel, TeamBrookvale.Game.IGameModel gameModel) { this.inventoryModel = inventoryModel; this.gameModel = gameModel; _guiElemRectRegisterSignal.Dispatch(iconRect, true); getIconRect = iconRect; guiStyle.alignment = TextAnchor.MiddleCenter; }
internal void init(ILevelTextModel model, TeamBrookvale.Game.IGameModel gameModel) { // initialize text guiStyle.font = model.AtwriterFont; guiStyle.alignment = TextAnchor.MiddleCenter; guiStyle.normal.textColor = Color.white; guiStyle.fontSize = TeamBrookvale.Game.TBUtil.CalcFontSize(30); // load level name this.gameModel = gameModel; // set text textToShow = gameModel.getCurrentLevelName(); }
internal void init(TeamBrookvale.Game.IGameModel gameModel) { this.gameModel = gameModel; _guiElemRectRegisterSignal.Dispatch(iconRect, true); getIconRect = iconRect; string iconPath = "UI/PauseIcon"; icon = Resources.Load <Texture2D> (iconPath); if (icon == null) { Debug.LogError(iconPath + " is missing"); } }