示例#1
0
 // Token: 0x06005A50 RID: 23120 RVA: 0x001F7154 File Offset: 0x001F5554
 public void LogEvent(VRC_EventHandler eventHandler, VRC_EventHandler.VrcEvent vrcEvent, long combinedNetworkId, VRC_EventHandler.VrcBroadcastType broadcast, int instagatorId, float fastForward)
 {
     if (instagatorId <= 0)
     {
         instagatorId = VRC.Network.LocalInstigatorID;
     }
     if (vrcEvent.EventType == VRC_EventHandler.VrcEventType.SpawnObject || broadcast == VRC_EventHandler.VrcBroadcastType.Local)
     {
         this.Dispatcher.Execute(vrcEvent, broadcast, instagatorId, fastForward);
         return;
     }
     VRC_EventLog.EventLogEntry eventLogEntry = new VRC_EventLog.EventLogEntry
     {
         Time = PhotonNetwork.time,
         InstagatorPhotonId = instagatorId,
         CombinedNetworkId  = combinedNetworkId,
         FastForward        = fastForward,
         Event             = vrcEvent,
         OriginalBroadcast = broadcast
     }.DeepClone();
     if (vrcEvent.ParameterObject != null)
     {
         eventLogEntry.ObjectPath            = VRC.Network.GetGameObjectPath(vrcEvent.ParameterObject);
         eventLogEntry.Event.ParameterObject = vrcEvent.ParameterObject;
     }
     this.FixBooleanValues(eventLogEntry.Event, this.Dispatcher.GetEventHandler(combinedNetworkId));
     VRC_EventLog.AssignObjectParameter(eventLogEntry, this.Dispatcher);
     Debug.Log("Replicating " + eventLogEntry.ToString());
     this.Replicator.ProcessEvent(eventLogEntry, PhotonNetwork.player);
 }
示例#2
0
        // Token: 0x06005A75 RID: 23157 RVA: 0x001F7CC4 File Offset: 0x001F60C4
        private static object DeserializeForPhoton(byte[] bytes)
        {
            VRC_EventLog.EventLogEntry eventLogEntry = new VRC_EventLog.EventLogEntry();
            eventLogEntry.Event = new VRC_EventHandler.VrcEvent();
            int num = 0;

            Protocol.Deserialize(out eventLogEntry.time, bytes, ref num);
            Protocol.Deserialize(out eventLogEntry.instagatorPhotonId, bytes, ref num);
            int num2;

            Protocol.Deserialize(out num2, bytes, ref num);
            int num3;

            Protocol.Deserialize(out num3, bytes, ref num);
            eventLogEntry.combinedNetworkId = ((long)num2 << 32 | (long)((ulong)num3));
            short num4;

            Protocol.Deserialize(out num4, bytes, ref num);
            eventLogEntry.objectPath = Encoding.UTF8.GetString(bytes, num, (int)num4);
            num += (int)num4;
            int value;

            Protocol.Deserialize(out value, bytes, ref num);
            eventLogEntry.theEvent.EventType = (VRC_EventHandler.VrcEventType)Enum.ToObject(typeof(VRC_EventHandler.VrcEventType), value);
            int value2;

            Protocol.Deserialize(out value2, bytes, ref num);
            eventLogEntry.theEvent.ParameterBoolOp = (VRC_EventHandler.VrcBooleanOp)Enum.ToObject(typeof(VRC_EventHandler.VrcBooleanOp), value2);
            Protocol.Deserialize(out eventLogEntry.theEvent.ParameterFloat, bytes, ref num);
            Protocol.Deserialize(out eventLogEntry.theEvent.ParameterInt, bytes, ref num);
            Protocol.Deserialize(out num4, bytes, ref num);
            eventLogEntry.theEvent.ParameterString = Encoding.UTF8.GetString(bytes, num, (int)num4);
            num += (int)num4;
            try
            {
                Protocol.Deserialize(out eventLogEntry.fastForward, bytes, ref num);
                short originalBroadcast;
                Protocol.Deserialize(out originalBroadcast, bytes, ref num);
                eventLogEntry.OriginalBroadcast = (VRC_EventHandler.VrcBroadcastType)originalBroadcast;
                short num5 = 0;
                Protocol.Deserialize(out num5, bytes, ref num);
                eventLogEntry.theEvent.ParameterBytes = new byte[(int)num5];
                if (num5 > 0)
                {
                    Array.Copy(bytes, num, eventLogEntry.theEvent.ParameterBytes, 0, (int)num5);
                }
                num += (int)num5;
            }
            catch (IndexOutOfRangeException)
            {
                eventLogEntry.fastForward             = 0f;
                eventLogEntry.theEvent.ParameterBytes = new byte[0];
            }
            return(eventLogEntry);
        }
