示例#1
0
 public override bool NextScript(String mes)
 {
     // 自定义命令(有些自定义命令为了突出写成了中文,实际不推荐)
     if (roleName != null)
     {
         if ("noname".Equals(mes, StringComparison.InvariantCultureIgnoreCase))
         {
             roleName.SetVisible(false);
         }
         else if ("name0".Equals(mes, StringComparison.InvariantCultureIgnoreCase))
         {
             roleName.SetVisible(true);
             roleName.SetBackground("assets/name0.png");
             roleName.SetLocation(5, 15);
         }
         else if ("name1".Equals(mes, StringComparison.InvariantCultureIgnoreCase))
         {
             roleName.SetVisible(true);
             roleName.SetBackground("assets/name1.png");
             roleName.SetLocation(GetWidth() - roleName.GetWidth() - 5, 15);
         }
     }
     if ((flag + "星星").Equals(mes, StringComparison.InvariantCultureIgnoreCase))
     {
         // 添加脚本事件标记(需要点击后执行)
         SetScrFlag(true);
         type = 1;
         return(false);
     }
     else if ((flag + "去死吧,星星").Equals(mes, StringComparison.InvariantCultureIgnoreCase))
     {
         type = 0;
     }
     else if ((flag + "关于天才").Equals(mes, StringComparison.InvariantCultureIgnoreCase))
     {
         message.SetVisible(false);
         SetScrFlag(true);
         // 强行锁定脚本
         SetLocked(true);
         yes       = new LButton("assets/dialog_yes.png", 112, 33);
         yes.Tag   = this;
         yes.Click = new YesClick();
         CenterOn(yes);
         Add(yes);
         return(false);
     }
     return(true);
 }
示例#2
0
        public override void Alter(LTimerContext t)
        {
            if (IsWait())
            {
                return;
            }
            if (timer1 == null)
            {
                timer1 = new LTimer(50);
            }
            if (title != null && timer1.Action(t.GetTimeSinceLastUpdate()))
            {
                if (title.GetY() > 50)
                {
                    title.Move_up(8);
                    title.ValidatePosition();
                }
                else if (title.GetAlpha() > 0.2f)
                {
                    title.SetAlpha(title.GetAlpha() - 0.1f);
                }
                else
                {
                    title.SetVisible(false);
                    Remove(title);
                    title = null;
                }
                return;
            }
            else if (over != null && timer1.Action(t.GetTimeSinceLastUpdate()) &&
                     !overFlag)
            {
                if (over.GetY() < (GetHeight() - over.GetHeight()) / 2)
                {
                    over.Move_down(8);
                    over.ValidatePosition();
                }
                else if (over.GetAlpha() < 1.0f)
                {
                    over.SetAlpha(over.GetAlpha() + 0.1f);
                }
                else
                {
                    CenterOn(over);
                    overFlag = true;
                }

                return;
            }
            if (!wingame)
            {
                if (timer == null)
                {
                    timer = new LTimer(100);
                }
                if (timer.Action(t.GetTimeSinceLastUpdate()))
                {
                    if (progress != null)
                    {
                        progress.SetUpdate(progress.GetValue() - (stageNo * 30));
                        if (progress.GetValue() <= 100 && !failgame)
                        {
                            failgame = true;
                            GetSprites().SetVisible(false);

                            over       = new LPaper(GetImage(16), 0, 0);
                            over.Click = new OverClick();
                            over.SetAlpha(0.1f);
                            CenterOn(over);
                            over.SetY(0);
                            Add(over);
                        }
                    }
                }
            }
            else
            {
                wingame = false;
                RemoveAll();
                Stage(stageNo + 1);
            }
        }