public override void OnInspectorGUI() { ViNoSaveInfo info = target as ViNoSaveInfo; m_Edit = EditorGUILayout.BeginToggleGroup("", m_Edit); info.data.m_LoadedLevelIndex = EditorGUILayout.IntField("LevelIndex", info.data.m_LoadedLevelIndex); info.data.m_LoadedLevelName = EditorGUILayout.TextField("LevelName", info.data.m_LoadedLevelName); // string[] pop = { info.data.m_CurrentScenarioName }; // int sel = 0; // sel =EditorGUILayout.Popup( "ScenarioName" , sel , pop ); info.data.m_CurrentScenarioName = EditorGUILayout.TextField("ScenarioName", info.data.m_CurrentScenarioName); // string[] pop2 = { info.data.m_NodeName }; // int sel2 = 0; // sel2 =EditorGUILayout.Popup( "CurrentNode" , sel2 , pop2 ); info.data.m_NodeName = EditorGUILayout.TextField("CurrentNode", info.data.m_NodeName); info.data.m_BgmName = EditorGUILayout.TextField("BGM", info.data.m_BgmName); info.data.m_ScenarioResourceFilePath = EditorGUILayout.TextField("ScenarioFilePath", info.data.m_ScenarioResourceFilePath); EditorGUILayout.LabelField("SceneXml"); info.data.m_SceneXmlData = EditorGUILayout.TextArea(info.data.m_SceneXmlData); EditorGUILayout.LabelField("Saved Date"); EditorGUILayout.SelectableLabel(info.data.m_Date); EditorGUILayout.LabelField("Desc"); EditorGUILayout.SelectableLabel(info.data.m_ScenarioDescription); scenarioNode = EditorGUILayout.ObjectField(scenarioNode, typeof(ScenarioNode), true) as ScenarioNode; if (scenarioNode != null) { List <string> tagList = scenarioNode.GetNodeTagsUnderMe(); m_SelectedID = EditorGUILayout.Popup("NodeTagList", m_SelectedID, tagList.ToArray()); } if (GUILayout.Button("Clear Data")) { bool yes = EditorUtility.DisplayDialog(" ! ", "Are you sure you want to Clear Data", "yes", "no"); if (yes) { info.ClearData(); } } EditorGUILayout.EndToggleGroup(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
public override void OnInspectorGUI() { ViNoSaveInfo info = target as ViNoSaveInfo; m_Edit = EditorGUILayout.BeginToggleGroup( "" , m_Edit ); info.data.m_LoadedLevelIndex = EditorGUILayout.IntField( "LevelIndex" , info.data.m_LoadedLevelIndex ); info.data.m_LoadedLevelName = EditorGUILayout.TextField( "LevelName" , info.data.m_LoadedLevelName ); // string[] pop = { info.data.m_CurrentScenarioName }; // int sel = 0; // sel =EditorGUILayout.Popup( "ScenarioName" , sel , pop ); info.data.m_CurrentScenarioName = EditorGUILayout.TextField( "ScenarioName" , info.data.m_CurrentScenarioName ); // string[] pop2 = { info.data.m_NodeName }; // int sel2 = 0; // sel2 =EditorGUILayout.Popup( "CurrentNode" , sel2 , pop2 ); info.data.m_NodeName = EditorGUILayout.TextField( "CurrentNode" , info.data.m_NodeName ); info.data.m_BgmName = EditorGUILayout.TextField( "BGM" , info.data.m_BgmName ); info.data.m_ScenarioResourceFilePath = EditorGUILayout.TextField( "ScenarioFilePath" , info.data.m_ScenarioResourceFilePath ); EditorGUILayout.LabelField( "SceneXml" ); info.data.m_SceneXmlData = EditorGUILayout.TextArea( info.data.m_SceneXmlData ); EditorGUILayout.LabelField( "Saved Date" ); EditorGUILayout.SelectableLabel( info.data.m_Date ); EditorGUILayout.LabelField( "Desc" ); EditorGUILayout.SelectableLabel( info.data.m_ScenarioDescription ); scenarioNode = EditorGUILayout.ObjectField( scenarioNode , typeof( ScenarioNode ) , true ) as ScenarioNode; if( scenarioNode != null ){ List<string> tagList = scenarioNode.GetNodeTagsUnderMe(); m_SelectedID =EditorGUILayout.Popup( "NodeTagList" , m_SelectedID , tagList.ToArray() ); } if( GUILayout.Button ( "Clear Data" ) ){ bool yes = EditorUtility.DisplayDialog( " ! " , "Are you sure you want to Clear Data" , "yes" , "no" ); if( yes) { info.ClearData(); } } EditorGUILayout.EndToggleGroup(); if( GUI.changed ){ EditorUtility.SetDirty( target ); } }
public override void OnInspectorGUI() { // serializedObject.Update(); ScenarioNode scenario = target as ScenarioNode; if (Application.isPlaying) { // Ping Current Node in playmode. IScriptEngine scr = IScriptEngine.Instance; if (scr != null) { GUICommon.DrawScriptEngineCommonInspector(scr); } } //*/ Color savedCol = GUI.backgroundColor; GUI.backgroundColor = Color.green; GUILayout.BeginHorizontal(); scenario.m_PlayAtStart = EditorGUILayout.Toggle("Play at Start", scenario.m_PlayAtStart); //, GUILayout.Width( 15f ) ); // EditorGUILayout.LabelField( "Start and Play" , GUILayout.Width( 100f ) ); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); scenario.startFromSave = EditorGUILayout.Toggle("Start from SavePoint", scenario.startFromSave); //, GUILayout.Width( 15f ) ); // EditorGUILayout.LabelField( "Start from Savepoint" , GUILayout.Width( 150f ) ); GUILayout.EndHorizontal(); scenario.flagTable = EditorGUILayout.ObjectField("Flag", scenario.flagTable, typeof(FlagTable), false) as FlagTable; //*/ // scenario.saveInfo = EditorGUILayout.ObjectField( "SaveInfo" , scenario.saveInfo , typeof( ViNoSaveInfo ) , false ) as ViNoSaveInfo; // scenario.soundData = EditorGUILayout.ObjectField( "SoundData" , scenario.soundData , typeof( ScriptableSoundData ) , false ) as ScriptableSoundData; /* if ( soundDataProp != null){ * EditorGUILayout.PropertyField( soundDataProp ); * } * //*/ // Dont show now. // Adv Script Compile Option. #if false if (GUILayout.Button("Node Names")) { List <string> list = scenario.GetNodeTagsUnderMe(); for (int i = 0; i < list.Count; i++) { Debug.Log("Node:" + list[i]); } } // scenario.execMode = (ScenarioExecMode)EditorGUILayout.EnumPopup( "ExecLevel" , scenario.execMode ); EditorGUILayout.LabelField("Scenario Script"); scenarioScript = EditorGUILayout.TextArea(scenarioScript); GUILayout.BeginHorizontal(); scenario.useCompiledScript = EditorGUILayout.Toggle(scenario.useCompiledScript); EditorGUILayout.LabelField("useCompiled", GUILayout.Width(100f)); scenario.compiledScriptFile = EditorGUILayout.ObjectField(scenario.compiledScriptFile, typeof(TextAsset), false) as TextAsset; GUILayout.EndHorizontal(); if (GUILayout.Button("Compile")) { CompileAndSaveAsBinaryFile(scenario.name, scenario); } GUILayout.BeginHorizontal(); scenario.m_CacheCode = EditorGUILayout.Toggle(scenario.m_CacheCode, GUILayout.Width(15f)); EditorGUILayout.LabelField("IsCacheCode", GUILayout.Width(100f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); scenario.m_PlayOnEnable = EditorGUILayout.Toggle(scenario.m_PlayOnEnable, GUILayout.Width(15f)); EditorGUILayout.LabelField("PlayOnEnable", GUILayout.Width(100f)); GUILayout.EndHorizontal(); #endif /* GUILayout.BeginHorizontal(); * * scenario.useScenarioScript = EditorGUILayout.Toggle( "use Scenario Script" , scenario.useScenarioScript );// , GUILayout.Width( 15f ) ); * // EditorGUILayout.LabelField( "useScenarioScript" , GUILayout.Width( 100f ) ); * * GUILayout.EndHorizontal(); * //*/ /* if( scenario.useScenarioScript ){ * scenario.scenarioScript = EditorGUILayout.ObjectField( "TextAsset" , scenario.scenarioScript , typeof( TextAsset ) , false ) as TextAsset; * } * else{ * //*/ // GUI.enabled = ! scenario.useScenarioScript; GUILayout.BeginHorizontal(); scenario.startNode = (ViNode)EditorGUILayout.ObjectField("START NODE", scenario.startNode, typeof(ViNode), true); GUILayout.EndHorizontal(); // } // GUI.enabled = true; // GUI.enabled = Application.isPlaying; // NodeGUI.OnGUI_ViNode( scenario , true , false ); if (Application.isPlaying) { if (GUILayout.Button("PLAY")) { if (AssetDatabase.Contains(scenario.gameObject)) { GameObject clone = Instantiate(scenario.gameObject) as GameObject; ViNoGOExtensions.StripGameObjectName(clone, "(Clone)", ""); } else { scenario.Play(); } } } else { GUILayout.BeginHorizontal(); GUILayout.Space(30f); if (AssetDatabase.Contains(scenario.gameObject)) { if (GUILayout.Button("Edit")) { EditorUtility.DisplayDialog("Note", "If you finish editing in your scene , please do not forget to apply changes to the prefab", "Ok"); GameObject obj = PrefabUtility.InstantiatePrefab(scenario.gameObject) as GameObject; //AttachedAsset( scenario.gameObject ); PrefabUtility.ReplacePrefab(obj, scenario.gameObject, ReplacePrefabOptions.ConnectToPrefab); EditorGUIUtility.PingObject(obj); } } else { /* if( GUILayout.Button ( "Save as ScenarioScript" ) ){ * // scenarioScript = KAGInterpreter._TEST_TO_KIRIKIRI_SCRIPT( scenario.gameObject ); * string text = ViNoToolkit.KAGInterpreter.ToScenarioScript( scenario.gameObject ); * // System.Text.StringBuilder sb = new System.Text.StringBuilder(); * // scenario.ToScenarioScript( ref sb ); * string filePath = Application.dataPath + "/" + scenario.name + ".txt"; * Debug.Log( "Saved as a Scenario Script at :" + filePath ); * File.WriteAllText( filePath , text ); * AssetDatabase.Refresh(); * * // scenario.scenarioScript = AssetDatabase.LoadAssetAtPath( filePath , typeof(TextAsset) ) as TextAsset; * // scenarioScript = sb.ToString(); * // Debug.Log ( sb.ToString ()); * } * //*/ } GUILayout.Space(30f); GUILayout.EndHorizontal(); } // GUI.enabled = true; GUI.backgroundColor = savedCol; // serializedObject.ApplyModifiedProperties(); }