Exemple #1
0
        protected override IEnumerator Execute(Block block)
        {
            CustomEnumerator ctor = CSharp.Interpreter.ValueReturn(block, "TEXT", new DataStruct(""));

            yield return(ctor);

            DataStruct input = ctor.Data;

            //todo: 暂时用Debug.Log,后面根据UI输出框再定
            UnityEngine.Debug.Log("c# print: " + input.ToString());
        }
        protected override IEnumerator Execute(Block block)
        {
            CustomEnumerator ctor = CSharp.Interpreter.ValueReturn(block, "AMOUNT", new DataStruct(0));

            yield return(ctor);

            DataStruct arg0 = ctor.Data;

            string rot = block.GetFieldValue("ROTATION");

            string msg = arg0.ToString() + " " + rot;

            MessageManager.Instance.SendMessage(msg, MSG_TYPE.ROTATE_LASER);

            yield return(new WaitForSeconds(Times.instructionWaitTime));
        }
        protected override IEnumerator Execute(Block block)
        {
            CustomEnumerator ctor = CSharp.Interpreter.ValueReturn(block, "ACTIVE", new DataStruct(0));

            yield return(ctor);

            DataStruct arg0 = ctor.Data;

            ctor = CSharp.Interpreter.ValueReturn(block, "NAME", new DataStruct(0));
            yield return(ctor);

            DataStruct arg1 = ctor.Data;

            string msg = arg1.ToString() + " " + arg0.ToString();

            MessageManager.Instance.SendMessage(msg, MSG_TYPE.ACTIVATE_DOOR);

            yield return(new WaitForSeconds(Times.instructionWaitTime));
        }
Exemple #4
0
        public static ArrayList ConvertString(this ArrayList list)
        {
            bool hasString = false;
            int  index     = 0;

            for (int i = 0; i < list.Count; i++)
            {
                DataStruct ds = (DataStruct)list[i];
                if (!hasString)
                {
                    if (ds.IsString)
                    {
                        hasString = true;
                        index     = i;
                    }
                }
                else
                {
                    if (!ds.IsString)
                    {
                        list[i] = new DataStruct(ds.ToString());
                    }
                }
            }
            if (!hasString)
            {
                return(list);
            }
            else
            {
                for (int i = 0; i < index; i++)
                {
                    list[i] = new DataStruct(((DataStruct)list[i]).ToString());
                }
                return(list);
            }
        }