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; }
void Start() { Debug.Assert(initialPanel != null, "InitialPanel must be set"); animationControlOrderMap = new Dictionary <ModePanel, int>(orderedListOfPanels.Length); int i = 0; foreach (ModePanel modePanel in orderedListOfPanels) { animationControlOrderMap.Add(modePanel, i++); bool visible = modePanel == initialPanel; modePanel.ImmediateStateSet(visible); modePanel.gameObject.SetActive(visible); } if (copyPanel != null) { copyPanel.gameObject.SetActive(true); } initialPanel.FocusAcquired(); }
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; }
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; }