public void SendTransformMessage(JsonGameObject obj)
 {
     SendJsonMessage.type       = (int)JsonMessageType.Transform;
     SendJsonMessage.gameobject = obj;
     udpclient.SendMessage(JsonUtility.ToJson(SendJsonMessage));
 }
Esempio n. 2
0
        // Update is called once per frame
        void Update()
        {
            if (isLoading)
            {
                for (int i = 0; i < PresentationCameras.Length; i++)
                {
                    PresentationCameraControl cameracontrol = PresentationCameras[i].GetComponent <PresentationCameraControl>();
                    if (Input.GetKeyUp((KeyCode)i + 49) || cameracontrol.GetTapFlag() == true)
                    {
                        SetPresentationCamera(i);
                        jsonmessagecontrol.SendCameraMessage(i);
                        Debug.Log("Camera:" + PresentationCameras[i].name);
                    }
                }

                foreach (var item in MediaObject)
                {
                    JsonGameObject jgo = null;
                    for (int i = 0; i < MediaJsonObject.gameobject.Count; i++)
                    {
                        if (MediaJsonObject.gameobject[i].name == item.Key)
                        {
                            jgo = MediaJsonObject.gameobject[i];
                            break;
                        }
                    }
                    if (jgo == null)
                    {
                        jgo      = new JsonGameObject();
                        jgo.name = item.Key;
                        jgo.transform.Set(item.Value.transform.localPosition, item.Value.transform.localRotation, item.Value.transform.localScale);
                        MediaJsonObject.gameobject.Add(jgo);
                    }
                    else
                    {
                        jgo.transform.Set(item.Value.transform.localPosition, item.Value.transform.localRotation, item.Value.transform.localScale);
                    }

                    MediaControl media = item.Value.GetComponent <MediaControl>();
                    if (media != null)
                    {
                        bool flag;
                        if (media.GetTapFlag(out flag))
                        {
                            jsonmessagecontrol.SendPlayMessage(item.Key, flag);
                            Debug.Log("Play:" + item.Key);
                        }
                        if (media.GetTransform())
                        {
                            jsonmessagecontrol.SendTransformMessage(jgo);
                            Debug.Log("Send:" + item.Key);
                        }
                    }
                    else
                    {
                        if (item.Value.GetComponent <PresentationCameraControl>().GetTransform())
                        {
                            jsonmessagecontrol.SendTransformMessage(jgo);
                            Debug.Log("Send:" + item.Key);
                        }
                    }
                }
                importexpot.jsonobject = MediaJsonObject;
            }
        }
Esempio n. 3
0
 public JsonMessage()
 {
     gameobject     = new JsonGameObject();
     gameobjectflag = new JsonGameObjectFlag();
 }