예제 #1
0
 protected override object RunBlock()
 {
     if (base.owningBlock != null)
     {
         if (this.RunAndGetVariable(null) == null)
         {
             return(null);
         }
         return(this.v.GetValue());
     }
     try
     {
         BloxBlock obj   = base.paramBlocks[0];
         object    value = (obj != null) ? obj.Run() : null;
         if (this.RunAndGetVariable(null) == null)
         {
             return(null);
         }
         this.v.SetValue(value);
     }
     catch (Exception e)
     {
         base.LogError("Could not set Variable Value: " + this.varName, e);
     }
     return(null);
 }
예제 #2
0
        protected override object RunBlock()
        {
            object obj   = base.contextBlock.Run();
            Array  array = obj as Array;

            if (array != null)
            {
                BloxBlock obj2  = base.paramBlocks[0];
                object    value = (obj2 != null) ? obj2.Run() : null;
                try
                {
                    Array val = BloxUtil.ArrayAdd(array, value);
                    base.contextBlock.UpdateWith(val);
                }
                catch (Exception ex)
                {
                    base.LogError(ex.Message, null);
                }
            }
            else
            {
                base.LogError("The context must be an Array but was [" + ((obj != null) ? obj.GetType() : null) + "]", null);
            }
            return(null);
        }
예제 #3
0
        protected override object RunBlock()
        {
            BloxContainer bloxContainer = (base.paramBlocks[1] == null) ? base.owningEvent.container : BloxUtil.GetComponent <BloxContainer>(base.paramBlocks[1].Run());

            if ((UnityEngine.Object)bloxContainer == (UnityEngine.Object)null)
            {
                base.LogError("Could not find a Blox Container component on the target GameObject", null);
                return(null);
            }
            string text = (string)base.paramBlocks[0].Run();

            if (string.IsNullOrEmpty(text))
            {
                base.LogError("The target Event name is invalid", null);
                return(null);
            }
            float afterSeconds = (float)((base.paramBlocks[2] == null) ? 0.0 : ((float)base.paramBlocks[2].Run()));

            if (base.paramBlocks.Length > 3)
            {
                BloxEventArg[] array = new BloxEventArg[base.paramBlocks.Length - 3];
                for (int i = 3; i < base.paramBlocks.Length; i++)
                {
                    BloxBlock obj = base.paramBlocks[i];
                    object    val = (obj != null) ? obj.Run() : null;
                    array[i - 3] = new BloxEventArg("param" + (i - 3).ToString(), val);
                }
                bloxContainer.TriggerEvent(text, afterSeconds, array);
            }
            else
            {
                bloxContainer.TriggerEvent(text, afterSeconds);
            }
            return(null);
        }
예제 #4
0
        protected override object RunBlock()
        {
            object obj   = base.contextBlock.Run();
            Array  array = obj as Array;

            if (array != null)
            {
                int num = 0;
                try
                {
                    num = ((base.paramBlocks[0] != null) ? ((int)base.paramBlocks[0].Run()) : 0);
                }
                catch (Exception e)
                {
                    object value = base.paramBlocks[0].Run();
                    object obj2  = null;
                    if (BloxUtil.TryConvert(value, typeof(int), out obj2))
                    {
                        num = (int)obj2;
                        goto end_IL_003d;
                    }
                    base.LogError("The index is invalid. Expected Integer value.", e);
                    return(null);

                    end_IL_003d :;
                }
                if (array.Length == 0)
                {
                    base.LogError("There are no values in the list.", null);
                    return(null);
                }
                if (num >= 0 && num < array.Length)
                {
                    BloxBlock obj3   = base.paramBlocks[1];
                    object    value2 = (obj3 != null) ? obj3.Run() : null;
                    try
                    {
                        array.SetValue(value2, num);
                        base.contextBlock.UpdateWith(array);
                    }
                    catch (Exception ex)
                    {
                        base.LogError(ex.Message, null);
                    }
                    goto IL_0148;
                }
                base.LogError("The index [" + num + "] is out of range. It should be a value between Array Start:[0] and Array Size:[" + array.Length + "]. Remember that arrays start indexing at 0 and not 1.", null);
                return(null);
            }
            base.LogError("The context must be an Array but was [" + ((obj != null) ? obj.GetType() : null) + "]", null);
            goto IL_0148;
IL_0148:
            return(null);
        }
