コード例 #1
0
ファイル: LineReader.cs プロジェクト: weimingtom/erica
 /// <summary>
 /// コンストラクター
 /// </summary>
 /// <remarks>
 /// ノードのバウンディング ボックスは書き換えません。
 /// </remarks>
 /// <param name="width">表示領域の横幅(ピクセル数)</param>
 /// <param name="height">表示領域の縦幅(ピクセル数)</param>
 public LineReader(int width, int height)
 {
     this.lines = new List<Line> ();
     this.index = 0;
     this.width = width;
     this.height = height;
     this.charSize = 24;
     this.color = new Color (255, 255, 255, 255);
     this.feedMode = FeedMode.Manual;
     this.feedParams = new FeedParameters (0, 0);
     this.tick = null;
     this.tack = null;
     this.tackWait = null;
 }
コード例 #2
0
ファイル: LineReader.cs プロジェクト: weimingtom/erica
        private void RecreateTimeCounter()
        {
            if (LineCount == 0) {
                return;
            }
            if (tick != null) {
                this.tick.Close ();
            }
            if (tack != null) {
                this.tack.Close ();
            }
            if (tackWait != null) {
                this.tackWait.Close ();
            }

            var wordCount = lines[index].Words.Length;
            var charWait = feedParams.TimeAfterOneCharacter;
            var lineWait = feedParams.TimeAfterOneSentense;

            this.tick = new TimeCounter (wordCount, charWait);                         // 1文字終わり
            this.tack = new TimeCounter (1, wordCount * charWait + 1);                 // 1行終わり
            this.tackWait = new TimeCounter (1, wordCount * charWait + lineWait + 1);  // 1行終わり + 自動送り用のウェイト

            tick.Elapsed += () => {
                if (Ticked != null) {
                    Ticked.Invoke (lines[index], null);
                }
            };
            tack.Elapsed += () => {
                if (Tacked != null) {
                    Tacked.Invoke (lines[index], null);
                }
            };

            tick.Start ();
            tack.Start ();
            tackWait.Start ();
        }