public static event Action OnInitFinish;                                                    // On Init Finish event.
    #endregion

    #region Methods

    #region Unity Callback Methods
    private void Awake()
    {
        if (_instance == null || _instance != this)
        {
            _instance = this;
        }
    }
    private static void PollForOffsetInput()
    {
        if (GameplayUIManager.ScrollUp()) // scroll up
        {
            if (Input.GetButton("Mod"))
            {
                PlacingOffset.y++;
            }
            else
            {
                PlacingOffset.x++;
            }
        }

        if (GameplayUIManager.ScrollDown())
        {
            if (Input.GetButton("Mod"))
            {
                PlacingOffset.y--;
            }
            else
            {
                PlacingOffset.x--;
            }
        }

        if (Input.GetButtonDown("ResetBoardOffset")) // middle click
        {
            PlacingOffset = Vector2Int.zero;
        }

        CapPlacingOffset();
    }
Example #3
0
 private void Awake()
 {
     if (current != null)
     {
         Debug.LogWarning("There is more then on GameplayUIHandler in the scene");
     }
     current = this;
 }
Example #4
0
    // the slider triggers this when it updates
    public void UpdateOctave()
    {
        OctavesAbove0 = (int)OctavesSlider.value;
        UpdateFrequency();

        OctavesLabel.text = "Octave: " + OctavesSlider.value.ToString();

        GameplayUIManager.DeselectAllUIElements();
    }
Example #5
0
    public void RunDisplayColorMenu()
    {
        if (Input.GetButtonDown("Cancel")) { DoneMenu(); }

        int numberkey = GameplayUIManager.NumberKey();
        if(numberkey != -1 && numberkey < 7)
        {
            SetNewDisplayColor((DisplayColor)numberkey + 1);
        }
    }
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         DestroyImmediate(this);
     }
 }
Example #7
0
    public void ResumeGame()
    {
        PauseCanvas.enabled   = false;
        OptionsCanvas.enabled = false;
        AboutCanvas.enabled   = false;

        GameplayUIManager.DeselectAllUIElements();

        Time.timeScale            = 1;
        GameplayUIManager.UIState = UIState.None;
    }
Example #8
0
    public void RunNoisemakerMenu()
    {
        if (SelectedThingJustChanged)
        {
            SetNote(SelectedThing);
        }

        // when scrolling past the end of the notes, change the octave if appropriate
        if (GameplayUIManager.ScrollUp() && SelectedThing == 0)
        {
            OctavesSlider.value--; // will automatically prevent us from going below the min
        }
        if (GameplayUIManager.ScrollDown() && SelectedThing == 11)
        {
            OctavesSlider.value++;
        }

        if (Input.GetButton("Mod"))
        {
            if (GameplayUIManager.ScrollDown())
            {
                OctavesSlider.value--;
            }
            if (GameplayUIManager.ScrollUp())
            {
                OctavesSlider.value++;
            }
        }
        else
        {
            ScrollThroughMenu();
        }

        // hotkeys
        if (Input.GetButtonDown("Jump") || Input.GetButtonDown("Submit") || Input.GetButtonDown("Confirm"))
        {
            Done();
        }

        if (Input.GetButtonDown("Cancel"))
        {
            // revert, and close the menu without setting a new FrequencyForNewNoisemakers
            Revert();
            Canvas.enabled            = false;
            GameplayUIManager.UIState = UIState.None;
        }

        PollForKeyCodes();
    }
    public static bool AllowedToUpdate = true; // set to false and then back to true by SaveManager.LoadAll to make sure circuitry doesn't run before it's finished loading.

    private void Update()
    {
        ScreenshotTaker.RunScreenshotTaking();

        if (!AllowedToUpdate)
        {
            return;
        }

        GameplayUIManager.RunGameplayUI();

        CircuitLogicUpdate.Update(); // might affect VisualStuffUpdate
        VisualStuffUpdate();         // might affect mega mesh stuff

        MeshQueueing.Update();
        RecalculateQueuedMegaMeshGroups();
    }
 private void Awake()
 {
     _puzzles                = FindObjectsOfType <Puzzle>();
     playerControlManager    = GetComponent <PlayerControlManager>();
     fpsController           = FindObjectOfType <FirstPersonController>();
     controllerManager       = GetComponent <ControllerManager>();
     brightness              = FindObjectOfType <Brightness>();
     postProcessingManager   = GetComponent <PostProcessingManager>();
     postProcessingBehaviour = FindObjectOfType <PostProcessingBehaviour>();
     blackScreen             = GameObject.Find("BlackFade");
     power                  = GetComponent <Power>();
     cursorManager          = GetComponent <CursorManager>();
     gameplayUIManager      = FindObjectOfType <GameplayUIManager>();
     videoSettingsManager   = FindObjectOfType <VideoSettingsManager>();
     loadingScreen          = FindObjectOfType <LoadingScreen>();
     audioSettingsManager   = FindObjectOfType <AudioSettingsManager>();
     controlSettingsManager = FindObjectOfType <ControlSettingsManager>();
 }
