public void ImmediatePanelSet(ModePanel newPanel) { if (lastActivePanel == newPanel) { //Cleanup panel newPanel.FocusLost(); //Reprepare panel newPanel.FocusAcquired(); return; } else if (!animationControlOrderMap.ContainsKey(newPanel)) { Debug.LogError("Error: Panel Not included in initialization array."); return; } newPanel.gameObject.SetActive(true); lastActivePanel.FocusLost(); lastActivePanel.ImmediateStateSet(false); newPanel.FocusAcquired(); newPanel.ImmediateStateSet(true); lastActivePanel.gameObject.SetActive(false); lastActivePanel = newPanel; }
protected void SpecialSetPanelActive(ModePanel newPanel, bool newPanelInferior) { copyPanel.gameObject.SetActive(true); copyPanel.TakeSnapshot(lastActivePanel.RectTransform); lastActivePanel.FocusLost(); lastActivePanel.ImmediateStateSet(false); if (lastActivePanel != newPanel) { lastActivePanel.gameObject.SetActive(false); newPanel.gameObject.SetActive(true); } newPanel.LerpHandler.Activate( duration: flipTime, lerpAction: new ModePanelTranslator( direction: Direction.Show, axis: panelAxis, orientation: newPanelInferior ? Orientation.Inferior : Orientation.Superior)); copyPanel.LerpHandler.Activate( duration: 0.8f * flipTime, lerpAction: new ModePanelTranslator( direction: Direction.Hide, axis: panelAxis, orientation: newPanelInferior ? Orientation.Superior : Orientation.Inferior), finishedCallback: DisableModePanel); newPanel.FocusAcquired(); lastActivePanel = newPanel; }
public void SimulatePanelSwipe( ModePanel panel, Action betweenSwipeAction = null, Action <ModePanel> afterSwipeAction = null, bool newPanelInferior = true) { if (panel != lastActivePanel) { Debug.LogError("Cannot simulate panel swipe on the non-active panel."); return; } copyPanel.TakeSnapshot(); betweenSwipeAction?.Invoke(); panel.ImmediateStateSet(false); panel.LerpHandler.Activate( duration: flipTime, lerpAction: new ModePanelTranslator( direction: Direction.Show, axis: panelAxis, orientation: newPanelInferior ? Orientation.Inferior : Orientation.Superior), finishedCallback: afterSwipeAction); copyPanel.FocusAcquired(); copyPanel.LerpHandler.Activate( duration: flipTime, lerpAction: new ModePanelTranslator( direction: Direction.Hide, axis: panelAxis, orientation: newPanelInferior ? Orientation.Superior : Orientation.Inferior), finishedCallback: DisableModePanel); }
private void DisableModePanel(ModePanel panel) { if (panel != copyPanel) { panel.gameObject.SetActive(false); } else if (copyPanel != null) { copyPanel.FocusLost(); } }
public void SetPanelActive(ModePanel newPanel, ShowPanelMode mode = ShowPanelMode.Hierarchy) { bool newPanelInferior = false; switch (mode) { case ShowPanelMode.Hierarchy: newPanelInferior = animationControlOrderMap[lastActivePanel] < animationControlOrderMap[newPanel]; break; case ShowPanelMode.Push: case ShowPanelMode.PushClone: newPanelInferior = true; break; case ShowPanelMode.Pop: case ShowPanelMode.PopClone: newPanelInferior = false; break; case ShowPanelMode.Immediate: //No setup necessary break; default: newPanelInferior = true; Debug.LogError($"Unrecognized ShowPanelMode: {mode}"); break; } switch (mode) { case ShowPanelMode.Hierarchy: case ShowPanelMode.Push: case ShowPanelMode.Pop: SetPanelActive(newPanel, newPanelInferior); break; case ShowPanelMode.PushClone: case ShowPanelMode.PopClone: SpecialSetPanelActive(newPanel, newPanelInferior); break; case ShowPanelMode.Immediate: ImmediatePanelSet(newPanel); break; default: Debug.LogError($"Unrecognized ShowPanelMode: {mode}"); break; } }
protected void SetPanelActive(ModePanel newPanel, bool newPanelInferior) { if (lastActivePanel == newPanel) { //Cleanup panel newPanel.FocusLost(); //Reprepare panel newPanel.FocusAcquired(); return; } if (!animationControlOrderMap.ContainsKey(newPanel)) { Debug.LogError("Error: Panel Not included in initialization array."); return; } newPanel.gameObject.SetActive(true); lastActivePanel.FocusLost(); newPanel.LerpHandler.Activate( duration: flipTime, lerpAction: new ModePanelTranslator( direction: Direction.Show, axis: panelAxis, orientation: newPanelInferior ? Orientation.Inferior : Orientation.Superior)); lastActivePanel.LerpHandler.Activate( duration: flipTime, lerpAction: new ModePanelTranslator( direction: Direction.Hide, axis: panelAxis, orientation: newPanelInferior ? Orientation.Superior : Orientation.Inferior), finishedCallback: DisableModePanel); newPanel.FocusAcquired(); lastActivePanel = newPanel; }
private void Awake() { lastActivePanel = initialPanel; }
private void DisableModePanel(ModePanel panel) => panel.gameObject.SetActive(false);