Ejemplo n.º 1
0
 void SecondDigit_TextChanged(object sender, EventArgs args)
 {
     if (SecondDigit.Text.Length > 0)
     {
         ThirdDigit.Focus();
     }
 }
Ejemplo n.º 2
0
 public override int GetHashCode()
 {
     return(FirstDigit.GetHashCode() ^ SecondDigit.GetHashCode() ^ ThirdDigit.GetHashCode() ^ FourthDigit.GetHashCode());
 }
Ejemplo n.º 3
0
    void OnGUI()
    {
        switch (CycleManager.jamState)
        {
            #region Main Menu
        case CycleState.MainMenu:
            if (GUI.Button(new Rect(Screen.width / 3, Screen.height - 250, Screen.width / 3, 100), "Begin CycleJam!"))
            {
                entriesNotPlayed = FindJamEntries();
                entriesPlayed.Clear();

                ResumePlay();

                //This is somewhat hacky. We only ever advance scenes through time running out.
                AdvanceToNext();
            }

            DrawQuitButton();

            #region Cycle Forever Button
            string buttonText = "Cycle Forever?\n";

            //Setting text based on which creates more personality.
            if (CycleManager.Instance.cycleForever)
            {
                buttonText += "Definitely";
            }
            else
            {
                buttonText += "Just once please.";
            }
            //Draw the button
            if (GUI.Button(new Rect(30, Screen.height - 170, 150, 40), buttonText))
            {
                //Toggle the boolean.
                CycleManager.Instance.cycleForever = !CycleManager.Instance.cycleForever;
            }
            #endregion

            #region Main Menu Digit Setting
            //A box for this little submenu
            GUI.Box(new Rect(10, Screen.height - 120, 190, 110), "Code Control");

            //A set of horizontal sliders for each. This uses some private floats to hold the values in the meantime.
            first  = GUI.HorizontalSlider(new Rect(20, Screen.height - 90, 150, 20), first, 0, 9);
            second = GUI.HorizontalSlider(new Rect(20, Screen.height - 70, 150, 20), second, 0, 9);
            third  = GUI.HorizontalSlider(new Rect(20, Screen.height - 50, 150, 20), third, 0, 9);
            fourth = GUI.HorizontalSlider(new Rect(20, Screen.height - 30, 150, 20), fourth, 0, 9);

            //We assign our digit values the integer values. The reason this works is because it keeps assigning the float to 3.4, but once it moves to 3.6, it will round up to 4, creating a integer slider.
            FirstDigit  = (int)first;
            SecondDigit = (int)second;
            ThirdDigit  = (int)third;
            FourthDigit = (int)fourth;

            //Reassign our new value so the slider snaps to integer values every frame.
            first  = (int)first;
            second = (int)second;
            third  = (int)third;
            fourth = (int)fourth;

            //Draw labels with the Digits so the user can easily see what values they have selected.
            GUI.Label(new Rect(180, Screen.height - 95, 10, 20), FirstDigit.ToString());
            GUI.Label(new Rect(180, Screen.height - 75, 10, 20), SecondDigit.ToString());
            GUI.Label(new Rect(180, Screen.height - 55, 10, 20), ThirdDigit.ToString());
            GUI.Label(new Rect(180, Screen.height - 35, 10, 20), FourthDigit.ToString());
            #endregion
            break;
            #endregion

            #region Paused
        case CycleState.Paused:

            //Contains no base pause menu currently. Individual devs make a pause menu on top of this.
            GUI.Box(new Rect(-5, -5, Screen.width + 5, Screen.height + 5), "");


            DrawTimeRemaining();

            //Pause menu elements
            DrawNextButton();
            DrawStopClockButton();
            DrawQuitButton();
            break;
            #endregion

            #region Playing
        case CycleState.Playing:

            DrawTimeRemaining();
            break;
            #endregion

            #region End
        case CycleState.End:
            //Need a way to reset to main menu to keep the play loop going.
            if (GUI.Button(new Rect(Screen.width / 3, Screen.height - 60, Screen.width / 3, 40), "Back to Main Menu!"))
            {
                ResumePlay();
                CycleManager.jamState = CycleState.MainMenu;
                Application.LoadLevel(0);
            }

            DrawQuitButton();
            break;
            #endregion
        }

#if UNITY_EDITOR
        //Will only draw in the editor. Will not draw in built versions
        DrawDebugInfo(CycleManager.jamState.ToString() + "\n" + GetDigitString());
#else
        if (Debug.isDebugBuild)
        {
            DrawDebugInfo(CycleManager.jamState.ToString() + "\n" + GetDigitString());
        }
#endif
    }