コード例 #1
0
ファイル: LatencyCheckerLine.cs プロジェクト: jottap/SyncUtil
        public virtual void DebugMenu()
        {
            enabled = GUILayout.Toggle(enabled, "LatencyChckerLine");

            if (enabled)
            {
                GUIUtil.Indent(() =>
                {
                    _width = GUIUtil.Slider(_width, 0f, 20f, "width");

                    using (var h = new GUILayout.HorizontalScope())
                    {
                        _timeEnable = GUILayout.Toggle(_timeEnable, "Time");
                        _timeStride = GUIUtil.Slider(_timeStride, 0.1f, 10f, "Stride");
                    }

                    using (var h = new GUILayout.HorizontalScope())
                    {
                        _networkTimeEnable = GUILayout.Toggle(_networkTimeEnable, "NetworkTime");
                        _networkTimeStride = GUIUtil.Slider(_networkTimeStride, 0.1f, 10f, "Stride");
                    }

                    DebugMenuInternal();

                    _datas.ForEach(data =>
                    {
                        using (var h = new GUILayout.HorizontalScope())
                        {
                            data.enable = GUILayout.Toggle(data.enable, data.name);
                            data.mode   = GUIUtil.Field(data.mode);
                        }
                    });
                });
            }
        }
コード例 #2
0
ファイル: SyncParamExample.cs プロジェクト: jottap/SyncUtil
 public void DebugMenu()
 {
     GUILayout.Label("SyncParamExample");
     GUIUtil.Indent(() =>
     {
         _bool    = GUIUtil.Field(_bool, "bool");
         _int     = GUIUtil.Field(_int, "int");
         _uint    = GUIUtil.Field(_uint, "uint");
         _float   = GUIUtil.Field(_float, "float");
         _string  = GUIUtil.Field(_string, "string");
         _vector2 = GUIUtil.Field(_vector2, "vector2");
         _vector3 = GUIUtil.Field(_vector3, "vector3");
         _vector4 = GUIUtil.Field(_vector4, "vector4");
     });
 }
コード例 #3
0
        public void DebugMenu()
        {
            using (var h = new GUILayout.HorizontalScope())
            {
                GUILayout.Label("NetworkManagerController");
                GUILayout.Label(SyncNet.isHost ? "Host" : (SyncNet.isServer ? "Server" : (SyncNet.isClient ? "Client" : "StandAlone")));
                if (SyncNet.isActive)
                {
                    if (GUILayout.Button("Disconnect"))
                    {
                        NetworkManager.Shutdown();
                    }
                }
            }

            GUIUtil.Indent(() =>
            {
                DebugMenuInternal();

                if (_fold == null)
                {
                    _fold = new GUIUtil.Fold("Time Debug", () =>
                    {
                        GUILayout.Label(string.Format("SyncTime: {0:0.000}", SyncNet.time));
                        //GUILayout.Label(string.Format("Network.time Synced/Orig: {0:0.000} / {1:0.000}", SyncNet.networkTime, Network.time));

                        LatencyChecker.Instance._conectionLatencyTable.ToList().ForEach(pair =>
                        {
                            var data = pair.Value;
                            GUILayout.Label(string.Format("ConnId: {0}  Latency: {1:0.000} Average:{2:0.000} " + (data._recieved ? "✔" : ""), pair.Key, data.Last, data.average));
                        });
                    });
                }

                _fold.OnGUI();
            });
        }
コード例 #4
0
        public virtual void OnGUI()
        {
            if (_networkManager != null && !_networkManager.isNetworkActive)
            {
                GUILayout.Label("SyncUtil Manual Boot");

                GUIUtil.Indent(() =>
                {
                    OnGUINetworkSetting();

                    var mgr          = _networkManager;
                    mgr.useSimulator = GUILayout.Toggle(mgr.useSimulator, "UseSimulator");
                    if (mgr.useSimulator)
                    {
                        GUIUtil.Indent(() =>
                        {
                            mgr.simulatedLatency     = GUIUtil.Slider(mgr.simulatedLatency, 1, 400, "Latency[msec]");
                            mgr.packetLossPercentage = GUIUtil.Slider(mgr.packetLossPercentage, 0f, 20f, "PacketLoss[%]");
                        });
                    }

                    if (GUILayout.Button("Host"))
                    {
                        OnNetworkStartByManual(); StartNetwork(BootType.Host);
                    }
                    if (GUILayout.Button("Client"))
                    {
                        OnNetworkStartByManual(); StartNetwork(BootType.Client);
                    }
                    if (GUILayout.Button("Server"))
                    {
                        OnNetworkStartByManual(); StartNetwork(BootType.Server);
                    }
                });
            }
        }