Beispiel #1
0
        // Use this for initialization
        void Start()
        {
            HandsGestureManager.HandGestureEvent += HandGestureEvent;
            isLoading   = false;
            importexpot = GetComponent <TransformImportExportManager>();
            importexpot.SaveDirectoryName     = SaveDirectoryName;
            importexpot.TransformImportEvent += SetJsonTransformGameObject;

            Dictionary <string, string> MediaName = new Dictionary <string, string>();

#if UNITY_UWP
            Task task = Task.Run(async() => {
                var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(SaveDirectoryName, CreationCollisionOption.OpenIfExists);
                var file   = await folder.GetFilesAsync();
                if (file != null)
                {
                    foreach (var item in file)
                    {
                        MediaName.Add(item.Name, ApplicationData.Current.LocalFolder.Path + "\\" + SaveDirectoryName + "\\" + item.Name);
                    }
                }
            });
            task.Wait();
#elif UNITY_EDITOR || UNITY_STANDALONE
            string directorypath = Application.dataPath + "\\..\\" + SaveDirectoryName;
            Directory.CreateDirectory(directorypath);
            DirectoryInfo info  = new DirectoryInfo(directorypath);
            FileInfo[]    files = info.GetFiles();
            for (int i = 0; i < files.Length; i++)
            {
                MediaName.Add(files[i].Name, files[i].FullName);
            }
#endif
            StartCoroutine(LoadMediaCoroutine(MediaName));

            if (DesktopCamera != null)
            {
                SetPresentationCamera(0);
            }
            for (int i = 0; i < PresentationCameras.Length; i++)
            {
                MediaObject.Add(PresentationCameras[i].name, PresentationCameras[i]);
            }

            jsonmessagecontrol = GetComponent <JsonMessageControl>();
            if (jsonmessagecontrol == null)
            {
                gameObject.AddComponent <JsonMessageControl>();
            }
            jsonmessagecontrol.ReceiveCameraJsonMessage    += ReceiveCameraJsonMessage;
            jsonmessagecontrol.ReceivePlayJsonMessage      += ReceivePlayJsonMessage;
            jsonmessagecontrol.ReceiveTransformJsonMessage += ReceiveTransformJsonMessage;
        }
Beispiel #2
0
            public override void OnInspectorGUI()
            {
                base.OnInspectorGUI();
                TransformImportExportManager obj = (TransformImportExportManager)target;

                if (GUILayout.Button("Export Transform"))
                {
                    obj.ExportTransform();
                }
                if (GUILayout.Button("Import Transform"))
                {
                    obj.ImportTransform();
                }
            }