Example #1
0
        public TextPiece t(string dialog, string name, string voice, string avatar, int model, Action action)
        {
            TextPiece tp = new TextPiece(id++, msgpanel, dialog, name, avatar, voice, model);

            tp.RunAction(action);
            return(tp);
        }
Example #2
0
        /// <summary>
        /// 生成一个带有简单逻辑的文字段
        /// </summary>
        /// <param name="dialog">正文</param>
        /// <param name="name">角色名字</param>
        /// <param name="voice">对话内容</param>
        /// <param name="avatar">头像图片名</param>
        /// <param name="model">l2d模型</param>
        /// <param name="simpleLogic">简单逻辑跳转,是一个返回int值的lambda表达式</param>
        public TextPiece t(string dialog, string name, string voice, string avatar, int model, Func <int> simpleLogic)
        {
            TextPiece tp = new TextPiece(id++, msgpanel, dialog, name, avatar, voice, model);

            tp.RunSimpleLogic(dm, simpleLogic);
            return(tp);
        }
Example #3
0
        /// <summary>
        /// 生成一个带有复杂跳转的文字段
        /// </summary>
        /// <param name="dialog">正文</param>
        /// <param name="name">角色名字</param>
        /// <param name="voice">对话内容</param>
        /// <param name="avatar">头像图片名</param>
        /// <param name="model">l2d模型</param>
        /// <param name="complexLogic">复杂逻辑跳转,是一个形如(Hashtabel gVars, Hashtable lVars)=> {return ... }的lambda表达式</param>
        public TextPiece t(string dialog, string name, string voice, string avatar, int model, Func <DataManager, int> complexLogic)
        {
            TextPiece tp = new TextPiece(id++, msgpanel, dialog, name, avatar, voice, model);

            tp.RunComplexLogic(dm, complexLogic);
            return(tp);
        }
Example #4
0
        /// <summary>
        /// 换行
        /// </summary>
        public TextPiece r()
        {
            TextPiece tp = new TextPiece(id++, msgpanel);

            tp.SetLineFeed();
            return(tp);
        }
Example #5
0
        /// <summary>
        /// 生成一个页面文字块
        /// </summary>
        /// <param name="dialog">正文</param>
        /// <param name="voice">语音文件</param>
        public TextPiece l(string dialog, string voice = "", int model = -1)
        {
            TextPiece tp = new TextPiece(id++, msgpanel, dialog, "", "", voice, model);

            tp.SetPageLine();
            return(tp);
        }
        public override string ToString()
        {
            string str = "";

            foreach (Piece p in pieces)
            {
                TextPiece tp = p as TextPiece;
                if (tp != null)
                {
                    str += tp.ToString();
                }
            }
            return(base.ToString() + str);
        }
Example #7
0
        /// <summary>
        /// 清空页面
        /// </summary>
        public TextPiece p()
        {
            TextPiece tp = new TextPiece(id++, msgpanel);

            return(tp);
        }
 public override void Update()
 {
     if (manager.isEffecting)
     {
         Debug.Log("Effects Running, Ignore Piece Update Event!");
         return;
     }
     if (pieces != null && current >= 0 && current < pieces.Count)
     {
         if (pieces[current].GetType() == typeof(EffectPiece))
         {
             //图像效果处理块
             manager.isEffecting = true;
             EffectPiece ep = (EffectPiece)pieces[current];
             ep.ExecAuto(new Action(() => {
                 manager.isEffecting = false; current = ep.Next(); Update();
             }));
         }
         else if (pieces[current].GetType() == typeof(SoundPiece))
         {
             //声音处理块
             manager.isEffecting = true;
             SoundPiece sp = (SoundPiece)pieces[current];
             sp.ExecAuto(new Action(() => { manager.isEffecting = false; current = sp.Next(); Update(); }));
         }
         else if (pieces[current].GetType() == typeof(ChapterNamePiece))
         {
             //章节名显示模块
             ChapterNamePiece cnp = (ChapterNamePiece)pieces[current];
             cnp.Exec();
             current = cnp.Next();
             Update();
         }
         //else if( pieces[current].GetType() == typeof(EviGetPiece))
         //{
         //    //证据显示处理块
         //    manager.BlockRightClick();
         //    EviGetPiece ev = (EviGetPiece)pieces[current];
         //    ev.Exec();
         //    if (ev.finished)
         //    {
         //        current = ev.Next();
         //        manager.UnblockRightClick();
         //        Update();
         //    }
         //}
         //else if (pieces[current].GetType() == typeof(HPPiece))
         //{
         //    //扣血模块
         //    manager.BlockRightClick();
         //    HPPiece hp = (HPPiece)pieces[current];
         //    hp.Exec();
         //    if (hp.finished)
         //    {
         //        current = hp.Next();
         //        manager.UnblockRightClick();
         //        Update();
         //    }
         //}
         else if (pieces[current].GetType() == typeof(DiaboxPiece))
         {
             //对话框控制模块
             manager.isEffecting = true;
             manager.BlockRightClick();
             DiaboxPiece dp = (DiaboxPiece)pieces[current];
             dp.ExecAuto(() => {
                 manager.isEffecting = false;
                 manager.UnblockRightClick();
                 current = dp.Next();
                 Update();
             });
         }
         //else if (pieces[current].GetType() == typeof(InputPiece))
         //{
         //    //姓名输入模块
         //    manager.isEffecting = true;
         //    manager.BlockRightClick();
         //    InputPiece ip = (InputPiece)pieces[current];
         //    ip.ExecAuto(new Action(() => { manager.isEffecting = false; manager.UnblockRightClick(); Update(); }));
         //    current = ip.Next();
         //}
         else if (pieces[current].GetType() == typeof(TimeSwitchPiece))
         {
             //地点转换模块
             manager.BlockRightClick();
             TimeSwitchPiece tsp = (TimeSwitchPiece)pieces[current];
             if (tsp.finished)
             {
                 tsp.ExecAuto(() => {
                     current = tsp.Next();
                     manager.UnblockRightClick();
                     Update();
                 });
             }
             else
             {
                 tsp.Exec();
             }
         }
         else
         {
             //文字块需等待点击
             TextPiece t = (TextPiece)pieces[current];
             if (t.finish)
             {
                 //t.Clear(); 交给textpiece内部处理
                 current = t.Next();
                 Update();
             }
             else
             {
                 //Debug.Log("文字块启用");
                 t.ExecAuto(() => { Update(); });
                 //t.Exec();
             }
         }
     }
     else
     {
         //Debug.Log(string.Format("Piece:{0}/{1}", current, pieces.Count()));
         end = true;
     }
 }