public HorizontalCluePanel(GameScene scene, Clue[] clues) : base(scene) { m_iSelectedIndex = -1; m_Clues = new List<Clue>(clues); int screenWidth = Scene.Game.ScreenWidth; int screenHeight = Scene.Game.ScreenHeight; int marginRight = (int)(Constants.MarginRight * screenWidth); int marginTop = (int)(Constants.MarginTop * screenHeight); m_IconSize = (int)(Constants.IconSize * screenHeight); m_ClueSpace = (int)(Constants.ClueSpace * screenHeight); int clueWidth = m_IconSize * 3; // Initialize the rectangle int width = clueWidth + marginRight; int x = screenWidth - width; m_Rect = new Rectangle(x, marginTop, width, screenHeight); // Setup scroll min/max float totalHeight = ((m_IconSize + m_ClueSpace) * clues.Length) - m_ClueSpace; m_ScrollMin = (-totalHeight + screenHeight) - marginTop; m_ScrollMax = marginTop; m_ScrollPosition = m_ScrollMax; }
public ButtonPanel(GameScene game, Rectangle rect) : base(game) { m_Rect = rect; int mid = m_Rect.Left + (m_Rect.Width >> 1); int buttonSize = (int)(Constants.ButtonPanel_ButtonSize * Scene.Game.ScreenHeight); int buttonSpace = (int)(Constants.ButtonPanel_ButtonSpace * Scene.Game.ScreenHeight); int buttonsLeft = mid - (buttonSize >> 1); int startY = (int)(Constants.HelpPanel_Height * Scene.Game.ScreenHeight); m_Buttons = new UIButton[5]; m_Buttons[0] = new UIButton(0, "P", Assets.DialogFont, new Rectangle(buttonsLeft, startY, buttonSize, buttonSize), Assets.ScrollBar); m_Buttons[1] = new UIButton(1, "H", Assets.DialogFont, new Rectangle(buttonsLeft, startY + buttonSize + buttonSpace, buttonSize, buttonSize), Assets.ScrollBar); m_Buttons[2] = new UIButton(2, "MH", Assets.DialogFont, new Rectangle(buttonsLeft, startY + ((buttonSize + buttonSpace) * 2), buttonSize, buttonSize), Assets.ScrollBar); m_Buttons[3] = new UIButton(3, "U", Assets.DialogFont, new Rectangle(buttonsLeft, startY + ((buttonSize + buttonSpace) * 3), buttonSize, buttonSize), Assets.ScrollBar); m_Buttons[4] = new UIButton(4, "HC", Assets.DialogFont, new Rectangle(buttonsLeft, startY + ((buttonSize + buttonSpace) * 4), buttonSize, buttonSize), Assets.ScrollBar); int coinMargin = (int)(Constants.ButtonPanel_CoinMargin * Scene.Game.ScreenHeight); int coinSize = (int)(Constants.ButtonPanel_CoinSize * Scene.Game.ScreenHeight); m_GoldCoinRect = new Rectangle(coinMargin, startY - (coinSize + coinMargin), coinSize, coinSize); m_vCoinsPosition.X = m_GoldCoinRect.Right + coinMargin; m_vCoinsPosition.Y = m_GoldCoinRect.Bottom - coinSize; m_CoinClickRect = new Rectangle(m_Rect.Left, m_Rect.Top, m_Rect.Width, startY - coinMargin); HideClueEnabled = false; }
public HelpPanel(GameScene game, Rectangle rect) : base(game) { m_Rect = rect; m_iClueIconSize = (int)(Constants.HelpClueIconSize * game.Game.ScreenHeight); }
public VerticalCluePanel(GameScene scene, Clue[] clues, int width) : base(scene) { m_Clues = new List<Clue>(clues); m_iSelectedIndex = -1; int screenHeight = scene.Game.ScreenHeight; m_IconSize = (int)(Constants.IconSize * screenHeight); m_ClueSpace = (int)(Constants.ClueSpace * screenHeight); int clueHeight = m_IconSize * 3; int bottomMargin = (int)(screenHeight * Constants.MarginBottom); int leftMargin = (int)(scene.Game.ScreenWidth * Constants.MarginLeft); int y = screenHeight - (clueHeight + bottomMargin); m_Rect = new Rectangle(leftMargin, y, width, screenHeight - y); // Setup scroll min/max float totalWidth = ((m_IconSize + m_ClueSpace) * clues.Length) - m_ClueSpace; m_ScrollMin = (-totalWidth + width) - leftMargin; m_ScrollMax = leftMargin; m_ScrollPosition = leftMargin; }
public ButtonPanel(GameScene game, Rectangle rect) : base(game) { m_Rect = rect; int mid = m_Rect.Left + (m_Rect.Width >> 1); int buttonSize = (int)(Constants.ButtonPanel_ButtonSize * Scene.Game.ScreenHeight); int buttonSpace = (int)(Constants.ButtonPanel_ButtonSpace * Scene.Game.ScreenHeight); int buttonsLeft = mid - (buttonSize >> 1); int startY = (int)(Constants.HelpPanel_Height * Scene.Game.ScreenHeight); m_Buttons = new UIButton[5]; m_Buttons[0] = new UIButton(0, "P", Assets.DialogFont, new Rectangle(buttonsLeft, startY, buttonSize, buttonSize), Assets.ScrollBar); m_Buttons[1] = new UIButton(1, "H", Assets.DialogFont, new Rectangle(buttonsLeft, startY + buttonSize + buttonSpace, buttonSize, buttonSize), Assets.ScrollBar); m_Buttons[2] = new UIButton(2, "MH", Assets.DialogFont, new Rectangle(buttonsLeft, startY + ((buttonSize + buttonSpace) * 2), buttonSize, buttonSize), Assets.ScrollBar); m_Buttons[3] = new UIButton(3, "U", Assets.DialogFont, new Rectangle(buttonsLeft, startY + ((buttonSize + buttonSpace) * 3), buttonSize, buttonSize), Assets.ScrollBar); m_Buttons[4] = new UIButton(4, "HC", Assets.DialogFont, new Rectangle(buttonsLeft, startY + ((buttonSize + buttonSpace) * 4), buttonSize, buttonSize), Assets.ScrollBar); m_Coins = new UICoinsDisplay(startY, m_Rect.Left, m_Rect.Top, m_Rect.Width); HideClueEnabled = false; }
public override void Click(int x, int y) { float virtY = y - m_ScrollPosition; m_iSelectedIndex = (int)(virtY / (m_IconSize + m_ClueSpace)); if (m_iSelectedIndex < m_Clues.Count) { SoundManager.Inst.PlaySound(SoundManager.SEInst.MenuAccept); GameScene.SelectClue(m_Clues[m_iSelectedIndex], this); if (m_iSelectedIndex == 0) { GameScene.Game.Tutorial.FinishPiece(TutorialSystem.TutorialPiece.HorizontalClueArea); GameScene.Game.Tutorial.FinishPiece(TutorialSystem.TutorialPiece.Hint2); } else if (m_iSelectedIndex == 1) { GameScene.Game.Tutorial.FinishPiece(TutorialSystem.TutorialPiece.HorizontalClue2a); } else if (m_iSelectedIndex == 2) { GameScene.Game.Tutorial.FinishPiece(TutorialSystem.TutorialPiece.HorizontalClue3a); } else if (m_iSelectedIndex == 3) { GameScene.Game.Tutorial.FinishPiece(TutorialSystem.TutorialPiece.HorizontalClue4b); } else if (m_iSelectedIndex == 4) { GameScene.Game.Tutorial.FinishPiece(TutorialSystem.TutorialPiece.HorizontalClue5a); } } else { GameScene.SelectClue(null, this); ClearSelected(); } }
public VerticalCluePanel(GameScene scene, Clue[] clues, int width) : base(scene) { m_Clues = new List <Clue>(clues); m_iSelectedIndex = -1; int screenHeight = scene.Game.ScreenHeight; m_IconSize = (int)(Constants.IconSize * screenHeight); m_ClueSpace = (int)(Constants.ClueSpace * screenHeight); int clueHeight = m_IconSize * 3; int bottomMargin = (int)(screenHeight * Constants.MarginBottom); int leftMargin = (int)(scene.Game.ScreenWidth * Constants.MarginLeft); int y = screenHeight - (clueHeight + bottomMargin); m_Rect = new Rectangle(leftMargin, y, width, screenHeight - y); // Setup scroll min/max float totalWidth = ((m_IconSize + m_ClueSpace) * clues.Length) - m_ClueSpace; m_ScrollMin = (-totalWidth + width) - leftMargin; m_ScrollMax = leftMargin; m_ScrollPosition = leftMargin; }
void LaunchGame() { if (m_iSelectedFloor >= 0) { m_Game.Tutorial.FinishPiece(TutorialSystem.TutorialPiece.FloorPlay); FloorDisplay floor = m_Floors[m_iSelectedFloor]; // Launch the puzzle GameScene gs = new GameScene(m_Game); gs.Initialize(floor.Floor, m_iTower + 3, true); m_Game.GotoScene(gs); } }
void DrawClue(SpriteBatch sb, int x, int y, Clue c, bool bHintClue) { Rectangle[] rects = new Rectangle[3]; rects[0] = new Rectangle(x, y, m_IconSize, m_IconSize); rects[1] = new Rectangle(x, y + m_IconSize, m_IconSize, m_IconSize); rects[2] = new Rectangle(x, y + (m_IconSize * 2), m_IconSize, m_IconSize); Rectangle bounds = new Rectangle(x, y, m_IconSize, m_IconSize * 3); int[] iIcons = new int[3]; int[] iRows = c.GetRows(); int iNumIcons = c.GetIcons(GameScene.Puzzle, iIcons); // Draw the frame sb.Draw(Assets.TransGray, bounds, Color.White); sb.Draw(Assets.GoldBarVertical, new Rectangle(x - 3, y - 3, 3, bounds.Height + 6), Color.White); sb.Draw(Assets.GoldBarHorizontal, new Rectangle(x - 3, y - 3, bounds.Width + 6, 3), Color.White); sb.Draw(Assets.GoldBarVertical, new Rectangle(bounds.Right, y - 3, 3, bounds.Height + 6), Color.White); sb.Draw(Assets.GoldBarHorizontal, new Rectangle(x - 3, bounds.Bottom, bounds.Width + 6, 3), Color.White); // Draw the icons for (int j = 0; j < iNumIcons; j++) { sb.Draw(GameScene.GetIcon(iRows[j], iIcons[j]), rects[j], Color.White); if (bHintClue) { Assets.HintSprite.Draw(sb, rects[j], Color.White); } } // Draw the operational overlay Rectangle[] overlayRects = new Rectangle[2]; overlayRects[0] = new Rectangle(x, y + (m_IconSize / 2), m_IconSize, m_IconSize); overlayRects[1] = new Rectangle(x, y + (m_IconSize / 2) + m_IconSize, m_IconSize, m_IconSize); switch (c.m_VerticalType) { case eVerticalType.Two: case eVerticalType.Three: break; case eVerticalType.EitherOr: sb.Draw(Assets.EitherOrOverlay, overlayRects[1], Color.White); break; case eVerticalType.TwoNot: sb.Draw(Assets.NotOverlay, overlayRects[0], Color.White); break; case eVerticalType.ThreeTopNot: sb.Draw(Assets.NotOverlay, rects[0], Color.White); break; case eVerticalType.ThreeMidNot: sb.Draw(Assets.NotOverlay, rects[1], Color.White); break; case eVerticalType.ThreeBotNot: sb.Draw(Assets.NotOverlay, rects[2], Color.White); break; } }
void ActivateTower(Tower t) { if (t.Locked) ShowLockedMessage(); else { // Launch the puzzle GameScene gs = new GameScene(Game); gs.Initialize(t.Floor, t.Size, true); Game.GotoScene(gs); } }
public CellDialog(GameScene game, int row, int col) { m_Game = game; m_iRow = row; m_iCol = col; m_iSelectedIcon = -1; int width = (int)(game.Game.ScreenWidth * Constants.CellDialogWidth); int height = (int)(game.Game.ScreenHeight * Constants.CellDialogHeight); int midScreenX = game.Game.ScreenWidth >> 1; int midScreenY = game.Game.ScreenHeight >> 1; int dialogHalfWidth = (width >> 1); int dialogHalfHeight = (height >> 1); int x = midScreenX - dialogHalfWidth; int y = midScreenY - dialogHalfHeight; m_Rect = new Rectangle(x, y, width, height); m_bIconStatus = new bool[game.Puzzle.m_iSize]; for (int i = 0; i < m_bIconStatus.Length; i++) { m_bIconStatus[i] = m_Game.Puzzle.m_Rows[m_iRow].m_Cells[m_iCol].m_bValues[i]; } // Setup large icon { m_iLargeIcon = m_Game.Puzzle.m_Rows[m_iRow].m_Cells[m_iCol].m_iFinalIcon; int largeIconSize = (int)(game.Game.ScreenHeight * Constants.CellDialogLargeIconSize); int halfLargeIconSize = largeIconSize >> 1; m_LargeIconRect = new Rectangle(m_Rect.Left + dialogHalfWidth - halfLargeIconSize, dialogHalfHeight - halfLargeIconSize, largeIconSize, largeIconSize); } // Setup small icons { m_IconRects = new Rectangle[game.Puzzle.m_iSize]; int topRowCount = game.Puzzle.m_iSize >> 1; int botRowCount = game.Puzzle.m_iSize - topRowCount; // Make sure bottom row is the smaller of the two while (topRowCount < botRowCount) { topRowCount++; botRowCount--; } int iconSize = (int)(game.Game.ScreenHeight * Constants.CellDialogSmallIconSize); // Setup the top row int halfTopRow = topRowCount >> 1; int topRowLeft = m_Rect.Left + dialogHalfWidth - (iconSize * halfTopRow); if ((topRowCount & 1) == 1) { topRowLeft = m_Rect.Left + dialogHalfWidth - (iconSize / 2) - (halfTopRow * iconSize); } for (int i = 0; i < topRowCount; i++) { m_IconRects[i] = new Rectangle(topRowLeft + (i * iconSize), dialogHalfHeight - iconSize, iconSize, iconSize); } // Setup the bottom row int halfBotRow = botRowCount >> 1; int botRowLeft = m_Rect.Left + dialogHalfWidth - (iconSize * halfBotRow); if ((botRowCount & 1) == 1) { botRowLeft = m_Rect.Left + dialogHalfWidth - (iconSize / 2) - (halfBotRow * iconSize); } for (int i = 0; i < botRowCount; i++) { m_IconRects[topRowCount + i] = new Rectangle(botRowLeft + (i * iconSize), dialogHalfHeight, iconSize, iconSize); } } // Setup Buttons { int cancelButtonX = (int)(m_Game.Game.ScreenWidth * Constants.CellDialog_CancelButtonX); int cancelButtonY = (int)(m_Game.Game.ScreenHeight * Constants.CellDialog_CancelButtonY); int smallButtonWidth = (int)(m_Game.Game.ScreenWidth * Constants.CellDialog_SmallButtonWidth); int smallButtonHeight = (int)(m_Game.Game.ScreenHeight * Constants.CellDialog_SmallButtonHeight); int buttonWidth = (int)(m_Game.Game.ScreenWidth * Constants.CellDialog_ButtonWidth); int buttonHeight = (int)(m_Game.Game.ScreenHeight * Constants.CellDialog_ButtonHeight); int bottomAreaHeight = m_Rect.Bottom - m_IconRects[m_IconRects.Length - 1].Bottom; int centerOfBottomArea = bottomAreaHeight >> 1; int buttonRowY = centerOfBottomArea + (buttonHeight >> 1); int innerButtonX = (m_Rect.Left + dialogHalfWidth) - (buttonWidth >> 1); int outerButtonX = ((innerButtonX - m_Rect.Left) >> 1) - (buttonWidth >> 1); m_Buttons = new UIButton[(int)ButtonID.Last]; Texture2D buttonTex = Assets.ScrollBar; m_Buttons[(int)ButtonID.Cancel] = new UIButton((int)ButtonID.Cancel, "<", Assets.MenuFont, new Rectangle(m_Rect.Left + cancelButtonX, m_Rect.Top + cancelButtonY, smallButtonWidth, smallButtonHeight), buttonTex); m_Buttons[(int)ButtonID.Done] = new UIButton((int)ButtonID.Done, ">", Assets.MenuFont, new Rectangle(m_Rect.Right - (cancelButtonX + smallButtonWidth), m_Rect.Top + cancelButtonY, smallButtonWidth, smallButtonHeight), buttonTex); m_Buttons[(int)ButtonID.Reset] = new UIButton((int)ButtonID.Reset, "Reset All", Assets.MenuFont, new Rectangle(innerButtonX, m_Rect.Bottom - buttonRowY, buttonWidth, buttonHeight), buttonTex); m_Buttons[(int)ButtonID.Confirm] = new UIButton((int)ButtonID.Confirm, "Confirm", Assets.MenuFont, new Rectangle(m_Rect.Left + outerButtonX, m_Rect.Bottom - buttonRowY, buttonWidth, buttonHeight), buttonTex); m_Buttons[(int)ButtonID.Eliminate] = new UIButton((int)ButtonID.Eliminate, "Eliminate", Assets.MenuFont, new Rectangle(m_Rect.Right - (outerButtonX + buttonWidth), m_Rect.Bottom - buttonRowY, buttonWidth, buttonHeight), buttonTex); m_Buttons[0].ClickSound = SoundManager.SEInst.MenuCancel; foreach (UIButton b in m_Buttons) { b.MainColor = Color.GreenYellow; } m_Buttons[(int)ButtonID.Confirm].Enabled = false; m_Buttons[(int)ButtonID.Eliminate].Enabled = false; m_Buttons[(int)ButtonID.Eliminate].ClickSound = SoundManager.SEInst.MenuCancel; } if (!game.Game.Tutorial.IsPieceSetup(TutorialSystem.TutorialPiece.EliminateRedNebula)) { Rectangle instRect = new Rectangle(m_IconRects[1].Right, m_IconRects[1].Top + (m_IconRects[1].Height >> 1) + game.Game.Tutorial.ArrowHeight, 250, 0); Vector2 rightIconTarget = new Vector2(m_IconRects[1].Right, m_IconRects[1].Top + (m_IconRects[1].Height >> 1)); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EliminateRedNebula, rightIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Hubble[4]} to select it.", TutorialSystem.TutorialPiece.EliminateRedNebula2, m_IconRects[1]); Rectangle eliminate = m_Buttons[(int)ButtonID.Eliminate].Rect; Vector2 eliminatePos = new Vector2(eliminate.Left + (eliminate.Width >> 1), eliminate.Top); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EliminateRedNebula2, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminate' button to eliminate the {icon:Hubble[4]}.", TutorialSystem.TutorialPiece.EliminateRedNebula3, eliminate); Rectangle done = m_Buttons[(int)ButtonID.Done].Rect; Vector2 donePos = new Vector2(done.Left, done.Bottom); string doneText = "Tap the '>' button to confirm the changes and return to the puzzle."; game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EliminateRedNebula3, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.BartMan1, done); Vector2 bottomIconTarget = new Vector2(m_IconRects[2].Right, m_IconRects[2].Top + (m_IconRects[2].Height >> 1)); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.BartMan2, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Simpsons[2]} to select it.", TutorialSystem.TutorialPiece.BartMan3, m_IconRects[2]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.BartMan3, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminte' button to eliminate the {icon:Simpsons[2]}", TutorialSystem.TutorialPiece.BartMan4, eliminate); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.BartMan4, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.Hulk1, done); Vector2 icon0Pos = new Vector2(m_IconRects[0].Right, m_IconRects[0].Top + (m_IconRects[0].Height >> 1)); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Hulk2, icon0Pos, Constants.ArrowLeft, instRect, "Tap the {icon:Superheros[3]} to select it.", TutorialSystem.TutorialPiece.Hulk3, m_IconRects[0]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Hulk3, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminte' button to eliminate the {icon:Superheros[3]}", TutorialSystem.TutorialPiece.Hulk4, eliminate); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Hulk4, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HorizontalClue2a, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.CrabNebula1, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Hubble[2]} to select it.", TutorialSystem.TutorialPiece.CrabNebula2, m_IconRects[2]); Rectangle confirm = m_Buttons[(int)ButtonID.Confirm].Rect; Vector2 confirmButtonPos = new Vector2(confirm.Left + (confirm.Width >> 1), confirm.Top); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.CrabNebula2, confirmButtonPos, Constants.ArrowDown, instRect, "Tap the 'Confirm' button to confirm the {icon:Hubble[2]} belongs in this grid cell.", TutorialSystem.TutorialPiece.CrabNebula3, confirm); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.CrabNebula3, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HorizontalClue2c, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern1, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Superheros[2]} to select it.", TutorialSystem.TutorialPiece.GreenLantern2, m_IconRects[2]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern2, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminate' button to eliminate the {icon:Superheros[2]}", TutorialSystem.TutorialPiece.GreenLantern3, eliminate); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern3, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HorizontalClue2d, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Homer1, icon0Pos, Constants.ArrowLeft, instRect, "Tap the {icon:Simpsons[3]} to select it.", TutorialSystem.TutorialPiece.Homer2, m_IconRects[0]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Homer2, confirmButtonPos, Constants.ArrowDown, instRect, "Tap the 'Confirm' button to confirm the {icon:Simpsons[3]} belongs in this grid cell.", TutorialSystem.TutorialPiece.Homer3, confirm); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Homer3, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HorizontalClue4, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern4, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Superheros[2]} to select it.", TutorialSystem.TutorialPiece.GreenLantern5, m_IconRects[2]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern5, confirmButtonPos, Constants.ArrowDown, instRect, "Tap the 'Confirm' button to confirm the {icon:Superheros[2]} belongs in this grid cell.", TutorialSystem.TutorialPiece.GreenLantern6, confirm); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern6, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HideClue1, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Bartman5, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Simpsons[2]} to select it.", TutorialSystem.TutorialPiece.Bartman6, m_IconRects[2]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Bartman6, confirmButtonPos, Constants.ArrowDown, instRect, "Tap the 'Confirm' button to confirm the {icon:Simpsons[2]} belongs in this grid cell.", TutorialSystem.TutorialPiece.Bartman7, confirm); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Bartman7, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.Undo, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.RedNebula4, rightIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Hubble[4]} to select it.", TutorialSystem.TutorialPiece.RedNebula5, m_IconRects[1]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.RedNebula5, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminate' button to eliminate the {icon:Hubble[4]}.", TutorialSystem.TutorialPiece.RedNebula6, eliminate); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.RedNebula6, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.EndScreen1, done); } }
void DrawClueDescription_Horizontal(SpriteBatch spriteBatch, Clue clue) { int iX = m_Rect.Left; int iY = (m_Rect.Top + (m_Rect.Height >> 1)) - (m_iClueIconSize >> 1); int[] iIcons = new int[3]; int[] iRows = clue.GetRows(); clue.GetIcons(GameScene.Puzzle, iIcons); string szDesc; switch (clue.m_HorizontalType) { case eHorizontalType.NextTo: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is next to"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eHorizontalType.NotNextTo: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is not next to"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eHorizontalType.LeftOf: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is left of"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eHorizontalType.NotLeftOf: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is not left of"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eHorizontalType.Span: spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "has"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "next to it on one side, and"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "next to it on the other"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); break; case eHorizontalType.SpanNotLeft: spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "has"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "next to it on one side, and not"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "next to it on the other"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); break; case eHorizontalType.SpanNotMid: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "and"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "have one column between them without"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eHorizontalType.SpanNotRight: spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "has"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "on one side, and not"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "on the other"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); break; } }
void DrawClueDescription_Vertical(SpriteBatch spriteBatch, Clue clue) { int iX = m_Rect.Left; int iY = (m_Rect.Top + (m_Rect.Height >> 1)) - (m_iClueIconSize >> 1); int[] iIcons = new int[3]; int[] iRows = clue.GetRows(); clue.GetIcons(GameScene.Puzzle, iIcons); string szDesc; switch (clue.m_VerticalType) { case eVerticalType.Two: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is in the same column as"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eVerticalType.Three: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is in the same column as"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "and"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eVerticalType.EitherOr: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is either in the column with"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "or the column with"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eVerticalType.TwoNot: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is not in the same column as"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); break; case eVerticalType.ThreeTopNot: spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "and"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "are in the same column but"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is not"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); break; case eVerticalType.ThreeMidNot: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "and"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "are in the same column but"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is not"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); break; case eVerticalType.ThreeBotNot: spriteBatch.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "and"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "are in the same column but"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); iX += (int)Assets.DialogFont.MeasureString(szDesc).X + 6; spriteBatch.Draw(GameScene.GetIcon(iRows[2], iIcons[2]), new Rectangle(iX, iY, m_iClueIconSize, m_iClueIconSize), Color.White); iX += m_iClueIconSize + 6; szDesc = "is not"; spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX + 2, iY + 2), Color.Black); spriteBatch.DrawString(Assets.DialogFont, szDesc, new Vector2(iX, iY), Color.White); break; } }
public CellDialog(GameScene game, int row, int col) { m_Game = game; m_iRow = row; m_iCol = col; m_iSelectedIcon = -1; int width = (int)(game.Game.ScreenWidth * Constants.CellDialogWidth); int height = (int)(game.Game.ScreenHeight * Constants.CellDialogHeight); int midScreenX = game.Game.ScreenWidth >> 1; int midScreenY = game.Game.ScreenHeight >> 1; int dialogHalfWidth = (width >> 1); int dialogHalfHeight = (height >> 1); int x = midScreenX - dialogHalfWidth; int y = midScreenY - dialogHalfHeight; m_Rect = new Rectangle(x, y, width, height); m_bIconStatus = new bool[game.Puzzle.m_iSize]; for (int i = 0; i < m_bIconStatus.Length; i++) m_bIconStatus[i] = m_Game.Puzzle.m_Rows[m_iRow].m_Cells[m_iCol].m_bValues[i]; // Setup large icon { m_iLargeIcon = m_Game.Puzzle.m_Rows[m_iRow].m_Cells[m_iCol].m_iFinalIcon; int largeIconSize = (int)(game.Game.ScreenHeight * Constants.CellDialogLargeIconSize); int halfLargeIconSize = largeIconSize >> 1; m_LargeIconRect = new Rectangle(m_Rect.Left + dialogHalfWidth - halfLargeIconSize, dialogHalfHeight - halfLargeIconSize, largeIconSize, largeIconSize); } // Setup small icons { m_IconRects = new Rectangle[game.Puzzle.m_iSize]; int topRowCount = game.Puzzle.m_iSize >> 1; int botRowCount = game.Puzzle.m_iSize - topRowCount; // Make sure bottom row is the smaller of the two while (topRowCount < botRowCount) { topRowCount++; botRowCount--; } int iconSize = (int)(game.Game.ScreenHeight * Constants.CellDialogSmallIconSize); // Setup the top row int halfTopRow = topRowCount >> 1; int topRowLeft = m_Rect.Left + dialogHalfWidth - (iconSize * halfTopRow); if ((topRowCount & 1) == 1) topRowLeft = m_Rect.Left + dialogHalfWidth - (iconSize / 2) - (halfTopRow * iconSize); for (int i = 0; i < topRowCount; i++) m_IconRects[i] = new Rectangle(topRowLeft + (i * iconSize), dialogHalfHeight - iconSize, iconSize, iconSize); // Setup the bottom row int halfBotRow = botRowCount >> 1; int botRowLeft = m_Rect.Left + dialogHalfWidth - (iconSize * halfBotRow); if ((botRowCount & 1) == 1) botRowLeft = m_Rect.Left + dialogHalfWidth - (iconSize / 2) - (halfBotRow * iconSize); for (int i = 0; i < botRowCount; i++) m_IconRects[topRowCount + i] = new Rectangle(botRowLeft + (i * iconSize), dialogHalfHeight, iconSize, iconSize); } // Setup Buttons { int cancelButtonX = (int)(m_Game.Game.ScreenWidth * Constants.CellDialog_CancelButtonX); int cancelButtonY = (int)(m_Game.Game.ScreenHeight * Constants.CellDialog_CancelButtonY); int smallButtonWidth = (int)(m_Game.Game.ScreenWidth * Constants.CellDialog_SmallButtonWidth); int smallButtonHeight = (int)(m_Game.Game.ScreenHeight * Constants.CellDialog_SmallButtonHeight); int buttonWidth = (int)(m_Game.Game.ScreenWidth * Constants.CellDialog_ButtonWidth); int buttonHeight = (int)(m_Game.Game.ScreenHeight * Constants.CellDialog_ButtonHeight); int bottomAreaHeight = m_Rect.Bottom - m_IconRects[m_IconRects.Length - 1].Bottom; int centerOfBottomArea = bottomAreaHeight >> 1; int buttonRowY = centerOfBottomArea + (buttonHeight >> 1); int innerButtonX = (m_Rect.Left + dialogHalfWidth) - (buttonWidth >> 1); int outerButtonX = ((innerButtonX - m_Rect.Left) >> 1) - (buttonWidth >> 1); m_Buttons = new UIButton[(int)ButtonID.Last]; Texture2D buttonTex = Assets.ScrollBar; m_Buttons[(int)ButtonID.Cancel] = new UIButton((int)ButtonID.Cancel, "<", Assets.MenuFont, new Rectangle(m_Rect.Left + cancelButtonX, m_Rect.Top + cancelButtonY, smallButtonWidth, smallButtonHeight), buttonTex); m_Buttons[(int)ButtonID.Done] = new UIButton((int)ButtonID.Done, ">", Assets.MenuFont, new Rectangle(m_Rect.Right - (cancelButtonX + smallButtonWidth), m_Rect.Top + cancelButtonY, smallButtonWidth, smallButtonHeight) , buttonTex); m_Buttons[(int)ButtonID.Reset] = new UIButton((int)ButtonID.Reset, "Reset All", Assets.MenuFont, new Rectangle(innerButtonX, m_Rect.Bottom - buttonRowY, buttonWidth, buttonHeight), buttonTex); m_Buttons[(int)ButtonID.Confirm] = new UIButton((int)ButtonID.Confirm, "Confirm", Assets.MenuFont, new Rectangle(m_Rect.Left + outerButtonX, m_Rect.Bottom - buttonRowY, buttonWidth, buttonHeight), buttonTex); m_Buttons[(int)ButtonID.Eliminate] = new UIButton((int)ButtonID.Eliminate,"Eliminate", Assets.MenuFont, new Rectangle(m_Rect.Right - (outerButtonX + buttonWidth), m_Rect.Bottom - buttonRowY, buttonWidth, buttonHeight), buttonTex); foreach( UIButton b in m_Buttons ) b.MainColor = Color.GreenYellow; m_Buttons[(int)ButtonID.Confirm].Enabled = false; m_Buttons[(int)ButtonID.Eliminate].Enabled = false; } if (!game.Game.Tutorial.IsPieceSetup(TutorialSystem.TutorialPiece.EliminateRedNebula)) { Rectangle instRect = new Rectangle(m_IconRects[1].Right, m_IconRects[1].Top + (m_IconRects[1].Height >> 1) + game.Game.Tutorial.ArrowHeight, 250, 0); Vector2 rightIconTarget = new Vector2(m_IconRects[1].Right, m_IconRects[1].Top + (m_IconRects[1].Height >> 1)); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EliminateRedNebula, rightIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Hubble[4]} to select it.", TutorialSystem.TutorialPiece.EliminateRedNebula2, m_IconRects[1]); Rectangle eliminate = m_Buttons[(int)ButtonID.Eliminate].Rect; Vector2 eliminatePos = new Vector2(eliminate.Left + (eliminate.Width >> 1), eliminate.Top); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EliminateRedNebula2, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminate' button to eliminate the {icon:Hubble[4]}.", TutorialSystem.TutorialPiece.EliminateRedNebula3, eliminate); Rectangle done = m_Buttons[(int)ButtonID.Done].Rect; Vector2 donePos = new Vector2(done.Left, done.Bottom); string doneText = "Tap the '>' button to confirm the changes and return to the puzzle."; game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.EliminateRedNebula3, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.BartMan1, done); Vector2 bottomIconTarget = new Vector2(m_IconRects[2].Right, m_IconRects[2].Top + (m_IconRects[2].Height >> 1)); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.BartMan2, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Simpsons[2]} to select it.", TutorialSystem.TutorialPiece.BartMan3, m_IconRects[2]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.BartMan3, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminte' button to eliminate the {icon:Simpsons[2]}", TutorialSystem.TutorialPiece.BartMan4, eliminate); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.BartMan4, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.Hulk1, done); Vector2 icon0Pos = new Vector2(m_IconRects[0].Right, m_IconRects[0].Top + (m_IconRects[0].Height >> 1)); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Hulk2, icon0Pos, Constants.ArrowLeft, instRect, "Tap the {icon:Superheros[3]} to select it.", TutorialSystem.TutorialPiece.Hulk3, m_IconRects[0]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Hulk3, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminte' button to eliminate the {icon:Superheros[3]}", TutorialSystem.TutorialPiece.Hulk4, eliminate); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Hulk4, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HorizontalClue2a, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.CrabNebula1, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Hubble[2]} to select it.", TutorialSystem.TutorialPiece.CrabNebula2, m_IconRects[2]); Rectangle confirm = m_Buttons[(int)ButtonID.Confirm].Rect; Vector2 confirmButtonPos = new Vector2(confirm.Left + (confirm.Width >> 1), confirm.Top); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.CrabNebula2, confirmButtonPos, Constants.ArrowDown, instRect, "Tap the 'Confirm' button to confirm the {icon:Hubble[2]} belongs in this grid cell.", TutorialSystem.TutorialPiece.CrabNebula3, confirm); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.CrabNebula3, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HorizontalClue2c, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern1, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Superheros[2]} to select it.", TutorialSystem.TutorialPiece.GreenLantern2, m_IconRects[2]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern2, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminate' button to eliminate the {icon:Superheros[2]}", TutorialSystem.TutorialPiece.GreenLantern3, eliminate); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern3, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HorizontalClue2d, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Homer1, icon0Pos, Constants.ArrowLeft, instRect, "Tap the {icon:Simpsons[3]} to select it.", TutorialSystem.TutorialPiece.Homer2, m_IconRects[0]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Homer2, confirmButtonPos, Constants.ArrowDown, instRect, "Tap the 'Confirm' button to confirm the {icon:Simpsons[3]} belongs in this grid cell.", TutorialSystem.TutorialPiece.Homer3, confirm); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Homer3, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HorizontalClue4, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern4, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Superheros[2]} to select it.", TutorialSystem.TutorialPiece.GreenLantern5, m_IconRects[2]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern5, confirmButtonPos, Constants.ArrowDown, instRect, "Tap the 'Confirm' button to confirm the {icon:Superheros[2]} belongs in this grid cell.", TutorialSystem.TutorialPiece.GreenLantern6, confirm); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.GreenLantern6, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.HideClue1, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Bartman5, bottomIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Simpsons[2]} to select it.", TutorialSystem.TutorialPiece.Bartman6, m_IconRects[2]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Bartman6, confirmButtonPos, Constants.ArrowDown, instRect, "Tap the 'Confirm' button to confirm the {icon:Simpsons[2]} belongs in this grid cell.", TutorialSystem.TutorialPiece.Bartman7, confirm); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.Bartman7, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.Undo, done); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.RedNebula4, rightIconTarget, Constants.ArrowLeft, instRect, "Tap the {icon:Hubble[4]} to select it.", TutorialSystem.TutorialPiece.RedNebula5, m_IconRects[1]); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.RedNebula5, eliminatePos, Constants.ArrowDown, instRect, "Tap the 'Eliminate' button to eliminate the {icon:Hubble[4]}.", TutorialSystem.TutorialPiece.RedNebula6, eliminate); game.Game.Tutorial.SetPieceData(TutorialSystem.TutorialPiece.RedNebula6, donePos, Constants.ArrowDiagonalUpRight, instRect, doneText, TutorialSystem.TutorialPiece.EndScreen1, done); } }
void DrawClue(SpriteBatch sb, int x, int y, Clue c, bool bHintClue) { Rectangle[] rects = new Rectangle[3]; rects[0] = new Rectangle(x, y, m_IconSize, m_IconSize); rects[1] = new Rectangle(x + m_IconSize, y, m_IconSize, m_IconSize); rects[2] = new Rectangle(x + (m_IconSize * 2), y, m_IconSize, m_IconSize); Rectangle bounds = new Rectangle(x, y, m_IconSize * 3, m_IconSize); int[] iIcons = new int[3]; int[] iRows = c.GetRows(); int iNumIcons = c.GetIcons(GameScene.Puzzle, iIcons); // Draw the frame //sb.Draw(m_Game.TransGrey, bounds, Color.White); sb.Draw(Assets.GoldBarHorizontal, new Rectangle(x - 3, y - 3, bounds.Width + 6, 3), Color.White); sb.Draw(Assets.GoldBarHorizontal, new Rectangle(x - 3, bounds.Bottom, bounds.Width + 6, 3), Color.White); sb.Draw(Assets.GoldBarVertical, new Rectangle(x - 3, y - 3, 3, bounds.Height + 6), Color.White); sb.Draw(Assets.GoldBarVertical, new Rectangle(bounds.Right, y - 3, 3, bounds.Height + 6), Color.White); // Draw the icons if (c.m_HorizontalType == eHorizontalType.LeftOf || c.m_HorizontalType == eHorizontalType.NotLeftOf) { sb.Draw(GameScene.GetIcon(iRows[0], iIcons[0]), rects[0], Color.White); sb.Draw(Assets.LeftOfIcon, rects[1], Color.White); sb.Draw(GameScene.GetIcon(iRows[1], iIcons[1]), rects[2], Color.White); if (bHintClue) { Assets.HintSprite.Draw(sb, rects[0], Color.White); Assets.HintSprite.Draw(sb, rects[2], Color.White); } } else { for (int j = 0; j < iNumIcons; j++) { sb.Draw(GameScene.GetIcon(iRows[j], iIcons[j]), rects[j], Color.White); if (bHintClue) { Assets.HintSprite.Draw(sb, rects[j], Color.White); } } } // Draw the operational overlay switch (c.m_HorizontalType) { case eHorizontalType.NextTo: case eHorizontalType.LeftOf: break; case eHorizontalType.NotLeftOf: case eHorizontalType.NotNextTo: sb.Draw(Assets.NotOverlay, rects[1], Color.White); break; case eHorizontalType.Span: sb.Draw(Assets.SpanOverlay, bounds, Color.White); break; case eHorizontalType.SpanNotLeft: sb.Draw(Assets.SpanOverlay, bounds, Color.White); sb.Draw(Assets.NotOverlay, rects[0], Color.White); break; case eHorizontalType.SpanNotMid: sb.Draw(Assets.SpanOverlay, bounds, Color.White); sb.Draw(Assets.NotOverlay, rects[1], Color.White); break; case eHorizontalType.SpanNotRight: sb.Draw(Assets.SpanOverlay, bounds, Color.White); sb.Draw(Assets.NotOverlay, rects[2], Color.White); break; } }