//TaskPinかその子供を選んでいたら、その詳細を表示する(一旦TaskGroundクラスを経由してまたViewerWindowに帰ってくる)
        //Playingの時にはTaskGroundBrain#Updateにて
        void OnSelectionChange()
        {
            if (EditorApplication.isPlaying)
            {
                return;
            }
            if (Selection.activeGameObject == null)
            {
                TaskGround.SelectingTask = null;
                return;
            }

            TaskPin tp = Selection.activeGameObject.GetComponent <TaskPin> ();

            if (tp != null)
            {
                TaskGround.SelectingTask = tp.task;
            }
            else
            {
                tp = Selection.activeGameObject.GetComponentInParent <TaskPin> ();
                if (tp != null)
                {
                    TaskGround.SelectingTask = tp.task;
                }
                else
                {
                    TaskGround.SelectingTask = null;
                }
            }
        }
        public IEnumerator SyncWork()
        {
            yield return(StartCoroutine(OnSyncStarted()));

            //送信
            foreach (Change c in changes)
            {
                yield return(StartCoroutine(Push(c)));
            }

            //受信
            List <Task> response = new List <Task>();

            yield return(StartCoroutine(Pull(r => response = r)));

            if (response == null)
            {
                yield break;                              //受信失敗
            }
            Transform pins = transform.Find("Pins");

            //一旦全部消す
            for (int i = pins.childCount - 1; i >= 0; --i)
            {
                GameObject.DestroyImmediate(pins.GetChild(i).gameObject);
            }
            //それから追加していく
            foreach (Task t in response)
            {
                TaskPin.Instantiate(pins, t, player, size, scaleFactor, minSize);
            }

            lastSynced = DateTime.Now.ToString();
        }
Exemple #3
0
        public static void Instantiate(Transform parent, Task task, Transform player, float size, float scaleFactor, float minSize)
        {
#if UNITY_EDITOR
            const string PrefabGUID = "a0a7bc9fda6e3194ea8fa6d188e3f802";
            string       prefabPath = AssetDatabase.GUIDToAssetPath(PrefabGUID);
            Object       prefab     = AssetDatabase.LoadAssetAtPath <Object>(prefabPath);

            GameObject go = Instantiate <GameObject>((GameObject)prefab, parent);
            go.transform.position = task.position;
            TaskPin tp = go.GetComponent <TaskPin>();
            tp.task        = task;
            tp.player      = player;
            tp.size        = size;
            tp.scaleFactor = scaleFactor;
            tp.minSize     = minSize;
#endif
        }