static public void DrawDialogCategory(DialogPartNode node, DialogPartData unit) { if (EditorGUIUtility.isProSkin) { GUI.contentColor = Color.white; GUICommon.DrawLineSpace(2f, 22f); EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); dialogToggle = EditorGUILayout.Foldout(dialogToggle, "Dialog"); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); dialogToggle = EditorGUILayout.Foldout(dialogToggle, "Dialog"); EditorGUILayout.EndHorizontal(); GUI.contentColor = Color.white; GUICommon.DrawLineSpace(3f, 1f); } if (dialogToggle) { // will be Drawn TextBox and NameTextBox field... // . // ... NodeGUI.DrawLayoutNameField(unit); NodeGUI.DrawLayoutDialogTextField(unit); } }
static public void OnGUI_a(DialogPartNode node, ref DialogPartData unit, int index, ViNoTextBox textBox, ViNoTextBox nameTextBox, int viewMode) { if (!EditorGUIUtility.isProSkin) { GUICommon.DrawLineSpace(0f, 1f); } switch (viewMode) { case 0: // Actions. DrawActionViewMode(unit.actionID, node, ref unit, index, textBox, nameTextBox); break; case 1: // Edit Text. DrawEditTextViewMode(unit.actionID, node, ref unit, index, textBox, nameTextBox); break; // case 2: // XML. // DialogPartNodeInspector.DrawXMLImportField( node ); // break; } /* * case 1: * * EditorGUILayout.BeginHorizontal(); * EditorGUILayout.LabelField ( "DIALOG_ID:" + unit.dialogID.ToString () , GUILayout.Width( 100f) ); * unit.dialogText = EditorGUILayout.TextArea( unit.dialogText , GUI.skin.textArea ); * * EditorGUILayout.EndHorizontal(); * * break; * } * //*/ }
static public void DrawSceneCategory(DialogPartNode node, DialogPartData unit) { if (EditorGUIUtility.isProSkin) { GUI.contentColor = Color.white; GUICommon.DrawLineSpace(2f, 22f); EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); sceneToggle = EditorGUILayout.Foldout(sceneToggle, "Scene"); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); sceneToggle = EditorGUILayout.Foldout(sceneToggle, "Scene"); EditorGUILayout.EndHorizontal(); GUI.contentColor = Color.white; GUICommon.DrawLineSpace(3f, 1f); } if (sceneToggle) { NodeGUI.DrawLayoutSceneField(unit); } }
static public void DrawImportField(DialogPartNode targetNode) { GUICommon.DrawLineSpace(10f, 5f); #if false if (GUILayout.Button("Log Scenario Script in Console")) { DialogPartNodeUtility.ExportScenarioScript(targetNode); } #endif /* m_ImportDataTypeID = GUILayout.Toolbar( m_ImportDataTypeID , m_ImportDataTypes ); * string dataType = m_ImportDataTypes[ m_ImportDataTypeID ]; * switch( dataType ){ * case "XML": * //*/ DrawXMLImportField(targetNode); /* break; * * case "Text": * EditorGUILayout.LabelField( "Overwrite ?" ); * m_IsOverwrite = EditorGUILayout.Toggle( m_IsOverwrite ); * * EditorGUILayout.LabelField( "Name Delimiter" ); * m_NameDelimiter = EditorGUILayout.TextArea( m_NameDelimiter ); * * EditorGUILayout.LabelField( "Block Delimiter" ); * m_BlockDelimiter = EditorGUILayout.TextArea( m_BlockDelimiter ); * * m_TxtAsset = EditorGUILayout.ObjectField( "Text" , m_TxtAsset , typeof(TextAsset) , false ) as TextAsset; * if( m_TxtAsset == null ){ * GUI.enabled = false; * } * * if( GUILayout.Button( "Import" ) ){ * if( EditorUtility.DisplayDialog( "Overwrite ?" , "Are you sure you really want to import?" * , "Yes", "Cancel") ){ * string[] nameDelimiter = { m_NameDelimiter }; * DialogPartNodeUtility.ImportText( targetNode , m_TxtAsset.text , m_BlockDelimiter , nameDelimiter , true ); * } * } * * GUI.enabled = true; * * EditorGUILayout.LabelField( "Text Flagment" ); * m_FlagmentText = EditorGUILayout.TextArea( m_FlagmentText ); * if( GUILayout.Button( "Add Text Flagment" ) ){ * string[] nameDelimiter = { m_NameDelimiter }; * DialogPartNodeUtility.ImportText( targetNode , m_FlagmentText , m_BlockDelimiter , nameDelimiter , false ); * } * * break; * } * * //*/ }
static public void DrawItemBarBackground() { if (EditorGUIUtility.isProSkin) { GUI.contentColor = Color.white; GUICommon.DrawLineSpace(2f, 22f); } else { GUI.contentColor = Color.white; GUICommon.DrawLineSpace(3f, 1f); } }
static public void DrawActorCategory(DialogPartNode node, DialogPartData unit) { if (EditorGUIUtility.isProSkin) { GUI.contentColor = Color.white; GUICommon.DrawLineSpace(2f, 22f); EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); actorToggle = EditorGUILayout.Foldout(actorToggle, "Actors"); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); actorToggle = EditorGUILayout.Foldout(actorToggle, "Actors"); EditorGUILayout.EndHorizontal(); GUI.contentColor = Color.white; GUICommon.DrawLineSpace(3f, 1f); } if (actorToggle) { switch (unit.actionID) { case DialogPartNodeActionType.MoveActor: case DialogPartNodeActionType.EnterActor: NodeGUI.DrawLayoutEnterActorField(unit); break; // case DialogPartNodeActionType.Shake: case DialogPartNodeActionType.ExitActor: NodeGUI.DrawLayoutExitActorField(unit); break; /* case DialogPartNodeActionType.ChangeState: * NodeGUI.DrawLayoutChangeStateActorField( unit ); * break; * //*/ } } }
static public void DrawDialogListUtil(DialogPartNode node) { GUICommon.DrawLineSpace(10f, 5f); ViNoEditorUtil.BeginGUIColor(Color.green, GUI.backgroundColor, GUI.contentColor); //Color.black , Color.white ); GUILayout.BeginHorizontal(); // GUILayout.Space( Screen.width/2f ); if (GUILayout.Button("+")) { // if( GUILayout.Button( ViNoEditorResources.plusIcon ) ){ // node.AddData( new DialogPartData() );// AddData( node ); // Debug.Log( "Register Scene Undo"); Undo.RegisterUndo(node, node.name); // Undo.SetSnapshotTarget( node , node.name ); int itemNum = node.GetMessageNum(); node.AddItemAt(itemNum); node.ReAssignDialogIDsInThisObject(); } if (GUILayout.Button("-")) { // if( GUILayout.Button( ViNoEditorResources.minusIcon ) ){//} , GUILayout.Width( sa ) ) ){ Undo.RegisterUndo(node, node.name); // if( EditorUtility.DisplayDialog( "Remove the Last Item ?" , "Are you sure you really want to remove?" // , "Yes", "Cancel" ) ){ if (node.dlgDataList != null && node.dlgDataList.Count > 0) { node.dlgDataList.RemoveAt(node.dlgDataList.Count - 1); } node.ReAssignDialogIDsInThisObject(); // } } GUILayout.EndHorizontal(); ViNoEditorUtil.EndGUIColor(); }
void OnGUI() { float space = ViNoToolUtil.kToolbarHeight + 5f; GUICommon.DrawLineSpace(5f, space); m_Selected = GUILayout.Toolbar(m_Selected, m_MenuItems, GUILayout.Height(ViNoToolUtil.kToolbarHeight)); string selectedStr = m_MenuItems[m_Selected]; switch (selectedStr) { case "Scenario": DrawScenarioTab.Draw(this); break; case "Nodes": DrawViNodesTab.Draw(); break; // case "Objects": DrawObjectsTab.Draw(); break; case "Samples": DrawSamplesTab.Draw(); break; case "Templates": DrawTemplatesTab.Draw(); break; // case "Animation": DrawAnimationTab(); break; } }
static public void DrawSoundCategory(DialogPartNode node, DialogPartData unit) { if (EditorGUIUtility.isProSkin) { GUI.contentColor = Color.white; GUICommon.DrawLineSpace(2f, 22f); EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); soundsToggle = EditorGUILayout.Foldout(soundsToggle, "Sounds"); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); soundsToggle = EditorGUILayout.Foldout(soundsToggle, "Sounds"); EditorGUILayout.EndHorizontal(); GUI.contentColor = Color.white; GUICommon.DrawLineSpace(3f, 1f); } if (soundsToggle) { float space = 30f; EditorGUILayout.BeginHorizontal(); GUILayout.Space(space); unit.isBGM = EditorGUILayout.Toggle(unit.isBGM, GUILayout.Width(10f)); EditorGUILayout.LabelField("Bgm", GUILayout.Width(35f)); EditorGUILayout.LabelField(folderIconContent, GUILayout.Width(16f)); if (unit.isBGM) { DrawBGMPopupField(node, unit); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space(space); unit.isSE = EditorGUILayout.Toggle(unit.isSE, GUILayout.Width(10f)); EditorGUILayout.LabelField("SE", GUILayout.Width(35f)); EditorGUILayout.LabelField(folderIconContent, GUILayout.Width(16f)); if (unit.isSE) { DrawSEPopupField(node, unit); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space(space); unit.isVoice = EditorGUILayout.Toggle(unit.isVoice, GUILayout.Width(10f)); EditorGUILayout.LabelField("Voice", GUILayout.Width(35f)); EditorGUILayout.LabelField(folderIconContent, GUILayout.Width(16f)); if (unit.isVoice) { DrawVoicePopupField(node, unit); } EditorGUILayout.EndHorizontal(); } }
public override void OnInspectorGUI() { Scene targetData = target as Scene; DrawDefaultInspector(); #if false if (targetData.sceneNodesData == null || targetData.sceneNodesData.Length == 0) { targetData.sceneNodesData = new SceneData.SceneNodeData[1]; targetData.sceneNodesData[0] = new SceneData.SceneNodeData(); } for (int i = 0; i < targetData.sceneNodesData.Length; i++) { DrawSceneNodeField(targetData.sceneNodesData[i], i * 220); } #endif #if true GUICommon.DrawLineSpace(5f, 5f); GUICommon.DrawLineSpace(5f, 5f); #if false if (GUILayout.Button("Save as XML")) { string xmlData = ViNoGameSaveLoad.SerializeObject <SceneData.SceneNodeData[]>(targetData.sceneNodesData); ViNoGameSaveLoad.CreateXML(targetData.name + ".xml", xmlData); AssetDatabase.Refresh(); EditorUtility.FocusProjectWindow(); } EditorGUILayout.BeginHorizontal(); sceneXmlFile = EditorGUILayout.ObjectField(sceneXmlFile, typeof(TextAsset), false) as TextAsset; GUI.enabled = (sceneXmlFile == null) ? false : true; if (GUILayout.Button("Load XML")) { targetData.sceneNodesData = ViNoGameSaveLoad.DeserializeObject <SceneData.SceneNodeData[]>(sceneXmlFile.text) as SceneData.SceneNodeData[]; EditorUtility.SetDirty(targetData); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); #endif if (!Application.isPlaying) { GUI.enabled = false; EditorGUILayout.HelpBox("Save Scene : PlayMode Only. \n Save under the \"ADVScene\" objects data.", MessageType.Info); } EditorGUILayout.BeginHorizontal(); // GUILayout.Space( 20f ); if (GUILayout.Button("Save Scene", GUILayout.Height(44f))) { // if( EditorUtility.DisplayDialog( "Warning" , "Do you really want to overwrite ?" , "ok" , "cancel" ) ){ ViNoSceneManager.FindInstance(); ViNoSceneManager.Instance.SaveSceneNodes(); targetData.sceneNodesData = ViNoSceneManager.Instance.GetSceneData().m_DataArray; // } // Application.CaptureScreenshot( "Assets/A Scene.png" ); } GUI.enabled = true; if (GUILayout.Button("Load Scene", GUILayout.Height(44f))) { // if( EditorUtility.DisplayDialog( "Warning" , "Do you really want to apply ?" , "ok" , "cancel" ) ){ Undo.RegisterSceneUndo("Load Scene"); SceneCreator.Create(targetData); // } } // GUILayout.Space( 20f ); EditorGUILayout.EndHorizontal(); EditorGUILayout.HelpBox("Clear under the \"ADVScene\" objects", MessageType.Info); if (GUILayout.Button("Clear Scene", GUILayout.Height(44f))) { ViNoSceneManager sm = GameObject.FindObjectOfType(typeof(ViNoSceneManager)) as ViNoSceneManager; SceneCreator.DestroySceneImmediate(sm.theSavedPanel); } #endif }
public override void OnInspectorGUI() { FlagTable flagTable = target as FlagTable; // m_ShowBoolean = EditorGUILayout.BeginToggleGroup( "Edit" , m_ShowBoolean ); if (EditorGUIUtility.isProSkin) { GUICommon.DrawLineSpace(5f, 15f); } else { GUICommon.DrawLineSpace(5f, 5f); } m_ShowBoolean = EditorGUILayout.Foldout(m_ShowBoolean, "Passed Labels"); if (m_ShowBoolean) { if (flagTable.flags == null || flagTable.flags.Length == 0) { flagTable.flags = new FlagTable.FlagUnit[1]; flagTable.flags[0] = new FlagTable.FlagUnit(); } if (flagTable.stringValues == null || flagTable.stringValues.Length == 0) { flagTable.stringValues = new FlagTable.VarUnit <string> [1]; flagTable.stringValues[0] = new FlagTable.VarUnit <string>(); } if (flagTable.floatValues == null || flagTable.floatValues.Length == 0) { flagTable.floatValues = new FlagTable.VarUnit <float> [1]; flagTable.floatValues[0] = new FlagTable.VarUnit <float>(); } EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); EditorGUILayout.LabelField("FlagName"); EditorGUILayout.LabelField("State", GUILayout.Width(34f)); EditorGUILayout.EndHorizontal(); for (int i = 0; i < flagTable.flags.Length; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); // EditorGUILayout.LabelField( "FlagState" , GUILayout.Width( 80f ) ); flagTable.flags[i].m_FlagName = EditorGUILayout.TextField(flagTable.flags[i].m_FlagName); flagTable.flags[i].m_IsFlagOn = EditorGUILayout.Toggle(flagTable.flags[i].m_IsFlagOn, GUILayout.Width(34f)); // EditorGUILayout.EndHorizontal(); // EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("+")) { ArrayUtility.Insert <FlagTable.FlagUnit>(ref flagTable.flags, i + 1, new FlagTable.FlagUnit()); } if (GUILayout.Button("-")) { ArrayUtility.RemoveAt <FlagTable.FlagUnit>(ref flagTable.flags, i); } EditorGUILayout.EndHorizontal(); } /* EditorGUILayout.BeginHorizontal(); * * if( flagTable.flags != null && flagTable.flags.Length > 0 ) { * if( GUILayout.Button( "+" ) ){ * ArrayUtility.Add<FlagTable.FlagUnit>( ref flagTable.flags , new FlagTable.FlagUnit() ); * } * * if( GUILayout.Button( "-" ) ){ * int lastIndex = flagTable.flags.Length - 1; * FlagTable.FlagUnit lastOne = flagTable.flags[ lastIndex ]; * ArrayUtility.Remove<FlagTable.FlagUnit>( ref flagTable.flags , lastOne ); * } * } * * EditorGUILayout.EndHorizontal(); */ } #if false if (EditorGUIUtility.isProSkin) { GUICommon.DrawLineSpace(5f, 15f); } else { GUICommon.DrawLineSpace(5f, 5f); } m_ShowString = EditorGUILayout.Foldout(m_ShowString, "Strings"); if (m_ShowString) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); EditorGUILayout.LabelField("VariableName", GUILayout.Width(100f)); EditorGUILayout.LabelField("StringValues"); EditorGUILayout.EndHorizontal(); for (int i = 0; i < flagTable.stringValues.Length; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); flagTable.stringValues[i].m_FlagName = EditorGUILayout.TextField(flagTable.stringValues[i].m_FlagName, GUILayout.Width(100f)); flagTable.stringValues[i].theValue = EditorGUILayout.TextField(flagTable.stringValues[i].theValue); if (GUILayout.Button("+")) { ArrayUtility.Insert <FlagTable.VarUnit <string> >(ref flagTable.stringValues, i + 1, new FlagTable.VarUnit <string>()); } if (GUILayout.Button("-")) { ArrayUtility.RemoveAt <FlagTable.VarUnit <string> >(ref flagTable.stringValues, i); } EditorGUILayout.EndHorizontal(); } } #endif // This is Test. #if false GUICommon.DrawLineSpace(10f, 5f); m_ShowFloat = EditorGUILayout.Foldout(m_ShowFloat, "Floats"); if (m_ShowFloat) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); EditorGUILayout.LabelField("FloatValues", GUILayout.Width(100f)); EditorGUILayout.LabelField("VariableName"); EditorGUILayout.EndHorizontal(); for (int i = 0; i < flagTable.floatValues.Length; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); flagTable.floatValues[i].floatValue = EditorGUILayout.FloatField(flagTable.floatValues[i].floatValue, GUILayout.Width(65f)); flagTable.floatValues[i].m_FlagName = EditorGUILayout.TextField(flagTable.floatValues[i].m_FlagName); if (GUILayout.Button("+")) { ArrayUtility.Insert <FlagTable.VarFloatUnit>(ref flagTable.floatValues, i + 1, new FlagTable.VarFloatUnit()); } if (GUILayout.Button("-")) { ArrayUtility.RemoveAt <FlagTable.VarFloatUnit>(ref flagTable.floatValues, i); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); /* if( flagTable.floatValues != null && flagTable.floatValues.Length > 0 ) { * if( GUILayout.Button( "+" ) ){ * ArrayUtility.Add<FlagTable.VarFloatUnit>( ref flagTable.floatValues , new FlagTable.VarFloatUnit() ); * } * * if( GUILayout.Button( "-" ) ){ * int lastIndex = flagTable.floatValues.Length - 1; * FlagTable.VarFloatUnit lastOne = flagTable.floatValues[ lastIndex ]; * ArrayUtility.Remove<FlagTable.VarFloatUnit>( ref flagTable.floatValues , lastOne ); * } * } * //*/ EditorGUILayout.EndHorizontal(); } #endif if (GUILayout.Button("Clear Flags")) { bool yes = EditorUtility.DisplayDialog(" ! ", "Are you sure you want to ClearFlags?", "yes", "no"); if (yes) { flagTable.ClearFlags(); } } // EditorGUILayout.EndToggleGroup(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
static public void OnGUI_ViNode(ViNode node, bool drawChildList, bool showNextNode) { GUICommon.DrawLineSpace(7f, 7f); bool hasViNode = false; if (drawChildList) { Color savedCol = GUI.color; GUI.color = Color.green; // node.startAndActive = EditorGUILayout.Toggle( "Start and Active" , node.startAndActive ); // EditorGUILayout.LabelField( "ViNode List" , GUILayout.Width( 200f ) ); int childCount = node.transform.GetChildCount(); for (int i = 0; i < childCount; i++) { Transform childTra = node.transform.GetChild(i); ViNode vinode = childTra.GetComponent <ViNode>(); if (vinode != null) { hasViNode = true; Undo.RegisterUndo(childTra.gameObject, "active" + childTra.name); EditorGUILayout.BeginHorizontal(); // bool t = EditorGUILayout.Toggle( childTra.gameObject.activeInHierarchy , GUILayout.Width( 10f) ); // Toggle active. if (GUILayout.Button(i.ToString(), GUILayout.Width(20f))) { childTra.gameObject.SetActive(!childTra.gameObject.activeInHierarchy); } // Need to be fixed. #if false if (GUILayout.Button("up", GUILayout.Width(35f))) { childTra.name = childTra.name.Replace(i + "_", (i + 1) + "_"); Transform parantTra = childTra.parent; childTra.parent = null; childTra.parent = parantTra; Transform childTra2 = node.transform.GetChild(i + 1); childTra2.name = childTra2.name.Replace((i + 1) + "_", i + "_"); parantTra = childTra2.parent; childTra2.parent = null; childTra2.parent = parantTra; } if (GUILayout.Button("dwn", GUILayout.Width(35f))) { childTra.name = childTra.name.Replace(i + "_", (i - 1) + "_"); Transform childTra2 = node.transform.GetChild(i - 1); childTra2.name = childTra2.name.Replace((i - 1) + "_", i + "_"); Transform parantTra = childTra2.parent; childTra2.parent = null; childTra2.parent = parantTra; } #endif GUI.enabled = childTra.gameObject.activeInHierarchy; if (GUILayout.Button(childTra.name)) { EditorGUIUtility.PingObject(childTra.gameObject); if (Application.isPlaying) { VM.Instance.GoToLabel(vinode.GetNodeLabel()); } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); } } GUI.color = savedCol; } if (hasViNode) { EditorGUILayout.LabelField("When execution order is not right in Children,"); EditorGUILayout.LabelField("Please push RefreshChildren button to fix."); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("RefreshChildren")) { node.RefreshChildren(); } if (GUILayout.Button("ReIndexChildren")) { ViNode[] childNodes = node.GetComponentsInChildren <ViNode>(); Undo.RegisterUndo(childNodes, "ReIndexChildren"); node.ReIndexChildren(); } EditorGUILayout.EndHorizontal(); } GUICommon.DrawLineSpace(5f, 5f); }