示例#3
0
 // Token: 0x06005A57 RID: 23127 RVA: 0x001F7830 File Offset: 0x001F5C30
 private static void AssignObjectParameter(VRC_EventLog.EventLogEntry entry, VRC_EventDispatcherRFC Dispatcher)
 {
     if (entry != null && entry.Event != null && entry.Event.ParameterObject == null && !string.IsNullOrEmpty(entry.ObjectPath))
     {
         GameObject gameObject = VRC.Network.FindGameObject(entry.ObjectPath, true);
         if (gameObject != null)
         {
             entry.Event.ParameterObject = gameObject;
         }
     }
 }
示例#4
0
 // Token: 0x06005A4F RID: 23119 RVA: 0x001F70D4 File Offset: 0x001F54D4
 private void OnNewEvent(VRC_EventLog.EventLogEntry entry, VRC.Player sender)
 {
     VRC_EventLog.AssignObjectParameter(entry, this.Dispatcher);
     entry.TimeReceived = (double)Time.time;
     if (VRC.Network.IsNetworkSettled && entry.Instigator == VRC.Network.LocalInstigatorID && VRC_EventLog.isEventReady(entry, false))
     {
         this.Dispatcher.Execute(entry.Event, entry.OriginalBroadcast, entry.Instigator, entry.FastForward);
     }
     else
     {
         this.eventsToProcess.Add(entry);
     }
 }
示例#5
0
        // Token: 0x06005A74 RID: 23156 RVA: 0x001F7AE4 File Offset: 0x001F5EE4
        private static byte[] SerializeForPhoton(object customobject)
        {
            VRC_EventLog.EventLogEntry eventLogEntry = (VRC_EventLog.EventLogEntry)customobject;
            if (eventLogEntry.serialized != null)
            {
                return(eventLogEntry.serialized);
            }
            byte[] array = new byte[32768];
            int    num   = 0;

            Protocol.Serialize(eventLogEntry.time, array, ref num);
            Protocol.Serialize(eventLogEntry.instagatorPhotonId, array, ref num);
            int value = (int)(eventLogEntry.combinedNetworkId >> 32);
            // HMM.
            int value2 = (int)(eventLogEntry.combinedNetworkId & (long)(-1));

            Protocol.Serialize(value, array, ref num);
            Protocol.Serialize(value2, array, ref num);
            if (eventLogEntry.ObjectPath == null)
            {
                eventLogEntry.ObjectPath = string.Empty;
            }
            byte[] bytes = Encoding.UTF8.GetBytes(eventLogEntry.ObjectPath);
            Protocol.Serialize((short)bytes.Length, array, ref num);
            bytes.CopyTo(array, num);
            num += bytes.Length;
            Protocol.Serialize((int)eventLogEntry.theEvent.EventType, array, ref num);
            Protocol.Serialize((int)eventLogEntry.theEvent.ParameterBoolOp, array, ref num);
            Protocol.Serialize(eventLogEntry.theEvent.ParameterFloat, array, ref num);
            Protocol.Serialize(eventLogEntry.theEvent.ParameterInt, array, ref num);
            bytes = Encoding.UTF8.GetBytes(eventLogEntry.theEvent.ParameterString);
            Protocol.Serialize((short)bytes.Length, array, ref num);
            bytes.CopyTo(array, num);
            num += bytes.Length;
            Protocol.Serialize(eventLogEntry.fastForward, array, ref num);
            Protocol.Serialize((short)eventLogEntry.OriginalBroadcast, array, ref num);
            if (eventLogEntry.theEvent.ParameterBytes == null)
            {
                eventLogEntry.theEvent.ParameterBytes = new byte[0];
            }
            Protocol.Serialize((short)eventLogEntry.theEvent.ParameterBytes.Length, array, ref num);
            eventLogEntry.theEvent.ParameterBytes.CopyTo(array, num);
            num += eventLogEntry.theEvent.ParameterBytes.Length;
            byte[] array2 = new byte[num];
            for (int i = 0; i < num; i++)
            {
                array2[i] = array[i];
            }
            eventLogEntry.serialized = array2;
            return(array2);
        }
