Example #1
0
    // Use this for initialization
    protected void Awake()
    {
        animator = gameObject.GetComponent<Animator>();

        UIState = FindObjectOfType<UIStates>();
        UISignals = FindObjectOfType<Signals>();
    }
Example #2
0
 private void SetConnectionUIStates(UIStates state)
 {
     uiState = state;
     fullscreenButton.IsEnabled   = state == UIStates.Streaming;
     serverComboBox.IsEnabled     = state == UIStates.Stopped;
     serverComboBox.Visibility    = settingsOverlay.settings.customSocketAddress.enabled ? Visibility.Hidden : Visibility.Visible;
     serverTextBox.Visibility     = settingsOverlay.settings.customSocketAddress.enabled ? Visibility.Visible : Visibility.Hidden;
     connectButton.Content        = state != UIStates.Stopped ? (state == UIStates.Streaming ? "Pause" : "Play") : "Connect";
     refreshButton.Content        = state != UIStates.Stopped ? "Stop" : "Refresh";
     notConnectedImage.Visibility = state == UIStates.Stopped ? Visibility.Visible : Visibility.Hidden;
     if (state == UIStates.Stopped)
     {
         while (processingFrame && !isDisposed)
         {
             Thread.Sleep(1);
         }
         if (bitmap != null)
         {
             bitmap.Lock();
             Utils.memset(bitmap.BackBuffer, 255, (IntPtr)metaData.imageDataSize);
             bitmap.AddDirtyRect(new Int32Rect(0, 0, bitmap.PixelWidth, bitmap.PixelHeight));
             bitmap.Unlock();
         }
     }
 }
 public void SwitchWin()
 {
     currentUIState = UIStates.WIN;
     gameScreen.SetActive(false);
     winScreen.SetActive(true);
     loseScreen.SetActive(false);
 }
Example #4
0
    public void UpdateUIStateMain()
    {
        bool anyTurning = false;
        bool allLegal   = true;

        foreach (Piece piece in CurrentPlayer.pieces)
        {
            anyTurning |= piece.IsRotating();
            allLegal   &= IsValidPosition(piece);
        }

        bool hasTurned = currentSelectedPiece != null && currentSelectedPiece.IsRotated();

        //if (anyTurning || currentSelectedPiece == null)
        //    UIState.SetGroupState(UIStates.Group.PieceControls, UIStates.State.Disabled);
        //else
        //    UIState.SetGroupState(UIStates.Group.PieceControls, UIStates.State.Active);
        if (lastSelectedPiece != null || hasTurned)
        {
            UIStates.SetGroupState(UIStates.Group.Undo, UIStates.State.Active);
        }
        else
        {
            UIStates.SetGroupState(UIStates.Group.Undo, UIStates.State.Disabled);
        }

        //if (allLegal && !anyTurning && hasTurned)
        //    UIState.SetGroupState(UIStates.Group.EndTurn, UIStates.State.Active);
        //else
        //    UIState.SetGroupState(UIStates.Group.EndTurn, UIStates.State.Disabled);
    }
Example #5
0
 public void AddState(UIStates newState)
 {
     if (gameObject.activeInHierarchy)
     {
         AddState(( int )newState);
     }
 }
 public void SwitchLose()
 {
     currentUIState = UIStates.LOSE;
     gameScreen.SetActive(false);
     winScreen.SetActive(false);
     loseScreen.SetActive(true);
 }
Example #7
0
 // Use this for initialization
 protected void Awake()
 {
     animator = gameObject.GetComponent <Animator>();
     if (group != UIStates.Group.None)
     {
         UIStates.GetEvent(group).AddListener(OnStateChanged);
     }
 }
Example #8
0
    // Update is called once per frame

    IEnumerator FadeWelcomeScreen()
    {
        yield return(new WaitForSeconds(fadeOutTime));

        title.SetActive(false);
        menuScreen.SetActive(true);
        state = UIStates.menu;
    }
Example #9
0
 // Use this for initialization
 void Start()
 {
     rigController   = GameObject.Find("RigController");
     functionControl = GetComponent <FunctionControl>();
     fadeOutTime     = 3;
     state           = UIStates.title;
     StartCoroutine(FadeWelcomeScreen());
 }
