Ejemplo n.º 1
0
        private static bool TriggerEvent(ref VrcEvent __0, ref VrcBroadcastType __1, ref int __2, ref float __3)
        {
            try
            {
                Player Sender = GeneralWrappers.GetPlayerManager().GetPlayer(__2);
                if (__1 == VrcBroadcastType.Always || __1 == VrcBroadcastType.AlwaysUnbuffered || __1 == VrcBroadcastType.AlwaysBufferOne)
                {
                    if (Sender != null)
                    {
                        if (Sender.GetVRCPlayerApi().playerId != GeneralWrappers.GetPlayerManager().GetCurrentPlayer().GetVRC_Player().GetVRCPlayerApi().playerId)
                        {
                            if (Configuration.GetConfig().AntiWorldTriggers)
                            {
                                return(false);
                            }
                        }
                    }
                }

                if (GeneralUtils.WorldTriggers && (__1 != VrcBroadcastType.Always || __1 != VrcBroadcastType.AlwaysBufferOne || __1 != VrcBroadcastType.AlwaysUnbuffered))
                {
                    __1 = VrcBroadcastType.Always;
                }
            }
            catch { }
            return(true);
        }
Ejemplo n.º 2
0
        private static void OnRPC(Player sender, VrcEvent ev)
        {
            if (sender?.field_Private_APIUser_0 is null || ev is null)
            {
                return;
            }

            if (ev.EventType == VrcEventType.SendRPC && ev.ParameterString == "UdonSyncRunProgramAsRPC")
            {
                ProcessRPC(sender, System.Text.Encoding.UTF8.GetString(ev.ParameterBytes).Substring(6));
            }
        }
Ejemplo n.º 3
0
 private static bool TriggerEvent(ref VrcEvent __0, ref VrcBroadcastType __1, ref int __2, ref float __3)
 {
     if (__1 == VrcBroadcastType.Always || __1 == VrcBroadcastType.AlwaysUnbuffered)
     {
         if (!GeneralUtils.WorldTriggers)
         {
             return(false);
         }
     }
     if (GeneralUtils.WorldTriggers)
     {
         __1 = VrcBroadcastType.Always;
     }
     return(true);
 }
Ejemplo n.º 4
0
 public void DeferEvent(VrcEvent e, VrcBroadcastType broadcast, GameObject instagator, float fastForward)
 {
     if (deferredEvents == null)
     {
         deferredEvents = new List <EventInfo>();
     }
     deferredEvents.Add(new EventInfo
     {
         evt         = e,
         broadcast   = broadcast,
         instagator  = instagator,
         fastForward = fastForward
     });
     if (DeferredEventProcessor == null)
     {
         DeferredEventProcessor = Networking.SafeStartCoroutine(ProcessDeferredEvents());
     }
 }
Ejemplo n.º 5
0
 public void TriggerEvent(VrcEvent e, VrcBroadcastType broadcast, int instagatorId, float fastForward)
 {
     if (e == null)
     {
         Debug.LogErrorFormat("Cancelling event because it was not valid", new object[0]);
     }
     else
     {
         VRC_PlayerApi playerById = VRC_PlayerApi.GetPlayerById(instagatorId);
         if (playerById == null)
         {
             Debug.LogErrorFormat("Cancelling event because instagator was not valid", new object[0]);
         }
         else
         {
             TriggerEvent(e, broadcast, playerById.get_gameObject(), fastForward);
         }
     }
 }
Ejemplo n.º 6
0
 private void InternalTriggerEvent(VrcEvent e, VrcBroadcastType broadcast, int instagatorId, float fastForward)
 {
     if (instagatorId <= 0)
     {
         Debug.LogErrorFormat("Cancelling event because the Instigator was invalid: {0}/{1}", new object[2]
         {
             e.EventType,
             broadcast
         });
     }
     if (LogEvent != null)
     {
         LogEvent(this, e, broadcast, instagatorId, fastForward);
     }
     else
     {
         Dispatcher.TriggerEvent(this, e, broadcast, instagatorId, fastForward);
     }
 }
Ejemplo n.º 7
0
 private static void OnRPCHook(ref Player __0, ref VrcEvent __1) => Events.OnRPC(__0, __1);
Ejemplo n.º 8
0
 public void TriggerEvent(VrcEvent e, VrcBroadcastType broadcast, GameObject instagator = null, float fastForward = 0f)
 {
     if (e == null)
     {
         throw new ArgumentException("Event was null");
     }
     if (instagator == null)
     {
         Debug.LogErrorFormat("Cancelling event {0} because the Instagator was null.", new object[1]
         {
             e.Name
         });
     }
     else
     {
         VRC_EventDispatcher dispatcher = Dispatcher;
         if (dispatcher == null)
         {
             Debug.LogFormat("Deferring event {0} of type {1} because dispatcher is unavailable.", new object[2]
             {
                 e.Name,
                 e.EventType
             });
             DeferEvent(e, broadcast, instagator, fastForward);
         }
         else if ((e.ParameterObjects == null || e.ParameterObjects.Length == 0) && e.ParameterObject == null)
         {
             Debug.LogError((object)("No object to receive event " + e.Name + " of type " + e.EventType));
         }
         else
         {
             int instagatorId = GetInstigatorId(instagator);
             if (e.ParameterObjects != null)
             {
                 GameObject[] parameterObjects = e.ParameterObjects;
                 foreach (GameObject parameterObject in parameterObjects)
                 {
                     GameObject parameterObject2 = e.ParameterObject;
                     e.ParameterObject = parameterObject;
                     try
                     {
                         if (null == e.ParameterObject && IsReceiverRequiredForEventType(e.EventType))
                         {
                             Debug.LogWarning((object)("Null object in parameter objects to receive event " + e.Name + " of type " + e.EventType + ", trigger event ignored."));
                         }
                         else
                         {
                             InternalTriggerEvent(e, broadcast, instagatorId, fastForward);
                         }
                     }
                     finally
                     {
                         e.ParameterObject = parameterObject2;
                     }
                 }
             }
             if (e.ParameterObject != null)
             {
                 InternalTriggerEvent(e, broadcast, instagatorId, fastForward);
             }
         }
     }
 }