void ActivateAction(FtueAction.Base action) { if (m_ActiveAction != null) { return; } if (m_ActiveAction == action) { return; } if (action == null) { return; } if (action.IsSkipped == true) { return; } if (action.IsFinished == true) { return; } if (action.CanActivate() == false) { return; } m_ActiveAction = action; m_ActiveAction.Activate(); }
public static bool IsActionFinished <T>() where T : FtueAction.Base { if (Instance == null) { return(true); } if (IsActive == false) { return(true); } FtueAction.Base action = m_Instance.GetAction(typeof(T)); if (action == null) { return(true); } bool finished = action.IsSkipped || action.IsFinished; FtueAction.Base current = ActiveAction; if (current == null) { return(finished); } if (action.Index > current.Index) { return(false); } return(finished); }
public static bool IsActionActive <T>() where T : FtueAction.Base { if (Instance == null) { return(false); } if (IsActive == false) { return(false); } FtueAction.Base action = m_Instance.GetAction(typeof(T)); if (action == null) { return(false); } FtueAction.Base current = ActiveAction; if (current == null) { return(false); } if (action.Index == current.Index) { return(true); } return(action.IsActive); }
public void Update(FtueAction.Base action, int actionsFinished, int actionsTotal) { if (m_Root.Visible == true) { string hint = Ftue.NextActionHint; string label = action.IsIdle == true?string.Format(TextDatabase.instance[9900003], action.Label) : action.Label; m_Caption.SetNewText(hint != null ? label : string.Format("{0}: {1}", TextDatabase.instance[9900000], label )); m_Text.Widget.ShowImmediate(true, true); m_Text.SetNewText(hint ?? action.Description); m_Text.textScale = string.IsNullOrEmpty(hint) ? new Vector2(m_DefaultTextScale.x * action.DescriptionScale.x, m_DefaultTextScale.y * action.DescriptionScale.y) : m_DefaultTextScale; bool isNext = action is FtueAction.Welcome || action is FtueAction.Hud || action is FtueAction.FinalText ? true : false; bool highlight = Alpha < 1.0f ? false : action.IsActive; m_SkipThis.animate = true; m_SkipThis.isHighlighted = isNext ? highlight : false; m_SkipThis.SetNewText(isNext ? 9900004 : 9900001); } m_Close.IsDisabled = Alpha < 0.8f ? true : false; m_SkipThis.IsDisabled = Alpha < 0.8f ? true : action.IsIdle; m_SkipAll.IsDisabled = Alpha < 0.8f ? true : false; }
FtueAction.Base GetAction(System.Type type) { if (m_CachedAction != null && m_CachedAction.GetType() == type) { return(m_CachedAction); } m_CachedAction = m_Actions.Find(obj => obj.GetType() == type); return(m_CachedAction); }
void DeactivateAction(FtueAction.Base action) { if (m_ActiveAction != action) { return; } if (m_ActiveAction != null) { action.Deactivate(); } m_ActiveAction = null; }
public void Update(FtueAction.Base action, int actionsFinished, int actionsTotal) { if (m_Root.Visible == true) { m_Caption.SetNewText(string.Format("{0}: {1}/{2}", TextDatabase.instance[9900000], Mathf.Min(actionsFinished + 1, actionsTotal), actionsTotal )); string label = action.IsIdle == true?string.Format(TextDatabase.instance[9900003], action.Label) : action.Label; m_Text.SetNewText(label); } m_ShowInfo.IsDisabled = Alpha < 0.8f ? true : false; //action.IsIdle; }
void UnregisterAction(FtueAction.Base action) { if (action == null) { return; } if (m_Actions.Contains(action) == false) { return; } UserGuide.UnregisterAction(action); m_Actions.Remove(action); DeactivateAction(m_ActiveAction); }
// PRIVATE METHODS void RegisterAction(FtueAction.Base action) { if (action == null) { return; } if (m_Actions.Contains(action) == true) { return; } if (UserGuide.RegisterAction(action) == true) { m_Actions.Add(action); DeactivateAction(m_ActiveAction); } }
protected override bool ShouldHighlightButton(GUIBase_Button button) { if (button.name != "Spawn_Button") { return(false); } FtueAction.Base action = Ftue.ActiveAction ?? Ftue.PendingAction; if (action is FtueAction.Spawn) { return(true); } if (action is FtueAction.RankUp) { return(true); } return(action != null ? action.ShouldBeIngame : false); }
protected override void OnViewUpdate() { FtueAction.Base action = Ftue.ActiveAction ?? Ftue.PendingAction; int actionsFinished = Ftue.ActionsSkipped + Ftue.ActionsFinished; int actionsTotal = Ftue.ActionsTotal; if (action != null && m_AnyScreenVisible == false && UserGuide.ActiveAction is FtueAction.Base) { m_Controls.Show(m_Tweener); m_Controls.Update(action, actionsFinished, actionsTotal); if (action.IsActive == true && action.IsExecuted == true) { string key = action.UniqueId; bool hasKey = m_DisplayedInfoBoxes.Contains(key); if (hasKey == false || m_IgnoreDisplayedState == true) { if (hasKey == false) { m_DisplayedInfoBoxes.Add(key); } m_InfoBox.Show(m_Tweener); m_IgnoreDisplayedState = false; } } else { //m_InfoBox.Hide(m_Tweener); } m_InfoBox.Update(action, actionsFinished, actionsTotal); } else { m_Controls.Hide(m_Tweener); m_InfoBox.Hide(m_Tweener); } UpdateTweener(); }
// PRIVATE METHODS void UpdateButtonStates() { FtueAction.Base action = Ftue.ActiveAction ?? Ftue.PendingAction; PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI(); ZoneControlInfo zcInfo = GameInfoSettings.GetGameInfo <ZoneControlInfo>(); int maxRank = PlayerPersistantInfo.MAX_RANK; int rank = ppi != null ? ppi.Rank : 1; int minRankZC = zcInfo != null?Mathf.Clamp(zcInfo.MinimalDesiredRankToPlay, 1, maxRank) : 1; bool disabled = !LobbyClient.IsConnected; bool highlight = action != null && action.ShouldBeIngame || action is FtueAction.RankUp ? true : false; bool disableDM = disabled; bool tutorialZC = Ftue.IsActionFinished <FtueAction.ZoneControl>() ? false : true; bool unlockedZC = rank >= minRankZC ? true : false; if (tutorialZC == true && Ftue.IsActionActive <FtueAction.ZoneControl>() == false) { unlockedZC = false; } bool highlightDM = unlockedZC == false ? highlight : false; bool disableZC = unlockedZC == true ? disabled : true; bool highlightZC = unlockedZC == true ? highlight : false; bool showBlurbDM = ppi != null && ppi.IsFirstGameToday(E_MPGameType.DeathMatch) ? true : false; bool showBlurbZC = ppi != null && ppi.IsFirstGameToday(E_MPGameType.ZoneControl) ? unlockedZC : false; bool showLockZC = zcInfo != null && unlockedZC == false ? true : false; m_ButtonPlayDM.IsDisabled = disableDM; m_ButtonPlayDM.animate = true; m_ButtonPlayDM.isHighlighted = action is FtueAction.DeathMatch || highlightDM ? !disableDM : false; ShowWidget(m_PlayDMBlurb, showBlurbDM); m_ButtonPlayZC.IsDisabled = disableZC; m_ButtonPlayZC.animate = true; m_ButtonPlayZC.isHighlighted = action is FtueAction.ZoneControl || highlightZC ? !disableZC : false; m_PlayZCLock.Show(showLockZC, tutorialZC && rank >= minRankZC ? -1 : minRankZC); ShowWidget(m_PlayZCBlurb, showBlurbZC); }
void Update() { m_PendingAction = null; m_ActionsIdle = 0; m_ActionsFinished = 0; m_ActionsSkipped = 0; if (m_ActiveAction != null && m_ActiveAction.IsActive == false) { DeactivateAction(m_ActiveAction); } bool activate = true; for (int idx = 0; idx < m_Actions.Count; ++idx) { FtueAction.Base action = m_Actions[idx]; switch (action.State) { case FtueState.None: case FtueState.InProgress: if (activate == true) { ActivateAction(action); activate = false; } if (m_PendingAction == null && action.IsIdle == true) { m_PendingAction = action; } break; case FtueState.Finished: case FtueState.Skipped: DeactivateAction(action); break; } } for (int idx = 0; idx < m_Actions.Count; ++idx) { FtueAction.Base action = m_Actions[idx]; switch (action.State) { case FtueState.None: m_ActionsIdle += 1; break; case FtueState.Finished: m_ActionsFinished += 1; break; case FtueState.Skipped: m_ActionsSkipped += 1; break; case FtueState.InProgress: break; } } }