Beispiel #1
0
    void menuEnd(bool scrolling = true)
    {
        GUI.color = Color.white;

        if (scrolling)
        {
            GUILayout.EndScrollView();
        }

        if (GUILayout.Button(GoToMainMenu))
        {
            switch (Mode)
            {
            case HudMode.About:
                aboutMenu.ShowingFarFuture = false;
                scrollPos = Vector2.zero;                         // should we reset this for ALL modes?
                break;

            case HudMode.ConnectionError:
                Network.Disconnect();
                break;

            case HudMode.Settings:
                net.LocEnt.name = PlayerPrefs.GetString("PlayerName", defaultName);
                break;
            }

            Mode = HudMode.MainMenu;
        }

        GUILayout.EndArea();
    }
Beispiel #2
0
    void Update()
    {
        // periodically check for servers
        if (!net.Connected)
        {
            if (serverSearch + 5f < Time.time)
            {
                serverSearch = Time.time;
                lookForServer();
            }
        }

        // see if escaping company logo splash
        if (CcInput.Started(UserAction.Menu) ||         // wanna bring up menu from ANY other mode
            Mode == HudMode.SplashLogos &&
            CcInput.Started(UserAction.Activate)        // allow alt splash screen escape
            )
        {
            if (Mode == HudMode.MainMenu)
            {
//				if (net.Connected)
//					Mode = HudMode.Playing;
            }
            else
            {
                Mode = HudMode.MainMenu;
            }
        }

        if (CcInput.Started(UserAction.Scores))
        {
            playMode.ShowingScores = !playMode.ShowingScores;
        }
    }
Beispiel #3
0
 public void SetHudMode(HudMode mode)
 {
     if (mHudMode != mode)
     {
         mHudMode = mode;
         UpdateUI();
     }
 }
Beispiel #4
0
 public void SetStateAndHudMode(State state, HudMode mode)
 {
     if (mState != state || mHudMode != mode)
     {
         mState   = state;
         mHudMode = mode;
         UpdateUI();
     }
 }
Beispiel #5
0
    void drawSettings()
    {
        // warn people changes can be ignored
        if (net.Connected)
        {
            S.SetShoutyColor();
            GUI.Box(new Rect(Screen.width / 3, 0, Screen.width / 3 * 2, 80), "Currently, you have to change AVATAR settings while disconnected \n for changes to be networked");
        }

        menuBegin();

        // allow sidestepping to control config screen
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Configure Mouse & Keys, or Controller"))
        {
            Mode = HudMode.Controls;
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        // misc settings
        // gun bob
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        net.gunBobbing = TickBox.Display(net.gunBobbing, "Gun bobbing");
        if (net.gunBobbing)
        {
            PlayerPrefs.SetInt("GunBobbing", 1);
        }
        else
        {
            PlayerPrefs.SetInt("GunBobbing", 0);
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        // chat fade
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        SizedLabel("Chat/Log fade time:   ");
        Log.FadeTime = (float)S.GetInt(GUILayout.TextField(Log.FadeTime.ToString()));
        PlayerPrefs.SetFloat("textFadeTime", Log.FadeTime);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        // audio
        //categoryHeader("Audio");
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label("Master Volume:   ");
        Sfx.VolumeMaster = GUILayout.HorizontalSlider(Sfx.VolumeMaster, 0.0f, 1f, GUILayout.MinWidth(128));
        PlayerPrefs.SetFloat("MasterVolume", Sfx.VolumeMaster);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        // FOV slider
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        var   s   = "FOV (field of view): ";
        float wid = GetWidthLabel(s + "188.8");

        GUILayout.Label(s + locUser.FOV.ToString("#.#"), GUILayout.MinWidth(wid));
        locUser.FOV = GUILayout.HorizontalSlider(locUser.FOV, 50f, 180f, GUILayout.MinWidth(128));
        if (net.Connected)
        {
            net.LocEnt.Actor.FOV = locUser.FOV;
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        // graphics
        //categoryHeader("Graphics");
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Full screen"))
        {
            Screen.SetResolution(fsWidth, fsHeight, true);
        }
        GUILayout.Label("(");
        fsWidth = S.GetInt(GUILayout.TextField(fsWidth.ToString()));
        GUILayout.Label("X");
        fsHeight = S.GetInt(GUILayout.TextField(fsHeight.ToString()));
        GUILayout.Label(")");
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        // avatar settings
        CategoryHeader("Avatar");
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        SizedLabel("Name:   ");
        net.LocEnt.name = GUILayout.TextField(net.LocEnt.name);
        if (net.LocEnt.name.Length > 20)
        {
            net.LocEnt.name = net.LocEnt.name.Substring(0, 20);
        }
        net.LocEnt.name = FormatName(net.LocEnt.name);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        innerScrollPos = GUILayout.BeginScrollView(innerScrollPos);

        // head slider
        float hss = 1f / (int)Head.Count;         // head slider span

        net.LocEnt.headType = (int)(headSliderPos / hss);
        GUILayout.BeginHorizontal();
        float w = GetWidthLabel(S.GetSpacedOut("" + Head.ElephantHeadMesh));

        GUILayout.Label(S.GetSpacedOut("" + (Head)net.LocEnt.headType), GUILayout.MaxWidth(w));
        headSliderPos = GUILayout.HorizontalSlider(headSliderPos, 0f, 1f);
        GUILayout.EndHorizontal();

        // colour sliders
        GUILayout.BeginHorizontal();
        GUI.color = net.LocEnt.colA;
        GUILayout.Box(Pics.White);
        GUI.color = net.LocEnt.colB;
        GUILayout.Box(Pics.White);
        GUI.color = net.LocEnt.colC;
        GUILayout.Box(Pics.White);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUI.color = net.LocEnt.colA;
        GUILayout.Box("Colour A");
        GUI.color = net.LocEnt.colB;
        GUILayout.Box("Colour B");
        GUI.color = net.LocEnt.colC;
        GUILayout.Box("Colour C");
        GUILayout.EndHorizontal();

        colorSliders();

        GUI.color = Color.white;
        GUILayout.EndScrollView();
        menuEnd();

        // now just save player
        if (net.LocEnt.name != "" && net.LocEnt.name != " ")
        {
            PlayerPrefs.SetString("PlayerName", net.LocEnt.name);
        }
        else
        {
            PlayerPrefs.SetString("PlayerName", defaultName);
        }

        PlayerPrefs.SetFloat("FOV", locUser.FOV);
        PlayerPrefs.SetInt("PlayerHead", net.LocEnt.headType);
        // the 3 user chosen colors
        PlayerPrefs.SetFloat("PlayerColA_R", net.LocEnt.colA.r);
        PlayerPrefs.SetFloat("PlayerColA_G", net.LocEnt.colA.g);
        PlayerPrefs.SetFloat("PlayerColA_B", net.LocEnt.colA.b);
        PlayerPrefs.SetFloat("PlayerColB_R", net.LocEnt.colB.r);
        PlayerPrefs.SetFloat("PlayerColB_G", net.LocEnt.colB.g);
        PlayerPrefs.SetFloat("PlayerColB_B", net.LocEnt.colB.b);
        PlayerPrefs.SetFloat("PlayerColC_R", net.LocEnt.colC.r);
        PlayerPrefs.SetFloat("PlayerColC_G", net.LocEnt.colC.g);
        PlayerPrefs.SetFloat("PlayerColC_B", net.LocEnt.colC.b);
    }