コード例 #1
0
ファイル: StackMachine.cs プロジェクト: rinkako/ProjectYuri
 /// <summary>
 /// 向栈机提交一个等待动画完成的调用
 /// </summary>
 /// <param name="causeBy">原因</param>
 public void Submit(string causeBy)
 {
     StackMachineFrame smf = new StackMachineFrame()
     {
         State = StackMachineState.WaitAnimation,
         ScriptName = null,
         PC = 0,
         IP = null,
         Argv = null,
         BindingFunctionName = null,
         BindingSceneName = null,
         Delay = TimeSpan.FromMilliseconds(0),
         Tag = String.Format("WaitingAnimationFor:{0}", causeBy)
     };
     this.coreStack.Push(smf);
 }
コード例 #2
0
ファイル: StackMachine.cs プロジェクト: rinkako/ProjectYuri
 /// <summary>
 /// 向栈机提交一个栈帧
 /// </summary>
 /// <param name="mySMF">自定义栈帧</param>
 public void Submit(StackMachineFrame mySMF)
 {
     this.coreStack.Push(mySMF);
 }
コード例 #3
0
ファイル: StackMachine.cs プロジェクト: rinkako/ProjectYuri
 /// <summary>
 /// 向栈机提交一个延时调用
 /// </summary>
 /// <param name="causeBy">发起延时的SA名</param>
 /// <param name="begin">开始计时的时刻</param>
 /// <param name="sleepTimeSpan">延时时间间隔</param>
 public void Submit(string causeBy, DateTime begin, TimeSpan sleepTimeSpan)
 {
     StackMachineFrame smf = new StackMachineFrame()
     {
         State = StackMachineState.Await,
         ScriptName = null,
         PC = 0,
         IP = null,
         Argv = null,
         BindingFunctionName = null,
         BindingSceneName = null,
         TimeStamp = begin,
         Delay = sleepTimeSpan,
         Tag = String.Format("ThreadSleepCausedBy:{0}({1} ms)", causeBy, sleepTimeSpan.Milliseconds)
     };
     this.coreStack.Push(smf);
 }
コード例 #4
0
ファイル: StackMachine.cs プロジェクト: rinkako/ProjectYuri
 /// <summary>
 /// 向栈机提交一个中断调用
 /// </summary>
 /// <param name="ntr">中断</param>
 public void Submit(Interrupt ntr)
 {
     StackMachineFrame smf = new StackMachineFrame()
     {
         State = StackMachineState.Interrupt,
         ScriptName = null,
         PC = 0,
         IP = ntr.interruptSA,
         Argv = null,
         BindingFunctionName = null,
         BindingSceneName = null,
         Delay = TimeSpan.FromMilliseconds(0),
         Tag = ntr.returnTarget,
         BindingInterrupt = ntr
     };
     this.coreStack.Push(smf);
 }
コード例 #5
0
ファイル: StackMachine.cs プロジェクト: rinkako/ProjectYuri
 /// <summary>
 /// 向栈机提交一个函数调用
 /// </summary>
 /// <param name="sf">被调用函数的SceneFuction实例</param>
 /// <param name="args">实参数列表</param>
 /// <param name="offset">PC偏移量</param>
 public void Submit(SceneFunction sf, List<object> args, int offset = 0)
 {
     // 处理形参顺序
     string argc = String.Empty;
     foreach (var arg in sf.Param)
     {
         argc += "," + arg;
     }
     if (argc.Length > 0)
     {
         argc = argc.Substring(1);
     }
     StackMachineFrame smf = new StackMachineFrame()
     {
         State = StackMachineState.FunctionCalling,
         ScriptName = sf.Callname,
         PC = offset,
         IP = sf.Sa,
         BindingFunction = sf,
         Argv = args,
         BindingFunctionName = String.Format("{0}?{1}", sf.GlobalName, this.coreStack.Count.ToString()),
         BindingSceneName = sf.ParentSceneName,
         Delay = TimeSpan.FromMilliseconds(0),
         Tag = argc
     };
     this.coreStack.Push(smf);
     this.EBP = this.coreStack.Peek();
 }
コード例 #6
0
ファイル: StackMachine.cs プロジェクト: rinkako/ProjectYuri
 /// <summary>
 /// 向栈机提交一个场景调用
 /// </summary>
 /// <param name="sc">被调用的场景Scene实例</param>
 /// <param name="offset">IP偏移</param>
 public void Submit(Scene sc, SceneAction offset = null)
 {
     StackMachineFrame smf = new StackMachineFrame()
     {
         State = StackMachineState.Interpreting,
         ScriptName = sc.Scenario,
         PC = 0,
         IP = offset == null ? sc.Ctor : offset,
         Argv = null,
         BindingSceneName = sc.Scenario,
         BindingFunctionName = null,
         Delay = TimeSpan.FromMilliseconds(0),
         Tag = ""
     };
     this.coreStack.Push(smf);
     this.EBP = this.SAVEP = this.coreStack.Peek();
 }
コード例 #7
0
ファイル: StackMachine.cs プロジェクト: rinkako/ProjectYuri
 /// <summary>
 /// 将调用栈栈顶取出
 /// </summary>
 /// <returns>调用栈帧</returns>
 public StackMachineFrame Consume()
 {
     if (this.ESP.State == StackMachineState.Interpreting)
     {
         this.SAVEP = null;
     }
     return this.coreStack.Pop();
 }