Beispiel #1
0
 void Start()
 {
     uOscClient        = this.GetComponent <uOSC.uOscClient>();
     BoneSend          = this.GetComponent <SampleBonesSend>();
     uOscServer        = this.GetComponent <uOSC.uOscServer>();
     BoneReceive       = this.GetComponent <SampleBonesReceive>();
     EDDPPort          = this.GetComponent <Responder>();
     PortText          = GameObject.Find("PortText").GetComponent <Text>();
     PortTextReceive   = GameObject.Find("PortTextReceive").GetComponent <Text>();
     inputField        = GameObject.Find("InputField").GetComponent <InputField>();
     inputFieldReceive = GameObject.Find("InputFieldReceive").GetComponent <InputField>();
     if (PlayerPrefs.GetInt("PortNumber") != 0)
     {
         PortNumber      = PlayerPrefs.GetInt("PortNumber");
         PortText.text   = "送信ポート番号:" + PortNumber.ToString();
         inputField.text = PortNumber.ToString();
         ChangePortNumber(0);
     }
     if (PlayerPrefs.GetInt("PortNumberReceive") != 0)
     {
         PortNumberReceive      = PlayerPrefs.GetInt("PortNumberReceive");
         PortTextReceive.text   = "送信ポート番号:" + PortNumberReceive.ToString();
         inputFieldReceive.text = PortNumberReceive.ToString();
         ChangePortNumber(1);
     }
 }
Beispiel #2
0
    void Start()
    {
        server = GetComponent <uOscServer>();
        //client = GetComponent<uOscClient>();
        server.onDataReceived.AddListener(onReceived);

        loadJSON();

        //複数起動用キーが指定されている場合、
        if (Environment.GetCommandLineArgs().Length >= 3)
        {
            if (Environment.GetCommandLineArgs()[1] == "overlaykey")
            {
                //サブインスタンスではOSCサーバーはオープンしない
                server.enabled = false;
                return;
            }
        }

        if (config.OSCReceive)
        {
            server.enabled = true;
        }
        else
        {
            server.enabled = false;
        }
    }
Beispiel #3
0
        static void Main(string[] args)
        {
            server = new uOscServer();
            server.RecivedEvent += Server_RecivedEvent;

            while (!string.IsNullOrEmpty(Console.ReadLine()))
            {
                ;
            }

            server.RecivedEvent -= Server_RecivedEvent;
            server.Dispose();
        }
    void Start()
    {
        uOscServer server = GetComponent <uOscServer>();

        server.onDataReceived.AddListener(OnDataReceived);
    }
Beispiel #5
0
        void Start()
        {
            client = GetComponent <uOscClient>();
            server = GetComponent <uOscServer>();
            switch ((int)to * 3 + (int)data)
            {
            case 0:
                if (!body)
                {
                    Quite("Body Tracking is null!");
                }
                sender = new SendBody2VMT(body, client);
                sender.SetOffsets(GetOffsets());
                break;

            case 3:
                if (!body)
                {
                    Quite("Body Tracking is null!");
                }
                sender = new SendBody2VMCProtocolToPerformer(body, client);
                sender.SetOffsets(GetOffsets());
                break;

            case 4:
                if (!face)
                {
                    Quite("Face Tracking is null!");
                }
                sender = new SendFace2VMCProtocolToPerformer(face, client);
                sender.SetOffsets(GetOffsets());
                break;

            case 5:
                if (!face || !body)
                {
                    Quite("Face Tracking or Body Tracking is null!");
                }
                sender = new SendBoth2VMCProtocolToPerformer(body, face, client);
                sender.SetOffsets(GetOffsets());
                break;

#if VRM_EXIST
            case 6:
                if (!model)
                {
                    Quite("Target model is null!");
                }
                try
                {
                    sender = new Send2VMCProtocolToMarionette(client, model, SendData.Body);
                }catch (Exception e)
                {
                    Quite(e.Message);
                } break;

            case 7:
                if (!model)
                {
                    Quite("Target model is null!");
                }
                try
                {
                    sender = new Send2VMCProtocolToMarionette(client, model, SendData.Face);
                }
                catch (Exception e)
                {
                    Quite(e.Message);
                }
                break;

            case 8:
                if (!model)
                {
                    Quite("Target model is null!");
                }
                try
                {
                    sender = new Send2VMCProtocolToMarionette(client, model, SendData.Both);
                }
                catch (Exception e)
                {
                    Quite(e.Message);
                }
                break;
#endif
            }
        }
Beispiel #6
0
 public void OnDataReceived(uOscServer server, Message message)
 {
     DataReceveEvent?.Invoke(server, message);
 }