private void CreateClassCommon(System.Type type, int instanceID) { var message = new HierarchyMessage(); message.messageID = HierarchyMessage.MessageID.CreateClass; message.baseID = instanceID; message.type = type; UnityChoseKunEditor.SendMessage <HierarchyMessage>(UnityChoseKun.MessageID.HierarchyPush, message); }
private void CreateObjectCommon(HierarchyMessage.MessageID messageID, int instanceID) { // ChoseKunWindowを開く EditorWindow.GetWindow(typeof(UnityChoseKunEditorWindow)); var message = new HierarchyMessage(); message.messageID = messageID; message.baseID = instanceID; UnityChoseKunEditor.SendMessage <HierarchyMessage>(UnityChoseKun.MessageID.HierarchyPush, message); }
/// <summary> /// Create Primitiveの共通関数 /// </summary> /// <param name="messageID"></param> /// <param name="instanceID"></param> /// <param name="primitiveType"></param> private void CreatePrimitiveCommon(HierarchyMessage.MessageID messageID, int instanceID, PrimitiveType primitiveType) { // ChoseKunWindowを開く EditorWindow.GetWindow(typeof(UnityChoseKunEditorWindow)); var message = new HierarchyMessage(); message.messageID = HierarchyMessage.MessageID.CreatePrimitive; message.baseID = instanceID; message.primitiveType = primitiveType; UnityChoseKunEditor.SendMessage <HierarchyMessage>(UnityChoseKun.MessageID.HierarchyPush, message); }
public void OnMessageEventPush(BinaryReader binaryReader) { Debug.Log("OnMessageEventPush"); HierarchyMessage message = new HierarchyMessage(); message.Deserialize(binaryReader); switch (message.messageID) { case HierarchyMessage.MessageID.Duplicate: { var go = FindGameObjectInScene(message.baseID); if (go != null) { var clone = GameObject.Instantiate(go); clone.transform.parent = go.transform.parent; clone.transform.localPosition = go.transform.localPosition; clone.transform.localRotation = go.transform.localRotation; clone.transform.localScale = go.transform.localScale; } } break; case HierarchyMessage.MessageID.Delete: { var go = FindGameObjectInScene(message.baseID); if (go != null) { GameObject.DestroyImmediate(go); } } break; case HierarchyMessage.MessageID.CreateEmpty: { var parent = FindGameObjectInScene(message.baseID); var go = new GameObject(); if (go != null) { if (parent != null) { go.transform.parent = parent.transform; } else { go.transform.parent = null; } go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; } } break; case HierarchyMessage.MessageID.CreateClass: { if (message.type != null) { var parent = FindGameObjectInScene(message.baseID); var go = new GameObject(message.type.Name, message.type); if (go != null) { if (parent != null) { go.transform.parent = parent.transform; } else { go.transform.parent = null; } go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; } } else { Debug.LogError(message.systemType + " is not include in the app."); } } break; case HierarchyMessage.MessageID.CreatePrimitive: { var parent = FindGameObjectInScene(message.baseID); var go = GameObject.CreatePrimitive(message.primitiveType); if (go != null) { if (parent != null) { go.transform.parent = parent.transform; } else { go.transform.parent = null; } go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; } } break; } var sceneManagerKun = new SceneManagerKun(true); UnityChoseKunPlayer.SendMessage <SceneManagerKun>(UnityChoseKun.MessageID.GameObjectPull, sceneManagerKun); }