public void FinishPiece(TutorialPiece piece, TutorialPiece onFail = TutorialPiece.None, bool condition = true) { if (m_Pieces[piece].Triggered) { m_Pieces[piece].Finished = true; Save(); } if (m_CurrentPiece == piece) { if (onFail != TutorialPiece.None && condition == false) { TriggerPiece(onFail); } else if (m_Pieces[piece].NextPiece != TutorialPiece.None) { TriggerPiece(m_Pieces[piece].NextPiece); } else { m_CurrentPiece = TutorialPiece.None; m_OKButton = null; } } }
public bool IsPieceFinished(TutorialPiece piece) { if (m_Pieces.ContainsKey(piece)) { return(m_Pieces[piece].Finished); } return(false); }
public bool IsPieceTriggered(TutorialPiece piece) { if (m_Pieces.ContainsKey(piece)) { return(m_Pieces[piece].Triggered); } return(false); }
public bool IsPieceSetup(TutorialPiece piece) { if (m_Pieces.ContainsKey(piece)) { return(m_Pieces[piece].Instructions != null); } return(false); }
public void CancelPiece() { if (m_CurrentPiece != TutorialPiece.None) { m_Pieces[m_CurrentPiece].Triggered = false; m_Pieces[m_CurrentPiece].Finished = false; m_CurrentPiece = TutorialPiece.None; } }
public void SetPieceData(TutorialPiece piece, Vector2 arrowTarget, float arrowRotation, Rectangle instructionRect, string instructions, TutorialPiece nextPiece, Rectangle clickRestriction, bool okButton = false) { m_Pieces[piece].ArrowTarget = arrowTarget; m_Pieces[piece].ArrowRotation = arrowRotation; m_Pieces[piece].InstructionRect = instructionRect; m_Pieces[piece].Instructions = instructions; m_Pieces[piece].OkButton = okButton; m_Pieces[piece].NextPiece = nextPiece; m_Pieces[piece].ClickRestriction = clickRestriction; }
public void TriggerPiece(TutorialPiece piece) { PieceData pd = m_Pieces[piece]; if (!pd.Finished && !pd.Triggered) { pd.Triggered = true; SetArrow(pd.ArrowTarget, pd.ArrowRotation); SetInstructions(pd.InstructionRect, pd.Instructions, pd.OkButton); m_CurrentPiece = piece; } else if (!pd.Triggered) { // Set this as triggered and move down the chain pd.Triggered = true; if (pd.NextPiece != TutorialPiece.None) { TriggerPiece(pd.NextPiece); } } }
public TutorialSystem(int screenWidth, int screenHeight) { m_Pieces = new Dictionary<TutorialPiece, PieceData>(); m_CurrentPiece = TutorialPiece.None; m_fArrowTravelDistance = Constants.TutorialSystem_ArrowTravelDistance * screenWidth; m_fArrowSpeed = Constants.TutorialSystem_ArrowSpeed; m_fArrowWidth = Constants.TutorialSystem_ArrowWidth * screenWidth; m_fArrowHeight = Constants.TutorialSystem_ArrowHeight * screenHeight; m_vArrowScale = new Vector2(m_fArrowWidth / Assets.Arrow.Width, m_fArrowHeight / Assets.Arrow.Height); m_vArrowOrigin = new Vector2(Assets.Arrow.Width, Assets.Arrow.Height >> 1); m_TextColor = Color.CornflowerBlue; m_iTextLineHeight = (int)Assets.HelpFont.MeasureString("qQ").Y + 1; m_iTextMarginTopBottom = (int)(Constants.TutorialSystem_TextMarginTopBottom * screenHeight); m_iTextMarginLeftRight = (int)(Constants.TutorialSystem_TextMarginLeftRight * screenWidth); m_iButtonWidth = (int)(Constants.TutorialSystem_ButtonWidth * screenWidth); m_iButtonHeight = (int)(Constants.TutorialSystem_ButtonHeight * screenHeight); Load(); }
public TutorialSystem(int screenWidth, int screenHeight, Happiness game) { m_Game = game; m_Pieces = new Dictionary <TutorialPiece, PieceData>(); m_CurrentPiece = TutorialPiece.None; m_fArrowTravelDistance = Constants.TutorialSystem_ArrowTravelDistance * screenWidth; m_fArrowSpeed = Constants.TutorialSystem_ArrowSpeed; m_fArrowWidth = Constants.TutorialSystem_ArrowWidth * screenWidth; m_fArrowHeight = Constants.TutorialSystem_ArrowHeight * screenHeight; m_vArrowScale = new Vector2(m_fArrowWidth / Assets.Arrow.Width, m_fArrowHeight / Assets.Arrow.Height); m_vArrowOrigin = new Vector2(Assets.Arrow.Width, Assets.Arrow.Height >> 1); m_TextColor = Color.CornflowerBlue; m_iTextLineHeight = (int)Assets.HelpFont.MeasureString("qQ").Y + 1; m_iTextMarginTopBottom = (int)(Constants.TutorialSystem_TextMarginTopBottom * screenHeight); m_iTextMarginLeftRight = (int)(Constants.TutorialSystem_TextMarginLeftRight * screenWidth); m_iButtonWidth = (int)(Constants.TutorialSystem_ButtonWidth * screenWidth); m_iButtonHeight = (int)(Constants.TutorialSystem_ButtonHeight * screenHeight); Load(); }
public void TriggerPiece(TutorialPiece piece) { PieceData pd = m_Pieces[piece]; if (!pd.Finished && !pd.Triggered) { pd.Triggered = true; SetArrow(pd.ArrowTarget, pd.ArrowRotation); SetInstructions(pd.InstructionRect, pd.Instructions, pd.OkButton); m_CurrentPiece = piece; } else if (!pd.Triggered) { // Set this as triggered and move down the chain pd.Triggered = true; if( pd.NextPiece != TutorialPiece.None ) TriggerPiece(pd.NextPiece); } }
public bool IsPieceSetup(TutorialPiece piece) { if (m_Pieces.ContainsKey(piece)) { return m_Pieces[piece].Instructions != null; } return false; }
public void FinishPiece(TutorialPiece piece) { if (m_Pieces[piece].Triggered) { m_Pieces[piece].Finished = true; Save(); } if (m_CurrentPiece == piece) { if (m_Pieces[piece].NextPiece != TutorialPiece.None) TriggerPiece(m_Pieces[piece].NextPiece); else { m_CurrentPiece = TutorialPiece.None; m_OKButton = null; } } }