Пример #1
0
 public override void AddEvent(BloxEvent ev)
 {
     if ("Input/OnMouseDrag".Equals(ev.ident))
     {
         this.onDragEvents.Add(ev);
     }
     else if ("Input/OnMouseEnter".Equals(ev.ident))
     {
         this.onEnterEvents.Add(ev);
     }
     else if ("Input/OnMouseExit".Equals(ev.ident))
     {
         this.onExitEvents.Add(ev);
     }
     else if ("Input/OnMouseOver".Equals(ev.ident))
     {
         this.onOverEvents.Add(ev);
     }
     else if ("Input/OnMouseUp".Equals(ev.ident))
     {
         this.onUpEvents.Add(ev);
     }
     else if ("Input/OnMouseDown".Equals(ev.ident))
     {
         this.onDownEvents.Add(ev);
     }
     else if ("Input/OnMouseUpAsButton".Equals(ev.ident))
     {
         this.onButtonEvents.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
Пример #2
0
        public BloxEvent Copy()
        {
            BloxEvent bloxEvent = new BloxEvent();

            this.CopyTo(bloxEvent);
            return(bloxEvent);
        }
Пример #3
0
 public void CopyTo(BloxEvent ev)
 {
     Debug.Log("CopyTo", "BloxEvent", Color.yellow);
     if (Application.isPlaying)
     {
         Debug.LogError("This can't be done at runtime");
     }
     else
     {
         Debug.Log("CopyTo", "Blox", Color.yellow);
         this.Serialize();
         if (this.data == null)
         {
             this.data = new BloxEventData();
         }
         ev.ident           = this.ident;
         ev.screenName      = this.screenName;
         ev.active          = this.active;
         ev._ed_viewOffs    = Vector2.zero;
         ev.data            = this.data.Copy();
         ev.storedBlocksIdx = new List <int>();
         ev.storedBlocksIdx.AddRange(this.storedBlocksIdx);
         ev.Deserialize(this.blox);
     }
 }
 public override void AddEvent(BloxEvent ev)
 {
     if ("Common/Awake".Equals(ev.ident))
     {
         this.awakeEvents.Add(ev);
     }
     else if ("Common/Start".Equals(ev.ident))
     {
         this.startEvents.Add(ev);
     }
     else if ("Common/OnDestroy".Equals(ev.ident))
     {
         this.destroyEvents.Add(ev);
     }
     else if ("Common/OnEnable".Equals(ev.ident))
     {
         this.enableEvents.Add(ev);
     }
     else if ("Common/OnDisable".Equals(ev.ident))
     {
         this.disableEvents.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
 public override void AddEvent(BloxEvent ev)
 {
     if ("Common/LateUpdate".Equals(ev.ident))
     {
         this.events.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
Пример #6
0
 public override void AddEvent(BloxEvent ev)
 {
     if ("Misc/OnGUI".Equals(ev.ident))
     {
         this.events.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
Пример #7
0
 public override void AddEvent(BloxEvent ev)
 {
     if ("Collision/OnControllerColliderHit".Equals(ev.ident))
     {
         this.events.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
Пример #8
0
 private void RunEvent(BloxEvent ev, params BloxEventArg[] args)
 {
     ev.GetReadyToRun(args);
     if (ev.canYield)
     {
         BloxGlobal.Instance.StartCoroutine(ev.RunYield(this.container));
     }
     else
     {
         ev.Run(this.container);
     }
 }
Пример #9
0
        private void AttachEventHandlers(Blox b)
        {
            if (!b.bloxLoaded)
            {
                Debug.Log("AttachEventHandlers", "BloxContainer", Color.yellow);
                b.Deserialize();
            }
            Common_BloxEventHandler common_BloxEventHandler = null;

            for (int i = 0; i < b.events.Length; i++)
            {
                BloxEvent bloxEvent = b.events[i].Init(this, b);
                if (bloxEvent != null)
                {
                    if (bloxEvent.ident.Equals("Custom"))
                    {
                        if (!this.customEvents.ContainsKey(bloxEvent.screenName))
                        {
                            this.customEvents.Add(bloxEvent.screenName, new List <BloxEvent>());
                        }
                        this.customEvents[bloxEvent.screenName].Add(bloxEvent);
                    }
                    else
                    {
                        Type type = BloxGlobal.FindEventHandlerType(bloxEvent.ident);
                        if (type == null)
                        {
                            Debug.LogWarning("Could not find a handler for: " + bloxEvent.ident, base.gameObject);
                        }
                        else
                        {
                            BloxEventHandler bloxEventHandler = (BloxEventHandler)base.gameObject.GetComponent(type);
                            if ((UnityEngine.Object)bloxEventHandler == (UnityEngine.Object)null)
                            {
                                bloxEventHandler = (BloxEventHandler)base.gameObject.AddComponent(type);
                                if (bloxEventHandler.GetType() == typeof(Common_BloxEventHandler))
                                {
                                    common_BloxEventHandler = (Common_BloxEventHandler)bloxEventHandler;
                                }
                            }
                            bloxEventHandler.AddEvent(bloxEvent);
                        }
                    }
                }
            }
            if ((UnityEngine.Object)common_BloxEventHandler != (UnityEngine.Object)null)
            {
                common_BloxEventHandler.Awake();
                common_BloxEventHandler.OnEnable();
            }
        }
 public override void AddEvent(BloxEvent ev)
 {
     if ("Misc/OnBecameInvisible".Equals(ev.ident))
     {
         this.onBecameInvisibleEvents.Add(ev);
     }
     else if ("Misc/OnBecameVisible".Equals(ev.ident))
     {
         this.onBecameVisible.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
Пример #11
0
 public override void AddEvent(BloxEvent ev)
 {
     if ("Misc/OnTransformParentChanged".Equals(ev.ident))
     {
         this.events1.Add(ev);
     }
     else if ("Misc/OnTransformChildrenChanged".Equals(ev.ident))
     {
         this.events2.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
 public override void AddEvent(BloxEvent ev)
 {
     if ("Misc/OnAnimatorMove".Equals(ev.ident))
     {
         this.moveEvents.Add(ev);
     }
     else if ("Misc/OnAnimatorIK".Equals(ev.ident))
     {
         this.ikEvents.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
 public override void AddEvent(BloxEvent ev)
 {
     if ("Collision/OnCollisionEnter".Equals(ev.ident))
     {
         this.onEnterEvents.Add(ev);
     }
     else if ("Collision/OnCollisionExit".Equals(ev.ident))
     {
         this.onExitEvents.Add(ev);
     }
     else if ("Collision/OnCollisionStay".Equals(ev.ident))
     {
         this.onStayEvents.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
 public override void AddEvent(BloxEvent ev)
 {
     if ("Trigger/with Info/OnTriggerEnter(...)".Equals(ev.ident))
     {
         this.onEnterEvents.Add(ev);
     }
     else if ("Trigger/with Info/OnTriggerExit(...)".Equals(ev.ident))
     {
         this.onExitEvents.Add(ev);
     }
     else if ("Trigger/with Info/OnTriggerStay(...)".Equals(ev.ident))
     {
         this.onStayEvents.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
Пример #15
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);
        }
Пример #16
0
 public override void AddEvent(BloxEvent ev)
 {
     if ("Misc/OnApplicationFocus".Equals(ev.ident))
     {
         this.focusEvents.Add(ev);
     }
     else if ("Misc/OnApplicationPause".Equals(ev.ident))
     {
         this.pauseEvents.Add(ev);
     }
     else if ("Misc/OnApplicationQuit".Equals(ev.ident))
     {
         this.quitEvents.Add(ev);
     }
     else if ("Misc/OnLevelWasLoaded".Equals(ev.ident))
     {
         this.lvLoadedEvents.Add(ev);
     }
     else
     {
         Debug.LogError("This event handler can't handle: " + ev.ident);
     }
 }
Пример #17
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;
                     }
                 }
             }
         }
     }
 }
Пример #18
0
 public virtual void AddEvent(BloxEvent ev)
 {
 }