Ejemplo n.º 1
0
    public void Start()
    {
        instance    = this;
        testProject = new FlowProject();
        testProject.initialize();

        // loads receive functions into command processor dictionary
        if (CommandProcessor.receiveEvents.Count == 0)
        {
            CommandProcessor.initializeRecieveEvents();
        }

        login();

        if (LocalServer)
        {
            if ((clientType != CLIENT_RIPPLE && clientType != CLIENT_HOLOLENS) || (DebugPanel.instance.forceHolo))
            {
                log("[unity] Connecting to " + LOCAL_SERVER);
                w = new WebSocket(new Uri(LOCAL_SERVER));
            }
            else
            {
                log("[unity] Connecting to " + LAN_SERVER);
                w = new WebSocket(new Uri(LAN_SERVER));
            }
        }
        else
        {
            log("[unity] Connecting Websocket " + REMOTE_SERVER);
            w = new WebSocket(new Uri(REMOTE_SERVER));
        }

        log("Going to Websocket Connection...");

        DoOnMainThread.ExecuteOnMainThread.Enqueue(() =>
        {
            StartCoroutine(ConnectWebsocket());
        });

        log("Sent Connection Request");
    }
Ejemplo n.º 2
0
    public void Start()
    {
        _debug      = debug;
        testProject = new FlowProject();
        testProject.initialize();

        if (CommandProcessor.recieveEvents.Count == 0)
        {
            CommandProcessor.initializeRecieveEvents();
        }

        //string username = "******" + DateTime.Now.ToString();
        //string password = "******" + DateTime.Now.ToString();

        //string username = "******";
        //string password = "******";

        //UserRegisterEvent register = new UserRegisterEvent();
        //register.Send(username, password, FlowClient.CLIENT_HOLOLENS);

        //UserLoginEvent login = new UserLoginEvent();
        //login.Send(username, password, FlowClient.CLIENT_HOLOLENS);

        //ProjectCreateEvent createProj = new ProjectCreateEvent();
        //createProj.Send("Subarus Maids2" + DateTime.Now.ToString());

        //ProjectFetchEvent fetchproj = new ProjectFetchEvent();
        //fetchproj.Send();



#if !UNITY_EDITOR && UNITY_WEBGL
        WebGLInput.captureAllKeyboardInput = false;
#endif

        username = GetUsername();
        uid      = GetUID();

        Application.runInBackground = true;
        if (clientType == CLIENT_EDITOR)
        {
            // Enable Vuforia
            mainGameCamera.SetActive(true);
            //          VectorLine.SetCamera3D(FlowCameras.mainCamera);

//            if (login != null)
//                login.fetch_account_id = true;
//            WULogin.onLoggedIn += OnLoggedIn;
        }
        else if (clientType == CLIENT_WEB)
        {
            FlowCameras.mainCamera = mainGameCamera.GetComponent <Camera>();
            //login.gameObject.SetActive(false);
            string loginName = GetUsername();
        }
        else if (clientType == CLIENT_HOLOLENS)
        {
            Debug.Log("HOLOLENS!");
            mainGameCamera.SetActive(true);
            //mainGameCamera.GetComponent<Camera>().enabled = false;
            //mainGameCamera.tag = "MainCamera";

            //login.gameObject.SetActive(false);
            string loginName = GetUsername();
#if UNITY_WSA
            eventSystem.AddComponent <UnityEngine.EventSystems.HoloLensInputModule>();
#endif
        }

        if (LocalServer)
        {
            if ((clientType != CLIENT_RIPPLE && clientType != CLIENT_HOLOLENS) || (DebugPanel.instance.forceHolo))
            {
                w = new WebSocket(new Uri(LOCAL_SERVER));
                Debug.Log("[unity] Connecting to " + LOCAL_SERVER);
            }
            else
            {
                Debug.Log("[unity] Connecting to " + LAN_SERVER);
                w = new WebSocket(new Uri(LAN_SERVER));
            }
        }
        else
        {
            Debug.Log("[unity] Connecting Websocket " + REMOTE_SERVER);
            w = new WebSocket(new Uri(REMOTE_SERVER));
        }
        //w.Connect();
        //ConnectWebsocket();
        Debug.Log("Going to Websocket Connection...");
        DoOnMainThread.ExecuteOnMainThread.Enqueue(() =>
        {
            StartCoroutine(ConnectWebsocket());
        });
        Debug.Log("Sent Connection Request");
    }