void OnGUI () { if (mgr == null) { EditorGUILayout.LabelField("Select Cutscene Object Or"); if (GUILayout.Button("Create New Cutscene")) { GameObject obj = new GameObject ("Cutscene"); obj.AddComponent ("CutsceneMgr"); if (Selection.activeTransform != null) obj.transform.parent = Selection.activeTransform; Selection.activeGameObject = obj; // CutsceneMgr mgr1 = obj.GetComponent<CutsceneMgr>(); /* mgr1.touchEffects = new Transform[4]; mgr1.touchEffects[0] = AssetDatabase.LoadAssetAtPath( "Assets/DoraEffect/EffectPrefab/Dora_Touch_Reaction_eff.prefab", typeof(Transform)) as Transform; mgr1.touchEffects[1] = AssetDatabase.LoadAssetAtPath( "Assets/DoraEffect/EffectPrefab/Dora_Touch_Reaction_eff_squre.prefab", typeof(Transform)) as Transform; mgr1.touchEffects[2] = AssetDatabase.LoadAssetAtPath( "Assets/DoraEffect/EffectPrefab/Dora_Touch_Reaction_eff_star.prefab", typeof(Transform)) as Transform; mgr1.touchEffects[3] = AssetDatabase.LoadAssetAtPath( "Assets/DoraEffect/EffectPrefab/Dora_Touch_Reaction_eff_tri.prefab", typeof(Transform)) as Transform;*/ // mgr1.prePlugin = AssetDatabase.LoadAssetAtPath("Assets/Resources/Plugin.prefab" // , typeof(Transform)) as Transform; } return; } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Release Mgr",GUILayout.Width(90))) { mgr = null; title = "Cutscene"; dialogs = null; bgmNames = null; return; } mgr.note = EditorGUILayout.TextField("Cutscene Description:", mgr.note); EditorGUILayout.EndHorizontal(); //scroll1 = EditorGUILayout.BeginScrollView(scroll1); HandleEvents(); if (mgr.steps == null || mgr.steps.Count == 0) { if (GUILayout.Button("New Step")) { AddStep(null); } } else { DrawNonZoomArea(); // Within the zoom area all coordinates are relative to the top left corner of the zoom area // with the width and height being scaled versions of the original/unzoomed area's width and height. _zoomArea = new Rect(0.0f, 35.0f, position.width , position.height - 35.0f); EditorZoomArea.Begin(_zoom, _zoomArea); //GUILayout.BeginArea(new Rect(0.0f - _zoomCoordsOrigin.x, 35.0f - _zoomCoordsOrigin.y, position.width , mgr.steps.Count*80.0f)); GUILayout.BeginArea(new Rect(0.0f , 35.0f - _zoomCoordsOrigin.y, 1000.0f , mgr.steps.Count*145.0f)); //GUILayout.BeginArea(new Rect(0.0f , 35.0f - _zoomCoordsOrigin.y, position.width , mgr.steps.Count*100.0f)); CutsceneStep step1 = null; StepOp stepOp = StepOp.NoOp; Color bgrndBak = GUI.backgroundColor; Color colorBak = GUI.color; foreach (CutsceneStep step in mgr.steps) { GUI.backgroundColor = selectedId == step.stepId ? Color.cyan : bgrndBak; #if UNITY_EDITOR if( step.bCurrentStep ) GUI.backgroundColor = Color.red; #endif EditorGUILayout.BeginVertical("Button"); EditorGUILayout.BeginHorizontal(); GUI.color = step.actor != null ? step.actor.symbolColor : colorBak; if (GUILayout.Button ("", GUILayout.Width(20))) { SelectStep(step.stepId); } GUI.color = colorBak; step.stepId = EditorGUILayout.IntField(step.stepId); step.preId = EditorGUILayout.IntField("Prev Id:", step.preId); step.delay = EditorGUILayout.FloatField("Delay:", step.delay); if (GUILayout.Button("Up", GUILayout.Width(90))) { SelectStep(step.stepId); step1 = step; stepOp = StepOp.Up; } if (GUILayout.Button("Down", GUILayout.Width(90))) { SelectStep(step.stepId); step1 = step; stepOp = StepOp.Down; } if (GUILayout.Button("Delete", GUILayout.Width(90))) { if( EditorUtility.DisplayDialog("This Step Delete?" ,"Are you sure you want to delete? ", "Yes", "No") ) { step1 = step; stepOp = StepOp.Del; } } if (GUILayout.Button("Add Step", GUILayout.Width(90))) { step1 = step; stepOp = StepOp.AddAfter; } if (GUILayout.Button("Run To", GUILayout.Width(90))) { SelectStep(step.stepId); RunTo (step.stepId); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); // step.objectIncludeActor = (GameObject) EditorGUILayout.ObjectField(step.objectIncludeActor // , typeof(GameObject), true, GUILayout.Width(150)); // // if (step.objectIncludeActor != null) // step.actor = step.objectIncludeActor.GetComponentInChildren<ActorBase>(); step.actor = (ActorBase) EditorGUILayout.ObjectField(step.actor, typeof(ActorBase), true , GUILayout.Width(150)); if( step.actor != null ) { if( step.actor.objIncludeActor != null ) { step.actor = step.actor.objIncludeActor; } } tempAcitonDisplay = CutsceneStep.ConverterActionIDToActionDisplayID(step.action); tempAcitonDisplay = (CutsceneStep.ActionDisplay) EditorGUILayout.EnumPopup(tempAcitonDisplay, GUILayout.Width(100)); step.action = CutsceneStep.ConverterActionDisplayIDToActionID(tempAcitonDisplay); ActorChar actorChar = null; if (step.actor != null) actorChar = step.actor.GetComponent<ActorChar>(); switch (step.action) { case CutsceneStep.Action.MoveTo: step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.pos; } step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(210)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.target = (Transform) EditorGUILayout.ObjectField("MovePosTransform", step.target , typeof(Transform), true , GUILayout.Width(400)); if( step.target != null ) { step.pos = step.target.position; // step.pos.x = step.target.position.x; // step.pos.x = step.target.position.x; // step.pos.x = step.target.position.x; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.boolVal = EditorGUILayout.Toggle("WithAction", step.boolVal,GUILayout.Width (200)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.obj = EditorGUILayout.ObjectField("Path:", step.obj, typeof(LcPath), true , GUILayout.Width(400)); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup("EaseType:", step.easeType , GUILayout.Width(300)); break; case CutsceneStep.Action.JumpTo: step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.pos; } step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(210)); break; case CutsceneStep.Action.GoBack: step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(210)); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup("EaseType:", step.easeType); break; case CutsceneStep.Action.WaitFor: step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } step.pos = EditorGUILayout.Vector3Field("Offset:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position - step.target.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.target.position + step.pos; } break; case CutsceneStep.Action.Follow: step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(200)); // step.boolVal = EditorGUILayout.Toggle("Vertical:", step.boolVal, GUILayout.Width(180)); step.pos = EditorGUILayout.Vector3Field("Offset:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position - step.target.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.target.position + step.pos; } break; case CutsceneStep.Action.Rotate: step.pos = EditorGUILayout.Vector3Field("Angle:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.eulerAngles; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.eulerAngles = step.pos; } break; case CutsceneStep.Action.Caption: if (dialogs != null) step.intVal = EditorGUILayout.IntPopup("Dialog:", step.intVal, dialogs, dialogIds); step.floatVal = EditorGUILayout.FloatField("Duration:", step.floatVal); break; case CutsceneStep.Action.TalkTo: case CutsceneStep.Action.SpeechTo: if (step.actor != null) { if (actorChar != null) ReadActionData(step.actor); // ReadActionData(step.actor); // actorChar = step.actor.GetComponent<ActorChar>(); if (dialogs != null) step.intVal = EditorGUILayout.IntPopup("Dialog:", step.intVal, dialogs, dialogIds); step.floatVal = EditorGUILayout.FloatField("Duration:", step.floatVal); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.boolVal = EditorGUILayout.Toggle("NextLoopAction:", step.boolVal,GUILayout.Width (200)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } if (actorChar != null && actorChar.actionNames != null) { if( selectedId == step.stepId ) { //Debug.Log ("actorChar"+actorChar); // foreach( string a in actorChar.actionNames ) // { // //Debug.Log ("actorChar.actionNames"+a); // } // Debug.Log ("actorChar.actionNames"+actorChar.actionNames); // Debug.Log ("actorChar.actionIds"+actorChar.actionIds); } // step.intVal2 = EditorGUILayout.IntPopup("Action:", step.intVal2, actorChar.actionNames, // actorChar.actionIds); // string[] temp = actorChar.actionNames; step.intVal2 = EditorGUILayout.IntPopup("Action:", step.intVal2, actorChar.actionNames, actorChar.actionIds); } else { step.intVal2 = EditorGUILayout.IntField("Action:", step.intVal2); } } break; case CutsceneStep.Action.Action: if (step.actor != null) { if (actorChar != null) ReadActionData(step.actor); if (actorChar != null && actorChar.actionNames != null) step.intVal = EditorGUILayout.IntPopup("Action:", step.intVal, actorChar.actionNames, actorChar.actionIds); else step.intVal = EditorGUILayout.IntField("Action:", step.intVal); if (dialogs != null) step.intVal2 = EditorGUILayout.IntPopup("Dialog:", step.intVal2, dialogs, dialogIds); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.boolVal = EditorGUILayout.Toggle("NextLoopAction:", step.boolVal, GUILayout.Width(200)); step.boolVal2 = EditorGUILayout.Toggle("Ignore Blink:", step.boolVal2, GUILayout.Width(200)); } break; case CutsceneStep.Action.LoopAction: if (step.actor != null) { if (actorChar != null) ReadLoopActionData(step.actor); if (actorChar != null && actorChar.loopActionNames != null) step.intVal = EditorGUILayout.IntPopup("Loop Action:", step.intVal, actorChar.loopActionNames, actorChar.loopActionIds); else step.intVal = EditorGUILayout.IntField("Loop Action:", step.intVal); step.boolVal = EditorGUILayout.Toggle("Ignore Blink:", step.boolVal, GUILayout.Width(200)); } // step.intVal = EditorGUILayout.IntField("No.:", step.intVal, GUILayout.Width(240)); // step.floatVal = EditorGUILayout.FloatField("Duration:", step.floatVal, GUILayout.Width(200)); break; case CutsceneStep.Action.LoadScene: step.strVal = EditorGUILayout.TextField("Name:", step.strVal); step.intVal = EditorGUILayout.IntField("Effect:", step.intVal, GUILayout.Width(200)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.strVal2 = EditorGUILayout.TextField("Param:", step.strVal2); step.obj = EditorGUILayout.ObjectField("Return Cutscene:", step.obj, typeof(CutsceneMgr), true); break; case CutsceneStep.Action.Setup: if (GUILayout.Button("Save", GUILayout.Width(80))) { if (step.actor == null) { UnityEngine.Object[] objs = GameObject.FindObjectsOfType(typeof(ActorBase)); step.actorData = new ActorData[objs.Length]; for (int i = 0; i < objs.Length; i++) { ActorBase actor = (ActorBase) objs[i]; ActorData data = new ActorData(); data.actor = actor; data.pos = actor.transform.position; data.rota = actor.transform.rotation; data.scale = actor.transform.localScale; step.actorData[i] = data; } } else { step.actorData = new ActorData[1]; ActorBase actor = step.actor; ActorData data = new ActorData(); data.actor = actor; data.pos = actor.transform.position; data.rota = actor.transform.rotation; data.scale = actor.transform.localScale; step.actorData[0] = data; } } if (GUILayout.Button("Apply", GUILayout.Width(80))) { foreach (ActorData data in step.actorData) { if (data.actor != null) { data.actor.transform.position = data.pos; data.actor.transform.rotation = data.rota; data.actor.transform.localScale = data.scale; } } } break; case CutsceneStep.Action.LookAt: step.intVal = EditorGUILayout.IntPopup(step.intVal, lookAtNames, lookAtIds, GUILayout.Width(100)); switch (step.intVal) { case 0: step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true, GUILayout.Width(350)); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } break; case 1: step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true, GUILayout.Width(350)); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { if (step.target != null) step.pos = step.target.position; } break; } /* step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Current", GUILayout.Width(80))) { step.pos = step.target.position; } step.boolVal = EditorGUILayout.Toggle("Position", step.boolVal);*/ break; case CutsceneStep.Action.Activate: step.intVal = EditorGUILayout.IntPopup(step.intVal, sendToNames, actionIds, GUILayout.Width(100)); step.target = (Transform) EditorGUILayout.ObjectField( "Target:", step.target, typeof(Transform), true); // if( step.target != null ) // { // ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); // if( temptarget != null ) // { // if( temptarget.objIncludeActor != null ) // { // step.target = temptarget.objIncludeActor.transform; // } // } // } switch (step.intVal) { case 0: case 2: step.boolVal = EditorGUILayout.Toggle("Wait", step.boolVal); break; } if (step.intVal == 2) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.strVal = EditorGUILayout.TextField("Method:", step.strVal); step.strVal2 = EditorGUILayout.TextField("Param:", step.strVal2); } break; case CutsceneStep.Action.Proc: step.strVal = EditorGUILayout.TextField("Name:", step.strVal); step.strVal2 = EditorGUILayout.TextField("Param:", step.strVal2); step.boolVal = EditorGUILayout.Toggle("Wait", step.boolVal); break; case CutsceneStep.Action.Sound: step.intVal = EditorGUILayout.IntPopup(step.intVal, soundNames, actionIds, GUILayout.Width(80)); if (step.intVal == 0) { step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false); step.boolVal = EditorGUILayout.Toggle("Loop", step.boolVal); } else if (step.intVal == 1) { step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false); } else if (step.intVal == 2) { if (bgmNames != null) step.intVal2 = EditorGUILayout.IntPopup("Song:", step.intVal2, bgmNames, bgmIds); step.boolVal = EditorGUILayout.Toggle("Loop", step.boolVal); } step.floatVal = EditorGUILayout.FloatField("Volume:", step.floatVal, GUILayout.Width(200)); break; case CutsceneStep.Action.ChangeInto: step.intVal2 =EditorGUILayout.IntPopup(step.intVal2, changeIntoNames, changeIntoIds, GUILayout.Width(100)); if (step.intVal2 == 0) { step.obj = EditorGUILayout.ObjectField("Parts:", step.obj, typeof(Transform), false); step.intVal = EditorGUILayout.IntField("Prop:", step.intVal); } else if (step.intVal2 == 3) { step.obj = EditorGUILayout.ObjectField("Parts:", step.obj, typeof(Transform), false); } break; case CutsceneStep.Action.PlayMovie: step.strVal = EditorGUILayout.TextField("Movie:", step.strVal); step.boolVal = EditorGUILayout.Toggle("Cancel On Input:", step.boolVal); break; case CutsceneStep.Action.UniqueAction: step.strVal = EditorGUILayout.TextField("Name:", step.strVal); step.intVal = EditorGUILayout.IntField("Phase", step.intVal); break; case CutsceneStep.Action.Mood: step.intVal = EditorGUILayout.IntPopup("Mood:", step.intVal, moodNames, moodIds); break; case CutsceneStep.Action.ScaleTo: step.pos = EditorGUILayout.Vector3Field("Scale:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.localScale; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.localScale = step.pos; } step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(210)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup("EaseType:", step.easeType, GUILayout.Width(300)); break; case CutsceneStep.Action.WaitTouch: step.floatVal = EditorGUILayout.FloatField("Prompt Delay:", step.floatVal, GUILayout.Width(200)); step.intVal = EditorGUILayout.IntField("Choice:", step.intVal, GUILayout.Width(200)); EditorGUILayout.EndHorizontal(); step.boolVal = EditorGUILayout.Toggle("Send GameLog Touch", step.boolVal,GUILayout.Width (200)); if( step.boolVal ) { step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200)); } EditorGUILayout.BeginHorizontal(); break; case CutsceneStep.Action.WaitSound: step.intVal = EditorGUILayout.IntPopup("For:", step.intVal, new string[] { "(Any)", "Sound", "Blow", "Clap","BlowNoDelay","ClapNoDelay" }, new int[] { 0, 1, 2, 3, 4, 5 } , GUILayout.Width(300)); step.floatVal = EditorGUILayout.FloatField("Timeout:", step.floatVal, GUILayout.Width(200)); EditorGUILayout.EndHorizontal(); step.boolVal = EditorGUILayout.Toggle("Send GameLog Voice", step.boolVal,GUILayout.Width (200)); if( step.boolVal ) { step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200)); } EditorGUILayout.BeginHorizontal(); break; case CutsceneStep.Action.GameLog: //GameStart, GameEnd, ChapterStart, ChapterEnd step.intVal = EditorGUILayout.IntPopup(step.intVal, gameLogNames, gameLogIds, GUILayout.Width(100)); if( step.intVal < 2 ) //GameStart, GameEnd { step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200)); } break; } /* step.floatVal = EditorGUILayout.FloatField("Value:", step.floatVal); step.target = EditorGUILayout.ObjectField("Target:", step.target, typeof(UnityEngine.Object), true); */ EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.note = EditorGUILayout.TextField("Comment:", step.note); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); GUILayout.Space(1); } switch (stepOp) { case StepOp.AddAfter: AddStep(step1); break; case StepOp.Del: RemoveStep (step1); break; case StepOp.Up: int idx = mgr.steps.IndexOf(step1); if (idx > 0) { mgr.steps.Remove(step1); mgr.steps.Insert(idx - 1, step1); } break; case StepOp.Down: idx = mgr.steps.IndexOf(step1); if (idx < mgr.steps.Count - 1) { mgr.steps.Remove(step1); mgr.steps.Insert(idx + 1, step1); } break; } GUILayout.EndArea(); EditorZoomArea.End(); } //EditorGUILayout.EndScrollView(); }
protected void DrawCutsceneStep() { //EDIT : San 20140513, edit Layout if( SelectedNote != -1 ) { currentStep = SongPlayer.Song.Notes[ SelectedNote ].Step; } CutsceneStep step = currentStep; if( step != null) { Color bgrndBak = GUI.backgroundColor; //Color colorBak = GUI.color; GUI.backgroundColor = LcCutsceneEditor.selectedId == step.stepId ? Color.cyan : bgrndBak; //GUI.color = colorBak; // // GUI.color = step.actor != null ? step.actor.symbolColor : colorBak; // if (GUILayout.Button ("", GUILayout.Width(20))) { // SelectStep(step.stepId); // } // step.stepId = EditorGUILayout.IntField(step.stepId); // step.preId = EditorGUILayout.IntField("Prev Id:", step.preId); // step.delay = EditorGUILayout.FloatField("Delay:", step.delay); EditorGUILayout.BeginVertical("button"); { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Actor: ",GUILayout.Width(50)); step.actor = (ActorBase) EditorGUILayout.ObjectField(step.actor, typeof(ActorBase), true , GUILayout.Width(150)); EditorGUILayout.LabelField("WithAction: ",GUILayout.Width(80)); step.boolVal = EditorGUILayout.Toggle(step.boolVal,GUILayout.Width(50)); } if( step.actor != null ) { if( step.actor.objIncludeActor != null ) { step.actor = step.actor.objIncludeActor; } } tempAcitonDisplay = CutsceneStep.ConverterActionIDToActionDisplayID(step.action); EditorGUILayout.LabelField("Action: ",GUILayout.Width(50)); tempAcitonDisplay = (CutsceneStep.ActionDisplay) EditorGUILayout.EnumPopup(tempAcitonDisplay, GUILayout.Width(100)); step.action = CutsceneStep.ConverterActionDisplayIDToActionID(tempAcitonDisplay); EditorGUILayout.EndHorizontal(); ActorChar actorChar = null; if (step.actor != null){ actorChar = step.actor.GetComponent<ActorChar>(); } switch (step.action) { case CutsceneStep.Action.MoveTo: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Speed:",GUILayout.Width(50)); step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70)); EditorGUILayout.LabelField(" Pos:",GUILayout.Width(40)); step.pos = EditorGUILayout.Vector3Field("",step.pos); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.pos; } }EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("MovePosTransform : ",GUILayout.Width(130)); step.target = (Transform) EditorGUILayout.ObjectField( step.target , typeof(Transform), true); if( step.target != null ) { step.pos = step.target.position; // step.pos.x = step.target.position. x; // step.pos.x = step.target.position.x; // step.pos.x = step.target.position.x; } EditorGUILayout.LabelField("Path:", GUILayout.Width(40)); step.obj = EditorGUILayout.ObjectField( step.obj, typeof(LcPath), true); EditorGUILayout.LabelField("EaseType:", GUILayout.Width(60)); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup(step.easeType); }EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.JumpTo: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Speed:",GUILayout.Width(50)); step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70)); EditorGUILayout.LabelField(" Pos:",GUILayout.Width(40)); step.pos = EditorGUILayout.Vector3Field("",step.pos); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.pos; } }EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.GoBack: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Speed:",GUILayout.Width(50)); step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70)); EditorGUILayout.LabelField("EaseType:", GUILayout.Width(60)); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup(step.easeType,GUILayout.Width(300)); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.WaitFor: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); step.target = (Transform) EditorGUILayout.ObjectField(step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } EditorGUILayout.LabelField("Offset:", GUILayout.Width(50)); step.pos = EditorGUILayout.Vector3Field("",step.pos); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position - step.target.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.target.position + step.pos; } } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.Follow: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); step.target = (Transform) EditorGUILayout.ObjectField(step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } EditorGUILayout.LabelField("Offset:", GUILayout.Width(50)); step.pos = EditorGUILayout.Vector3Field("",step.pos); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position - step.target.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.target.position + step.pos; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Speed:",GUILayout.Width(50)); step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70)); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.Rotate: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Angle:", GUILayout.Width(50)); step.pos = EditorGUILayout.Vector3Field("",step.pos); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.eulerAngles; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.eulerAngles = step.pos; } } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.Caption: EditorGUILayout.BeginHorizontal(); { if (dialogs != null) EditorGUILayout.LabelField("Dialog:", GUILayout.Width(60)); step.intVal = EditorGUILayout.IntPopup(step.intVal, dialogs, dialogIds); EditorGUILayout.LabelField("Duration:", GUILayout.Width(60)); step.floatVal = EditorGUILayout.FloatField(step.floatVal,GUILayout.Width(50)); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.TalkTo: case CutsceneStep.Action.SpeechTo: if (step.actor != null) { ReadActionData(step.actor); if (dialogs != null) EditorGUILayout.BeginHorizontal(); { if (dialogs != null) EditorGUILayout.LabelField("Dialog:", GUILayout.Width(50)); step.intVal = EditorGUILayout.IntPopup(step.intVal, dialogs, dialogIds); EditorGUILayout.LabelField("Duration:", GUILayout.Width(60)); step.floatVal = EditorGUILayout.FloatField(step.floatVal,GUILayout.Width(50)); EditorGUILayout.LabelField("NextLoopAction:", GUILayout.Width(100)); step.boolVal = EditorGUILayout.Toggle( step.boolVal); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); step.target = (Transform) EditorGUILayout.ObjectField(step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } if (actorChar != null && actorChar.actionNames != null){ EditorGUILayout.LabelField("Action:", GUILayout.Width(50)); step.intVal2 = EditorGUILayout.IntPopup( step.intVal2, actorChar.actionNames, actorChar.actionIds); }else{ EditorGUILayout.LabelField("Action:", GUILayout.Width(50)); step.intVal2 = EditorGUILayout.IntField( step.intVal2); } } EditorGUILayout.EndHorizontal(); } break; case CutsceneStep.Action.Action: if (step.actor != null) { if (actorChar != null) { ReadActionData(step.actor); } EditorGUILayout.BeginHorizontal(); { if (actorChar != null && actorChar.actionNames != null) { EditorGUILayout.LabelField("Action:", GUILayout.Width(50)); //Debug.Log ("actorChar.actionNames = "+actorChar.actionNames); step.intVal = EditorGUILayout.IntPopup( step.intVal, actorChar.actionNames, actorChar.actionIds); }else{ EditorGUILayout.LabelField("Action:", GUILayout.Width(50)); step.intVal = EditorGUILayout.IntField( step.intVal); } if (dialogs != null){ EditorGUILayout.LabelField("Dialog:", GUILayout.Width(50)); step.intVal2 = EditorGUILayout.IntPopup( step.intVal2, dialogs, dialogIds); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("NextLoopAction:", GUILayout.Width(95)); step.boolVal = EditorGUILayout.Toggle(step.boolVal, GUILayout.Width(50)); EditorGUILayout.LabelField("Ignore Blink:", GUILayout.Width(70)); step.boolVal2 = EditorGUILayout.Toggle( step.boolVal2, GUILayout.Width(10)); } EditorGUILayout.EndHorizontal(); } break; case CutsceneStep.Action.LoopAction: if (step.actor != null) { if (actorChar != null) ReadLoopActionData(step.actor); EditorGUILayout.BeginHorizontal(); { if (actorChar != null && actorChar.loopActionNames != null){ EditorGUILayout.LabelField("Loop Action:", GUILayout.Width(80)); step.intVal = EditorGUILayout.IntPopup( step.intVal,actorChar.loopActionNames, actorChar.loopActionIds); }else{ EditorGUILayout.LabelField("Loop Action:", GUILayout.Width(80)); step.intVal = EditorGUILayout.IntField( step.intVal); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Ignore Blink:", GUILayout.Width(70)); step.boolVal = EditorGUILayout.Toggle( step.boolVal, GUILayout.Width(10)); } EditorGUILayout.EndHorizontal(); } break; case CutsceneStep.Action.LoadScene: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Name:", GUILayout.Width(40)); step.strVal = EditorGUILayout.TextField( step.strVal); EditorGUILayout.LabelField("Effect:", GUILayout.Width(40)); step.intVal = EditorGUILayout.IntField(step.intVal, GUILayout.Width(200)); EditorGUILayout.LabelField("Param:", GUILayout.Width(40)); step.strVal2 = EditorGUILayout.TextField( step.strVal2); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Return Cutscene:", GUILayout.Width(100)); step.obj = EditorGUILayout.ObjectField(step.obj, typeof(CutsceneMgr), true,GUILayout.Width(200)); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.Setup: EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("Save", GUILayout.Width(80))) { if (step.actor == null) { UnityEngine.Object[] objs = GameObject.FindObjectsOfType(typeof(ActorBase)); step.actorData = new ActorData[objs.Length]; for (int i = 0; i < objs.Length; i++) { ActorBase actor = (ActorBase) objs[i]; ActorData data = new ActorData(); data.actor = actor; data.pos = actor.transform.position; data.rota = actor.transform.rotation; data.scale = actor.transform.localScale; step.actorData[i] = data; } } else { step.actorData = new ActorData[1]; ActorBase actor = step.actor; ActorData data = new ActorData(); data.actor = actor; data.pos = actor.transform.position; data.rota = actor.transform.rotation; data.scale = actor.transform.localScale; step.actorData[0] = data; } } if (GUILayout.Button("Apply", GUILayout.Width(80))) { foreach (ActorData data in step.actorData) { if (data.actor != null) { data.actor.transform.position = data.pos; data.actor.transform.rotation = data.rota; data.actor.transform.localScale = data.scale; } } } } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.LookAt: step.intVal = EditorGUILayout.IntPopup(step.intVal, lookAtNames, lookAtIds, GUILayout.Width(100)); switch (step.intVal) { case 0: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); step.target = (Transform) EditorGUILayout.ObjectField( step.target, typeof(Transform), true, GUILayout.Width(350)); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } } EditorGUILayout.EndHorizontal(); break; case 1: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); step.target = (Transform) EditorGUILayout.ObjectField(step.target, typeof(Transform), true, GUILayout.Width(350)); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } EditorGUILayout.LabelField("pos:", GUILayout.Width(50)); step.pos = EditorGUILayout.Vector3Field("", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { if (step.target != null) step.pos = step.target.position; } } EditorGUILayout.EndHorizontal(); break; } /* step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Current", GUILayout.Width(80))) { step.pos = step.target.position; } step.boolVal = EditorGUILayout.Toggle("Position", step.boolVal);*/ break; case CutsceneStep.Action.Activate: step.intVal = EditorGUILayout.IntPopup(step.intVal, sendToNames, actionIds, GUILayout.Width(100)); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); step.target = (Transform) EditorGUILayout.ObjectField( step.target, typeof(Transform), true); } EditorGUILayout.EndHorizontal(); // if( step.target != null ) // { // ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); // if( temptarget != null ) // { // if( temptarget.objIncludeActor != null ) // { // step.target = temptarget.objIncludeActor.transform; // } // } // } switch (step.intVal) { case 0: case 2: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Wait", GUILayout.Width(50)); step.boolVal = EditorGUILayout.Toggle( step.boolVal); } EditorGUILayout.EndHorizontal(); break; } if (step.intVal == 2) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Method:", GUILayout.Width(50)); step.strVal = EditorGUILayout.TextField( step.strVal); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Param:", GUILayout.Width(50)); step.strVal2 = EditorGUILayout.TextField( step.strVal2); } EditorGUILayout.EndHorizontal(); } break; case CutsceneStep.Action.Proc: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Name:", GUILayout.Width(50)); step.strVal = EditorGUILayout.TextField( step.strVal,GUILayout.Width(150)); EditorGUILayout.LabelField("Param:", GUILayout.Width(50)); step.strVal2 = EditorGUILayout.TextField( step.strVal2,GUILayout.Width(300)); EditorGUILayout.LabelField("Wait", GUILayout.Width(50)); step.boolVal = EditorGUILayout.Toggle(step.boolVal); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.Sound: // step.intVal = EditorGUILayout.IntPopup(step.intVal, soundNames, actionIds, GUILayout.Width(80)); // step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false); // if (step.intVal == 0) // step.boolVal = EditorGUILayout.Toggle("Loop", step.boolVal); // // else if (step.intVal == 1) // { // step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false); // } // step.floatVal = EditorGUILayout.FloatField("Volume:", step.floatVal, GUILayout.Width(200)); step.intVal = EditorGUILayout.IntPopup(step.intVal, soundNames, actionIds, GUILayout.Width(80)); if (step.intVal == 0) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Clip:", GUILayout.Width(50)); step.obj = EditorGUILayout.ObjectField(step.obj, typeof(AudioClip), false); EditorGUILayout.LabelField("Loop", GUILayout.Width(50)); step.boolVal = EditorGUILayout.Toggle( step.boolVal); } EditorGUILayout.EndHorizontal(); } else if (step.intVal == 1) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Clip:", GUILayout.Width(50)); step.obj = EditorGUILayout.ObjectField(step.obj, typeof(AudioClip), false); } EditorGUILayout.EndHorizontal(); } else if (step.intVal == 2) { EditorGUILayout.BeginHorizontal(); { if (bgmNames != null) EditorGUILayout.LabelField("Song:", GUILayout.Width(50)); step.intVal2 = EditorGUILayout.IntPopup( step.intVal2, bgmNames, bgmIds); EditorGUILayout.LabelField("Loop", GUILayout.Width(50)); step.boolVal = EditorGUILayout.Toggle( step.boolVal); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Volume:", GUILayout.Width(50)); step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(200)); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.ChangeInto: step.intVal2 =EditorGUILayout.IntPopup(step.intVal2, changeIntoNames, changeIntoIds, GUILayout.Width(100)); if (step.intVal2 == 0) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Parts:", GUILayout.Width(50)); step.obj = EditorGUILayout.ObjectField( step.obj, typeof(Transform), false,GUILayout.Width(200)); EditorGUILayout.LabelField("Prop:", GUILayout.Width(50)); step.intVal = EditorGUILayout.IntField( step.intVal,GUILayout.Width(50)); } EditorGUILayout.EndHorizontal(); } else if (step.intVal2 == 3) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Parts:", GUILayout.Width(50)); step.obj = EditorGUILayout.ObjectField(step.obj, typeof(Transform), false); } EditorGUILayout.EndHorizontal(); } break; case CutsceneStep.Action.PlayMovie: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Movie:", GUILayout.Width(50)); step.strVal = EditorGUILayout.TextField(step.strVal); EditorGUILayout.LabelField("Cancel On Input:", GUILayout.Width(100)); step.boolVal = EditorGUILayout.Toggle( step.boolVal); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.UniqueAction: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Name:", GUILayout.Width(50)); step.strVal = EditorGUILayout.TextField(step.strVal,GUILayout.Width(200)); EditorGUILayout.LabelField("Phase :", GUILayout.Width(50)); step.intVal = EditorGUILayout.IntField( step.intVal,GUILayout.Width(50)); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.Mood: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Mood:", GUILayout.Width(50)); step.intVal = EditorGUILayout.IntPopup( step.intVal, moodNames, moodIds,GUILayout.Width(300)); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.ScaleTo: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Speed:",GUILayout.Width(50)); step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70)); EditorGUILayout.LabelField(" Scale:",GUILayout.Width(40)); step.pos = EditorGUILayout.Vector3Field("", step.pos); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.localScale; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.localScale = step.pos; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("EaseType:", GUILayout.Width(60)); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup(step.easeType, GUILayout.Width(300)); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.WaitTouch: step.floatVal = EditorGUILayout.FloatField("Prompt Delay:", step.floatVal, GUILayout.Width(200)); step.intVal = EditorGUILayout.IntField("Choice:", step.intVal, GUILayout.Width(200)); step.boolVal = EditorGUILayout.Toggle("Send GameLog Touch", step.boolVal,GUILayout.Width (200)); if( step.boolVal ) { step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200)); } break; case CutsceneStep.Action.WaitSound: EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("For:", GUILayout.Width(50)); step.intVal = EditorGUILayout.IntPopup(step.intVal, new string[] { "(Any)", "Sound", "Blow", "Clap","BlowNoDelay","ClapNoDelay" }, new int[] { 0, 1, 2, 3, 4, 5 } , GUILayout.Width(300)); EditorGUILayout.LabelField("Timeout:", GUILayout.Width(50)); step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70)); if( step.boolVal ) { step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200)); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Send GameLog Voice", GUILayout.Width(150)); step.boolVal = EditorGUILayout.Toggle( step.boolVal); } EditorGUILayout.EndHorizontal(); break; case CutsceneStep.Action.GameLog: //GameStart, GameEnd, ChapterStart, ChapterEnd step.intVal = EditorGUILayout.IntPopup(step.intVal, gameLogNames, gameLogIds, GUILayout.Width(100)); if( step.intVal < 2 ) //GameStart, GameEnd { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("ID:", GUILayout.Width(50)); step.intVal2 = EditorGUILayout.IntField( step.intVal2, GUILayout.Width(200)); } EditorGUILayout.EndHorizontal(); } break; } /* step.floatVal = EditorGUILayout.FloatField("Value:", step.floatVal); step.target = EditorGUILayout.ObjectField("Target:", step.target, typeof(UnityEngine.Object), true); */ EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Comment: ", GUILayout.Width(60)); step.note = EditorGUILayout.TextField(step.note); }EditorGUILayout.EndHorizontal(); GUILayout.Space(1); } EditorGUILayout.EndVertical(); } }
private void DrawNonZoomArea() { // GUI.Box(new Rect(0.0f, 0.0f, 600.0f, 50.0f), "Adjust zoom of middle box with slider or mouse wheel.\nMove zoom area dragging with middle mouse button or Alt+left mouse button."); _zoom = EditorGUI.Slider(new Rect(20.0f, 20.0f, 600.0f, 15.0f), _zoom, kZoomMin, kZoomMax); //GUI.Box(new Rect(0.0f, 300.0f - 25.0f, 600.0f, 25.0f), "Unzoomed Box"); GUI.Box(new Rect(0.0f, position.height - 150.0f, position.width, position.height), "Unzoomed Box"); GUILayout.BeginArea(new Rect(0.0f, position.height - 145.0f, position.width, 145.0f)); //CutsceneStep step1 = null; //StepOp stepOp = StepOp.NoOp; CutsceneStep step = currentStep; if( step != null ) { Color bgrndBak = GUI.backgroundColor; Color colorBak = GUI.color; GUI.backgroundColor = LcCutsceneEditor.selectedId == step.stepId ? Color.cyan : bgrndBak; #if UNITY_EDITOR if( step.bCurrentStep ) GUI.backgroundColor = Color.red; #endif EditorGUILayout.BeginVertical("Button"); EditorGUILayout.BeginHorizontal(); GUI.color = step.actor != null ? step.actor.symbolColor : colorBak; if (GUILayout.Button ("", GUILayout.Width(20))) { SelectStep(step.stepId); } GUI.color = colorBak; step.stepId = EditorGUILayout.IntField(step.stepId); step.preId = EditorGUILayout.IntField("Prev Id:", step.preId); step.delay = EditorGUILayout.FloatField("Delay:", step.delay); // if (GUILayout.Button("Up", GUILayout.Width(90))) { // SelectStep(step.stepId); // step1 = step; // stepOp = StepOp.Up; // } // if (GUILayout.Button("Down", GUILayout.Width(90))) { // SelectStep(step.stepId); // step1 = step; // stepOp = StepOp.Down; // } // if (GUILayout.Button("Delete", GUILayout.Width(90))) { // if( EditorUtility.DisplayDialog("This Step Delete?" // ,"Are you sure you want to delete? ", "Yes", "No") ) // { // step1 = step; // stepOp = StepOp.Del; // } // // } // if (GUILayout.Button("Add Step", GUILayout.Width(90))) { // step1 = step; // stepOp = StepOp.AddAfter; // } // if (GUILayout.Button("Run To", GUILayout.Width(90))) { // SelectStep(step.stepId); // RunTo (step.stepId); // } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); // step.objectIncludeActor = (GameObject) EditorGUILayout.ObjectField(step.objectIncludeActor // , typeof(GameObject), true, GUILayout.Width(150)); // // if (step.objectIncludeActor != null) // step.actor = step.objectIncludeActor.GetComponentInChildren<ActorBase>(); step.actor = (ActorBase) EditorGUILayout.ObjectField(step.actor, typeof(ActorBase), true , GUILayout.Width(150)); if( step.actor != null ) { if( step.actor.objIncludeActor != null ) { step.actor = step.actor.objIncludeActor; } } tempAcitonDisplay = CutsceneStep.ConverterActionIDToActionDisplayID(step.action); tempAcitonDisplay = (CutsceneStep.ActionDisplay) EditorGUILayout.EnumPopup(tempAcitonDisplay, GUILayout.Width(100)); step.action = CutsceneStep.ConverterActionDisplayIDToActionID(tempAcitonDisplay); ActorChar actorChar = null; if (step.actor != null) actorChar = step.actor.GetComponent<ActorChar>(); switch (step.action) { case CutsceneStep.Action.MoveTo: step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.pos; } step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(210)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.target = (Transform) EditorGUILayout.ObjectField("MovePosTransform", step.target , typeof(Transform), true , GUILayout.Width(400)); if( step.target != null ) { step.pos = step.target.position; // step.pos.x = step.target.position.x; // step.pos.x = step.target.position.x; // step.pos.x = step.target.position.x; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.boolVal = EditorGUILayout.Toggle("WithAction", step.boolVal,GUILayout.Width (200)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.obj = EditorGUILayout.ObjectField("Path:", step.obj, typeof(LcPath), true , GUILayout.Width(400)); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup("EaseType:", step.easeType , GUILayout.Width(300)); break; case CutsceneStep.Action.JumpTo: step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.pos; } step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(210)); break; case CutsceneStep.Action.GoBack: step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(210)); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup("EaseType:", step.easeType); break; case CutsceneStep.Action.WaitFor: step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } step.pos = EditorGUILayout.Vector3Field("Offset:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position - step.target.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.target.position + step.pos; } break; case CutsceneStep.Action.Follow: step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(200)); // step.boolVal = EditorGUILayout.Toggle("Vertical:", step.boolVal, GUILayout.Width(180)); step.pos = EditorGUILayout.Vector3Field("Offset:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.position - step.target.position; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.position = step.target.position + step.pos; } break; case CutsceneStep.Action.Rotate: step.pos = EditorGUILayout.Vector3Field("Angle:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.eulerAngles; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.eulerAngles = step.pos; } break; case CutsceneStep.Action.Caption: if (dialogs != null) step.intVal = EditorGUILayout.IntPopup("Dialog:", step.intVal, dialogs, dialogIds); step.floatVal = EditorGUILayout.FloatField("Duration:", step.floatVal); break; case CutsceneStep.Action.TalkTo: case CutsceneStep.Action.SpeechTo: if (step.actor != null) { ReadActionData(step.actor); if (dialogs != null) step.intVal = EditorGUILayout.IntPopup("Dialog:", step.intVal, dialogs, dialogIds); step.floatVal = EditorGUILayout.FloatField("Duration:", step.floatVal); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.boolVal = EditorGUILayout.Toggle("NextLoopAction:", step.boolVal); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } if (actorChar != null && actorChar.actionNames != null) step.intVal2 = EditorGUILayout.IntPopup("Action:", step.intVal2, actorChar.actionNames, actorChar.actionIds); else step.intVal2 = EditorGUILayout.IntField("Action:", step.intVal2); } break; case CutsceneStep.Action.Action: if (step.actor != null) { if (actorChar != null) ReadActionData(step.actor); if (actorChar != null && actorChar.actionNames != null) step.intVal = EditorGUILayout.IntPopup("Action:", step.intVal, actorChar.actionNames, actorChar.actionIds); else step.intVal = EditorGUILayout.IntField("Action:", step.intVal); if (dialogs != null) step.intVal2 = EditorGUILayout.IntPopup("Dialog:", step.intVal2, dialogs, dialogIds); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.boolVal = EditorGUILayout.Toggle("NextLoopAction:", step.boolVal, GUILayout.Width(200)); step.boolVal2 = EditorGUILayout.Toggle("Ignore Blink:", step.boolVal2, GUILayout.Width(200)); } break; case CutsceneStep.Action.LoopAction: if (step.actor != null) { if (actorChar != null) ReadLoopActionData(step.actor); if (actorChar != null && actorChar.loopActionNames != null) step.intVal = EditorGUILayout.IntPopup("Loop Action:", step.intVal, actorChar.loopActionNames, actorChar.loopActionIds); else step.intVal = EditorGUILayout.IntField("Loop Action:", step.intVal); step.boolVal = EditorGUILayout.Toggle("Ignore Blink:", step.boolVal, GUILayout.Width(200)); } break; case CutsceneStep.Action.LoadScene: step.strVal = EditorGUILayout.TextField("Name:", step.strVal); step.intVal = EditorGUILayout.IntField("Effect:", step.intVal, GUILayout.Width(200)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.strVal2 = EditorGUILayout.TextField("Param:", step.strVal2); step.obj = EditorGUILayout.ObjectField("Return Cutscene:", step.obj, typeof(CutsceneMgr), true); break; case CutsceneStep.Action.Setup: if (GUILayout.Button("Save", GUILayout.Width(80))) { if (step.actor == null) { UnityEngine.Object[] objs = GameObject.FindObjectsOfType(typeof(ActorBase)); step.actorData = new ActorData[objs.Length]; for (int i = 0; i < objs.Length; i++) { ActorBase actor = (ActorBase) objs[i]; ActorData data = new ActorData(); data.actor = actor; data.pos = actor.transform.position; data.rota = actor.transform.rotation; data.scale = actor.transform.localScale; step.actorData[i] = data; } } else { step.actorData = new ActorData[1]; ActorBase actor = step.actor; ActorData data = new ActorData(); data.actor = actor; data.pos = actor.transform.position; data.rota = actor.transform.rotation; data.scale = actor.transform.localScale; step.actorData[0] = data; } } if (GUILayout.Button("Apply", GUILayout.Width(80))) { foreach (ActorData data in step.actorData) { if (data.actor != null) { data.actor.transform.position = data.pos; data.actor.transform.rotation = data.rota; data.actor.transform.localScale = data.scale; } } } break; case CutsceneStep.Action.LookAt: step.intVal = EditorGUILayout.IntPopup(step.intVal, lookAtNames, lookAtIds, GUILayout.Width(100)); switch (step.intVal) { case 0: step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true, GUILayout.Width(350)); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } break; case 1: step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true, GUILayout.Width(350)); if( step.target != null ) { ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); if( temptarget != null ) { if( temptarget.objIncludeActor != null ) { step.target = temptarget.objIncludeActor.transform; } } } step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { if (step.target != null) step.pos = step.target.position; } break; } /* step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true); step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Current", GUILayout.Width(80))) { step.pos = step.target.position; } step.boolVal = EditorGUILayout.Toggle("Position", step.boolVal);*/ break; case CutsceneStep.Action.Activate: step.intVal = EditorGUILayout.IntPopup(step.intVal, sendToNames, actionIds, GUILayout.Width(100)); step.target = (Transform) EditorGUILayout.ObjectField( "Target:", step.target, typeof(Transform), true); // if( step.target != null ) // { // ActorBase temptarget = step.target.gameObject.GetComponent<ActorBase>(); // if( temptarget != null ) // { // if( temptarget.objIncludeActor != null ) // { // step.target = temptarget.objIncludeActor.transform; // } // } // } switch (step.intVal) { case 0: case 2: step.boolVal = EditorGUILayout.Toggle("Wait", step.boolVal); break; } if (step.intVal == 2) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.strVal = EditorGUILayout.TextField("Method:", step.strVal); step.strVal2 = EditorGUILayout.TextField("Param:", step.strVal2); } break; case CutsceneStep.Action.Proc: step.strVal = EditorGUILayout.TextField("Name:", step.strVal); step.strVal2 = EditorGUILayout.TextField("Param:", step.strVal2); step.boolVal = EditorGUILayout.Toggle("Wait", step.boolVal); break; case CutsceneStep.Action.Sound: // step.intVal = EditorGUILayout.IntPopup(step.intVal, soundNames, actionIds, GUILayout.Width(80)); // step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false); // if (step.intVal == 0) // step.boolVal = EditorGUILayout.Toggle("Loop", step.boolVal); // // else if (step.intVal == 1) // { // step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false); // } // step.floatVal = EditorGUILayout.FloatField("Volume:", step.floatVal, GUILayout.Width(200)); step.intVal = EditorGUILayout.IntPopup(step.intVal, soundNames, actionIds, GUILayout.Width(80)); if (step.intVal == 0) { step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false); step.boolVal = EditorGUILayout.Toggle("Loop", step.boolVal); } else if (step.intVal == 1) { step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false); } else if (step.intVal == 2) { if (bgmNames != null) step.intVal2 = EditorGUILayout.IntPopup("Song:", step.intVal2, bgmNames, bgmIds); step.boolVal = EditorGUILayout.Toggle("Loop", step.boolVal); } step.floatVal = EditorGUILayout.FloatField("Volume:", step.floatVal, GUILayout.Width(200)); break; case CutsceneStep.Action.ChangeInto: step.intVal2 =EditorGUILayout.IntPopup(step.intVal2, changeIntoNames, changeIntoIds, GUILayout.Width(100)); if (step.intVal2 == 0) { step.obj = EditorGUILayout.ObjectField("Parts:", step.obj, typeof(Transform), false); step.intVal = EditorGUILayout.IntField("Prop:", step.intVal); } else if (step.intVal2 == 3) { step.obj = EditorGUILayout.ObjectField("Parts:", step.obj, typeof(Transform), false); } break; case CutsceneStep.Action.PlayMovie: step.strVal = EditorGUILayout.TextField("Movie:", step.strVal); step.boolVal = EditorGUILayout.Toggle("Cancel On Input:", step.boolVal); break; case CutsceneStep.Action.UniqueAction: step.strVal = EditorGUILayout.TextField("Name:", step.strVal); step.intVal = EditorGUILayout.IntField("Phase", step.intVal); break; case CutsceneStep.Action.Mood: step.intVal = EditorGUILayout.IntPopup("Mood:", step.intVal, moodNames, moodIds); break; case CutsceneStep.Action.ScaleTo: step.pos = EditorGUILayout.Vector3Field("Scale:", step.pos, GUILayout.Width(240)); if (GUILayout.Button("Save", GUILayout.Width(80))) { step.pos = step.actor.transform.localScale; } if (GUILayout.Button("Apply", GUILayout.Width(80))) { step.actor.transform.localScale = step.pos; } step.floatVal = EditorGUILayout.FloatField("Speed:", step.floatVal, GUILayout.Width(210)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup("EaseType:", step.easeType, GUILayout.Width(300)); break; case CutsceneStep.Action.WaitTouch: step.floatVal = EditorGUILayout.FloatField("Prompt Delay:", step.floatVal, GUILayout.Width(200)); step.intVal = EditorGUILayout.IntField("Choice:", step.intVal, GUILayout.Width(200)); EditorGUILayout.EndHorizontal(); step.boolVal = EditorGUILayout.Toggle("Send GameLog Touch", step.boolVal,GUILayout.Width (200)); if( step.boolVal ) { step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200)); } EditorGUILayout.BeginHorizontal(); break; case CutsceneStep.Action.WaitSound: step.intVal = EditorGUILayout.IntPopup("For:", step.intVal, new string[] { "(Any)", "Sound", "Blow", "Clap","BlowNoDelay","ClapNoDelay" }, new int[] { 0, 1, 2, 3, 4, 5 } , GUILayout.Width(300)); step.floatVal = EditorGUILayout.FloatField("Timeout:", step.floatVal, GUILayout.Width(200)); EditorGUILayout.EndHorizontal(); step.boolVal = EditorGUILayout.Toggle("Send GameLog Voice", step.boolVal,GUILayout.Width (200)); if( step.boolVal ) { step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200)); } EditorGUILayout.BeginHorizontal(); break; case CutsceneStep.Action.GameLog: //GameStart, GameEnd, ChapterStart, ChapterEnd step.intVal = EditorGUILayout.IntPopup(step.intVal, gameLogNames, gameLogIds, GUILayout.Width(100)); if( step.intVal < 2 ) //GameStart, GameEnd { step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200)); } break; } /* step.floatVal = EditorGUILayout.FloatField("Value:", step.floatVal); step.target = EditorGUILayout.ObjectField("Target:", step.target, typeof(UnityEngine.Object), true); */ EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); step.note = EditorGUILayout.TextField("Comment:", step.note); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); GUILayout.Space(1); } GUILayout.EndArea(); }