static public void Swap2Items(DialogPartNode targetNode) { int idx1 = -1; int idx2 = -1; for (int i = 0; i < targetNode.dlgDataList.Count; i++) { if (targetNode.dlgDataList[i].active) { if (idx1 == -1) { idx1 = i; } else if (idx2 == -1) { idx2 = i; break; } } } if (idx1 != -1 && idx2 != -1) { DialogPartData data1 = targetNode.dlgDataList[idx1]; DialogPartData data2 = targetNode.dlgDataList[idx2]; targetNode.dlgDataList[idx1] = data2; targetNode.dlgDataList[idx2] = data1; } else { Debug.Log("please check 2 items when swap items."); } }
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 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); } }
/// <summary> /// Tos the byte code. /// </summary> public override void ToByteCode(ByteCodes code) { List <byte> byteList = new List <byte>(); AddNodeCode(byteList); string nameHndName = (m_NameTextBox != null) ? m_NameTextBox.name : ""; string dialogHndName = (m_ViNoTextBox != null) ? m_ViNoTextBox.name : ""; for (int i = 0; i < dlgDataList.Count; i++) { DialogPartData dlgData = dlgDataList[i]; // if a item is not Checked , the item is shown. #if false if (!dlgData.active) { continue; } #endif string tag = GetSingleDialogIDNodeTag(dlgData.dialogID); ByteCodeScriptTools.AddNodeCode(byteList, tag); CodeGenerator.GenerateADialogCode(byteList, dlgData, nameHndName, dialogHndName); } code.Add(byteList.ToArray()); // To Byte codes this Children. ToByteCodeInternal(code); }
static public void DrawAnimation(DialogPartData unit) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); unit.isAnim = EditorGUILayout.Toggle(unit.isAnim, GUILayout.Width(10f)); EditorGUILayout.LabelField("Animation", GUILayout.Width(75f)); if (unit.isAnim) { EditorGUILayout.BeginHorizontal(); if (DialogPartNodeInspector.animationEntries != null) { unit.animationID = EditorGUILayout.Popup(unit.animationID, DialogPartNodeInspector.animationEntries, GUILayout.Width(85f)); if (DialogPartNodeInspector.animationEntries != null && DialogPartNodeInspector.animationEntries.Length > 0) { unit.animNameKey = DialogPartNodeInspector.animationEntries[unit.animationID]; } } // Show Dummy Contents. else { unit.animationID = EditorGUILayout.Popup(unit.animationID, kDummyContents, GUILayout.Width(75f)); } // unit.animNameKey = EditorGUILayout.TextField( unit.animNameKey ); // unit.animationID = DialogPartNodeInspector.animManagerInstance.GetAnimationIDBy( unit.animNameKey ); //EditorGUILayout.Popup( unit.animationID , kDummyContents , GUILayout.Width( 75f ) ); // ViNoEditorUtil.EndGUIColor(); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndHorizontal(); }
/// <summary> /// Adds the data. /// </summary> /// <returns> /// The data. /// </returns> /// <param name='name'> /// Name. /// </param> /// <param name='text'> /// Text. /// </param> public DialogPartData AddData(string name, string text) { DialogPartData dpd = CreateData(name, text); AddData(dpd); return(dpd); }
static public void ViewScene(DialogPartData data) { // TODO... #if false ViNoSceneManager sm = GameObject.FindObjectOfType(typeof(ViNoSceneManager)) as ViNoSceneManager; if (sm != null) { GameObject advSceneRoot = sm.theSavedPanel; if (data.isClearScene) { bool destroyImmediate = true; ClearSceneNode.Do(advSceneRoot, destroyImmediate); } // if( data.isLoadScene && data.Scene != null ){ if (!string.IsNullOrEmpty(data.sceneFilePath) && sm != null) { bool TODO1 = false; bool TODO2 = false; Scene scene = Resources.Load(data.sceneFilePath, typeof(Scene)) as Scene; // LoadSceneNode.Do( advSceneRoot , data.Scene , TODO1 , TODO2 , true ); LoadSceneNode.Do(advSceneRoot, scene, TODO1, TODO2, true); } } // No need to warning , if user do not need Scene Save and Load function. // else{ // Debug.LogWarning( "There is no ViNoSceneManager object. Scene Save and Load will not work..." ); // } #endif }
static public void DrawLayoutDialogTextField(DialogPartData unit) { ViNoEditorUtil.BeginGreenColor(); EditorGUILayout.BeginHorizontal(); /* if( _DIALOG_TEX == null ){ * _DIALOG_TEX = AssetDatabase.LoadAssetAtPath("Assets/017722-dialog.png", typeof(Texture2D)) as Texture2D; * } * GUILayout.Box( _DIALOG_TEX , GUILayout.Width( 54f ) , GUILayout.Height( 54f ) ); * //*/ GUILayout.Space(30f); if (!unit.isClearMessageAfter) { unit.dialogText = EditorGUILayout.TextArea(unit.dialogText, GUI.skin.textArea); } else { unit.dialogText = EditorGUILayout.TextArea(unit.dialogText, GUI.skin.textArea, GUILayout.Height(50f)); } EditorGUILayout.EndHorizontal(); ViNoEditorUtil.EndGUIColor(); }
static public void ImportText(DialogPartNode dlg, string text, string blockDelimiter, string[] nameDelimiter, bool overWrite) { string[] delimiter = { blockDelimiter }; //{ System.Environment.NewLine + System.Environment.NewLine }; string[] blocks = text.Split(delimiter, System.StringSplitOptions.None); int dlgID = 0; if (dlg != null) { if (overWrite) { dlg.dlgDataList.Clear(); } foreach (string s in blocks) { string[] temp = s.Split(nameDelimiter, System.StringSplitOptions.None); if (temp.Length > 1) { DialogPartData data = new DialogPartData(); data.dialogID = dlgID; data.nameText = temp[0]; data.dialogText = temp[1]; data.isName = true; dlg.AddData(data); } else { dlg.AddData("", s); } dlgID++; } // Debug.Log( "Imported Text."); } }
static public void DrawLayoutExitActorField(DialogPartData unit) { if (unit.exitActorEntries == null || unit.exitActorEntries.Length == 0) { unit.exitActorEntries = new DialogPartData.ActorEntry[1]; unit.exitActorEntries[0] = new DialogPartData.ActorEntry(); } EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); EditorGUILayout.LabelField("ActorName", GUILayout.Width(150f)); EditorGUILayout.LabelField("WithFade", GUILayout.Width(100f)); EditorGUILayout.EndHorizontal(); for (int i = 0; i < unit.exitActorEntries.Length; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); unit.exitActorEntries[i].actorName = EditorGUILayout.TextField(unit.exitActorEntries[i].actorName, GUILayout.Width(150f)); unit.exitActorEntries[i].withFade = EditorGUILayout.Toggle(unit.exitActorEntries[i].withFade, GUILayout.Width(100f)); if (GUILayout.Button("+")) { ArrayUtility.Insert <DialogPartData.ActorEntry>(ref unit.exitActorEntries, i + 1, new DialogPartData.ActorEntry()); } if (GUILayout.Button("-")) { ArrayUtility.RemoveAt <DialogPartData.ActorEntry>(ref unit.exitActorEntries, i); } EditorGUILayout.EndHorizontal(); } }
/// <summary> /// Adds the data. /// </summary> /// <param name='data'> /// Data. /// </param> public void AddData( DialogPartData data ) { if( dlgDataList == null ){ dlgDataList =new List<DialogPartData>(); } dlgDataList.Add( data ); }
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 private void AddAudioCode(List <byte> byteList, DialogPartData data) { ISoundPlayer pl = ISoundPlayer.Instance; if (pl as ViNoSoundPlayer) { if (data.isBGM) { byteList.Add(Opcode.PLAY_SOUND); byteList.Add(0); // 0: BGM. byteList.Add((byte)data.bgmAudioID); } if (data.isSE) { byteList.Add(Opcode.PLAY_SOUND); byteList.Add(1); // 1: SE. byteList.Add((byte)data.seAudioID); } if (data.isVoice) { byteList.Add(Opcode.PLAY_SOUND); byteList.Add(2); // 2: VOICE. byteList.Add((byte)data.voiceAudioID); } else { byteList.Add(Opcode.STOP_VOICE); } } else if (pl as SimpleSoundPlayer) { if (data.isBGM) { // Loop. AddPlaySoundCode(byteList, "playbgm", data.bgmAudioKey, "true"); /* * Hashtable args = new Hashtable(); * args[ "eventType" ] = "playbgm"; * args[ "storage" ] = data.bgmAudioKey; * args[ "loop" ] = "true"; * ByteCodeScriptTools.AddTablePairsCode( byteList , args ); * ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); * //*/ } if (data.isSE) { AddPlaySoundCode(byteList, "playse", data.seAudioKey, "false"); } if (data.isVoice) { AddPlaySoundCode(byteList, "playvoice", data.voiceAudioKey, "false"); } } }
/// <summary> /// Adds the data. /// </summary> /// <param name='data'> /// Data. /// </param> public void AddData(DialogPartData data) { if (dlgDataList == null) { dlgDataList = new List <DialogPartData>(); } dlgDataList.Add(data); }
void OnClickVoice() { DialogPartData data = ViNoBackLog.GetItemAt(m_LogIndex); if (data.isVoice && ISoundPlayer.Instance != null) { ISoundPlayer.Instance.PlayVoice(data.voiceAudioID, ViNoConfig.prefsVoiceVolume, 0f); } }
/// <summary> /// Creates the Dialog data and return it. /// </summary> public static DialogPartData CreateData( string name , string text ) { DialogPartData data = new DialogPartData(); data.dialogID = m_IdCounter; data.dialogText = text; data.nameText = name; m_IdCounter++; return data; }
/// <summary> /// Creates the Dialog data and return it. /// </summary> static public DialogPartData CreateData(string name, string text) { DialogPartData data = new DialogPartData(); data.dialogID = m_IdCounter; data.dialogText = text; data.nameText = name; m_IdCounter++; return(data); }
static public void ViewDialog(DialogPartData data, ViNoTextBox dialogTextBox, ViNoTextBox nameTextBox) { if (dialogTextBox != null) { dialogTextBox.SetText(data.dialogText); } if (nameTextBox != null) { nameTextBox.SetText(data.nameText); } }
public void AssignDialogID(int startID) { if (dlgDataList == null) { return; } for (int i = 0; i < dlgDataList.Count; i++) { DialogPartData dlgData = dlgDataList[i]; dlgData.dialogID = startID + i; } }
static public void DrawLayoutNameField(DialogPartData unit) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); unit.isName = EditorGUILayout.Toggle(unit.isName, GUILayout.Width(10f)); EditorGUILayout.LabelField("Name/Title", GUILayout.Width(80f), GUILayout.Height(20f)); if (unit.isName) { unit.nameText = EditorGUILayout.TextField(unit.nameText, GUI.skin.textArea, GUILayout.Width(200f), GUILayout.Height(20f)); } EditorGUILayout.EndHorizontal(); }
public void AddItemAt(int index) { DialogPartData data = new DialogPartData(); if (index - 1 > 0) { DialogPartData prevData = dlgDataList[index - 1]; data.isName = prevData.isName; data.nameText = prevData.nameText; data.dialogText = ""; } dlgDataList.Insert(index, data); }
void UpdateGameView() { if (current != null) { if (current.dlgDataList.Count <= m_CurrentID) { m_CurrentID = current.dlgDataList.Count - 1; } currentData = current.dlgDataList[m_CurrentID]; //current.GetItemAt( m_CurrentID ); DialogPartNodeUtility.ViewDialog(currentData, current.m_ViNoTextBox, current.m_NameTextBox); DialogPartNodeUtility.ViewScene(currentData); } }
static public void DrawLayoutSceneField(DialogPartData unit) { #if false EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); unit.isClearScene = EditorGUILayout.Toggle(unit.isClearScene, GUILayout.Width(10f)); EditorGUILayout.LabelField("ClearScene?", GUILayout.Width(75f)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); // EditorGUILayout.BeginHorizontal(); // unit.isLoadScene = EditorGUILayout.BeginToggleGroup( "Scene" , unit.isLoadScene );//, GUILayout.Width( 10f ) ); // unit.isLoadScene = EditorGUILayout.Toggle( unit.isLoadScene , GUILayout.Width( 10f ) ); EditorGUILayout.LabelField("FilePath", GUILayout.Width(75f)); EditorGUILayout.BeginHorizontal(); // unit.Scene = EditorGUILayout.ObjectField( unit.Scene , typeof( ScriptableSceneData ) , false ) as ScriptableSceneData; unit.sceneFilePath = EditorGUILayout.TextField(unit.sceneFilePath); // DialogPartNodeUtility.RestoreSceneData( unit ); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); unit.isFadeInStart = EditorGUILayout.Toggle(unit.isFadeInStart, GUILayout.Width(10f)); EditorGUILayout.LabelField("withFadeIn?", GUILayout.Width(75f)); EditorGUILayout.EndHorizontal(); #else if (unit.scene == null) { unit.scene = new DialogPartData.SceneEntry(); } EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); EditorGUILayout.LabelField("SceneName", GUILayout.Width(150f)); EditorGUILayout.LabelField("WithFade", GUILayout.Width(100f)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); unit.scene.sceneName = EditorGUILayout.TextField(unit.scene.sceneName, GUILayout.Width(150f)); unit.scene.withFade = EditorGUILayout.Toggle(unit.scene.withFade, GUILayout.Width(100f)); EditorGUILayout.EndHorizontal(); #endif }
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 DrawEnterActorActionsView(DialogPartNode node, ref DialogPartData unit) { if (unit.enterActorEntries == null || unit.enterActorEntries.Length == 0) { unit.enterActorEntries = new DialogPartData.ActorEntry[1]; unit.enterActorEntries[0] = new DialogPartData.ActorEntry(); } EditorGUILayout.BeginHorizontal(); GUI.enabled = false; GUILayout.Space(15f); string[] label = new string[k_PositionEntryNum]; int enterActorNum = unit.enterActorEntries.Length; for (int i = 0; i < enterActorNum; i++) { int posIndex = 1; switch (unit.enterActorEntries[i].position) { case ViNoToolkit.SceneEvent.ActorPosition.left: posIndex = 0; break; case ViNoToolkit.SceneEvent.ActorPosition.middle_left: posIndex = 1; break; case ViNoToolkit.SceneEvent.ActorPosition.center: posIndex = 2; break; case ViNoToolkit.SceneEvent.ActorPosition.middle_right: posIndex = 3; break; case ViNoToolkit.SceneEvent.ActorPosition.right: posIndex = 4; break; } label[posIndex] = unit.enterActorEntries[i].actorName; } for (int i = 0; i < k_PositionEntryNum; i++) { if (string.IsNullOrEmpty(label[i])) { label[i] = ""; } GUILayout.Button(label[i]); //, GUILayout.Width( 100f ) ); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
public static 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; //*/ } } }
public static void Add( DialogPartData unit ) { // If str equals the latest Added String , return. /* if( m_Log.Count > 1 ){ int lastIndex = m_Log.Count - 1; if( m_Log[ lastIndex ].Equals( str ) ){ return; } } //*/ if (m_Log.Count > ViNo.backLogLimit ) m_Log.RemoveAt(0); m_Log.Add( unit ); if (m_Instance == null ){ GameObject go = new GameObject("_ViNoBackLog"); go.hideFlags = HideFlags.HideInHierarchy; m_Instance = go.AddComponent<ViNoBackLog>(); DontDestroyOnLoad(go); } }
// TEST !!!! /* static private string[] m_ActorPopup; * static private string[] actorPopup{ * get{ * if( m_ActorPopup == null ){ * List<string> actorNames = new List<string>(); * ActorLibrary actorLib = GameObject.FindObjectOfType( typeof(ActorLibrary) ) as ActorLibrary; * for(int i=0;i<actorLib.actorEntries.Length;i++){ * actorNames.Add( actorLib.actorEntries[ i ].actorName ); * } * m_ActorPopup = actorNames.ToArray(); * } * return m_ActorPopup; * } * } * //*/ static public void DrawLayoutEnterActorField(DialogPartData unit) { if (unit.enterActorEntries == null || unit.enterActorEntries.Length == 0) { unit.enterActorEntries = new DialogPartData.ActorEntry[1]; unit.enterActorEntries[0] = new DialogPartData.ActorEntry(); } EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); EditorGUILayout.LabelField("ActorName", GUILayout.Width(150f)); EditorGUILayout.LabelField("Position", GUILayout.Width(100f)); EditorGUILayout.LabelField("WithFade", GUILayout.Width(70f)); EditorGUILayout.EndHorizontal(); for (int i = 0; i < unit.enterActorEntries.Length; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(30f); #if true unit.enterActorEntries[i].actorName = EditorGUILayout.TextField(unit.enterActorEntries[i].actorName, GUILayout.Width(150f)); #else int actorID = 0; actorID = EditorGUILayout.Popup(actorID, actorPopup, GUILayout.Width(150f)); #endif unit.enterActorEntries[i].position = (ViNoToolkit.SceneEvent.ActorPosition)EditorGUILayout.EnumPopup(unit.enterActorEntries[i].position, GUILayout.Width(100f)); unit.enterActorEntries[i].withFade = EditorGUILayout.Toggle(unit.enterActorEntries[i].withFade, GUILayout.Width(70f)); if (GUILayout.Button("+")) { ArrayUtility.Insert <DialogPartData.ActorEntry>(ref unit.enterActorEntries, i + 1, new DialogPartData.ActorEntry()); } if (GUILayout.Button("-")) { ArrayUtility.RemoveAt <DialogPartData.ActorEntry>(ref unit.enterActorEntries, i); } EditorGUILayout.EndHorizontal(); } }
static public void DrawVoicePopupField(DialogPartNode node, DialogPartData unit) { #if true unit.voiceAudioKey = EditorGUILayout.TextField(unit.voiceAudioKey, GUILayout.Width(175f)); /* * if( DialogPartNodeInspector.voiceEntries != null ){ * unit.voiceAudioID = EditorGUILayout.Popup( unit.voiceAudioID , DialogPartNodeInspector.voiceEntries , GUILayout.Width( 75f ) ); * if( DialogPartNodeInspector.voiceEntries.Length > unit.voiceAudioID ){ * unit.voiceAudioKey = DialogPartNodeInspector.voiceEntries[ unit.voiceAudioID ]; * } * } * // Show Dummy Contents. * else{ * unit.voiceAudioID = EditorGUILayout.Popup( unit.voiceAudioID , kDummyContents , GUILayout.Width( 75f ) ); * } * // unit.voiceAudioKey = EditorGUILayout.TextField( unit.voiceAudioKey , GUI.skin.textArea, GUILayout.Width(50f ) , GUILayout.Height(20f)); * //*/ #else if (node.soundData != null) { if (node.soundData.voiceEntries != null) { string[] entries = node.soundData.GetVoiceEntryNames(); unit.voiceAudioID = EditorGUILayout.Popup(unit.voiceAudioID, entries, GUILayout.Width(75f)); if (entries.Length > unit.voiceAudioID) { unit.voiceAudioKey = entries[unit.voiceAudioID]; } } // Show Dummy Contents. else { unit.voiceAudioID = EditorGUILayout.Popup(unit.voiceAudioID, kDummyContents, GUILayout.Width(75f)); } } #endif }
/// <summary> /// SendMessage to the TextTarget. /// </summary> /// <param name='index'> /// Index. /// </param> void OnChangedLogIndex(int index) { // string logStr = ViNoBackLog.GetLogText( index ); DialogPartData data = ViNoBackLog.GetItemAt(index); if (voiceButton != null) { voiceButton.SetActive(data.isVoice); } if (nameTextTarget != null) { if (!string.IsNullOrEmpty(data.nameText) && data.nameText.Trim() != string.Empty) { nameTextTarget.gameObject.SetActive(true); nameTextTarget.gameObject.SendMessage("OnUpdateText", data.nameText); } else { nameTextTarget.gameObject.SetActive(false); } } textTarget.gameObject.SendMessage("OnUpdateText", data.dialogText); }
// static private string[] kDummyContents = { "NO ENTRY" }; static public void DrawBGMPopupField(DialogPartNode node, DialogPartData unit) { #if true unit.bgmAudioKey = EditorGUILayout.TextField(unit.bgmAudioKey, GUILayout.Width(175f)); /* if( DialogPartNodeInspector.bgmEntries != null ){ * unit.bgmAudioID = EditorGUILayout.Popup( unit.bgmAudioID , DialogPartNodeInspector.bgmEntries , GUILayout.Width( 75f ) ); * if( DialogPartNodeInspector.bgmEntries.Length > unit.bgmAudioID ){ * unit.bgmAudioKey = DialogPartNodeInspector.bgmEntries[ unit.bgmAudioID ]; * } * } * // Show Dummy Contents. * else{ * unit.bgmAudioID = EditorGUILayout.Popup( unit.bgmAudioID , kDummyContents , GUILayout.Width( 75f ) ); * } * //*/ #else if (node.soundData != null) { if (node.soundData.bgmEntries != null) { string[] entries = node.soundData.GetSoundEntryNames(); unit.bgmAudioID = EditorGUILayout.Popup(unit.bgmAudioID, entries, GUILayout.Width(75f)); if (entries.Length > unit.bgmAudioID) { unit.bgmAudioKey = entries[unit.bgmAudioID]; } } // Show Dummy Contents. else { unit.bgmAudioID = EditorGUILayout.Popup(unit.bgmAudioID, kDummyContents, GUILayout.Width(75f)); } } #endif }
static public void Add(DialogPartData unit) { // If str equals the latest Added String , return. /* if( m_Log.Count > 1 ){ * int lastIndex = m_Log.Count - 1; * if( m_Log[ lastIndex ].Equals( str ) ){ * return; * } * } * //*/ if (m_Log.Count > ViNo.backLogLimit) { m_Log.RemoveAt(0); } m_Log.Add(unit); if (m_Instance == null) { GameObject go = new GameObject("_ViNoBackLog"); go.hideFlags = HideFlags.HideInHierarchy; m_Instance = go.AddComponent <ViNoBackLog>(); DontDestroyOnLoad(go); } }
private void AddToBacklog() { if (m_MsgTargetTextBox != null) { if (!string.IsNullOrEmpty(m_MsgTargetTextBox.text)) { DialogPartData data = new DialogPartData(); data.isName = string.IsNullOrEmpty(m_CurrentText) ? false : true; if (data.isName) { data.nameText = m_CurrentText; } data.dialogText = m_MsgTargetTextBox.text; data.isVoice = m_IsPlayVoice; data.voiceAudioID = m_CurrentVoiceID; data.voiceAudioKey = m_CurrentVoiceKey; ViNoBackLog.Add(data); m_CurrentText = ""; m_IsPlayVoice = false; m_CurrentVoiceID = 0; } } }
private void AddToBacklog() { if( m_MsgTargetTextBox != null ){ if( ! string.IsNullOrEmpty( m_MsgTargetTextBox.text ) ){ DialogPartData data = new DialogPartData(); data.isName = string.IsNullOrEmpty( m_CurrentText ) ? false : true; if( data.isName ){ data.nameText = m_CurrentText; } data.dialogText = m_MsgTargetTextBox.text; data.isVoice = m_IsPlayVoice; data.voiceAudioID = m_CurrentVoiceID; data.voiceAudioKey = m_CurrentVoiceKey; ViNoBackLog.Add( data ); m_CurrentText = ""; m_IsPlayVoice = false; m_CurrentVoiceID = 0; } } }
public void AddItemAt( int index ) { DialogPartData data = new DialogPartData(); if( index - 1 > 0 ){ DialogPartData prevData = dlgDataList[ index - 1 ]; data.isName = prevData.isName; data.nameText = prevData.nameText; data.dialogText = ""; } dlgDataList.Insert( index , data ); }
public static 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 ); } }
public static void DrawVoicePopupField( DialogPartNode node , DialogPartData unit ) { #if true unit.voiceAudioKey = EditorGUILayout.TextField( unit.voiceAudioKey , GUILayout.Width( 175f ) ); /* if( DialogPartNodeInspector.voiceEntries != null ){ unit.voiceAudioID = EditorGUILayout.Popup( unit.voiceAudioID , DialogPartNodeInspector.voiceEntries , GUILayout.Width( 75f ) ); if( DialogPartNodeInspector.voiceEntries.Length > unit.voiceAudioID ){ unit.voiceAudioKey = DialogPartNodeInspector.voiceEntries[ unit.voiceAudioID ]; } } // Show Dummy Contents. else{ unit.voiceAudioID = EditorGUILayout.Popup( unit.voiceAudioID , kDummyContents , GUILayout.Width( 75f ) ); } // unit.voiceAudioKey = EditorGUILayout.TextField( unit.voiceAudioKey , GUI.skin.textArea, GUILayout.Width(50f ) , GUILayout.Height(20f)); //*/ #else if( node.soundData != null ){ if( node.soundData.voiceEntries != null ){ string[] entries = node.soundData.GetVoiceEntryNames(); unit.voiceAudioID = EditorGUILayout.Popup( unit.voiceAudioID , entries , GUILayout.Width( 75f ) ); if( entries.Length > unit.voiceAudioID ){ unit.voiceAudioKey = entries[ unit.voiceAudioID ]; } } // Show Dummy Contents. else{ unit.voiceAudioID = EditorGUILayout.Popup( unit.voiceAudioID , kDummyContents , GUILayout.Width( 75f ) ); } } #endif }
private static void AddAudioCode( List<byte> byteList , DialogPartData data ) { ISoundPlayer pl = ISoundPlayer.Instance; if( pl as ViNoSoundPlayer ){ if( data.isBGM ){ byteList.Add( Opcode.PLAY_SOUND ); byteList.Add( 0 ); // 0: BGM. byteList.Add( (byte)data.bgmAudioID ); } if( data.isSE ){ byteList.Add( Opcode.PLAY_SOUND ); byteList.Add( 1 ); // 1: SE. byteList.Add( (byte)data.seAudioID ); } if( data.isVoice ){ byteList.Add( Opcode.PLAY_SOUND ); byteList.Add( 2 ); // 2: VOICE. byteList.Add( (byte)data.voiceAudioID ); } else{ byteList.Add( Opcode.STOP_VOICE ); } } else if( pl as SimpleSoundPlayer ){ if( data.isBGM ){ // Loop. AddPlaySoundCode( byteList , "playbgm" , data.bgmAudioKey , "true" ); /* Hashtable args = new Hashtable(); args[ "eventType" ] = "playbgm"; args[ "storage" ] = data.bgmAudioKey; args[ "loop" ] = "true"; ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); //*/ } if( data.isSE ){ AddPlaySoundCode( byteList , "playse" , data.seAudioKey , "false" ); } if( data.isVoice ){ AddPlaySoundCode( byteList , "playvoice" , data.voiceAudioKey , "false" ); } } }
public static void DrawActionViewMode( DialogPartNodeActionType action , DialogPartNode node , ref DialogPartData unit , int index , ViNoTextBox textBox , ViNoTextBox nameTextBox ) { switch( action ){ case DialogPartNodeActionType.EnterActor: DrawEnterActorActionsView( node , ref unit ); break; case DialogPartNodeActionType.ExitActor: if( unit.exitActorEntries != null && unit.exitActorEntries.Length != 0 ){ int actorNum = unit.exitActorEntries.Length; GUILayout.BeginHorizontal(); GUILayout.Space( 30f ); string label = ""; for( int i=0;i<actorNum;i++){ label += unit.exitActorEntries[ i ].actorName; if( i < actorNum - 1 ){ label += ","; } } GUILayout.Label( label , GUILayout.Width( 100f ) ); GUILayout.EndHorizontal(); } break; /* case DialogPartNodeActionType.Selections: if( unit.selection == null ){ unit.selection = new SelectionsNode1.SelectUnit(); } OnGUISelectionNode1Unit( unit.selection ); break; case DialogPartNodeActionType.Scene: DrawLayoutSceneField( unit ); // break; //*/ case DialogPartNodeActionType.Dialog: EditorGUILayout.BeginHorizontal(); GUILayout.Space( 15f ); GUILayout.Box( ViNoEditorResources.dialogIcon , GUILayout.Width( 30f ) , GUILayout.Height( 25f ) ); /* string subStr = ( unit.dialogText.Length > k_TextDispNum )? unit.dialogText.Substring( 0 , k_TextDispNum ) : unit.dialogText; subStr += "..."; subStr = subStr.Replace( "\n" , "" ); //*/ // unit.nameText = unit.nameText .Replace ( "\n" , "" ); // unit.show = EditorGUILayout.Foldout( unit.show ,"ID_" + unit.dialogID + ":" + unit.nameText + " < " + subStr ); if( unit.isName ){ if( string.IsNullOrEmpty( unit.nameText) ){ // unit.show = EditorGUILayout.Foldout( unit.show , subStr ); EditorGUILayout.LabelField( unit.dialogText );// subStr ); } else{ // unit.show = EditorGUILayout.Foldout( unit.show , unit.nameText + " : " + subStr ); EditorGUILayout.LabelField( unit.nameText + " : " + unit.dialogText ); //subStr ); } } else{ // unit.show = EditorGUILayout.Foldout( unit.show , subStr ); EditorGUILayout.LabelField( unit.dialogText );//unit.nameText + " : " + subStr ); } unit.isClearMessageAfter = EditorGUILayout.Toggle( unit.isClearMessageAfter , GUILayout.Width( 10f ) ); EditorGUILayout.LabelField( "ClearMessage" , GUILayout.Width( 80f ) , GUILayout.Height( 20f ) ); EditorGUILayout.EndHorizontal(); /* EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); EditorGUILayout.EndHorizontal(); //*/ break; } }
public static void DrawLayoutDialogTextField( DialogPartData unit ) { ViNoEditorUtil.BeginGreenColor(); EditorGUILayout.BeginHorizontal(); /* if( _DIALOG_TEX == null ){ _DIALOG_TEX = AssetDatabase.LoadAssetAtPath("Assets/017722-dialog.png", typeof(Texture2D)) as Texture2D; } GUILayout.Box( _DIALOG_TEX , GUILayout.Width( 54f ) , GUILayout.Height( 54f ) ); //*/ GUILayout.Space( 30f ); if( ! unit.isClearMessageAfter ){ unit.dialogText = EditorGUILayout.TextArea( unit.dialogText , GUI.skin.textArea ); } else{ unit.dialogText = EditorGUILayout.TextArea( unit.dialogText , GUI.skin.textArea, GUILayout.Height(50f)); } EditorGUILayout.EndHorizontal(); ViNoEditorUtil.EndGUIColor(); }
public static void DrawEnterActorActionsView( DialogPartNode node , ref DialogPartData unit ) { if( unit.enterActorEntries == null || unit.enterActorEntries.Length == 0 ){ unit.enterActorEntries = new DialogPartData.ActorEntry[ 1 ]; unit.enterActorEntries[ 0 ] = new DialogPartData.ActorEntry(); } EditorGUILayout.BeginHorizontal(); GUI.enabled = false; GUILayout.Space( 15f ); string[] label = new string[ k_PositionEntryNum ]; int enterActorNum = unit.enterActorEntries.Length; for( int i=0;i<enterActorNum;i++){ int posIndex = 1; switch( unit.enterActorEntries[ i ].position ){ case ViNoToolkit.SceneEvent.ActorPosition.left: posIndex = 0; break; case ViNoToolkit.SceneEvent.ActorPosition.middle_left: posIndex = 1; break; case ViNoToolkit.SceneEvent.ActorPosition.center: posIndex = 2; break; case ViNoToolkit.SceneEvent.ActorPosition.middle_right: posIndex = 3; break; case ViNoToolkit.SceneEvent.ActorPosition.right: posIndex = 4; break; } label[ posIndex ] = unit.enterActorEntries[ i ].actorName; } for( int i=0;i<k_PositionEntryNum;i++){ if( string.IsNullOrEmpty( label[ i ] ) ){ label[ i ] = ""; } GUILayout.Button( label[ i ] );//, GUILayout.Width( 100f ) ); } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
public static void DrawEditTextViewMode( DialogPartNodeActionType action , DialogPartNode node , ref DialogPartData unit , int index , ViNoTextBox textBox , ViNoTextBox nameTextBox ) { // EditorGUILayout.LabelField( unit.actionName ); switch( action ){ case DialogPartNodeActionType.Dialog: DrawLayoutNameField( unit ); DrawLayoutDialogTextField( unit ); break; default: DrawItemBarBackground(); EditorGUILayout.BeginHorizontal(); GUILayout.Space( 15f ); // EditorGUILayout.SelectableLabel( action.ToString() ); EditorGUILayout.LabelField( "[" + action.ToString() + "]" ); EditorGUILayout.EndHorizontal(); break; } }
// ViewMode 0 : Actions 1 : Edit Text. public static void DrawDialogItemBar( DialogPartNode node , ref DialogPartData unit , int index , ViNoTextBox textBox , ViNoTextBox nameTextBox ) { #if true DrawItemBarBackground(); #else EditorGUIUtility.LookLikeInspector(); #endif EditorGUILayout.BeginHorizontal(); unit.active = EditorGUILayout.Toggle( unit.active , GUILayout.Width( 10f ) ); #if true EditorGUILayout.LabelField( "ID_" + unit.dialogID , GUILayout.Width( 42f ) ); //*/ unit.actionID = (DialogPartNodeActionType)EditorGUILayout.EnumPopup( unit.actionID , GUILayout.Width( 100f ) ); if( node != null ){ // if( unit.actionID != DialogPartNodeActionType.ClearScene ){ if( GUILayout.Button( "Edit" , GUILayout.Width( 40f ) ) ){ DialogItemInspector browser = EditorWindow.GetWindow( typeof(DialogItemInspector) ) as DialogItemInspector; browser.InitWith( node , index ); } // } } switch( unit.actionID){ case DialogPartNodeActionType.Dialog: // unit.show = EditorGUILayout.Foldout( unit.show , "" ); break; } /* if( GUILayout.Button( "View" , GUILayout.Width( 40f ) ) ){ DialogPartNodeUtility.ViewDialog( unit , textBox , nameTextBox ); DialogPartNodeUtility.ViewScene( unit ); } //*/ #else // EditorGUILayout.LabelField( "ID_" + unit.dialogID , GUILayout.Width( 42f ) ); #endif ///////////////////////// #if true if( GUILayout.Button( "+" , GUILayout.Width( 25f ) ) ){ node.AddItemAt( index + 1 ); node.ReAssignDialogIDsInThisObject(); } if( GUILayout.Button( "-" , GUILayout.Width( 25f ) ) ){ if( EditorUtility.DisplayDialog( "Remove Item at ID_" + index.ToString() + " ?" , "Are you sure you really want to remove?" , "Yes", "Cancel" ) ){ node.RemoveItemAt( index ); node.ReAssignDialogIDsInThisObject(); } } #else // unit.show = EditorGUILayout.Foldout( unit.show , "_" ); EditorGUILayout.BeginHorizontal(); GUILayout.Space( 15f ); unit.isName = EditorGUILayout.Toggle( unit.isName , GUILayout.Width( 10f ) ); EditorGUILayout.LabelField( "Name" , GUILayout.Width(40f ) , GUILayout.Height( 20f ) ); if( unit.isName ){ unit.nameText = EditorGUILayout.TextField( unit.nameText , GUI.skin.textArea, GUILayout.Width(75f ) , GUILayout.Height(20f)); } unit.dialogText = EditorGUILayout.TextArea( unit.dialogText , GUI.skin.textArea ); DrawBGMPopupField( node , unit ); DrawSEPopupField( node , unit ); DrawVoicePopupField( node , unit ); EditorGUILayout.EndHorizontal(); #endif EditorGUILayout.EndHorizontal(); }
void OnGUI() { /* if( m_DialogIconTex == null || m_ArrowBackTex == null || m_ArrowForwardTex == null ){ LoadIcons(); } //*/ #if false if( EditorGUIUtility.isProSkin ){ ViNoEditorUtil.BeginGUIColor( GUI.color , Color.green , GUI.contentColor ); } else{ // ViNoEditorUtil.BeginGUIColor( Color.white , new Color( 0f , 0.8f , 0f , 1f ) , Color.black ); ViNoEditorUtil.BeginGUIColor( Color.white , new Color( 0.8f , 0.8f , 0.8f , 1f ) , Color.black ); } #endif m_ScrollPos = EditorGUILayout.BeginScrollView( m_ScrollPos ); #if false EditorGUILayout.BeginHorizontal(); // GUILayout.Box( m_DialogIconTex , GUILayout.Width( 44f ) , GUILayout.Height( 44f ) ); current = EditorGUILayout.ObjectField( "Target" , current , typeof( DialogPartNode ) , true ) as DialogPartNode; // current = EditorGUILayout.ObjectField( m_DialogIconTex , current , typeof( DialogPartNode ) , true ) as DialogPartNode; EditorGUILayout.EndHorizontal(); /* if( Selection.activeGameObject != null ){ if( current != null ){ if( current.gameObject != Selection.activeGameObject ){ current = Selection.activeGameObject.GetComponent<DialogPartNode>(); UpdateGameView(); } } else{ current = Selection.activeGameObject.GetComponent<DialogPartNode>(); UpdateGameView(); } } else{ m_CurrentID = 0; current = null; return; } //*/ if( current != null ){ m_DialogItemNum = current.GetMessageNum(); GUI.enabled = true; } else{ GUI.enabled = false; } DrawMessageControl(); #endif if( current != null ){ if( currentData != null ){ currentData.show = false; } if( current.dlgDataList.Count == 0 ){ ShowNotificate(); } else{ if( m_CurrentID >= current.dlgDataList.Count ){ m_CurrentID = 0; } currentData = current.dlgDataList[ m_CurrentID ];//current.GetItemAt( m_CurrentID ); currentData.show = true; // NodeGUI.DrawDialogItemBar( current , ref currentData , m_CurrentID , current.m_ViNoTextBox , current.m_NameTextBox ); switch( currentData.actionID ){ case DialogPartNodeActionType.Dialog: // DrawSceneCategory( current , currentData ); // DrawActorCategory( current , currentData ); DrawSoundCategory( current , currentData ); DrawDialogCategory( current , currentData ); break; case DialogPartNodeActionType.EnterActor: case DialogPartNodeActionType.ExitActor: // case DialogPartNodeActionType.Shake: // case DialogPartNodeActionType.ChangeState: case DialogPartNodeActionType.MoveActor: DrawActorCategory( current , currentData ); break; // case DialogPartNodeActionType.EnterScene: // case DialogPartNodeActionType.ExitScene: // DrawSceneCategory( current , currentData ); // break; } } } else{ ShowNotificate(); } // If not play mode , Change the scene and Message . if( GUI.changed ){//&& ! Application.isPlaying ){ UpdateGameView(); } // EditorGUILayout.LabelField( "Dialog Item Num" + m_DialogItemNum.ToString() ); EditorGUILayout.EndScrollView(); GUI.enabled = true; #if false ViNoEditorUtil.EndGUIColor(); #endif }
public static void ViewScene( DialogPartData data ) { // TODO... #if false ViNoSceneManager sm = GameObject.FindObjectOfType( typeof(ViNoSceneManager )) as ViNoSceneManager; if( sm != null ){ GameObject advSceneRoot = sm.theSavedPanel; if( data.isClearScene ){ bool destroyImmediate = true; ClearSceneNode.Do( advSceneRoot , destroyImmediate ); } // if( data.isLoadScene && data.Scene != null ){ if( ! string.IsNullOrEmpty( data.sceneFilePath ) && sm != null ){ bool TODO1 = false; bool TODO2 = false; Scene scene = Resources.Load( data.sceneFilePath , typeof(Scene ) ) as Scene; // LoadSceneNode.Do( advSceneRoot , data.Scene , TODO1 , TODO2 , true ); LoadSceneNode.Do( advSceneRoot , scene , TODO1 , TODO2 , true ); } } // No need to warning , if user do not need Scene Save and Load function. // else{ // Debug.LogWarning( "There is no ViNoSceneManager object. Scene Save and Load will not work..." ); // } #endif }
public static void ImportText( DialogPartNode dlg , string text , string blockDelimiter , string[] nameDelimiter , bool overWrite ) { string[] delimiter = { blockDelimiter }; //{ System.Environment.NewLine + System.Environment.NewLine }; string[] blocks = text.Split(delimiter, System.StringSplitOptions.None ); int dlgID = 0; if( dlg != null ){ if( overWrite ){ dlg.dlgDataList.Clear(); } foreach (string s in blocks) { string[] temp = s.Split( nameDelimiter, System.StringSplitOptions.None ); if( temp.Length > 1 ){ DialogPartData data = new DialogPartData(); data.dialogID = dlgID; data.nameText = temp[ 0 ]; data.dialogText = temp[ 1 ]; data.isName = true; dlg.AddData( data ); } else{ dlg.AddData( "" , s ); } dlgID++; } // Debug.Log( "Imported Text."); } }
// TEST !!!! /* static private string[] m_ActorPopup; static private string[] actorPopup{ get{ if( m_ActorPopup == null ){ List<string> actorNames = new List<string>(); ActorLibrary actorLib = GameObject.FindObjectOfType( typeof(ActorLibrary) ) as ActorLibrary; for(int i=0;i<actorLib.actorEntries.Length;i++){ actorNames.Add( actorLib.actorEntries[ i ].actorName ); } m_ActorPopup = actorNames.ToArray(); } return m_ActorPopup; } } //*/ public static void DrawLayoutEnterActorField( DialogPartData unit ) { if( unit.enterActorEntries == null || unit.enterActorEntries.Length == 0 ){ unit.enterActorEntries = new DialogPartData.ActorEntry[ 1 ]; unit.enterActorEntries[ 0 ] = new DialogPartData.ActorEntry(); } EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); EditorGUILayout.LabelField( "ActorName" , GUILayout.Width( 150f ) ); EditorGUILayout.LabelField( "Position" , GUILayout.Width( 100f ) ); EditorGUILayout.LabelField( "WithFade" , GUILayout.Width( 70f ) ); EditorGUILayout.EndHorizontal(); for( int i=0;i<unit.enterActorEntries.Length;i++){ EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); #if true unit.enterActorEntries[ i ].actorName = EditorGUILayout.TextField( unit.enterActorEntries[ i ].actorName , GUILayout.Width( 150f ) ); #else int actorID = 0; actorID = EditorGUILayout.Popup( actorID , actorPopup , GUILayout.Width( 150f ) ); #endif unit.enterActorEntries[ i ].position = (ViNoToolkit.SceneEvent.ActorPosition)EditorGUILayout.EnumPopup( unit.enterActorEntries[ i ].position , GUILayout.Width( 100f ) ); unit.enterActorEntries[ i ].withFade = EditorGUILayout.Toggle( unit.enterActorEntries[ i ].withFade , GUILayout.Width( 70f ) ); if( GUILayout.Button( "+" ) ){ ArrayUtility.Insert<DialogPartData.ActorEntry>( ref unit.enterActorEntries , i + 1 , new DialogPartData.ActorEntry() ); } if( GUILayout.Button( "-" ) ){ ArrayUtility.RemoveAt<DialogPartData.ActorEntry>( ref unit.enterActorEntries , i ); } EditorGUILayout.EndHorizontal(); } }
/// <summary> /// Generates a Dialog code. /// </summary> /// <param name='byteList'> /// Byte list. /// </param> /// <param name='isName'> /// Is name. /// </param> /// <param name='isClearMessageAfter'> /// Is clear message after. /// </param> /// <param name='textNameHndStr'> /// Text name hnd string. /// </param> /// <param name='nameText'> /// Name text. /// </param> /// <param name='textDialogHndStr'> /// Text dialog hnd string. /// </param> /// <param name='dialogText'> /// Dialog text. /// </param> public static void GenerateADialogCode( List<byte> byteList , DialogPartData data , string textNameHndStr , string textDialogHndStr ) { // Currently not show. #if false if( data.isClearScene ){ // Clear Current Shown Scene. byteList.Add( Opcode.CLEAR_SCENE ); } if( ! string.IsNullOrEmpty( data.sceneFilePath ) ){ AddSceneAdditiveCode( byteList , data.sceneFilePath , data.isFadeInStart ); } #endif /* else{ Debug.LogWarning( "Action:Scene data.sceneFilePath must not be null or empty." ); } //*/ switch( data.actionID ){ case DialogPartNodeActionType.EnterActor: for( int i=0;i<data.enterActorEntries.Length;i++){ DialogPartData.ActorEntry entry= data.enterActorEntries[ i ]; // Debug.Log ( "ADDCODE ACTOR:" + entry.actorName ); Hashtable args = new Hashtable(); args[ "eventType" ] = data.actionID.ToString().ToLower(); args[ "name" ] = entry.actorName; args[ "position" ] = entry.position.ToString(); args[ "fade" ] = entry.withFade.ToString().ToLower(); ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); } break; case DialogPartNodeActionType.MoveActor: for( int i=0;i<data.enterActorEntries.Length;i++){ DialogPartData.ActorEntry entry= data.enterActorEntries[ i ]; Hashtable args = new Hashtable(); args[ "eventType" ] = data.actionID.ToString().ToLower(); args[ "name" ] = entry.actorName; args[ "position" ] = entry.position.ToString(); ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); } break; case DialogPartNodeActionType.ExitActor: for( int i=0;i<data.exitActorEntries.Length;i++){ DialogPartData.ActorEntry entry= data.exitActorEntries[ i ]; Hashtable args = new Hashtable(); args[ "eventType" ] = data.actionID.ToString().ToLower(); args[ "name" ] = entry.actorName; args[ "fade" ] = entry.withFade.ToString().ToLower(); ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); } break; case DialogPartNodeActionType.Dialog: AddAudioCode( byteList , data ); if( data.isName ){ AddSetTextCode( byteList , data.nameText , textNameHndStr ); } else{ AddHideMessageCode( byteList , textNameHndStr ); } AddCurrentCode( byteList , textDialogHndStr ); string str = data.dialogText; if( ! data.isClearMessageAfter ){ str += System.Environment.NewLine; } ByteCodeScriptTools.AddStringCode( byteList , str ); byteList.Add( Opcode.PRINT ); byteList.Add( Opcode.WAIT_TOUCH ); if( data.isClearMessageAfter ){ byteList.Add( Opcode.CM ); } break; /* case DialogPartNodeActionType.ChangeState: for( int i=0;i<data.exitActorEntries.Length;i++){ DialogPartData.ActorEntry entry= data.exitActorEntries[ i ]; Hashtable args = new Hashtable(); args[ "eventType" ] = data.actionID.ToString().ToLower(); args[ "name" ] = entry.actorName; args[ "state" ] = entry.state; args[ "fade" ] = entry.withFade.ToString().ToLower(); ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); } break; case DialogPartNodeActionType.Shake: for( int i=0;i<data.exitActorEntries.Length;i++){ DialogPartData.ActorEntry entry= data.exitActorEntries[ i ]; Hashtable args = new Hashtable(); args[ "eventType" ] = data.actionID.ToString().ToLower(); args[ "name" ] = entry.actorName; ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); } break; case DialogPartNodeActionType.EnterScene: Hashtable args = new Hashtable(); args[ "eventType" ] = data.actionID.ToString().ToLower(); args[ "name" ] = data.scene.sceneName; args[ "fade" ] = data.scene.withFade.ToString().ToLower(); ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); break; case DialogPartNodeActionType.ExitScene: args = new Hashtable(); args[ "eventType" ] = data.actionID.ToString().ToLower(); args[ "name" ] = data.scene.sceneName; args[ "fade" ] = data.scene.withFade.ToString().ToLower(); ByteCodeScriptTools.AddTablePairsCode( byteList , args ); ByteCodeScriptTools.AddMessagingCode( byteList , " " , OpcodeMessaging.TRIGGER_EVENT_WITH_ARGS ); break; //*/ // Show later update... #if false case DialogPartNodeActionType.Scene: break; case DialogPartNodeActionType.ClearScene: byteList.Add( Opcode.CLEAR_SCENE ); break; case DialogPartNodeActionType.PlayAnimation: if( data.isAnim ){ byteList.Add( Opcode.PLAY_ANIMATION ); byteList.Add( (byte)data.animationID ); } break; case DialogPartNodeActionType.ClearScene: byteList.Add( Opcode.CLEAR_SCENE ); break; case DialogPartNodeActionType.EnterActor: break; case "Scenario Script": AddAudioCode( byteList , data ); AddCurrentCode( byteList , textDialogHndStr ); KAGInterpreter ip = new KAGInterpreter(); List<byte> temp = ip.Interpret( data.dialogText ); for( int i=0;i<temp.Count;i++){ byteList.Add( temp[ i ] ); } temp = null; break; case "Selections": // if( data.isSelections ){ ByteCodeScriptTools.AddMessagingCode( byteList , "_" , OpcodeMessaging.SELECTIONS ); ByteCodeScriptTools.AddTextLiteralCode( byteList , "_" ); byteList.Add( Opcode.SELECTIONS ); // for( int i=0;i<units.Length;i++){ // SelectionsNode1.SelectUnit unit = units[ i ]; // CodeGenerator.GenerateASelection( byteList , i , data.targetNodeName , unit.text , false , "_" ); // } CodeGenerator.GenerateASelection( byteList , 0 , data.selection.targetNodeName , data.selection.text , false , "_" ); byteList.Add( Opcode.STOP ); // } break; #endif } }
public static void DrawLayoutExitActorField( DialogPartData unit ) { if( unit.exitActorEntries == null || unit.exitActorEntries.Length == 0 ){ unit.exitActorEntries = new DialogPartData.ActorEntry[ 1 ]; unit.exitActorEntries[ 0 ] = new DialogPartData.ActorEntry(); } EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); EditorGUILayout.LabelField( "ActorName" , GUILayout.Width( 150f ) ); EditorGUILayout.LabelField( "WithFade" , GUILayout.Width( 100f ) ); EditorGUILayout.EndHorizontal(); for( int i=0;i<unit.exitActorEntries.Length;i++){ EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); unit.exitActorEntries[ i ].actorName = EditorGUILayout.TextField( unit.exitActorEntries[ i ].actorName , GUILayout.Width( 150f ) ); unit.exitActorEntries[ i ].withFade = EditorGUILayout.Toggle( unit.exitActorEntries[ i ].withFade , GUILayout.Width( 100f ) ); if( GUILayout.Button( "+" ) ){ ArrayUtility.Insert<DialogPartData.ActorEntry>( ref unit.exitActorEntries , i + 1 , new DialogPartData.ActorEntry() ); } if( GUILayout.Button( "-" ) ){ ArrayUtility.RemoveAt<DialogPartData.ActorEntry>( ref unit.exitActorEntries , i ); } EditorGUILayout.EndHorizontal(); } }
public static void DrawLayoutNameField( DialogPartData unit ) { EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); unit.isName = EditorGUILayout.Toggle( unit.isName , GUILayout.Width( 10f ) ); EditorGUILayout.LabelField( "Name/Title" , GUILayout.Width(80f ) , GUILayout.Height( 20f ) ); if( unit.isName ){ unit.nameText = EditorGUILayout.TextField( unit.nameText , GUI.skin.textArea, GUILayout.Width(200f ) , GUILayout.Height(20f)); } EditorGUILayout.EndHorizontal(); }
public static void DrawLayoutSceneField( DialogPartData unit ) { #if false EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); unit.isClearScene = EditorGUILayout.Toggle( unit.isClearScene , GUILayout.Width( 10f ) ); EditorGUILayout.LabelField( "ClearScene?" , GUILayout.Width( 75f ) ); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); // EditorGUILayout.BeginHorizontal(); // unit.isLoadScene = EditorGUILayout.BeginToggleGroup( "Scene" , unit.isLoadScene );//, GUILayout.Width( 10f ) ); // unit.isLoadScene = EditorGUILayout.Toggle( unit.isLoadScene , GUILayout.Width( 10f ) ); EditorGUILayout.LabelField( "FilePath" , GUILayout.Width( 75f ) ); EditorGUILayout.BeginHorizontal(); // unit.Scene = EditorGUILayout.ObjectField( unit.Scene , typeof( ScriptableSceneData ) , false ) as ScriptableSceneData; unit.sceneFilePath = EditorGUILayout.TextField( unit.sceneFilePath ); // DialogPartNodeUtility.RestoreSceneData( unit ); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); unit.isFadeInStart = EditorGUILayout.Toggle( unit.isFadeInStart , GUILayout.Width( 10f ) ); EditorGUILayout.LabelField( "withFadeIn?" , GUILayout.Width( 75f ) ); EditorGUILayout.EndHorizontal(); #else if( unit.scene == null ){ unit.scene = new DialogPartData.SceneEntry(); } EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); EditorGUILayout.LabelField( "SceneName" , GUILayout.Width( 150f ) ); EditorGUILayout.LabelField( "WithFade" , GUILayout.Width( 100f ) ); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Space( 30f ); unit.scene.sceneName = EditorGUILayout.TextField( unit.scene.sceneName , GUILayout.Width( 150f ) ); unit.scene.withFade = EditorGUILayout.Toggle( unit.scene.withFade , GUILayout.Width( 100f ) ); EditorGUILayout.EndHorizontal(); #endif }
public static 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 static 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; } //*/ }
public static 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 ); } }
public static void DrawAnimation( DialogPartData unit ) { EditorGUILayout.BeginHorizontal(); GUILayout.Space( 15f ); unit.isAnim = EditorGUILayout.Toggle( unit.isAnim , GUILayout.Width( 10f ) ); EditorGUILayout.LabelField( "Animation" , GUILayout.Width( 75f ) ); if( unit.isAnim ){ EditorGUILayout.BeginHorizontal(); if( DialogPartNodeInspector.animationEntries != null ){ unit.animationID = EditorGUILayout.Popup( unit.animationID , DialogPartNodeInspector.animationEntries , GUILayout.Width( 85f ) ); if( DialogPartNodeInspector.animationEntries != null && DialogPartNodeInspector.animationEntries.Length > 0 ){ unit.animNameKey = DialogPartNodeInspector.animationEntries[ unit.animationID ]; } } // Show Dummy Contents. else{ unit.animationID = EditorGUILayout.Popup( unit.animationID , kDummyContents , GUILayout.Width( 75f ) ); } // unit.animNameKey = EditorGUILayout.TextField( unit.animNameKey ); // unit.animationID = DialogPartNodeInspector.animManagerInstance.GetAnimationIDBy( unit.animNameKey ); //EditorGUILayout.Popup( unit.animationID , kDummyContents , GUILayout.Width( 75f ) ); // ViNoEditorUtil.EndGUIColor(); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndHorizontal(); }
void OnGUI() { /* if( m_DialogIconTex == null || m_ArrowBackTex == null || m_ArrowForwardTex == null ){ * LoadIcons(); * } * //*/ #if false if (EditorGUIUtility.isProSkin) { ViNoEditorUtil.BeginGUIColor(GUI.color, Color.green, GUI.contentColor); } else { // ViNoEditorUtil.BeginGUIColor( Color.white , new Color( 0f , 0.8f , 0f , 1f ) , Color.black ); ViNoEditorUtil.BeginGUIColor(Color.white, new Color(0.8f, 0.8f, 0.8f, 1f), Color.black); } #endif m_ScrollPos = EditorGUILayout.BeginScrollView(m_ScrollPos); #if false EditorGUILayout.BeginHorizontal(); // GUILayout.Box( m_DialogIconTex , GUILayout.Width( 44f ) , GUILayout.Height( 44f ) ); current = EditorGUILayout.ObjectField("Target", current, typeof(DialogPartNode), true) as DialogPartNode; // current = EditorGUILayout.ObjectField( m_DialogIconTex , current , typeof( DialogPartNode ) , true ) as DialogPartNode; EditorGUILayout.EndHorizontal(); /* * if( Selection.activeGameObject != null ){ * if( current != null ){ * if( current.gameObject != Selection.activeGameObject ){ * current = Selection.activeGameObject.GetComponent<DialogPartNode>(); * UpdateGameView(); * } * } * else{ * current = Selection.activeGameObject.GetComponent<DialogPartNode>(); * UpdateGameView(); * } * } * else{ * m_CurrentID = 0; * current = null; * return; * } * //*/ if (current != null) { m_DialogItemNum = current.GetMessageNum(); GUI.enabled = true; } else { GUI.enabled = false; } DrawMessageControl(); #endif if (current != null) { if (currentData != null) { currentData.show = false; } if (current.dlgDataList.Count == 0) { ShowNotificate(); } else { if (m_CurrentID >= current.dlgDataList.Count) { m_CurrentID = 0; } currentData = current.dlgDataList[m_CurrentID]; //current.GetItemAt( m_CurrentID ); currentData.show = true; // NodeGUI.DrawDialogItemBar( current , ref currentData , m_CurrentID , current.m_ViNoTextBox , current.m_NameTextBox ); switch (currentData.actionID) { case DialogPartNodeActionType.Dialog: // DrawSceneCategory( current , currentData ); // DrawActorCategory( current , currentData ); DrawSoundCategory(current, currentData); DrawDialogCategory(current, currentData); break; case DialogPartNodeActionType.EnterActor: case DialogPartNodeActionType.ExitActor: // case DialogPartNodeActionType.Shake: // case DialogPartNodeActionType.ChangeState: case DialogPartNodeActionType.MoveActor: DrawActorCategory(current, currentData); break; // case DialogPartNodeActionType.EnterScene: // case DialogPartNodeActionType.ExitScene: // DrawSceneCategory( current , currentData ); // break; } } } else { ShowNotificate(); } // If not play mode , Change the scene and Message . if (GUI.changed) //&& ! Application.isPlaying ){ { UpdateGameView(); } // EditorGUILayout.LabelField( "Dialog Item Num" + m_DialogItemNum.ToString() ); EditorGUILayout.EndScrollView(); GUI.enabled = true; #if false ViNoEditorUtil.EndGUIColor(); #endif }
public static void ViewDialog( DialogPartData data , ViNoTextBox dialogTextBox , ViNoTextBox nameTextBox ) { if( dialogTextBox != null ){ dialogTextBox.SetText( data.dialogText ); } if( nameTextBox != null ){ nameTextBox.SetText( data.nameText ); } }
// static private string[] kDummyContents = { "NO ENTRY" }; public static void DrawBGMPopupField( DialogPartNode node , DialogPartData unit ) { #if true unit.bgmAudioKey = EditorGUILayout.TextField( unit.bgmAudioKey , GUILayout.Width( 175f ) ); /* if( DialogPartNodeInspector.bgmEntries != null ){ unit.bgmAudioID = EditorGUILayout.Popup( unit.bgmAudioID , DialogPartNodeInspector.bgmEntries , GUILayout.Width( 75f ) ); if( DialogPartNodeInspector.bgmEntries.Length > unit.bgmAudioID ){ unit.bgmAudioKey = DialogPartNodeInspector.bgmEntries[ unit.bgmAudioID ]; } } // Show Dummy Contents. else{ unit.bgmAudioID = EditorGUILayout.Popup( unit.bgmAudioID , kDummyContents , GUILayout.Width( 75f ) ); } //*/ #else if( node.soundData != null ){ if( node.soundData.bgmEntries != null ){ string[] entries = node.soundData.GetSoundEntryNames(); unit.bgmAudioID = EditorGUILayout.Popup( unit.bgmAudioID , entries , GUILayout.Width( 75f ) ); if( entries.Length > unit.bgmAudioID ){ unit.bgmAudioKey = entries[ unit.bgmAudioID ]; } } // Show Dummy Contents. else{ unit.bgmAudioID = EditorGUILayout.Popup( unit.bgmAudioID , kDummyContents , GUILayout.Width( 75f ) ); } } #endif }
void UpdateGameView() { if( current != null ){ if( current.dlgDataList.Count <= m_CurrentID ){ m_CurrentID = current.dlgDataList.Count - 1; } currentData = current.dlgDataList[ m_CurrentID ];//current.GetItemAt( m_CurrentID ); DialogPartNodeUtility.ViewDialog( currentData , current.m_ViNoTextBox , current.m_NameTextBox ); DialogPartNodeUtility.ViewScene( currentData ); } }