Example #10
0
    private void ActivateUI(UIStates newState, bool isActive)
    {
        var reference = GetReference(newState);

        if (reference.target == null)
        {
            return;
        }
        reference.target.SetActive(isActive);
    }
 void Start()
 {
     //add panels here so they are all on top of each other
     currState    = defaultState;
     homePosition = Home.transform.position;
     Environment.transform.position = homePosition;
     View.transform.position        = homePosition;
     Materials.transform.position   = homePosition;
     Lights.transform.position      = homePosition;
     ChooseCar.transform.position   = homePosition;
 }
Example #12
0
 public void ShowUI(UIStates newState)
 {
     if (newState == _currentState)
     {
         return;
     }
     ActivateUI(newState, true);
     HideUI(_currentState);
     _currentState = newState;
     IsVisible     = true;
     UIChanged?.Invoke(_currentState);
 }
Example #13
0
 public void ClickedFunctions()
 {
     levelScreen.SetActive(false);
     functionScreen.SetActive(true);
     methodCanvas.SetActive(true);
     dashboardCanvas.SetActive(true);
     gameController.SetActive(true);
     CanvasAnimations.MoveCanvas(menuCanvas, new Vector3(-0.28f, 0, 0.2f));
     CanvasAnimations.MoveCanvas(dashboardCanvas, new Vector3(0, 0, 0.35f));
     CanvasAnimations.MoveCanvas(methodCanvas, new Vector3(0.24f, 0, 0.25f));
     state = UIStates.function;
 }
Example #14
0
    protected override void OnEnter()
    {
        UIStates.SetGroupState(UIStates.Group.PieceControls, UIStates.State.Hidden);
        UIStates.SetGroupState(UIStates.Group.EndGame, UIStates.State.Hidden);
        UIStates.SetGroupState(UIStates.Group.PuzzleSelection, UIStates.State.Hidden);

        AddListeners(new List <ESignalType> {
            ESignalType.SetupComplete
        });

        Game.currentGame.StartSetup();
    }
Example #15
0
    protected override void OnEnter()
    {
        AddListeners(new List <ESignalType> {
            ESignalType.StartPuzzle, ESignalType.Quit
        });
        AddListenersOne(new List <ESignalType> {
            ESignalType.StartPuzzle
        });

        UIStates.SetGroupState(UIStates.Group.EndGame, UIStates.State.Hidden);
        UIStates.SetGroupState(UIStates.Group.EndTurn, UIStates.State.Hidden);
        UIStates.SetGroupState(UIStates.Group.PuzzleSelection, UIStates.State.Active);
    }
Example #16
0
    private void resetUIState()
    {
        switch (_uiState)
        {
        case UIStates.PickFaction:
            GameObject.Destroy(_factionUI.gameObject);
            break;

        case UIStates.Playing:
            GameObject.Destroy(_showCoodsUI.gameObject);
            break;
        }

        _uiState = UIStates.Nothing;
    }
Example #17
0
    private UIReference GetReference(UIStates state)
    {
        UIReference foundReference = new UIReference();
        var         l = _references.Length;

        for (int i = 0; i < l; i++)
        {
            if (_references[i].state == state)
            {
                foundReference = _references[i];
                break;
            }
        }

        return(foundReference);
    }
Example #18
0
    protected override void OnEnter()
    {
        UIStates.SetGroupState(UIStates.Group.EndGame, UIStates.State.Active);
        UIStates.SetGroupState(UIStates.Group.PieceControls, UIStates.State.Disabled);
        UIStates.SetGroupState(UIStates.Group.Undo, UIStates.State.Disabled);

        AddListeners(new List <ESignalType> {
            ESignalType.StartPuzzle, ESignalType.SelectBoard, ESignalType.Quit
        });

        Game.currentGame.SetPieceModeEnd();
        foreach (Player player in Game.currentGame.players)
        {
            player.SetActivePlayer(false);
        }
    }
Example #19
0
    protected override void OnEnter()
    {
        UIStates.SetGroupState(UIStates.Group.PieceControls, UIStates.State.Active);

        AddListeners(new List <ESignalType> {
            ESignalType.Quit,
            ESignalType.RotateCCW,
            ESignalType.RotateUndo,
            ESignalType.RotateCW,
            ESignalType.EndTurn,
            ESignalType.Restart
        });

        AddListenersOne(new List <ESignalType> {
            ESignalType.PuzzleComplete
        });

        Game.currentGame.StartMain();
    }
