Esempio n. 1
0
 public void Init(BloxContainer container)
 {
     if (!this.inited && this.active)
     {
         this.inited    = true;
         this.container = container;
         for (BloxBlock next = this.firstBlock; next != null; next = next.next)
         {
             next.owningEvent = this;
             if (next.next != null)
             {
                 next.next.prevBlock = next;
             }
             next.Init();
             if (next.selfOrChildCanYield)
             {
                 if (this.yieldAllowed)
                 {
                     this.canYield = true;
                 }
                 else
                 {
                     Debug.LogWarningFormat("You should not use Flow Blocks related to Waiting in this Event [{0}]. The Wait Block will be ignored.", this.ident);
                 }
             }
         }
     }
 }
Esempio n. 2
0
        public BloxEvent Init(BloxContainer container, Blox blox)
        {
            Debug.Log("Init", "BloxEvent", Color.yellow);
            if (!this.active)
            {
                return(null);
            }
            BloxEvent bloxEvent = new BloxEvent();

            bloxEvent.ident           = this.ident;
            bloxEvent.screenName      = this.screenName;
            bloxEvent.active          = this.active;
            bloxEvent.yieldAllowed    = this.yieldAllowed;
            bloxEvent.container       = container;
            bloxEvent.data            = this.data;
            bloxEvent.storedBlocksIdx = this.storedBlocksIdx;
            bloxEvent.Deserialize(blox);
            bloxEvent.data            = null;
            bloxEvent.storedBlocksIdx = null;
            for (BloxBlock next = bloxEvent.firstBlock; next != null; next = next.next)
            {
                next.owningEvent = bloxEvent;
                if (next.next != null)
                {
                    next.next.prevBlock = next;
                }
                next.Init();
                if (next.selfOrChildCanYield)
                {
                    if (bloxEvent.yieldAllowed)
                    {
                        bloxEvent.canYield = true;
                    }
                    else
                    {
                        Debug.LogWarningFormat("You should not use Flow Blocks related to Waiting in this Event [{0}]. The Wait Block will be ignored.", this.ident);
                    }
                }
            }
            return(bloxEvent);
        }
Esempio n. 3
0
 public void Init()
 {
     if (this.active)
     {
         if (this.blockType == BloxBlockType.Unknown || (this.mi != null && !this.mi.IsValid))
         {
             this.isValid = false;
         }
         else
         {
             if (this.returnValue == null && this.returnType != null && this.returnType != typeof(void))
             {
                 this.returnValue = BloxMemberInfo.GetDefaultValue(this.returnType);
             }
             if (this.owningBlock != null && this.mi != null && (this.mi.MemberType == MemberTypes.Field || this.mi.MemberType == MemberTypes.Property))
             {
                 this.paramBlocks = null;
             }
             BloxMemberInfo obj = this.mi;
             this.contextType = ((obj != null) ? obj.ReflectedType : null);
             if (this.contextBlock != null)
             {
                 this.contextBlock.owningEvent = this.owningEvent;
                 this.contextBlock.owningBlock = this;
                 this.contextBlock.Init();
             }
             BloxMemberInfo  obj2  = this.mi;
             ParameterInfo[] array = (obj2 != null) ? obj2.GetParameters() : null;
             if (((array != null) ? array.Length : 0) != 0)
             {
                 this.paramTypes = new Type[array.Length];
                 for (int i = 0; i < this.paramTypes.Length; i++)
                 {
                     this.paramTypes[i] = array[i].ParameterType;
                     if (this.paramTypes[i].IsByRef)
                     {
                         this.hasReferenceTypes = true;
                         if (this.paramBlocks != null && this.paramBlocks.Length >= i && this.paramBlocks[i] != null && this.paramBlocks[i].GetType() == typeof(Variable_Block))
                         {
                             break;
                         }
                         this.LogError("The Block field [" + array[i].Name + "] expected a Variable Block.", null);
                         return;
                     }
                 }
             }
             else if (this.mi != null && (this.mi.MemberType == MemberTypes.Field || this.mi.MemberType == MemberTypes.Property))
             {
                 this.paramTypes = new Type[1]
                 {
                     this.mi.ReturnType
                 };
             }
             if (((this.paramBlocks != null) ? this.paramBlocks.Length : 0) != 0)
             {
                 this.paramValues = new object[this.paramBlocks.Length];
                 for (int j = 0; j < this.paramBlocks.Length; j++)
                 {
                     if (this.paramBlocks[j] == null)
                     {
                         if (this.paramTypes != null && this.paramTypes.Length > j)
                         {
                             this.paramValues[j] = BloxMemberInfo.GetDefaultValue(this.paramTypes[j]);
                         }
                     }
                     else
                     {
                         this.paramBlocks[j].owningEvent = this.owningEvent;
                         this.paramBlocks[j].owningBlock = this;
                         this.paramBlocks[j].fieldIdx    = j;
                         this.paramBlocks[j].Init();
                     }
                 }
             }
             this.InitBlock();
             if (this.isValid)
             {
                 for (BloxBlock bloxBlock = this.firstChild; bloxBlock != null; bloxBlock = bloxBlock.next)
                 {
                     bloxBlock.parentBlock = this;
                     bloxBlock.owningEvent = this.owningEvent;
                     if (bloxBlock.next != null)
                     {
                         bloxBlock.next.prevBlock = bloxBlock;
                     }
                     bloxBlock.Init();
                     if (bloxBlock.selfOrChildCanYield)
                     {
                         this.selfOrChildCanYield = true;
                     }
                 }
             }
         }
     }
 }