public void SetText2(DialogText dialogText) { bool emptyDialog = dialogText == null || string.IsNullOrEmpty(dialogText.Text); gameObject.SetActive(!emptyDialog); _text.text = !emptyDialog ? dialogText.Text : null; }
protected void Awake() { if(mDialogText == null) { mDialogText = GetComponentInChildren<DialogText>(); } }
public void EndDialog() { dialogIsInitiated = false; currentTextDisplayer.CloseDialog(); player.GetComponent <PlayerMovement>().EnableControl(); currentDialog = null; }
public void GenerateRandomText(string[] inputs) { System.Enum.TryParse(inputs[0], out DialogText.Type t); DialogText.Emotion e = DialogText.Emotion.neutral; if (inputs[1] == "any") { e = DialogText.RandomEmotion(); } else { System.Enum.TryParse(inputs[1], out e); } List <DialogText> matchingType = Globals.GameVars.portDialogText.FindAll(x => x.TextType == t); List <DialogText> matchingBoth = matchingType.FindAll(x => x.TextEmotion == e); if (matchingBoth.Count == 0) { Debug.Log($"Nothing found with both type {t.ToString()} and emotion {e.ToString()} ({matchingType.Count} matching just type)"); } int i = Random.Range(0, matchingBoth.Count); storage.SetValue("$random_text", matchingBoth[i].Text); storage.SetValue("$emotion", e.ToString()); }
IEnumerator CoroutineTextAnimation(DialogText dialog, Action completed) { TextBox.text = ""; TextSpeaker.text = dialog.speaker; foreach (char c in dialog.text) { if (skipCurrent) { TextBox.text = dialog.text; skipCurrent = false; break; } TextBox.text += c; yield return(new WaitForSeconds(TextSpeed)); } while (!skipCurrent) { yield return(null); } skipCurrent = false; if (DialogQueue.Count > 0) { StartCoroutine(CoroutineTextAnimation(DialogQueue.Dequeue(), completed)); } else { Hide(); //DialogFinished(this); completed(); } }
protected void Awake() { if (mDialogText == null) { mDialogText = GetComponentInChildren <DialogText>(); } }
public void ElementTextEditTestEditThenInspect() { CharacterDialogVM testVM = ElementTextEditTestCreation(); DialogSegment dialogSegment = testVM.DialogSegment; testVM.EditMode = EditMode.TextBlock; testVM.InspectionActive = true; Assert.AreEqual("", testVM.DialogDocument.Text()); testVM.EditMode = EditMode.Elements; // add simple text element string elementName = new DialogText().ElementName; Assert.IsTrue(testVM.AddDialogElementCommand.CanExecute(elementName)); testVM.AddDialogElementCommand.Execute(elementName); Assert.AreEqual(1, dialogSegment.SegmentParts.Count); // edit simple text const string simpleText = "This is some simple text"; DialogText element = dialogSegment.SegmentParts.First() as DialogText; Assert.NotNull(element); element.Text = simpleText; // check that all of the characterDialogVMs text matches Assert.AreEqual(simpleText, element.Text); Assert.AreEqual(simpleText, dialogSegment.Text); testVM.EditMode = EditMode.TextBlock; Assert.AreEqual(simpleText, testVM.DialogDocument.Text()); }
public void ClearElements() { NpcChatProject project = new NpcChatProject(); if (project.ProjectCharacters.RegisterNewCharacter(out int id, "bill")) { DialogTree tree = project.ProjectDialogs.CreateNewDialogTree(); DialogTreeBranch branch = tree.CreateNewBranch(); DialogSegment segment = branch.CreateNewDialog(id); Assert.NotNull(segment); DialogText one = DialogTypeStore.Instance.CreateEntity <DialogText>(); one.Text = "one"; segment.AddDialogElement(one); Assert.IsTrue(segment.SegmentParts.Count > 0); bool callback = false; segment.PropertyChanged += (sender, args) => callback = true; segment.ClearElements(); Assert.AreEqual(0, segment.SegmentParts.Count); Assert.IsTrue(callback, "Failed to send callback for added type"); } else { Assert.Fail("Failed to create character"); } }
public void Activate() { renderer.enabled = true; currentDialog = dialog[0]; currentDialog.ResetDialog(); isActive = true; }
public void Instantiate() { DialogText element = DialogTypeStore.Instance.CreateEntity <DialogText>(); Assert.NotNull(element); Assert.NotNull(element.Text); }
private void UserDialogExitProcessing(PopdownReason popdownReason) { // Log to Honorbuddy why we're exiting behavior... if (popdownReason.IsReasonKnown()) { string directiveRequester = (IsStopOnContinue ? "Profile Writer request" : popdownReason.IsPopdown() ? "Notification criteria no longer valid" : popdownReason.IsTimerExpiry() ? "Profile Writer request" : popdownReason.IsUserResponse() ? "User request" : "Profile Writer request"); string messageType = (popdownReason.IsTimerExpiry() ? "timer expired" : popdownReason.IsUserResponse() ? "user response" : popdownReason.IsPopdown() ? "completion criteria" : "info"); string terminationMessage = string.Format("{0} {1}", (popdownReason.IsBotStop() ? "Honorbuddy stopped due to " : "Continuing profile due to"), directiveRequester); TreeRoot.StatusText = terminationMessage; DialogText = DialogText.Replace(@"\n", System.Environment.NewLine).Replace(@"\t", "\t"); QBCLog.DeveloperInfo("[{0}, {1}] {2}\nDisposition: {3}", DialogTitle, messageType, DialogText, terminationMessage); } if (popdownReason.IsBotStop()) { TreeRoot.Stop(); } }
private void btnClear_Click(object sender, EventArgs e) { if (f != null) { DialogText.Clear(); Action(f); } }
// Use this for initialization void Start() { PlayerAmmo = FindObjectOfType <Ammunition>(); interaction = FindObjectOfType <InteractionUni>(); ammoAmount = Random.Range(1, 3); dialog = FindObjectOfType <DialogText>(); control = FindObjectOfType <BinController>(); }
public static void AddDialogText(DialogText dialog) { if (dialogText == null) { dialogText = new List <DialogText>(); } dialogText.Add(dialog); }
public void StartDialog(DialogText dialog) { dialogIsInitiated = true; player.GetComponent <PlayerMovement>().DisableControl(); currentDialog = dialog; GameObject currentDialogObject = Instantiate(dialogPrefab, mainCanvas.transform); currentTextDisplayer = currentDialogObject.GetComponent <DialogTextDisplayer>(); currentTextDisplayer.SetDialogText(currentDialog.GetDialogText()); }
protected override void Awake() { base.Awake(); if(mDialogText == null) { mDialogText = GetComponentInChildren<DialogText>(); } mOriginalWeaponSlotPos = mWeaponSlot.localPosition; mOriginalWeaponSlotRotation = mWeaponSlot.localRotation; }
public void SetupUI(DialogText option) { button.gameObject.SetActive(true); button1.gameObject.SetActive(false); button2.gameObject.SetActive(false); display.text = option.text; button.onClick.RemoveAllListeners(); button.onClick.AddListener(() => SetNewDialogOption(currentDialog.ExecuteNodeAndGetNextId())); button.GetComponentInChildren <Text>().text = "Next"; }
protected override void Awake() { base.Awake(); if (mDialogText == null) { mDialogText = GetComponentInChildren <DialogText>(); } mOriginalWeaponSlotPos = mWeaponSlot.localPosition; mOriginalWeaponSlotRotation = mWeaponSlot.localRotation; }
public void ProcessInput() { if (ShouldProcessInput()) { actionAxisInUSe = true; if (currentDialog.IsNextDialog()) { currentDialog = currentDialog.GetNextDialog(); currentDialogDisplayer.SetDialogText(currentDialog.GetDialogText()); } } }
private void ShowDialog() { if (currentDialog != null && currentDialog.Count > 0) { DialogText nextDialog = currentDialog.Dequeue(); speakerText.text = nextDialog.Speaker; dialogText.text = nextDialog.Text; dialogImage.gameObject.SetActive(true); } else { StopDialog(); } }
public void TextChangedCallback() { DialogText element = DialogTypeStore.Instance.CreateEntity <DialogText>(); bool changed = false; element.PropertyChanged += (s, a) => { changed = true; }; const string newText = "This is a text"; element.Text = newText; Assert.IsTrue(changed, "Failed to trigger PropertyChanged callback"); Assert.AreEqual(newText, element.Text); }
public void Use() { if (!canvas.isActiveAndEnabled) { canvas.gameObject.SetActive(true); canvas.enabled = true; dialogText = DialogText.getInstance(); } else { dialogText = DialogText.getInstance(); } dialogText = DialogText.getInstance(); initialized = true; }
public void Start() { renderer.enabled = false; txtMsh = gameObject.GetComponent(typeof(TextMesh)) as TextMesh; if (!txtMsh) Destroy(this.gameObject); if (dialog.Length <= 0) { isActive = false; } else { currentDialog = dialog[0]; } }
public static PlaylistVM CreatePlaylist(Window owner) { try { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(AppSettings.Culture); DialogText dlg = new DialogText(); dlg.Init(Properties.Resources.Playlist_Name + " ", ""); dlg.Owner = owner; bool?res = dlg.ShowDialog(); if (res.HasValue && res.Value) { if (string.IsNullOrEmpty(dlg.EnteredText)) { Utils.ShowErrorMessage(Properties.Resources.Playlist_NameBlank); return(null); } JMMServerBinary.Contract_Playlist pl = new JMMServerBinary.Contract_Playlist(); pl.DefaultPlayOrder = (int)PlaylistPlayOrder.Sequential; pl.PlaylistItems = ""; pl.PlaylistName = dlg.EnteredText; pl.PlayUnwatched = 1; pl.PlayWatched = 0; JMMServerBinary.Contract_Playlist_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.SavePlaylist(pl); if (!string.IsNullOrEmpty(resp.ErrorMessage)) { Utils.ShowErrorMessage(resp.ErrorMessage); return(null); } // refresh data PlaylistHelperVM.Instance.RefreshData(); PlaylistVM plRet = new PlaylistVM(resp.Playlist); return(plRet); } return(null); } catch (Exception ex) { Utils.ShowErrorMessage(ex); return(null); } }
public static VM_Playlist CreatePlaylist(Window owner) { try { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(AppSettings.Culture); DialogText dlg = new DialogText(); dlg.Init(Shoko.Commons.Properties.Resources.Playlist_Name + " ", ""); dlg.Owner = owner; bool?res = dlg.ShowDialog(); if (res.HasValue && res.Value) { if (string.IsNullOrEmpty(dlg.EnteredText)) { Utils.ShowErrorMessage(Shoko.Commons.Properties.Resources.Playlist_NameBlank); return(null); } Playlist pl = new Playlist { DefaultPlayOrder = (int)PlaylistPlayOrder.Sequential, PlaylistItems = "", PlaylistName = dlg.EnteredText, PlayUnwatched = 1, PlayWatched = 0 }; CL_Response <Playlist> resp = VM_ShokoServer.Instance.ShokoServices.SavePlaylist(pl); if (!string.IsNullOrEmpty(resp.ErrorMessage)) { Utils.ShowErrorMessage(resp.ErrorMessage); return(null); } // refresh data Instance.RefreshData(); return((VM_Playlist)resp.Result); } return(null); } catch (Exception ex) { Utils.ShowErrorMessage(ex); return(null); } }
private void ProcessInput() { if (ShouldProcessInput()) { actionAxisInUser = true; if (currentDialog.IsNextDialog()) { currentDialog = currentDialog.GetNextDialog(); currentDialogDisplayer.SetDialogText(currentDialog.GetDialogText()); } else { EndDialog(); } } ValidAxisInUser(); }
private void PlayClip(DialogText dialogText) { if (dialogText == null) { return; } _audio.Stop(); AudioClip clip = Clips.FirstOrDefault(x => x.name.Equals(dialogText.ID, StringComparison.OrdinalIgnoreCase)); if (clip != null) { _audio.clip = clip; _audio.Play(); } }
public void UpdateDialog(string name) { DialogText current = this.allDialog[name]; nameText.text = current.title; questionText.text = current.question; this.dialogCanvas.enabled = true; this.dialogType = current.type; if (!current.requiresAnswer) { this.bNo.SetActive(false); } else { this.bNo.SetActive(true); } }
public void Start() { renderer.enabled = false; txtMsh = gameObject.GetComponent(typeof(TextMesh)) as TextMesh; if (!txtMsh) { Destroy(this.gameObject); } if (dialog.Length <= 0) { isActive = false; } else { currentDialog = dialog[0]; } }
public void ProcessInput() { if (ShouldProcessInput()) { actionAxisInUse = true; if (currentDialog.IsNextDialog()) { currentDialog = currentDialog.GetNextDialog(); currentTextDisplayer.SetDialogText(currentDialog.GetDialogText()); } else { EndDialog(); } } ValidateAxisInUse(); }
public static PlaylistVM CreatePlaylist(Window owner) { try { DialogText dlg = new DialogText(); dlg.Init("Enter playlist name: ", ""); dlg.Owner = owner; bool?res = dlg.ShowDialog(); if (res.HasValue && res.Value) { if (string.IsNullOrEmpty(dlg.EnteredText)) { Utils.ShowErrorMessage("Please enter a playlist name"); return(null); } JMMServerBinary.Contract_Playlist pl = new JMMServerBinary.Contract_Playlist(); pl.DefaultPlayOrder = (int)PlaylistPlayOrder.Sequential; pl.PlaylistItems = ""; pl.PlaylistName = dlg.EnteredText; pl.PlayUnwatched = 1; pl.PlayWatched = 0; JMMServerBinary.Contract_Playlist_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.SavePlaylist(pl); if (!string.IsNullOrEmpty(resp.ErrorMessage)) { Utils.ShowErrorMessage(resp.ErrorMessage); return(null); } // refresh data PlaylistHelperVM.Instance.RefreshData(); PlaylistVM plRet = new PlaylistVM(resp.Playlist); return(plRet); } return(null); } catch (Exception ex) { Utils.ShowErrorMessage(ex); return(null); } }
public void Generate(string[] text, int FadeIn, int FadeOut, bool startTriggerGroup = false, string triggerType = "", int startTrigger = 0, int endTrigger = 0, int triggerGroup = 0) { // convert text to string lines List <string> Sentences = new List <string>(text); // string[] text = sentences.Split('|'); var position = new Position(); var dialogTiming = new DialogTiming(); dialogTiming.startTime = startTime; dialogTiming.endTime = endTime; position.position = new Vector2(x, y); var dialog = new DialogText(generator, layerText, font, sprite, textColor, position, dialogTiming, textFade, FadeIn, FadeOut, fontSize, originCentre); var dialogOne = new DialogBoxes(generator, layerBox, dialogTiming, position); // write sentences foreach (string line in Sentences) { dialog.lines.Add(line); } if (showBox) { dialog.calculateLineWidth(); dialog.calculateLineHeight(); sprite = dialog.Generate(sprite, startTriggerGroup, triggerType, startTrigger, endTrigger, triggerGroup); spriteBox = dialogOne.GenerateBoxes(generator, layerBox, sampleDelay, sampleName, boxColor, dialogTiming, (fontSize * 0.08f) - 1, boxFade, position, pointer, push, originCentre, dialog.GetLineWidth(), dialog.heightSpace(), spriteBox, startTriggerGroup, triggerType, startTrigger, endTrigger, triggerGroup); } else { dialog.calculateLineWidth(); dialog.calculateLineHeight(); sprite = dialog.Generate(sprite, startTriggerGroup, triggerType, startTrigger, endTrigger, triggerGroup); spriteBox = dialogOne.GenerateBoxes(generator, layerBox, sampleDelay, sampleName, boxColor, dialogTiming, (fontSize * 0.08f) - 1, 0f, position, pointer, push, originCentre, dialog.GetLineWidth(), dialog.heightSpace(), spriteBox, startTriggerGroup, triggerType, startTrigger, endTrigger, triggerGroup); } }
/* * /// <summary> * /// Will strip abnormal characters (colors, etc) from the string * /// </summary> * /// <param name="line">line to clean (left intact)</param> * /// <returns>string containing the cleaned line</returns> * private string CleanLine(string line) * { * string cleanedString = line; * byte[] bytearray1252 = System.Text.Encoding.GetEncoding(1252).GetBytes(cleanedString); * int i = 0, len = bytearray1252.Length; * string sEF = "\xFF\x1F\x20\x21\x22\x23\x24\x25\x26\x27\x28\xFF"; * // 1f 20 21 22 23 24 25 26 27 28 * string rep = "<FIAETWLD{}>"; * string s1E = "\x01\x02\x03\xFC\xFD"; * string s1F = "\x0E\x0F\x2F\x7F\x79\x7B\x7C\x8D\x88\x8A\xA1\xD0\r\n\x07"; * string sExtra = "\r\n\x07\x7F\x81\x87"; * System.Collections.Generic.List<Byte> cleaned = new System.Collections.Generic.List<byte>(); * int ndx = -1; * * for (int c = 0; c < len; ++c) * { * * if ((bytearray1252[c] == '\xEF') && (((c + 1) < len) && ((ndx = sEF.IndexOf((char)bytearray1252[c + 1])) >= 0))) * { * // 3C < 3E > * // 7B { 7D } * if (sEF[ndx] != '\x28') // Not closing brace? Needs starter char * cleaned.Add((byte)rep[0]); * cleaned.Add((byte)rep[ndx]); // add rep.char based on Index * if (sEF[ndx] != '\x27') // Not opening brace? Needs closer char * cleaned.Add((byte)rep[rep.Length - 1]); // > Final: <{ and }> for Auto-translate braces ++c; * } * else if ((bytearray1252[c] == '\x1F') && (((c + 1) < len) && s1F.IndexOf((char)bytearray1252[c + 1]) >= 0)) * { ++c; * } * else if ((bytearray1252[c] == '\x1E') && (((c + 1) < len) && s1E.IndexOf((char)bytearray1252[c + 1]) >= 0)) * { ++c; * } * else * { * i = sExtra.IndexOf((char)bytearray1252[c]); * if (i >= 3) // \r\n\07 are singles, others are doubles * { * if (((bytearray1252[c] == '\x7F') && (((c + 1) < len) && bytearray1252[c + 1] == '\x31')) || * ((bytearray1252[c] == '\x81') && (((c + 1) < len) && bytearray1252[c + 1] == '\xA1')) || * ((bytearray1252[c] == '\x87') && (((c + 1) < len) && bytearray1252[c + 1] == '\xB2')) || * ((bytearray1252[c] == '\x87') && (((c + 1) < len) && bytearray1252[c + 1] == '\xB3'))) * { ++c; * } * else * { * i = -1; // not a target, so "wasn't found" * } * } * if (i < 0) * { * cleaned.Add(bytearray1252[c]); * } * } * } * cleaned.Add(0); * if (cleaned[0] != 0) * cleanedString = System.Text.Encoding.GetEncoding(932).GetString(cleaned.ToArray()); * else * cleanedString = String.Empty; * if (cleanedString.StartsWith("[")) // Detect and remove Windower Timestamp plugin text. * { * string text = cleanedString.Substring(1, 8); * string re1 = ".*?"; // Non-greedy match on filler * string re2 = "((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)"; * * Regex r = new Regex(re1 + re2, RegexOptions.IgnoreCase | RegexOptions.Singleline); * Match m = r.Match(text); * if (m.Success) * { * cleanedString = cleanedString.Remove(0, 11); // this assumes timestamp found is only 10+1 space in length * // Better way? : line = line.Remove(0,m.Length+1); * } * } // Detect and remove Windower Timestamp plugin text. * * return cleanedString; * * } // private CleanLine(string line) */ #endregion public DialogText Clone(DialogText dt) { if (dt == null) { return(null); } DialogText ret = new DialogText(String.Empty); ret._Question = dt._Question; System.Collections.Generic.List <String> tmp = new System.Collections.Generic.List <string>(); tmp.AddRange(dt._Options); ret._Options = new string[dt._Options.Length]; for (int i = 0; i < dt._Options.Length; i++) { ret._Options[i] = dt._Options[i]; } return(ret); }
public void Update() { if (isActive) { if (TextTargetPosition) { transform.position = new Vector3(TextTargetPosition.position.x, TextTargetPosition.position.y + heightOffset, TextTargetPosition.position.z); } transform.LookAt(transform.position + (transform.position - Camera.mainCamera.transform.position), Vector3.up); if (!started) { txtMsh.text = StartText; if (Input.GetKeyDown(KeyCode.Mouse0)) { started = true; txtMsh.text = dialog[dialogStep].Text; } } else { if (currentDialog.Timer < 0) { currentDialog.ResetDialog(); if (dialogStep < dialog.Length - 1) { dialogStep++; currentDialog = dialog[dialogStep]; txtMsh.text = dialog[dialogStep].Text; } } else { if (Input.GetKeyDown(KeyCode.Mouse0) && dialogStep == dialog.Length - 1) { Deactivate(); Activate(); } currentDialog.Timer -= Time.deltaTime; } } } }
public void Update() { if (isActive) { if(TextTargetPosition) transform.position = new Vector3(TextTargetPosition.position.x, TextTargetPosition.position.y + heightOffset, TextTargetPosition.position.z); transform.LookAt(transform.position + (transform.position - Camera.mainCamera.transform.position), Vector3.up); if (!started) { txtMsh.text = StartText; if (Input.GetKeyDown(KeyCode.Mouse0)) { started = true; txtMsh.text = dialog[dialogStep].Text; } } else { if (currentDialog.Timer < 0) { currentDialog.ResetDialog(); if (dialogStep < dialog.Length - 1) { dialogStep++; currentDialog = dialog[dialogStep]; txtMsh.text = dialog[dialogStep].Text; } } else { if(Input.GetKeyDown(KeyCode.Mouse0) && dialogStep == dialog.Length - 1) { Deactivate(); Activate(); } currentDialog.Timer -= Time.deltaTime; } } } }
/* /// <summary> /// Will strip abnormal characters (colors, etc) from the string /// </summary> /// <param name="line">line to clean (left intact)</param> /// <returns>string containing the cleaned line</returns> private string CleanLine(string line) { string cleanedString = line; byte[] bytearray1252 = System.Text.Encoding.GetEncoding(1252).GetBytes(cleanedString); int i = 0, len = bytearray1252.Length; string sEF = "\xFF\x1F\x20\x21\x22\x23\x24\x25\x26\x27\x28\xFF"; // 1f 20 21 22 23 24 25 26 27 28 string rep = "<FIAETWLD{}>"; string s1E = "\x01\x02\x03\xFC\xFD"; string s1F = "\x0E\x0F\x2F\x7F\x79\x7B\x7C\x8D\x88\x8A\xA1\xD0\r\n\x07"; string sExtra = "\r\n\x07\x7F\x81\x87"; System.Collections.Generic.List<Byte> cleaned = new System.Collections.Generic.List<byte>(); int ndx = -1; for (int c = 0; c < len; ++c) { if ((bytearray1252[c] == '\xEF') && (((c + 1) < len) && ((ndx = sEF.IndexOf((char)bytearray1252[c + 1])) >= 0))) { // 3C < 3E > // 7B { 7D } if (sEF[ndx] != '\x28') // Not closing brace? Needs starter char cleaned.Add((byte)rep[0]); cleaned.Add((byte)rep[ndx]); // add rep.char based on Index if (sEF[ndx] != '\x27') // Not opening brace? Needs closer char cleaned.Add((byte)rep[rep.Length - 1]); // > Final: <{ and }> for Auto-translate braces ++c; } else if ((bytearray1252[c] == '\x1F') && (((c + 1) < len) && s1F.IndexOf((char)bytearray1252[c + 1]) >= 0)) { ++c; } else if ((bytearray1252[c] == '\x1E') && (((c + 1) < len) && s1E.IndexOf((char)bytearray1252[c + 1]) >= 0)) { ++c; } else { i = sExtra.IndexOf((char)bytearray1252[c]); if (i >= 3) // \r\n\07 are singles, others are doubles { if (((bytearray1252[c] == '\x7F') && (((c + 1) < len) && bytearray1252[c + 1] == '\x31')) || ((bytearray1252[c] == '\x81') && (((c + 1) < len) && bytearray1252[c + 1] == '\xA1')) || ((bytearray1252[c] == '\x87') && (((c + 1) < len) && bytearray1252[c + 1] == '\xB2')) || ((bytearray1252[c] == '\x87') && (((c + 1) < len) && bytearray1252[c + 1] == '\xB3'))) { ++c; } else { i = -1; // not a target, so "wasn't found" } } if (i < 0) { cleaned.Add(bytearray1252[c]); } } } cleaned.Add(0); if (cleaned[0] != 0) cleanedString = System.Text.Encoding.GetEncoding(932).GetString(cleaned.ToArray()); else cleanedString = String.Empty; if (cleanedString.StartsWith("[")) // Detect and remove Windower Timestamp plugin text. { string text = cleanedString.Substring(1, 8); string re1 = ".*?"; // Non-greedy match on filler string re2 = "((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)"; Regex r = new Regex(re1 + re2, RegexOptions.IgnoreCase | RegexOptions.Singleline); Match m = r.Match(text); if (m.Success) { cleanedString = cleanedString.Remove(0, 11); // this assumes timestamp found is only 10+1 space in length // Better way? : line = line.Remove(0,m.Length+1); } } // Detect and remove Windower Timestamp plugin text. return cleanedString; } // private CleanLine(string line) */ #endregion public DialogText Clone (DialogText dt) { if (dt == null) return null; DialogText ret = new DialogText(String.Empty); ret._Question = dt._Question; System.Collections.Generic.List<String> tmp = new System.Collections.Generic.List<string>(); tmp.AddRange(dt._Options); ret._Options = new string[dt._Options.Length]; for (int i = 0; i < dt._Options.Length; i++) { ret._Options[i] = dt._Options[i]; } return ret; }
void Awake() { instance = this; textLabel = GetComponent<Text>(); }