예제 #5
0
        protected override object RunBlock()
        {
            object obj  = base.contextBlock.Run();
            IList  list = obj as IList;

            if (list != null)
            {
                int num = 0;
                try
                {
                    num = ((base.paramBlocks[0] != null) ? ((int)base.paramBlocks[0].Run()) : 0);
                }
                catch (Exception e)
                {
                    object value = base.paramBlocks[0].Run();
                    object obj2  = null;
                    if (BloxUtil.TryConvert(value, typeof(int), out obj2))
                    {
                        num = (int)obj2;
                        goto end_IL_003d;
                    }
                    base.LogError("The index is invalid. Expected Integer value.", e);
                    return(null);

                    end_IL_003d :;
                }
                if (list.Count == 0)
                {
                    base.LogError("There are no values in the list.", null);
                    return(null);
                }
                if (num >= 0 && num < list.Count)
                {
                    BloxBlock obj3   = base.paramBlocks[1];
                    object    value2 = (obj3 != null) ? obj3.Run() : null;
                    try
                    {
                        BloxUtil.ListSet(list, value2, num);
                    }
                    catch (Exception ex)
                    {
                        base.LogError(ex.Message, null);
                    }
                    goto IL_013c;
                }
                base.LogError("The index [" + num + "] is out of range. It should be a value between List Start:[0] and List Size:[" + list.Count + "]. Remember that lists start indexing at 0 and not 1.", null);
                return(null);
            }
            base.LogError("The context must be a List but was [" + ((obj != null) ? obj.GetType() : null) + "]", null);
            goto IL_013c;
IL_013c:
            return(null);
        }
예제 #6
0
        protected override object RunBlock()
        {
            object obj  = base.contextBlock.Run();
            IList  list = obj as IList;

            if (list != null)
            {
                BloxBlock obj2  = base.paramBlocks[0];
                object    value = (obj2 != null) ? obj2.Run() : null;
                return(BloxUtil.ListContains(list, value));
            }
            base.LogError("The context must be a List but was [" + ((obj != null) ? obj.GetType() : null) + "]", null);
            return(false);
        }
예제 #7
0
        protected override object RunBlock()
        {
            object obj   = base.contextBlock.Run();
            Array  array = obj as Array;

            if (array != null)
            {
                BloxBlock obj2  = base.paramBlocks[0];
                object    value = (obj2 != null) ? obj2.Run() : null;
                return(BloxUtil.ArrayContains(array, value));
            }
            base.LogError("The context must be an Array but was [" + ((obj != null) ? obj.GetType() : null) + "]", null);
            return(false);
        }
예제 #8
0
 public IEnumerator RunYield(BloxContainer container)
 {
     if (this.active && this.firstBlock != null)
     {
         this.container = container;
         this.flowSig   = BloxFlowSignal.None;
         BloxBlock b        = this.firstBlock;
         int       deadlock = 0;
         while (true)
         {
             if (b != null)
             {
                 if (b == this.firstBlock)
                 {
                     deadlock++;
                     if (deadlock >= BloxGlobal.Instance.deadlockDetect)
                     {
                         break;
                     }
                 }
                 b.Run();
                 if (this.flowSig == BloxFlowSignal.Wait)
                 {
                     yield return(b.yieldInstruction);
                 }
                 else
                 {
                     if (this.flowSig == BloxFlowSignal.Continue)
                     {
                         this.flowSig = BloxFlowSignal.None;
                         b            = this.firstBlock;
                         continue;
                     }
                     if (this.flowSig == BloxFlowSignal.Break)
                     {
                         yield break;
                     }
                     if (this.flowSig == BloxFlowSignal.Stop)
                     {
                         yield break;
                     }
                 }
                 b = b.next;
                 continue;
             }
             yield break;
         }
         Debug.LogErrorFormat(container.gameObject, "Deadlock detected in Event [{0}:{1}]. Forcing stop.", container.gameObject.name, this.screenName);
     }
 }