示例#6
0
    // Token: 0x06005A55 RID: 23125 RVA: 0x001F74E4 File Offset: 0x001F58E4
    private void ProcessEvents()
    {
        int count = this.eventsToProcess.Count;

        for (int i = 0; i < count; i++)
        {
            VRC_EventLog.EventLogEntry eventLogEntry = this.eventsToProcess[0];
            this.eventsToProcess.RemoveAt(0);
            if (eventLogEntry != null)
            {
                try
                {
                    VRC_EventLog.AssignObjectParameter(eventLogEntry, this.Dispatcher);
                    bool flag = (double)Time.time - eventLogEntry.TimeReceived < (double)this.DeferNewEventsTolerance;
                    if (!VRC_EventLog.isEventReady(eventLogEntry, !flag))
                    {
                        if (flag)
                        {
                            this.eventsToProcess.Add(eventLogEntry);
                        }
                    }
                    else
                    {
                        try
                        {
                            float fastForward = eventLogEntry.FastForward + (float)(PhotonNetwork.time - eventLogEntry.Time);
                            this.Dispatcher.Execute(eventLogEntry.Event, eventLogEntry.OriginalBroadcast, eventLogEntry.InstagatorPhotonId, fastForward);
                        }
                        catch (Exception exception)
                        {
                            Debug.LogException(exception);
                        }
                    }
                }
                catch (Exception exception2)
                {
                    Debug.LogException(exception2, this);
                }
            }
        }
    }
示例#7
0
 // Token: 0x06005A54 RID: 23124 RVA: 0x001F72A8 File Offset: 0x001F56A8
 private static bool isEventReady(VRC_EventLog.EventLogEntry e, bool logError)
 {
     if (!string.IsNullOrEmpty(e.ObjectPath) && e.Event.ParameterObject == null)
     {
         if (logError)
         {
             Debug.LogError("Could not find target " + e.ObjectPath + " for " + e.ToString());
         }
         return(false);
     }
     if (e.Event.ParameterObject != null && !VRC.Network.IsObjectReady(e.Event.ParameterObject))
     {
         if (logError)
         {
             Debug.LogError(string.Concat(new string[]
             {
                 "Object did not ready in time ",
                 e.ObjectPath,
                 " for ",
                 e.ToString(),
                 " because ",
                 e.Event.ParameterObject.WhyNotReady()
             }));
         }
         return(false);
     }
     if (e.Event.EventType == VRC_EventHandler.VrcEventType.SendRPC)
     {
         object[] array = null;
         try
         {
             array = VRC_Serialization.ParameterDecoder(e.Event.ParameterBytes, true);
         }
         catch (KeyNotFoundException ex)
         {
             if (logError)
             {
                 Debug.LogError(string.Concat(new string[]
                 {
                     "RPC Parameters did not ready in time ",
                     e.ObjectPath,
                     " for ",
                     e.ToString(),
                     " because ",
                     ex.Message
                 }));
             }
             return(false);
         }
         if (array == null || array.Length <= 0)
         {
             return(true);
         }
         if (array.Any((object p) => p == null || (p is GameObject && !(p as GameObject).IsReady())))
         {
             if (logError)
             {
                 string[] value = (from p in array
                                   where p == null || (p is GameObject && !(p as GameObject).IsReady())
                                   select(p != null) ? ((p as GameObject).name + ": " + (p as GameObject).WhyNotReady()) : "parameter is null").ToArray <string>();
                 Debug.LogError(string.Concat(new string[]
                 {
                     "RPC Parameters did not ready in time ",
                     e.ObjectPath,
                     " for ",
                     e.ToString(),
                     " because ",
                     string.Join(", ", value)
                 }));
             }
             return(false);
         }
         return(true);
     }
     return(true);
 }