public virtual void Dispose() { IsComplete = false; mFile = null; mHeap = null; mResult = null; }
protected virtual void OnStop() { mExecs.Clear(); mStack.Clear(); mFileStack.Clear(); mResult = null; mTask = null; Heap.ResetStack(); mFile.SetNextMark(0); IsComplete = true; }
public virtual void Update(float deltaTime) { if (IsComplete) { return; } if (mTask != null) { mTask.Update(deltaTime); } if (mResult != null && mResult.State == ESitcomState.Doing) { return; } while (mExecs.Count > 0 || mStack.Count > 0) { while (mExecs.Count > 0) { var t = mExecs.Dequeue(); t.OnExecute(this); if (t is SitcomCmdSequence) { mFileStack.Add(t as SitcomCmdSequence); } mStack.Push(t); } if (mStack.Count > 0) { var t = mStack.Pop(); t.OnStop(this); if (t is SitcomCmdSequence) { mFileStack.Remove(t as SitcomCmdSequence); } mResult = t.Result; if (mResult != null && mResult.State == ESitcomState.Doing) { mTask = mResult as ISitcomTask; return; } mTask = null; } } OnStop(); }
public override void OnStop(SitcomContext runtime) { object target; if (mLeft == null) { target = runtime.Heap; } else if (mLeft.Result != null) { target = mLeft.Result.Result; } else { target = null; } if (target == null) { throw new SitcomNullReferenceExpception(keyword); } var meta = runtime.Heap.GetMeta(target.GetType()); if (!mWaitContent) { mResult = new SitcomValue(meta.GetProperty(mRight.id, target)); return; } var domain = meta.GetDomain(mRight.id); if (domain == null) { throw new SitcomNullReferenceExpception(keyword); } object[] args; if (domain.ArgLength > 0) { args = new object[domain.ArgLength]; } else { args = new object[mKVs.Count]; } if (mUseKV) { for (int i = 0; i < mKVs.Count; i++) { var index = mKVs[i].useKey ? domain.ArgIndex(mKVs[i].key.keyword.id) : i; if (index >= 0 && index < args.Length) { args[index] = mKVs[i].GetValue(); } } } else { var len = Mathf.Min(args.Length, mKVs.Count); for (int i = 0; i < len; i++) { var ret = mKVs[i].key.Result; args[i] = ret.Result; } } mResult = domain.Call(runtime, target, mContent.text, args); }