コード例 #1
0
 public void OnExecute(SitcomContext runtime)
 {
     if (mOper != null)
     {
         runtime.Push(mOper);
     }
 }
コード例 #2
0
 public override void OnExecute(SitcomContext runtime)
 {
     if (mContent != null)
     {
         runtime.Push(mContent);
     }
 }
コード例 #3
0
        public ISitcomResult Dom_Unspawn(SitcomContext runtime, SitcomHeap target, string content, object[] args)
        {
            var names = new List <string>();

            if (!StringUtil.ParseArray(content, names, '\n') || names.Count == 0)
            {
                return(new SitcomValue(false));
            }
            if (args != null && args.Length > 0 && args[0] != null)
            {
                var goes = GameObject.FindGameObjectsWithTag(args[0].ToString());
                for (int i = 0; i < goes.Length; i++)
                {
                    if (names.Contains(goes[i].name))
                    {
                        GameObject.Destroy(goes[i]);
                    }
                }
            }
            else
            {
                for (int i = 0; i < names.Count; i++)
                {
                    var go = GameObject.Find(names[i]);
                    if (go != null)
                    {
                        GameObject.Destroy(go);
                    }
                }
            }
            return(new SitcomValue(true));
        }
コード例 #4
0
 public ISitcomResult Dom_Alloc(SitcomContext runtime, SitcomHeap target, string content, object[] args)
 {
     if (args != null && args.Length > 0)
     {
         target.Alloc(args[0].ToString(), content);
     }
     return(new SitcomValue(content));
 }
コード例 #5
0
        public override void OnStop(SitcomContext runtime)
        {
            var ret = mRight != null ? mRight.Result : null;

            if (ret != null && ret.State == ESitcomState.Success && mLeft != null)
            {
                runtime.Push(mLeft);
            }
        }
コード例 #6
0
 public ISitcomResult Dom_Print(SitcomContext runtime, SitcomHeap target, string content, object[] args)
 {
     if (args[0] != null)
     {
         Debug.Log(args[0]);
     }
     if (!string.IsNullOrEmpty(content))
     {
         Debug.Log(content);
     }
     return(new SitcomDelay(args == null || args.Length < 1 ? 1 : SitcomUtil.ParseAsNumber(args[1])));
 }
コード例 #7
0
 public void OnStop(SitcomContext runtime)
 {
     if (!mFinish)
     {
         runtime.Push(this);
     }
     else
     {
         mExecuting = false;
         mFinish    = false;
         mIsReading = false;
         runtime.Heap.EndStack();
     }
 }
コード例 #8
0
 public void OnExecute(SitcomContext runtime)
 {
     if (!mExecuting)
     {
         mExecuting = true;
         mFinish    = false;
         if (!mIsReading)
         {
             BeginRead();
         }
         runtime.Heap.BeginStack();
     }
     if (SelectNextMark() && mCmd.Read(this))
     {
         runtime.Push(mCmd);
     }
     else
     {
         mFinish = true;
     }
 }
コード例 #9
0
 public override void OnExecute(SitcomContext runtime)
 {
     if (mLeft != null)
     {
         runtime.Push(mLeft);
     }
     if (mUseKV)
     {
         for (int i = 0; i < mKVs.Count; i++)
         {
             runtime.Push(mKVs[i].useKey ? mKVs[i].value : mKVs[i].key);
         }
     }
     else
     {
         for (int i = 0; i < mKVs.Count; i++)
         {
             runtime.Push(mKVs[i].key);
         }
     }
 }
コード例 #10
0
        public ISitcomResult Dom_Spawn(SitcomContext runtime, SitcomHeap target, string content, object[] args)
        {
            var names = new List <string>();

            if (!StringUtil.ParseArray(content, names, '\n') || names.Count == 0)
            {
                return(new SitcomValue(false));
            }
            var ret = new SitcomAsyncOperator();

            AssetsUtil.GetAssetAsync <GameObject>(args[0].ToString(), (x) =>
            {
                float f;
                if (args[3] != null)
                {
                    f = SitcomUtil.AsNumber(args[3]);
                }
                else
                {
                    f = 0;
                }
                Vector3 pos   = args[1] == null ? Vector3.zero : StringUtil.ParseVector3(args[1].ToString());
                Vector3 euler = args[2] == null ? Vector3.zero : StringUtil.ParseVector3(args[2].ToString());
                for (int i = 0; i < names.Count; i++)
                {
                    var go  = GameObject.Instantiate(x);
                    go.name = names[i];
                    var rad = Random.insideUnitCircle * f;
                    go.transform.position         = pos + new Vector3(rad.x, 0, rad.y);
                    go.transform.localEulerAngles = euler;
                    ret.Result = go;
                }
                ret.State = ESitcomState.Success;
            }, (error) =>
            {
                ret.Result = error;
                ret.State  = ESitcomState.Failed;
            });
            return(ret);
        }
コード例 #11
0
 public virtual ISitcomResult Sit_ToString(SitcomContext context, T target, string content, object[] args)
 {
     return(new SitcomValue(target.ToString()));
 }
コード例 #12
0
 public ISitcomResult Dom_Deactive(SitcomContext runtime, SitcomHeap target, string content, object[] args)
 {
     return(Dom_SetActive(false, runtime, target, content, args));
 }
コード例 #13
0
 public ISitcomResult Dom_End(SitcomContext runtime, SitcomHeap target, string content, object[] args)
 {
     runtime.SetNextMark(SitcomCmdSequence.EndMarkId);
     return(null);
 }
コード例 #14
0
 public ISitcomResult Dom_Delay(SitcomContext runtime, SitcomHeap target, string content, object[] args)
 {
     return(new SitcomDelay((float)SitcomUtil.ParseAsNumber(args[0])));
 }
コード例 #15
0
 public override void OnExecute(SitcomContext runtime)
 {
     runtime.Push(mLeft);
     runtime.Push(mRight);
 }
コード例 #16
0
 public override void OnStop(SitcomContext runtime)
 {
 }
コード例 #17
0
 public virtual ISitcomResult Sit_HashCode(SitcomContext context, T target, string content, object[] args)
 {
     return(new SitcomValue(target.GetHashCode()));
 }
コード例 #18
0
        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);
        }
コード例 #19
0
 public ISitcomResult Dom_Result(SitcomContext runtime, SitcomHeap target, string content, object[] args)
 {
     return(new SitcomValue(args == null || args.Length < 1 ? content : args[0]));
 }
コード例 #20
0
 public void OnStop(SitcomContext runtime)
 {
 }
コード例 #21
0
 public override void OnStop(SitcomContext runtime)
 {
     throw new SitcomCompileException(keyword);
 }
コード例 #22
0
 public abstract void OnExecute(SitcomContext runtime);
コード例 #23
0
 public abstract void OnStop(SitcomContext runtime);
コード例 #24
0
        public ISitcomResult Call(SitcomContext runtime, object target, string content, object[] args)
        {
            var t = ((SitcomHeap)target).GetValue(id);

            return(domain.Call(runtime, t, content, args));
        }
コード例 #25
0
 public ISitcomResult Call(SitcomContext context, object target, string content, object[] args)
 {
     return(callback(context, (T)target, content, args));
 }