Пример #1
0
    public override void render()
    {
        GUILayout.BeginArea(usersArea);
        lobbyScroll = GUILayout.BeginScrollView(lobbyScroll);
        foreach (PlayerInfo p in Connections.GetInstance().players.Values)
        {
            GUI.color = Connections.GetInstance().playerColors[p.id];
            GUILayout.BeginHorizontal();
            string text = p.name;
            GUIShadow.LayoutLabel(text, GUILayout.Width(300));
            GUI.color = Color.white;
            GUIShadow.LayoutLabel(p.ready ? "Ready" : "Not ready");
            GUILayout.EndHorizontal();
        }
        GUILayout.EndScrollView();

        if (Connections.GetInstance().localPlayers.Count > 1 &&
            GUILayout.Button("Remove local player"))
        {
            Connections.GetInstance().KickLocalPlayer();
        }
        if (GUILayout.Button("Add local player"))
        {
            Connections.GetInstance().AddLocalPlayer();
        }
        GUILayout.EndArea();

        foreach (Button b in buttons)
        {
            b.update(data);
        }

        if (Network.isServer)
        {
            host.update(data);
        }
        else
        {
            ready.update(data);
        }
    }
Пример #2
0
    void OnGUI()
    {
        GUI.matrix = matrix;
        if (skin != null)
        {
            GUI.skin = skin;
        }



        if (Options.dynamicHud)
        {
            float rotate = Time.time;
            RotateAroundDraw(rotate * spinner_TR_speed, spinner_TR_rect, spinner_TR_tex);
            RotateAroundDraw(rotate * spinner_BL_speed, spinner_BL_rect, spinner_BL_tex);
        }
        else
        {
            GUI.DrawTexture(spinner_TR_rect, spinner_TR_tex);
            GUI.DrawTexture(spinner_BL_rect, spinner_BL_tex);
        }

        ambulance_list.gui();

        if (Input.GetKey(KeyCode.Tab))
        {
            playas.Sort(delegate(PlayerInfo p1, PlayerInfo p2)
            {
                int winDiff = p2.wins.CompareTo(p1.wins);
                if (winDiff != 0)
                {
                    return(winDiff);
                }
                else
                {
                    return(p2.kills.CompareTo(p1.kills));
                }
            });

            GUILayout.BeginArea(area, GUI.skin.box);
            GUILayout.BeginHorizontal();
            GUIShadow.LayoutLabel("Name", GUILayout.Width(250));
            GUIShadow.LayoutLabel("Wins");
            GUIShadow.LayoutLabel("Kills");
            GUILayout.EndHorizontal();


            foreach (PlayerInfo p in playas)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Box(playerIcons[p.id], skin.customStyles[0]);
                GUI.color = Connections.GetInstance().playerColors[p.id];
                GUIShadow.LayoutLabel(p.name, GUILayout.Width(250));       // Player name
                GUI.color = Color.white;
                GUIShadow.LayoutLabel(p.wins.ToString());                  // Player wins
                GUIShadow.LayoutLabel(p.kills.ToString());                 // Player kills
                GUILayout.EndHorizontal();
            }
            // }
            GUILayout.EndArea();
        }
        float f = 1.0f;

        if (HUDSingleton.instance.onFire)
        {
            f = Random.Range(0.9f, 1.1f);
        }

        if (Connections.GetInstance().localPlayers.Count == 1)
        {
            float perc = accelloCurve.Evaluate(HUDSingleton.instance.speed / est_maxSpeed);
            speedometer_mat.SetFloat("_Cutoff", perc);
            if (Event.current.rawType == EventType.repaint)
            {
                Graphics.DrawTexture(speedometer_rect, speedometer_mat.mainTexture, speedometer_mat);
            }
            GUI.Label(speedometer_textrect, (int)(perc * (quote_maxSpeed_endquote + (float)Random.Range(0, 2))) + "", GUI.skin.customStyles [1]);              //
        }

        else
        {
            randomSpeed = Mathf.Lerp(randomSpeed, Random.Range(0f, 1f), 3 * Time.deltaTime);
            speedometer_mat.SetFloat("_Cutoff", randomSpeed);
            if (Event.current.rawType == EventType.repaint)
            {
                Graphics.DrawTexture(speedometer_rect, speedometer_mat.mainTexture, speedometer_mat);
            }
            GUIUtility.ScaleAroundPivot(Vector2.one, speedometer_rect.center);
            GUI.Label(speedometer_textrect, "N/A", GUI.skin.customStyles [1]);              //
        }

        GUI.DrawTexture(gurka_rect, gurka_tex);

        if (currentAnnouncement != null)
        {
            GUI.DrawTexture(announcerRect, currentAnnouncement);
        }

        if (HUDSingleton.instance.onFire && Options.dynamicHud)
        {
            GUIUtility.ScaleAroundPivot(Vector2.one * f, nosmoke_rect.center);
        }
        GUI.DrawTexture(nosmoke_rect, nosmoke_tex);
        if (HUDSingleton.instance.onFire && Options.dynamicHud)
        {
            GUIUtility.ScaleAroundPivot(Vector2.one * (1 / f), nosmoke_rect.center);
        }

        GUI.DrawTexture(BACKGROUND_AREA, statics);

        if (menuActive)
        {
            current.render();
        }
    }