/// <summary> /// Find the oppositve panel action type. /// </summary> /// <param name="type"> type to find opposite </param> /// <returns> opposite type </returns> private JCS_PanelActionType FindOppsiteType(JCS_PanelActionType type) { switch (type) { case JCS_PanelActionType.HIDE: return(JCS_PanelActionType.SHOW); case JCS_PanelActionType.SHOW: return(JCS_PanelActionType.HIDE); } // default type. return(JCS_PanelActionType.NONE); }
/// <summary> /// Active this action. /// </summary> public void ActiveAction() { // reset timer. mDoActionTimer = 0; mActionActive = true; // do the opposite first JCS_PanelActionType oppositeType = FindOppsiteType(mPanelActionType); foreach (JCS_DialogueObject panel in mDialogueObjects) { DoActionForeachPanel(panel, oppositeType); } }
/// <summary> /// Do action according to the panel action type. /// </summary> /// <param name="panel"> panel to set </param> /// <param name="type"> action type </param> private void DoActionForeachPanel(JCS_DialogueObject panel, JCS_PanelActionType type) { if (panel == null) { return; } switch (type) { case JCS_PanelActionType.HIDE: { panel.Hide(!mPlayPanelSound); } break; case JCS_PanelActionType.SHOW: { panel.Show(!mPlayPanelSound); } break; } }
/// <summary> /// Do action according to the panel action type. /// </summary> /// <param name="panel"> panel to set </param> /// <param name="type"> action type </param> private void DoActionForeachPanel(JCS_DialogueObject panel, JCS_PanelActionType type) { // check null references... if (panel == null) { return; } switch (type) { case JCS_PanelActionType.HIDE: { if (mPlayPanelSound) { panel.HideDialogue(); } else { panel.HideDialogueWithoutSound(); } } break; case JCS_PanelActionType.SHOW: { if (mPlayPanelSound) { panel.ShowDialogue(); } else { panel.ShowDialogueWithoutSound(); } } break; } }