Example #1
0
        protected override void OnEnable()
        {
            var setting = new Setting()
            {
                localPort           = this.localPort,
                defaultRemoteHost   = this.defaultRemoteHost,
                defaultRemotePort   = this.defaultRemotePort,
                limitReceiveBiuffer = this.limitReceiveBuffer
            };

            SettingManager.AddSettingMenu(setting, "OscControll/setting.json");
            SettingManager.AddExtraGuiFunc(ShowReceivedOscOnGUI);
            _oscEventMap = oscEvents.ToDictionary(b => b.path, b => b.onOsc);
            try
            {
                base.OnEnable();

                _udp = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                _udp.Bind(new IPEndPoint(IPAddress.Any, localPort));

                _receiveBuffer = new byte[BUFFER_SIZE];

                _reader = new Thread(Reader);
                _reader.Start();
            }
            catch (System.Exception e)
            {
                RaiseError(e);
                enabled = false;
            }
        }
Example #2
0
 void Start()
 {
     fpsStr            = fps.ToString();
     superSizeStr      = superSize.ToString();
     stopFramecountStr = stopFramecount.ToString();
     SettingManager.AddExtraGuiFunc(DrawControllGUI);
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     SettingManager.AddSettingMenu(setting, SettingFolderPath + targetMesh.name + "_infoTex.json");
     SettingManager.AddExtraGuiFunc(ViewTexture);
     generatedTexes = GeneratePositionNormalTexture(targetMesh, setting.texWidth, setting.texHeight);
     onCreatePositionTex.Invoke(generatedTexes[0]);
     onCreateNormalTex.Invoke(generatedTexes[1]);
 }
        static void RegisterHandlerToClient()
        {
            if (handlerList == null)
            {
                return;
            }
            var msgType = MsgType.Highest;

            handlerMap = handlerList.OrderBy(handler => GetIdentifier(handler)).ToDictionary(b => ++ msgType, b => b);
            foreach (var pair in handlerMap)
            {
                client.RegisterHandler(pair.Key, pair.Value);
            }
            SettingManager.AddExtraGuiFunc(ShowNetworkMessageInfo);
        }
Example #5
0
        protected override void OnEnable()
        {
            var setting = new Setting()
            {
                localPort           = this.localPort,
                defaultRemoteHost   = this.defaultRemoteHost,
                defaultRemotePort   = this.defaultRemotePort,
                limitReceiveBiuffer = this.limitReceiveBuffer
            };

            SettingManager.AddSettingMenu(setting, settingFilePath);
            SettingManager.AddExtraGuiFunc(ShowReceivedOscOnGUI);
            foreach (var oscEvent in oscEvents)
            {
                var path  = oscEvent.path;
                var onOsc = oscEvent.onOsc;
                for (var i = 0; i < onOsc.GetPersistentEventCount(); i++)
                {
                    var target   = onOsc.GetPersistentTarget(i);
                    var method   = onOsc.GetPersistentMethodName(i);
                    var callback = new OscCallback(target, method);
                    AddCallback(path, callback);
                }
            }

            try
            {
                base.OnEnable();

                _udp = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                _udp.Bind(new IPEndPoint(IPAddress.Any, localPort));

                _receiveBuffer = new byte[BUFFER_SIZE];

                _reader = new Thread(Reader);
                _reader.Start();
                if (dontDestroyOnLoad)
                {
                    DontDestroyOnLoad(gameObject);
                }
            }
            catch (System.Exception e)
            {
                RaiseError(e);
                enabled = false;
            }
        }