Beispiel #1
0
    void onScreenDrop(SocketIOEvent e)
    {
        var msg = e.Parse();

        if (msg.From == SocketId)
        {
            Destroy(this.gameObject);
        }
    }
Beispiel #2
0
    void onContentArrived(SocketIOEvent e)
    {
        var msg  = e.Parse();
        var data = msg.Data;

        var responseKey = data.Element("key").Value;

        if (responseKey != requestKey)
        {
            return;                            //This response is not for us
        }
        Destroy(Indicator);

        var type = data.Element("type").Value;

        SocketController.Instance.io.Off("content", onContentArrived);

        switch (type)
        {
        case "image":
            spawnedItem = spawnImage(data.Element("img").Value);
            break;

        case "text":
            break;
        }

        if (spawnedItem != null)
        {
            spawnedItem.transform.position = transform.position;
            spawnedItem.transform.rotation = transform.rotation;
            var animator = spawnedItem.AddComponent <AnimateToLocation>();

            if (cursor != null)
            {
                animator.Target = cursor.PinchPointObject;
                animator.AnimationCompleteCallback = () =>
                {
                    var mover = spawnedItem.AddComponent <OnePointMove>();
                    mover.PointA = cursor.PinchPointObject;
                };
            }
            else
            {
                var targetPlace = new GameObject();
                targetPlace.transform.position = transform.position + transform.up * 0.5f + Random.insideUnitSphere * 0.1f;
                animator.Target = targetPlace.transform;
                animator.AnimationCompleteCallback = () =>
                {
                    Destroy(targetPlace);
                };
            }
        }

        Destroy(this.gameObject); //Our job is done.
    }
Beispiel #3
0
    public void EnrollNewScreen(SocketIOEvent e)
    {
        //iPad: 6.5 x 9.5"
        var msg  = e.Parse();
        var data = msg.Data;

        socketId = msg.From;

        var isHandHeldEl = data.Element("isHandHeld");

        if (isHandHeldEl != null && isHandHeldEl.Value == "true")
        {
            //Is a hand held screen
            screen = Instantiate(ScreenPrefab);
            screen.transform.localScale = new Vector3(0.1651f, 0.2413f, .005f);
            screen.GetComponent <ScreenProxy>().IsHandHeld = true;
            screenReady();
        }
        else
        {
            //Static screen
            var poseData = data.Element("pose");
            if (poseData != null)
            {
                screen = Instantiate(ScreenPrefab);
                screen.transform.position   = vectorFromXElement(poseData.Element("position"));
                screen.transform.rotation   = Quaternion.Euler(vectorFromXElement(poseData.Element("rotation")));
                screen.transform.localScale = vectorFromXElement(poseData.Element("scale"));
                screenReady();
            }
            else
            {
                MeshVisualizer.SetRenderers(MeshingVisualizer.RenderMode.Wireframe);

                isScreenPlaced = false;
                ControlPanel.SetActive(false);
            }
        }
    }