Example #1
0
	static public void SetScene(CutsceneMgr resumeCutscene) {
		if(resumeCutscene == null) return; 

		SceneData data = null;
		
		string sceneName = World.loadedLevelName;
		
		if( sceneName == "")
			sceneName = Application.loadedLevelName;
		
		if (sceneFlow.Count > 0) {
			data = sceneFlow[sceneFlow.Count - 1];
			if (data.name != sceneName) {
				data = null;
			}
		}
		
		if (data == null) {
			if (sceneFlow.Count > 1) {
				sceneFlow.RemoveRange(0, sceneFlow.Count - 1);
			}
			
			data = new SceneData();
			data.name = sceneName;
			sceneFlow.Add(data);
		}
		
		if (resumeCutscene != null) {
			data.resumeCutscene = resumeCutscene.name;
		} else 
			data.resumeCutscene = null;
	}
Example #2
0
	void OnSelectionChange() {
		//Debug.Log ("OnSelectionChange");
		CutsceneMgr newMgr = null;
		if (Selection.activeGameObject != null) {
			newMgr = Selection.activeGameObject.GetComponent<CutsceneMgr>();
		}
		
		if (newMgr != null) {
			dialogs = null;
			bgmNames = null;
			
			//position reset : oneway48
			if( mgr != null )
			{
				if( newMgr.gameObject.name != mgr.gameObject.name )
					_zoomCoordsOrigin.y = 0;
			}

			
			
			mgr = newMgr;
			title = mgr.transform.name;// Selection.activeGameObject.name;
//			List<CutsceneMgr.Dialog2> list = CutsceneMgr.ReadDialogData(mgr.dialogData);
			CutsceneMgr.Dialog[] list = null;
			if (mgr.dialogData != null)
				list = mgr.dialogData.GetDialogs(EditorGlobal.langIdx);
			if (list != null) {
				dialogs = new string[list.Length];
				dialogIds = new int[list.Length];
				int i = 0;
				foreach (CutsceneMgr.Dialog item in list) {
					if (i == 0)
						dialogs[i] = item.caption;
					else
						dialogs[i] = string.Format ("{0}. {1}", i, item.caption);
					dialogIds[i] = i;
					i++;
				}
			}
			
			CutsceneMgr.BGM[] listBGM = null;
			
			if (mgr.BGMData != null)
				listBGM = mgr.BGMData.GetBGMs(EditorGlobal.langIdx);
			if (listBGM != null) {
				bgmNames = new string[listBGM.Length];
				bgmIds = new int[listBGM.Length];
				int i = 0;
				foreach (CutsceneMgr.BGM item in listBGM) {
					if (i == 0)
						bgmNames[i] = "(None)";
					else
					{
						if( item.clip != null )
							bgmNames[i] = string.Format ("{0}. {1}", i, item.clip.name);
					}
					bgmIds[i] = i;
					i++;
				}
			}
			
			if( actionReadDic != null )
				actionReadDic.Clear();
			if( loopActionReadDic != null )
				loopActionReadDic.Clear();
			actionReadDic = new Dictionary<ActorBase, ActorBase>();
			loopActionReadDic = new Dictionary<ActorBase, ActorBase>();
			
		} 
//		else {
//			mgr = newMgr;
//			title = "Cutscene";
			
			
//			if( mgr != null )
//			{
//				CutsceneMgr.Dialog[] list = null;
//				
//				if (mgr.dialogData != null)
//					list = mgr.dialogData.GetDialogs(EditorGlobal.langIdx);
//				
//				if (list != null) {
//					dialogs = new string[list.Length];
//					dialogIds = new int[list.Length];
//					int i = 0;
//					foreach (CutsceneMgr.Dialog item in list) {
//						if (i == 0)
//							dialogs[i] = item.caption;
//						else
//							dialogs[i] = string.Format ("{0}. {1}", i, item.caption);
//						dialogIds[i] = i;
//						i++;
//					}
//				}
//				
//				actionReadDic = new Dictionary<ActorBase, ActorBase>();
//				loopActionReadDic = new Dictionary<ActorBase, ActorBase>();
//			}
//		}
		
		Repaint();
	}
Example #3
0
    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();
		
    }
Example #4
0
	void OnSelectionChange() {
		CutsceneMgr newMgr = null;
		if (Selection.activeGameObject != null) {
			newMgr = Selection.activeGameObject.GetComponent<CutsceneMgr>();
		}
		
		if (newMgr != null) {
			mgr = newMgr;
			title = Selection.activeGameObject.name;
		} 
//		else {
//			mgr = newMgr;
//			title = "Timeline";
//		}
		
		Repaint();
	}