Exemple #1
0
 UiElementTransition
     (UiElementTransitionType type,
     UIElements targets)
 {
     this.Type    = type;
     this.Targets = targets;
 }
 RequestTransition
     (UiElementTransitionType transitionType,
     UIElements targets)
 {
     TransitionRequester.RequestTransition(
         transitionType,
         targets
         );
 }
        RequestTransition
            (UiElementTransitionType transitionType,
            UIElements targets)
        {
            UiElementTransition RequestedTransition
                = new UiElementTransition(
                      transitionType,
                      targets
                      );

            UiTransitionRequest(RequestedTransition);
        }
Exemple #4
0
        TransitionToUIElements
            (UiElementTransitionType transitionType,
            UIElements newUIElements)
        {
            if (UITransitionsOnHold)
            {
                // Queue this to be played later,
                // then exit early
                DelayedTransitions.Enqueue(
                    new UiElementTransition(transitionType, newUIElements)
                    );
                return;
            }
            // Add current active elements as a new history element
            if (transitionType == UiElementTransitionType.Tracked)
            {
                UITransitionHistory.Push(ActiveUIElements);
            }

            // Deactivate current UIElements
            if (transitionType == UiElementTransitionType.Fresh ||
                transitionType == UiElementTransitionType.Tracked)
            {
                //Debug.Log("TransitionToUIElements hiding elements " + ActiveUIElements);
                // Avoid deactivating persistent elements
                UIElements ElementsToDeactivate = ActiveUIElements;
                showUIElementFromFlags(false, ElementsToDeactivate);
                ActiveUIElements = UIElements.None;
            }

            // Deactivate newUIElements
            if (transitionType == UiElementTransitionType.Subtractive)
            {
                showUIElementFromFlags(false, newUIElements);
                // Remove deactivated elements from ActiveUIElements
                UIElements DeactivatedComponents
                    = newUIElements & ActiveUIElements;
                ActiveUIElements ^= DeactivatedComponents;
            }
            // Activate new UIElements
            else // transitionType != UiElementTransitionType.Subtractive
            {
                //Debug.Log("TransitionToUIElements showing elements " + newUIElements);
                showUIElementFromFlags(true, newUIElements);
                ActiveUIElements |= newUIElements;
            }

            // Clear history
            if (transitionType == UiElementTransitionType.Fresh)
            {
                UITransitionHistory.Clear();
            }

            // Set input state
            // There's a hard priority here so higher elements
            // will take precedence

            // if gameplay UI is active
            if ((ActiveUIElements & UIElements.GameplayUI) > 0)
            {
                UiState = UiInputState.InGame;
            }
            // if orrery UI is active
            else if ((ActiveUIElements & UIElements.OrreryUI) > 0)
            {
                UiState = UiInputState.Orrery;
            }
            // if main menu UI is active
            else if ((ActiveUIElements & UIElements.MainMenu) > 0)
            {
                UiState = UiInputState.MainMenu;
            }
        }