Ejemplo n.º 1
0
    public void TurnOn()
    {
        BindGazeManager(true);
        selectedContainer.gameObject.SetActive(true);
        originContainer.gameObject.SetActive(true);
        //selected = false;
        universeView.universeTime = 0;
        planetMap = new Dictionary <string, PlanetObject>();
        foreach (GameObject p in planetObjects)
        {
            string       name = p.name;
            PlanetObject po   = p.GetComponent <PlanetObject>();
            po.planetType = (PlanetObject.PlanetType)Enum.Parse(typeof(PlanetObject.PlanetType), name);
            //Debug.Log("addPlanetView:" + pv.planetType);
            planetMap.Add(name, po);
        }

        if (connectToServer)
        {
            SceneObject roomInitData = new SceneObject();
            //roomInitData.ShowObjectDic.Add(UniverseObject.OBJECT_TYPE, universeView.uo.CreateShowObject());
            roomInitData.ShowObjectDic.Add(cv_selected.containerType.ToString(), cv_selected.co.CreateShowObject());
            roomInitData.ShowObjectDic.Add(cv_originContainer.containerType.ToString(), cv_originContainer.co.CreateShowObject());
            roomInitData.ShowObjectDic.Add(PlanetObject.OBJECT_TYPE, selectedPlanet.CreateShowObject());
            cm.roomInitData = roomInitData;
            cm.TurnOn();

            //讲师端发送同步信息
            StartCoroutine(UpdateContainerData());
            Debug.Log(cm.GetSyncDelay());
        }
    }
Ejemplo n.º 2
0
    private IEnumerator WaitForInit()
    {
        MEHoloEntrance entrance = MEHoloEntrance.Instance;

        while (!entrance.HasInit)
        {
            yield return(null);
        }

        collaborationManager = CollaborationManager.Instance;

        collaborationManager.AddMessageHandler(this);

        MsgEntry entry = new MsgEntry();

        entry.ShowId = "Test";
        GetTransformFloat(cube.transform, entry);

        ShowObject  showObject = new ShowObject(entry);
        SceneObject roomData   = new SceneObject();

        roomData.ShowObjectDic.Add(showObject.ShowId, showObject);

        collaborationManager.roomInitData = roomData;

        collaborationManager.TurnOn();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// initialization of modules and variables
    /// </summary>
    /// <returns></returns>
    private IEnumerator WaitForInit()
    {
        MEHoloEntrance entrance = MEHoloEntrance.Instance;

        while (!entrance.HasInit)
        {
            yield return(null);
        }

        //instantiate elements
        inputManager           = MultiInputManager.Instance;
        inputManager.layerMask = LayerMask.GetMask("Default") | LayerMask.GetMask("UI");
        inputManager.cbTap    += OnTap;
        //collaboration module
        collaborationManager = CollaborationManager.Instance;
        collaborationManager.AddMessageHandler(this);
        collaborationManager.cbEnterRoom = cbEnterRoom;
        //cursor module
        cursor = UIManager.Instance.cursorController;

        //it is possible to use more than message.
        //bear in mind that messages must have different id so
        string   showId = "showId001";
        MsgEntry msg    = new MsgEntry();

        msg.ShowId = showId;
        showObject = new ShowObject(msg);
        roomData   = new SceneObject();
        roomData.ShowObjectDic.Add(showObject.ShowId, showObject);

        collaborationManager.roomInitData = roomData;
        collaborationManager.TurnOn();
    }
Ejemplo n.º 4
0
    private IEnumerator WaitForInit()
    {
        MEHoloEntrance entrance = MEHoloEntrance.Instance;

        while (!entrance.HasInit)
        {
            yield return(null);
        }
        cm = CollaborationManager.Instance;
        cm.AddMessageHandler(this);
        initShowObject();
        cm.TurnOn();
    }
Ejemplo n.º 5
0
        private IEnumerator WaitForInit()
        {
            MEHoloEntrance entrance = MEHoloEntrance.Instance;

            while (!entrance.HasInit)
            {
                yield return(null);
            }

            cursor = UIManager.Instance.cursorController;


            // Todo: Begin your logic
            inputManager        = MultiInputManager.Instance;
            inputManager.cbTap += OnTap;

            cm = CollaborationManager.Instance;
            cm.AddMessageHandler(this);
            cm.cbEnterRoom = cbEnterRoom;

            string showId   = "showId001";
            string obj_type = "ColorType";

            MsgEntry msg = new MsgEntry();

            msg.ShowId = showId;

            ObjectInfo info = new ObjectInfo();

            info.ObjType = obj_type;
            msg.Info     = info;

            msg.Vec.Add((long)CurrentColor);

            showObject = new ShowObject(msg);
            roomData   = new SceneObject();
            roomData.ShowObjectDic.Add(showObject.ShowId, showObject);

            cm.roomInitData = roomData;
            cm.TurnOn();
        }
Ejemplo n.º 6
0
    /// <summary>
    /// used for initialization of variable and modules
    /// </summary>
    /// <returns></returns>
    private IEnumerator WaitForInit()
    {
        MEHoloEntrance entrance = MEHoloEntrance.Instance;

        while (!entrance.HasInit)
        {
            yield return(null);
        }
        //instantiate modules
        inputManager = MultiInputManager.Instance;
        cm           = CollaborationManager.Instance;
        uiManager    = UIManager.Instance;

        // Todo: Begin your logic
        inputManager.cbTap += OnTap;
        cm.AddMessageHandler(this);
        cm.cbEnterRoom = cbEnterRoom;

        string showId   = "showId001";
        string obj_type = "name";

        string showId2 = "showId002";

        //creation of a message entry
        MsgEntry msg = new MsgEntry();

        msg.ShowId = showId;
        ObjectInfo info = new ObjectInfo();

        info.ObjType = obj_type;
        msg.Info     = info;
        //add position of the main camera
        msg.Pr.Add(mainCamera.transform.position.x);
        msg.Pr.Add(mainCamera.transform.position.y);
        msg.Pr.Add(mainCamera.transform.position.z);
        //add three other elements to Pr to
        //reserve position for the focused object
        msg.Pr.Add(0);
        msg.Pr.Add(0);
        msg.Pr.Add(0);
        showObject = new ShowObject(msg);
        roomData   = new SceneObject();
        roomData.ShowObjectDic.Add(showObject.ShowId, showObject);

        cm.roomInitData = roomData;
        cm.TurnOn();

        //UI module
        menu = uiManager.menuManager.GetMenu("Menu");
        menu.transform.position           = mainCamera.transform.forward;
        uiManager.menuManager.cbMenuHide += OnMenuHide;
        //register action for the elements of the Menu
        menu.RegistButtonClick("button1.a", ShowAction);
        menu.RegistButtonClick("button1.b", HideAction);
        menu.RegistButtonClick("button2", DeleteLines);
        menu.RegistButtonClick("button2.b", DeleteJsonAction);
        menu.RegistButtonClick("button3", LoadAction);
        menu.RegistButtonClick("button4", SaveAction);


        inputManager.layerMask = LayerMask.GetMask("Engine") | LayerMask.GetMask("UI");
    }