Example #11
0
    public bool SelectedThingJustChanged; // used for when action is needed when the player scrolls (i.e. opening a menu). True during a single frame when UpdateSelectedThing has been run
    // TODO change to an abstract void now that I know what those are :P

    public void ScrollThroughMenu()
    {
        SelectedThingJustChanged = false;

        // move selected thing
        if (GameplayUIManager.ScrollUp())
        {
            if (SelectedThing > 0)
            {
                SelectedThing--; // go to the previous thing
            }
            else
            {
                SelectedThing = MaxSelectedThing; // allows the scrolling to loop
            }
            UpdateSelectedThing();
        }

        if (GameplayUIManager.ScrollDown())
        {
            if (SelectedThing < MaxSelectedThing)
            {
                SelectedThing++; // go to the next thing
            }
            else
            {
                SelectedThing = 0; // allows the scrolling to loop
            }
            UpdateSelectedThing();
        }

        // number key selection
        int selectkey = GameplayUIManager.NumberKey();

        if (selectkey != -1 && selectkey <= MaxSelectedThing)
        {
            SelectedThing = selectkey;
            UpdateSelectedThing();
        }
    }
Example #12
0
    public void RunStackBoardMenu()
    {
        if (Input.GetButtonDown("Cancel") || Input.GetButtonDown("Delete"))
        {
            Done();
        }
        if (Input.GetButtonDown("Confirm") || Input.GetButtonDown("BoardMenu") || Input.GetButtonDown("Place"))
        {
            Place();
        }

        if (GameplayUIManager.ScrollUp(false))
        {
            IterationsSlider.value++;
        }
        if (GameplayUIManager.ScrollDown(false))
        {
            IterationsSlider.value--;
        }

        PollForStackingDirectionInput();
    }
Example #13
0
    public void RunTextMenu()
    {
        if (GameplayUIManager.ScrollDown())
        {
            if (SizeSlider.value > 1)
            {
                SizeSlider.value--;
            }
        }

        if (GameplayUIManager.ScrollUp())
        {
            if (SizeSlider.value < SizeSlider.maxValue)
            {
                SizeSlider.value++;
            }
        }

        if (Input.GetButtonDown("Cancel"))
        {
            Done();
        }
    }
Example #14
0
 private void Awake()
 {
     _gameplayUIManager = FindObjectOfType <GameplayUIManager>();
 }
Example #15
0
    public void RunNewBoardMenu()
    {
        // caching system makes sure a new board is only generated on frames where it matters
        if (PreviousSizeX != SizeX || CachedSizeY != SizeY)
        {
            BoardFunctions.CreateNewBoard(SizeX, SizeY);
        }
        PreviousSizeX = SizeX;
        CachedSizeY   = SizeY;

        // create the menu if space or enter or V are pressed
        if (Input.GetButtonDown("Jump") || Input.GetButtonDown("Submit") || Input.GetButtonDown("BoardMenu") || Input.GetButtonDown("Confirm")) // the last check is so you can place the same new board by double tapping v
        {
            Done();
        }

        // cancel if esc is pressed
        if (Input.GetButtonDown("Cancel"))
        {
            Done(true);
        }

        // tab between input fields
        if (Input.GetButtonDown("tab"))
        {
            if (SizeXInput.isFocused)
            {
                SizeYInput.ActivateInputField();
            }
            else
            {
                SizeXInput.ActivateInputField();
            }
        }

        if (GameplayUIManager.ScrollUp(false))
        {
            if (Input.GetButton("Mod"))
            {
                SizeXSlider.value += 1;
            }
            else
            {
                SizeYSlider.value += 1;
            }
        }

        if (GameplayUIManager.ScrollDown(false))
        {
            if (Input.GetButton("Mod"))
            {
                SizeXSlider.value -= 1;
            }
            else
            {
                SizeYSlider.value -= 1;
            }
        }

        // lets you rotate in the new board menu
        StuffPlacer.PollRotationInput();
        BoardPlacer.PollForBoardRotation();
        BoardPlacer.PollForBoardFlatness();

        RaycastHit hit;

        if (Physics.Raycast(FirstPersonInteraction.Ray(), out hit, Settings.ReachDistance))
        {
            StuffPlacer.MoveThingBeingPlaced(hit, false, true);
        }
    }
Example #16
0
 // Use this for initialization
 void Awake()
 {
     if(instance == null)
     {
         instance = this;
     }
     else
     {
         DestroyImmediate(this);
     }
 }
Example #17
0
 private void Awake()
 {
     instance = this;
 }