Example #20
0
    protected override void OnSignal(ESignalType signalType)
    {
        switch (signalType)
        {
        case ESignalType.StartPuzzle:
            UIStates.SetGroupState(UIStates.Group.EndGame, UIStates.State.Hidden);
            Game.SelectGame();
            SMTransition(signalType);
            break;

        case ESignalType.SelectBoard:
            UIStates.SetGroupState(UIStates.Group.EndGame, UIStates.State.Hidden);
            SMTransition(signalType);
            break;

        case ESignalType.Quit:
            SMTransition(signalType);
            break;
        }
    }
Example #21
0
        public override string ToHtmlString()
        {
            UIStates uiState = this.UIState();

            this.Aria("disabled", "false");

            this.AddClassWhen(uiState.HasFlag(UIStates.Primary), "ui-priority-primary");
            this.AddClassWhen(uiState.HasFlag(UIStates.Secondary), "ui-priority-secondary");
            this.AddClassWhen(uiState.HasFlag(UIStates.Highlight), "ui-state-highlight");
            this.AddClassWhen(uiState.HasFlag(UIStates.Active), "ui-state-active");
            this.AddClassWhen(uiState.HasFlag(UIStates.Error), "ui-state-error");

            this.BuildWhen(uiState.HasFlag(UIStates.Disabled),
                           x =>
            {
                x.Attr("disabled", "disabled");
                x.AddClass("ui-state-disabled");
                x.Aria("disabled", "true");
            });

            this.DefaultAttr("aria-role", "button");
            this.DefaultAttr("type", "button");

            this.DefaultProp("tagName", "button");

            var tagName = this.Prop <string>("tagName");

            var tagBuilder = new TagBuilder(tagName);

            if (string.Compare(tagName, "input", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                this.DefaultAttr("value", this.Val());
            }
            else
            {
                tagBuilder.InnerHtml = Convert.ToString(this.Val());
            }
            tagBuilder.MergeAttributes(HtmlAttributes, true);

            return(tagBuilder.ToString(TagRenderMode.Normal));
        }
Example #22
0
    protected virtual void OnStateChanged(UIStates.State newState)
    {
        if (state == newState)
            return;

        animator.ResetTrigger("Active");
        animator.ResetTrigger("Disabled");
        animator.ResetTrigger("Hidden");

        switch (newState)
        {
            case UIStates.State.Active:
                animator.SetTrigger("Active");
                break;
            case UIStates.State.Disabled:
                animator.SetTrigger("Disabled");
                break;
            case UIStates.State.Hidden:
                animator.SetTrigger("Hidden");
                break;
        }

        state = newState;
    }
Example #23
0
    public void Tick()
    {
        switch (_gameController.State)
        {
        case GameStates.SelectingFaction:
            if (_uiState != UIStates.PickFaction)
            {
                resetUIState();
                _factionUI = _factionPickerFactory.Create();
                _uiState   = UIStates.PickFaction;
            }
            break;

        case GameStates.OfflineMode:                 // For now, offline mode and playing are same UI
        case GameStates.Playing:
            if (_uiState != UIStates.Playing)
            {
                resetUIState();
                if (_settings.ShowCoordinatesOnClick)
                {
                    _showCoodsUI = _showCoordsFactory.Create();
                }
                _uiState = UIStates.Playing;
            }
            break;

        case GameStates.Error:
            if (_uiState != UIStates.Error)
            {
                // User must quit the application to get out of this state :(
                _errorModalFactory.Create(_gameController.LastErrorMessage);
                _uiState = UIStates.Error;
            }
            break;
        }
    }
 public void SwitchToView()
 {
     currState = UIStates.View;
 }
Example #25
0
 private void OnTappedOnDone()
 {
     m_state = UIStates.GAME_RENDERING;
 }
Example #26
0
 private void OnTappedOnReset()
 {
     m_state = UIStates.RESET_ALL;
 }
Example #27
0
 private void OnCylinderTrackableFoundFirstTime()
 {
     m_state = UIStates.INIT_ANIMATION;
 }
Example #28
0
 void Awake()
 {
     UIState = gameObject.GetComponent<UIStates>();
     Signals = gameObject.GetComponent<Signals>();
 }
 //methods to change states
 public void SwitchToHome()
 {
     currState = UIStates.Home;
 }
 public void SwitchToChooseCar()
 {
     currState = UIStates.ChooseCar;
 }
Example #31
0
 public void AddStates ( UIStates[] newStates )
 {
     for ( int i = 0 ; i < newStates.Length ; i++ )
         AddState( ( int ) newStates[ i ] );
 }
Example #32
0
 public bool ContainsState ( UIStates state )
 {
     return ContainsState( ( int ) state );
 }
Example #33
0
 /// <summary>
 /// Sets the UIState property.
 /// </summary>
 public static TBuilder UIState <TBuilder>(this TBuilder instance,
                                           UIStates value) where TBuilder : IUIStateBuilder
 {
     return(instance.Prop("Build.Mvc.UIStates", value));
 }
Example #34
0
 public void RemoveState ( UIStates state )
 {
     RemoveState( ( int ) state );
 }
Example #35
0
 public void RemoveStates ( UIStates[] newStates )
 {
     for ( int i = 0 ; i < newStates.Length ; i++ )
         RemoveState( ( int ) newStates[ i ] );
 }
 public void SwitchToLights()
 {
     currState = UIStates.Lights;
 }
Example #37
0
 public void ClickedPlay()
 {
     menuScreen.SetActive(false);
     levelScreen.SetActive(true);
     state = UIStates.level;
 }
 public void SwitchToMaterials()
 {
     currState = UIStates.Materials;
 }
Example #39
0
 public void AddState ( UIStates newState )
 {
     if ( gameObject.activeInHierarchy )
         AddState( ( int ) newState );
 }
Example #40
0
    void Start()
    {
        Layout.defaultLayout = new Layout(Layout.pointy, new Point(layoutSize, layoutSize), new Point(0, 0));

        Signals = FindObjectOfType<Signals>();
        UIState = FindObjectOfType<UIStates>();

        Signals.AddListeners(OnUISignal, new List<Signal>() {
            Signal.RotateCCW,
            Signal.RotateUndo,
            Signal.RotateCW,
            Signal.EndTurn});

        players = new List<Player>();
        for (int i = 0; i < numPlayers; i++)
        {
            Player p = new Player();
            players.Add(p);
            p.Name = "Player" + i;
        }

        StartGame();
    }
Example #41
0
    //All the UI states are managed here.
    void OnGUI()
    {
        if (mErrorOccurred)
        {
            mPopUpMsg.Draw();
            return;
        }

        switch (m_state)
        {
            //Detection phase
            case UIStates.OVERLAY_OUTLINE:
                m_uiInput.UpdateTitle(HEADER_MESSAGE.POINT_THE_DEVICE);
                m_smartSurface.GetComponent<Renderer>().enabled = false;
                m_uiInput.DrawCylinderOutline();
                break;

            //Soda can ice animating phase
            case UIStates.INIT_ANIMATION:
                m_smartSurface.GetComponent<Renderer>().enabled = false;
                Ice anim = GameObject.FindObjectOfType(typeof(Ice)) as Ice;
                anim.Play();
                if (anim.DidFinishAnimation)
                {
                    m_smartSurface.GetComponent<Renderer>().enabled = m_smartTerrainTrackableHandler.m_trackablesFound;
                    m_state = UIStates.SCANNING;
                }
                break;

            //Scanning phase
            case UIStates.SCANNING:
                m_smartSurface.GetComponent<Renderer>().enabled = m_smartTerrainTrackableHandler.m_trackablesFound;
                m_uiInput.UpdateTitle(HEADER_MESSAGE.PULLBACK_SLOWLY);
                m_uiInput.DrawDoneButton();
                break;

            //Icebergs rendering phase - user taps on [DONE] button
            case UIStates.GAME_RENDERING:
                if ((m_reconstructionBehaviour != null) && (m_reconstructionBehaviour.Reconstruction != null))
                {
                    m_smartTerrainEventHandler.ShowPropClones();
                    m_reconstructionBehaviour.Reconstruction.Stop();
                    m_state = UIStates.GAME_PLAY;
                }
                break;

            //Penguin appears and user taps on surface to move the penguin around
            case UIStates.GAME_PLAY:
                if (m_smartTerrainEventHandler.propsCloned && !m_penguin.DidAppear)
                {
                    m_penguin.gameObject.SetActive(true);
                }

                if (m_penguin.DidAppear)
                {
                    //Update UI messaging
                    m_uiInput.UpdateTitle(HEADER_MESSAGE.TAP_ICE);
                    m_uiInput.DrawResetButton();
                }
                break;

            //User taps on [RESET] button - Re-loads the level
            case UIStates.RESET_ALL:

                //Go back to loading scene
                Application.LoadLevelAsync(1);
                m_state = UIStates.NONE;

                break;

            //just a placeholder state, to make sure that the previous state runs for just one frame.
            case UIStates.NONE: break;
        }
    }
 public void SwitchToEnvironment()
 {
     currState = UIStates.Environment;
 }
Example #43
0
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape) || Input.GetKeyUp(KeyCode.JoystickButton0))
        {
            #if UNITY_EDITOR
            UnityEditor.EditorApplication.isPlaying = false;
            #else
            Application.Quit();
            #endif
        }

        bool showOutline     = false;
        bool showDoneButton  = false;
        bool showResetButton = false;

        switch (mState)
        {
        //Detection phase
        case UIStates.OVERLAY_OUTLINE:
            instructionsImage.texture = mPointDeviceTexture;
            mSmartSurface.GetComponent <Renderer>().enabled = false;
            showOutline = true;
            break;

        // Soda can ice animating phase
        case UIStates.INIT_ANIMATION:
            mSmartSurface.GetComponent <Renderer>().enabled = false;
            Ice anim = GameObject.FindObjectOfType <Ice>();
            anim.Play();
            if (anim.DidFinishAnimation)
            {
                mSmartSurface.GetComponent <Renderer>().enabled = mSTTrackableHandler.m_trackablesFound;
                mState = UIStates.SCANNING;
            }
            break;

        // Scanning phase
        case UIStates.SCANNING:
            mSmartSurface.GetComponent <Renderer>().enabled = mSTTrackableHandler.m_trackablesFound;
            instructionsImage.texture = mPullBackTexture;
            showDoneButton            = true;
            break;

        // Icebergs rendering phase - user taps on [DONE] button
        case UIStates.GAME_RENDERING:
            if ((mReconstructionBehaviour != null) && (mReconstructionBehaviour.Reconstruction != null))
            {
                mSTEventHandler.ShowPropClones();
                mReconstructionBehaviour.Reconstruction.Stop();
                mState = UIStates.GAME_PLAY;
            }
            break;

        //Penguin appears and user taps on surface to move the penguin around
        case UIStates.GAME_PLAY:
            if (mSTEventHandler.propsCloned && !penguin.DidAppear)
            {
                penguin.gameObject.SetActive(true);
            }

            if (penguin.DidAppear)
            {
                // Update UI messaging
                instructionsImage.texture = mTapIceTexture;
                showResetButton           = true;
            }
            break;

        //User taps on [RESET] button - Re-loads the level
        case UIStates.RESET_ALL:
            // Go back to loading scene
            int loadingScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex - 1;
            if (loadingScene < 0)
            {
                loadingScene = 0;
            }
            UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(loadingScene);

            mState = UIStates.NONE;
            break;

        // Just a placeholder state, to make sure that the previous state runs for just one frame.
        case UIStates.NONE: break;
        }

        if (cylinderOutline != null &&
            showOutline != cylinderOutline.enabled)
        {
            cylinderOutline.enabled = showOutline;
        }

        if (doneButton != null &&
            showDoneButton != doneButton.enabled)
        {
            doneButton.enabled       = showDoneButton;
            doneButton.image.enabled = showDoneButton;
            doneButton.gameObject.SetActive(showDoneButton);
        }

        if (resetButton != null &&
            showResetButton != resetButton.enabled)
        {
            resetButton.enabled       = showResetButton;
            resetButton.image.enabled = showResetButton;
            resetButton.gameObject.SetActive(showResetButton);
        }
    }