예제 #1
0
    void OnGUI()
    {
        int w = Screen.width;
        int h = Screen.height;

        int height = h * 2 / 70;

        GUIStyle style = new GUIStyle();

        style.alignment        = TextAnchor.UpperRight;
        style.fontSize         = height;
        style.normal.textColor = new Color(200.0f, 200.0f, 220.0f);

        float msec = deltaTime * 1000.0f;
        float fps  = 1.0f / deltaTime;

        string text = string.Format("{0:0.0} ms ({1:0.}) fps", msec, fps);
        Rect   rect = new Rect(0, 0, w, height);

        GUI.Label(rect, text, style);

        BUStats stats = bu.GetStats();
        string  stext = string.Format("pings: {0} ws, {1} udp", stats.WsPing, stats.UdpPing);
        Rect    rect2 = new Rect(0, height, w, height);

        GUI.Label(rect2, stext, style);
    }
예제 #2
0
    public BUStats GetStats()
    {
        BUStats stats = new BUStats();

        if (rgc != null)
        {
            stats.WsPing = rgc.GetPing();
        }

        if (rgc.GetUdpSubClient() != null)
        {
            stats.UdpPing = rgc.GetUdpSubClient().GetPing();
        }

        return(stats);
    }