void StateChanged(String mode)
 {
     if (mode.Equals("Recording"))
     {
         if (recorder)
         {
             recorder.Reset();
             recorder.mode = RecordAvatar.Mode.Recording;
         }
         timer    = Time.time + recordingTime;
         uiActive = true;
     }
     else
     {
         uiActive = false;
     }
 }
Exemple #2
0
    void OnGUI()
    {
        if (true)//Event.current.type == EventType.Repaint)
        {
            if (mode == Mode.WaitingForDetails)
            {
                if (mgr != null)
                {
                    mgr.Enabled = false;
                }

                GUILayout.BeginArea(new Rect(Screen.width * 0.02f, Screen.height * 0.02f, Screen.width * 0.5f, Screen.height * 0.1f), areaStyle);

                GUILayout.FlexibleSpace();
                // Make a background box

                GUILayout.BeginHorizontal();
                GUILayout.Label("Enter dancer's name:", textStyle);
                currentUser = GUILayout.TextField(currentUser);
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Enter name for the phrase:", textStyle);
                currentPhrase = GUILayout.TextField(currentPhrase);
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Go"))
                {
                    if (timed)
                    {
                        timer = Time.time + delayTime;
                        mode  = Mode.DelayedStart;
                    }
                    else
                    {
                        mode = Mode.Recording;
                        if (recorder)
                        {
                            recorder.Reset();
                            recorder.mode = RecordAvatar.Mode.Recording;
                        }
                    }
                }

                // End the group we started above. This is very important to remember!
                GUILayout.FlexibleSpace();

                GUILayout.EndArea();
            }
            else if (mode == Mode.DelayedStart)
            {
                if (Time.time > timer)
                {
                    timer = Time.time + recordTime;
                    mode  = Mode.Recording;
                    if (recorder)
                    {
                        recorder.Reset();
                        recorder.mode = RecordAvatar.Mode.Recording;
                    }
                }
                else
                {
                    float timeRemaining = timer - Time.time;
                    GUILayout.BeginArea(new Rect(Screen.width * 0.02f, Screen.height * 0.02f, Screen.width * 0.5f, Screen.height * 0.1f), areaStyle);

                    GUILayout.Label("Starting in " + timeRemaining + "s", textStyle);


                    GUILayout.EndArea();
                }
            }
            else if (mode == Mode.Recording)
            {
                if (mgr != null)
                {
                    mgr.Enabled = true;
                }

                GUILayout.BeginArea(new Rect(Screen.width * 0.02f, Screen.height * 0.02f, Screen.width * 0.3f, Screen.height * 0.1f), areaStyle);
                if (timed)
                {
                    if (Time.time > timer)
                    {
                        mode = Mode.WaitingForDetails;
                    }
                    float timeRemaining = timer - Time.time;

                    GUILayout.Label("Stopping in " + timeRemaining + "s", textStyle);
                }
                else
                {
                    if (GUILayout.Button("Stop"))
                    {
                        mode = Mode.WaitingForDetails;
                    }
                }


                GUILayout.EndArea();
            }
        }
    }