private void StoryValue() { DialogObject dialog = Selection.activeObject as DialogObject; if (dialog == null) { EditorGUILayout.LabelField("Not select dialog!"); return; } if (dialog.Dialog != null) { EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("<color=#FF00FF>" + dialog.name + "</color>", ResourcesManager.GetInstance.GetFontStyle(18)); //GUILayout.Space(10); if (GUILayout.Button("<color=#00FF00>Add Value</color>", ResourcesManager.GetInstance.skin.button, GUILayout.Height(25))) { ValueAdder.Open(dialog.Dialog); } EditorGUILayout.EndHorizontal(); GUILayout.Space(10); ShowContainer(dialog.Dialog); EditorGUILayout.EndVertical(); } }
void OnGUI() { _windowRect = new Rect(0, 0, position.width, position.height); _contentRect = new Rect(_leftWidth, _topHeight, position.width, position.height); //========Story Editor ============== if (MainPageEditor.GetInstance.OnGUI(this)) { return; } if (_lastDialogObject != _dialogObject) { _lastDialogObject = _dialogObject; DialogEditor.GetInstance.Reset(); } //Show Pages MainPage(); //========Top Button ============== ShowTitle(); //========Version ============== ShowVersion(); }
void MakeNewDialog(string newDialog) { DialogObject newDialogObject = Instantiate(dialogPrefab, dialogHolder.transform) .GetComponent <DialogObject>(); newDialogObject.Setup(newDialog); }
private void ReadDialog(object sender, EventArgs e) { DialogEventArgs d = (DialogEventArgs)e; DialogObject dialog = d.payload; StartCoroutine(HandleDialogBroadcast(dialog)); }
//set de los parametros del modal public void setDialog(DialogObject dialog) { generalText.text = dialog.genText; confText.text = dialog.confText; canText.text = dialog.cancText; confButton.onClick.RemoveAllListeners(); confButton.onClick.AddListener(dialog.confEv.Invoke); }
private void DialogTest() { DialogObject test = new DialogObject(); test.shakeAmp = .2f; test.dialogLines.Add("Lorem ipsum this is a test"); GameEvents.InvokeDialogInitiated(test); }
public void SetDialog(DialogObject d) { ShowDialog(); dialogText.text = d.dText; confirmText.text = d.confirmText; cancelText.text = d.cancelText; confirmBtn.onClick.RemoveAllListeners(); confirmBtn.onClick.AddListener(d.confirmEvent.Invoke); }
private void CreateNewStory() { string path = EditorUtility.SaveFilePanelInProject("Create Dialog", "New Dialog", "asset", "Create new dialog"); if (!string.IsNullOrEmpty(path)) { DialogObject o = ScriptableObject.CreateInstance <DialogObject>(); AssetDatabase.CreateAsset(o, path); Selection.activeObject = o; } }
// Use this for initialization void Awake() { //speaking = false; paused = false; endletterActive = false; introletterActive = false; dialogSystem = GameObject.FindGameObjectWithTag("DialogSystem").GetComponent <DialogObject>(); settingManager = GameObject.FindGameObjectWithTag("SettingsManager").GetComponent <SettingsMngr>(); StaticIngameData.gameMenu = this; }
public void StartDialog(DialogObject dialogObject) { animator.SetBool("isOpen", true); sentences.Clear(); //Add all sentences from the dialog object to the queue foreach (string sentence in dialogObject.sentences) { sentences.Enqueue(sentence); } DisplayNextSentence(); }
public bool OnGUI(DialogEditorWindow window) { DialogObject dialog = Selection.activeObject as DialogObject; window._dialogObject = dialog; if (dialog == null) { ShowTips(window._windowRect.center); return(true); } return(false); }
public void ShowCurrentDialog() { if (_currentDialogSeries.Length > _currentDialogIndex) { DialogObject currentDialog = _currentDialogSeries[_currentDialogIndex]; dialogPanel.SetDialogObject(currentDialog); } else { _dialogInProgress = false; dialogPanel.ClosePanel(); } }
/// <summary> /// DialogObjectの初期化 /// </summary> private void InitDialogObject() { // 初回は作成 if (dialogObject == null) { dialogObject = new DialogObject(); dialogObject.GameObject = dialogPrefabHolder.InstantiateDialog(); Transform[] childTransformList = dialogObject.GameObject.GetComponentsInChildren <Transform>(); foreach (Transform ts in childTransformList) { GameObject go = ts.gameObject; // メッセージ if (go.name == TEXT_MESSAGE) { dialogObject.MessageTextObject = go; } // OK if (go.name == TEXT_BUTTON_OK) { dialogObject.OkText = go.GetComponent <Text>(); } // Cancel if (go.name == TEXT_BUTTON_CANCEL) { dialogObject.CancelText = go.GetComponent <Text>(); } // OK if (go.name == BUTTON_BUTTON_OK) { dialogObject.OkButton = go.GetComponent <Button>(); dialogObject.OkButton.onClick.AddListener(this.Ok); } // Cancel if (go.name == BUTTON_BUTTON_CANCEL) { dialogObject.CancelButton = go.GetComponent <Button>(); dialogObject.CancelButton.onClick.AddListener(this.Cancel); } } } dialogObject.OkAction = null; dialogObject.CancelAction = this.HideDialog; }
IEnumerator MakeNewDialog(string newDialog) { // Instantiates the dialog object (the prefab) on the dialog holder scrollInProgress = true; DialogObject newDialogObject = Instantiate(dialogPrefab, dialogHolder.transform).GetComponent <DialogObject>(); StartCoroutine(ScrollCo()); float r = newDialogObject.Setup(newDialog); yield return(new WaitForSeconds(r)); scrollInProgress = false; afterDialog(); }
void Update() { if (Input.GetMouseButton(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray.origin, ray.direction, out hit, Mathf.Infinity)) { DialogObject obj = hit.collider.GetComponent <DialogObject>(); if (obj) { obj.TriggerDialog(); } } } }
public void RenderCreateDialog() { EditorGUILayout.LabelField("File Name"); dialogObjName = EditorGUILayout.TextField(dialogObjName); if (GUILayout.Button("Create New")) { if (!string.IsNullOrEmpty(dialogObjName)) { DialogObject dObj = DialogObject.CreateInstance <DialogObject>(); dObj.name = dialogObjName; DialogGraph graph = DialogGraph.CreateInstance <DialogGraph>(); graph.dialogObject = dObj; AssetDatabase.CreateAsset(graph, "Assets/DialogSystem/Editor/Resources/" + dialogObjName + ".asset"); AssetDatabase.CreateAsset(dObj, "Assets/DialogSystem/Resources/" + dialogObjName + ".asset"); graphs.Add(graph); dialogObjName = ""; } } }
IEnumerator DialogCoroutine(DialogObject dialogObject, String startTrigger, String stopTrigger) { //yield return new WaitForSeconds(1); //start Audio _audio.clip = dialogObject.VoiceOver_Audio; _audio.Play(); TextHolder.SetActive(true); _textMeshProUgui.text = dialogObject.VoiceOver_Text; _animator.SetTrigger(startTrigger); yield return(new WaitForSeconds(dialogObject.VoiceOver_Audio.length + 1)); //Audio Length _animator.SetTrigger(stopTrigger); TextHolder.SetActive(false); DeathAble = true; }
private IEnumerator HandleDialogBroadcast(DialogObject dialog) { foreach (string s in dialog.dialogLines) { if (letters.Count < s.Length) { print("Dialog reader not long enough for this message! Add more letters"); } else { print(s); int index_letters = 0; foreach (string w in GetWords(s)) { int index_word = 0; int wordLength = w.Length; while (index_word < wordLength) { letters[index_letters].InitializeLetter(w[index_word], dialog.shakeSpeed, dialog.shakeAmp, dialog.textColor); yield return(new WaitForSeconds(dialog.textReadSpeed)); index_letters++; index_word++; } letters[index_letters].InitializeLetter(' ', dialog.shakeSpeed, dialog.shakeAmp, dialog.textColor); index_letters++; yield return(new WaitForSeconds(dialog.pauseBetweenWords)); } yield return(new WaitForSeconds(dialog.pauseBetweenLines)); foreach (Letter l in letters) { l.ClearLetter(); } } } }
public async Task <Stream> GetDialogAsync(ICommandContext context, DialogObject obj, string cooldownMessage) { if (_authenticationService.AuthenticationData.expiry < DateTime.Now) { await _authenticationService.Login(); } var str = JsonSerializer.ToJsonString(obj); var request = new HttpRequestMessage { RequestUri = new Uri("https://tetsukizone.com/api/dialog"), Method = HttpMethod.Post, Headers = { { HttpRequestHeader.Accept.ToString(), "application/json" }, { HttpRequestHeader.ContentType.ToString(), "application/json" }, { HttpRequestHeader.Authorization.ToString(), $"Bearer {_authenticationService.AuthenticationData.token}" } }, Content = new StringContent(str, Encoding.UTF8, "application/json") }; var response = await _http.SendAsync(request); if (response.StatusCode == HttpStatusCode.TooManyRequests) { await context.Channel.SendMessageAsync(cooldownMessage); return(null); } else if (response.StatusCode == HttpStatusCode.Unauthorized) { await _authenticationService.Login(); return(await GetDialogAsync(context, obj, cooldownMessage)); } return(await response.Content.ReadAsStreamAsync()); }
public DialogEventArgs(DialogObject dialog) { payload = dialog; }
public static void InvokeDialogFinished(DialogObject dialog) { DialogFinished(null, new DialogEventArgs(dialog)); }
public static void InvokeDialogInitiated(DialogObject dialog) { DialogInitiated(null, new DialogEventArgs(dialog)); }
public override void OnGUI() { //GUILayout.BeginArea(new Rect(new Vector2(0, 0), box)); if (graph == null) { graph = target as DialogGraph; } if (dialogObj == null) { dialogObj = (target as DialogGraph).dialogObject; } if (dialogObj == null) { return; } EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.MinHeight(20), GUILayout.MaxHeight(20)); options = EditorGUILayout.Toggle("Options", options, GUILayout.MaxWidth(100)); if (GUILayout.Button("Save", EditorStyles.toolbarButton)) { if (dialogObj.name != graph.name) { AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(dialogObj), graph.name); AssetDatabase.RenameAsset(AssetDatabase.GetAssetPath(graph), dialogObj.name); } window.Save(); AssetDatabase.SaveAssets(); } if (GUILayout.Button("Add Node", EditorStyles.toolbarButton)) { graph.AddNode(typeof(DialogNode)); } if (GUILayout.Button("Add Event", EditorStyles.toolbarButton)) { graph.AddNode(typeof(DialogEventNode)); } graph.name = EditorGUILayout.TextField(graph.name, EditorStyles.toolbarTextField); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.MaxWidth(150)); if (options) { Debug.Log("options enabled"); EditorGUILayout.BeginVertical(EditorStyles.helpBox); //dialogObj.name = EditorGUILayout.TextField("Name", dialogObj.name); SerializedObject so = new SerializedObject(dialogObj); dialogObj.canExit = EditorGUILayout.Toggle("Can Exit", dialogObj.canExit); dialogObj.startDialog = EditorGUILayout.IntField("Entry", dialogObj.startDialog); if (dialogObj.fallBacks == null) { dialogObj.fallBacks = new int[0]; } if (fallbacks = EditorGUILayout.Foldout(options, "Fallbacks")) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("+")) { List <int> fb = new List <int>(dialogObj.fallBacks); fb.Add(0); dialogObj.fallBacks = fb.ToArray(); } if (GUILayout.Button("-")) { List <int> fb = new List <int>(dialogObj.fallBacks); if (fb.Count > 0) { fb.Remove(fb[fb.Count - 1]); } dialogObj.fallBacks = fb.ToArray(); } EditorGUILayout.EndHorizontal(); for (int i = 0; i < dialogObj.fallBacks.Length; i++) { dialogObj.fallBacks[i] = EditorGUILayout.IntField("ID" + i.ToString(), dialogObj.fallBacks[i]); } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorUtility.SetDirty(dialogObj); base.OnGUI(); }
void Dialog(DialogObject dialogObject, String startTrigger, String stopTrigger) { StartCoroutine(DialogCoroutine(dialogObject, startTrigger, stopTrigger)); }
static Manipulation() { jQuery.OnDocumentReady(delegate() { // tabs init with a custom tab template and an "add" callback filling in the content TabsObject tabs = jQuery.Select("#tabs6") .Plugin <TabsObject>() .Tabs(new TabsOptions( "tabTemplate", "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>Remove Tab</span></li>", "add", new jQueryUIEventHandler <TabsAddEvent>( delegate(jQueryEvent @event, TabsAddEvent ui) { string tab_content = tab_content_input.GetValue() ?? ("Tab " + tab_counter + " content."); jQuery.Select(ui.Panel).Append("<p>" + tab_content + "</p>"); }))); // modal dialog init: custom buttons and a "close" callback reseting the form inside DialogObject dialog = jQuery.Select("#dialog11") .Plugin <DialogObject>() .Dialog(new DialogOptions( DialogOption.AutoOpen, false, DialogOption.Modal, true, DialogOption.Buttons, new DialogOptions( "Add", new Action(delegate() { addTab(tabs); jQuery.This.Plugin <DialogObject>().Dialog(DialogMethod.Close); }), "Cancel", new Action(delegate() { jQuery.This.Plugin <DialogObject>().Dialog(DialogMethod.Open); })), DialogMethod.Open, new Action(delegate() { tab_title_input.Focus(); }), DialogMethod.Close, new Action(delegate() { // addTab form: calls addTab function on submit and closes the dialog jQuery.Select("form", jQuery.This) .Submit(new jQueryEventHandler(delegate(jQueryEvent e) { addTab(tabs); jQuery.This.Plugin <DialogObject>().Dialog(DialogMethod.Close); e.PreventDefault(); e.StopPropagation(); })); }))); // addTab button: just opens the dialog jQuery.Select("#add_tab") .Plugin <ButtonObject>() .Button() .Click(new jQueryEventHandler(delegate(jQueryEvent e) { dialog.Dialog(DialogMethod.Open); })); // close icon: removing the tab on click // note: closable tabs gonna be an option in the future - see http://dev.jqueryui.com/ticket/3924 jQuery.Select("#tabs6 span.ui-icon-close") .Live("click", new jQueryEventHandler(delegate(jQueryEvent e) { int index = jQuery.Select("li", tabs).Index(jQuery.This.Parent()[0]); tabs.Tabs(TabsMethod.Remove, index); })); }); }