예제 #9
0
        private IEnumerator _RunChildBlocksYield()
        {
            this.flowSig = BloxFlowSignal.None;
            BloxBlock b        = this.firstChild;
            int       deadlock = 0;

            while (true)
            {
                if (b != null)
                {
                    if (b == this.firstChild)
                    {
                        deadlock++;
                        if (deadlock >= BloxGlobal.Instance.deadlockDetect)
                        {
                            break;
                        }
                    }
                    b.Run();
                    if (this.flowSig == BloxFlowSignal.Wait)
                    {
                        this.yieldInstruction = b.yieldInstruction;
                        yield return(b.yieldInstruction);
                    }
                    else
                    {
                        if (this.flowSig == BloxFlowSignal.Continue)
                        {
                            yield break;
                        }
                        if (this.flowSig == BloxFlowSignal.Break)
                        {
                            yield break;
                        }
                        if (this.flowSig == BloxFlowSignal.Stop)
                        {
                            yield break;
                        }
                    }
                    b = b.next;
                    continue;
                }
                yield break;
            }
            Debug.LogErrorFormat(this.owningEvent.container.gameObject, "Deadlock detected in Event [{0}:{1}]. Forcing stop.", this.owningEvent.container.gameObject.name, this.owningEvent.screenName);
            this.flowSig = BloxFlowSignal.Break;
        }
예제 #10
0
 public void Run(BloxContainer container)
 {
     if (this.active && this.firstBlock != null)
     {
         this.container = container;
         this.flowSig   = BloxFlowSignal.None;
         BloxBlock next = this.firstBlock;
         int       num  = 0;
         while (true)
         {
             if (next != null)
             {
                 if (next == this.firstBlock)
                 {
                     num++;
                     if (num >= BloxGlobal.Instance.deadlockDetect)
                     {
                         break;
                     }
                 }
                 next.Run();
                 if (this.flowSig == BloxFlowSignal.Continue)
                 {
                     this.flowSig = BloxFlowSignal.None;
                     next         = this.firstBlock;
                 }
                 else
                 {
                     if (this.flowSig == BloxFlowSignal.Break)
                     {
                         return;
                     }
                     if (this.flowSig == BloxFlowSignal.Stop)
                     {
                         return;
                     }
                     next = next.next;
                 }
                 continue;
             }
             return;
         }
         Debug.LogErrorFormat(container.gameObject, "Deadlock detected in Event [{0}:{1}]. Forcing stop.", container.gameObject.name, this.screenName);
     }
 }
예제 #11
0
        private void _RunChildBlocks()
        {
            BloxBlock bloxBlock = this.firstChild;
            int       num       = 0;

            while (true)
            {
                if (bloxBlock != null)
                {
                    if (bloxBlock == this.firstChild)
                    {
                        num++;
                        if (num >= BloxGlobal.Instance.deadlockDetect)
                        {
                            break;
                        }
                    }
                    bloxBlock.Run();
                    if (this.flowSig == BloxFlowSignal.Continue)
                    {
                        return;
                    }
                    if (this.flowSig == BloxFlowSignal.Break)
                    {
                        return;
                    }
                    if (this.flowSig == BloxFlowSignal.Stop)
                    {
                        return;
                    }
                    bloxBlock = bloxBlock.next;
                    continue;
                }
                return;
            }
            Debug.LogErrorFormat(this.owningEvent.container.gameObject, "Deadlock detected in Event [{0}:{1}]. Forcing stop.", this.owningEvent.container.gameObject.name, this.owningEvent.screenName);
            this.flowSig = BloxFlowSignal.Break;
        }
예제 #12
0
        protected override object RunBlock()
        {
            object obj  = base.contextBlock.Run();
            IList  list = obj as IList;

            if (list != null)
            {
                BloxBlock obj2  = base.paramBlocks[0];
                object    value = (obj2 != null) ? obj2.Run() : null;
                try
                {
                    BloxUtil.ListAdd(list, value);
                }
                catch (Exception ex)
                {
                    base.LogError(ex.Message, null);
                }
            }
            else
            {
                base.LogError("The context must be a List but was [" + ((obj != null) ? obj.GetType() : null) + "]", null);
            }
            return(null);
        }