示例#1
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);
        }
示例#2
0
 private void OnButtonClick()
 {
     if (base.variables == null || base.variables.varDefs == null || base.variables.varDefs.Count == 0)
     {
         this.container.TriggerEvent(this.eventName);
     }
     else
     {
         BloxEventArg[] array = new BloxEventArg[base.variables.varDefs.Count];
         for (int i = 0; i < base.variables.varDefs.Count; i++)
         {
             array[i] = new BloxEventArg(base.variables.varDefs[i].name, base.variables.varDefs[i].GetValue());
         }
         this.container.TriggerEvent(this.eventName, array);
     }
 }