// Tests novel bookmarks static async Task ViewNovelText() { Console.Write("Please enter the ID of the novel to view\n> "); NovelText noveltext = await Client.ViewNovelTextAsync(Console.ReadLine()); Console.WriteLine("-------------------------------------------------------------------------------"); Console.WriteLine(noveltext.Content); Console.WriteLine("-------------------------------------------------------------------------------"); }
public void SetVerticesOnlyDirty() { ChagneType last = CurrentChangeType; NovelText.SetVerticesDirty(); if (last != ChagneType.All) { CurrentChangeType = ChagneType.VertexOnly; } }
public NovelText Say(params string[] str) { var textScene = Game.Scene as TextScene; var action = new NovelText { Text = str, Character = this }; textScene.NovelInfo.Add(action); return(action); }
public override void HtmlCapture(string webHtml) { var text = ToTraditional(webHtml); text = Regex.Replace(text, "(<!D).+?(<div id=\"contentmain)", "<"); //文庫去頭 text = Regex.Replace(text, "(</ul></div>).+?(html>)", "</ul>"); //文庫去尾 text = Regex.Replace(text, " ", "-空白-"); text = Regex.Replace(text, "<ul id=\"contentdp\">", "-換行-"); text = Regex.Replace(text, "<br />", "-換行-"); text = Regex.Replace(text, "(<ul).+?(</ul>)", string.Empty); //細切 text = Regex.Replace(text, "<.+?>", " "); //去除其餘tag text = Regex.Replace(text, "-空白-", " "); text = Regex.Replace(text, "-換行-", "<br />"); NovelText.Add(text); }
//頂点情報を作成 void LateUpdate() { //文字送りなどは、頂点のみ作り直せばいいので //少し複雑だけど、こうする bool changed = HasChanged; if (HasChangedLitte) { NovelText.SetVerticesDirty(); } if (changed) { ClearGraphicObjectList(); Refresh(); } HasChangedLitte = false; HasChanged = false; //絵文字など子オブジェクトとして表示するグラフィックを更新 UpdateGraphicObjectList(lineDataList); }
public override void HtmlCapture(string webHtml) { string str = webHtml; string line = ""; str = Regex.Replace(str, "(<!D).+?(<!-- END -->)", string.Empty); //卡提諾第一頁 切頭 str = Regex.Replace(str, "(<td class=\"t_f).+?(\">)", "--頭--頭--"); //卡提諾每章節開頭tag str = Regex.Replace(str, "</td></tr>", "~尾~~--"); //卡提諾每章節結尾tag str = "~--" + str + "--頭-"; //添加頭尾tag str = Regex.Replace(str, "(~--).+?(--頭-)", "\n\n"); //切除尾~頭之間的所有內容 //str = Regex.Replace(str, " ", " "); MatchCollection matches = Regex.Matches(str, "(?<=-頭--).+?(?=~尾~)", RegexOptions.IgnoreCase | RegexOptions.Multiline); foreach (Match match in matches) { line = Regex.Replace(match.Value, "<br />", "-換行-"); line = Regex.Replace(line, "<.+?>", " "); line = Regex.Replace(line, "-換行-", "<br />"); NovelText.Add(line); } }
/* * 小説のダウンロードを行う。 * * * */ public void DownloadNovel() { var urls = getNovelUrl(); var text = new List <string>(); var title = new List <string>(); foreach (string url in urls) { string html = getHtml(url); text.Add(analysisHtml(html)); if (Juge) { title.Add(analysisHtmTitlel(html)); } } NovelText.Add(Ncode, text); if (Juge) { Title.Add(Ncode, title); } return; }
void SetAllDirty() { NovelText.SetAllDirty(); }
void Advance(bool doNotIncrement = false) { //Debug.Log("advance:"+doNotIncrement); lastToken = currentBranch.frames[currentFrame].token; if (!doNotIncrement) { currentFrame++; } if (currentFrame >= currentBranch.frames.Count) { running = false; characterGraphic.gameObject.SetActive(false); if (callBack != null) { callBack.Invoke(); } return; } NovelFrame frame = currentBranch.frames[currentFrame]; switch (frame.token) { case Tokens.background: { title.text = string.Empty; message.text = string.Empty; background.sprite = marshal.Background((string)frame.payload); StartTimer(); } break; case Tokens.monologue: { title.text = "monologue"; message.text = (string)frame.payload; state = RunnerStates.waitOnInput; } break; case Tokens.character: { NovelCharacter character = ((NovelCharacter)frame); if (character.name != "You" && character.name != "player") { characterGraphic.gameObject.SetActive(true); characterGraphic.sprite = marshal.Character(character.name, null); characterGraphic.rectTransform.sizeDelta = Scale(characterGraphic.sprite.rect.size.y, 1080, characterGraphic.sprite.rect.size); } title.text = ((NovelCharacter)frame).name; message.text = string.Empty; state = RunnerStates.waitOnTimer; } break; case Tokens.expression: { NovelExpression expression = ((NovelExpression)frame); if (expression.character != "You" && expression.character != "player") { characterGraphic.gameObject.SetActive(true); characterGraphic.sprite = marshal.Character(expression.character, (string)expression.payload); characterGraphic.rectTransform.sizeDelta = Scale(characterGraphic.sprite.rect.size.y, 1080, characterGraphic.sprite.rect.size); } title.text = ((NovelExpression)frame).character; StartTimer(); } break; case Tokens.line: { if (lastToken == Tokens.character || lastToken == Tokens.expression || lastToken == Tokens.line) { /* Do Nothing */ } else { title.text = ((NovelExpression)frame).character + " " + ((NovelExpression)frame).payload; } message.text = (string)frame.payload; state = RunnerStates.waitOnInput; } break; case Tokens.hidecharacter: { characterGraphic.gameObject.SetActive(false); StartTimer(); } break; case Tokens.directive: { marshal.ExecuteProcedure((string)frame.payload); state = RunnerStates.waitOnTimer; StartTimer(); } break; case Tokens.jump: { StartTimer(); Jump((string)frame.payload); } break; case Tokens.TEXT: { NovelText text = (NovelText)frame; state = RunnerStates.waitOnInput; phone.PostTextMessage(text.character == "You", text.character, text.line); } break; case Tokens.options: { novelAssembly.SetActive(true); state = RunnerStates.waitOnChoice; NovelOptions options = (NovelOptions)frame; normalDisplay.SetActive(false); optionDisplay.SetActive(true); Transform[] old = optionContent.GetComponentsInChildren <Transform>(); Debug.Log(old.Length); foreach (Transform go in old) { if (go == optionContent.transform) { continue; } go.transform.parent = null; GameObject.Destroy(go.gameObject); } foreach (NovelOption option in options.options) { GameObject g = GameObject.Instantiate(providedButton, optionContent.transform.position, optionContent.transform.rotation, optionContent.transform); g.GetComponentInChildren <Text>().text = (string)option.payload; g.GetComponent <Button>().onClick.AddListener( () => { Jump(option.target); EndOptions(); } /// CLOSURE! to the rescue!! ); } } break; default: { throw new System.Exception("Unexpected token " + frame.token + " in switch statement."); } } }