示例#1
0
        // Token: 0x06004D93 RID: 19859 RVA: 0x001A06F0 File Offset: 0x0019EAF0
        private void SetupTriggers()
        {
            VRC_Trigger vrc_Trigger = base.GetComponent <VRC_Trigger>();

            if (vrc_Trigger == null)
            {
                vrc_Trigger = base.gameObject.AddComponent <VRC_Trigger>();
            }
            VRC_Trigger.TriggerEvent triggerEvent = new VRC_Trigger.TriggerEvent();
            triggerEvent.TriggerType   = VRC_Trigger.TriggerType.OnPickup;
            triggerEvent.BroadcastType = VRC_EventHandler.VrcBroadcastType.AlwaysUnbuffered;
            VRC_EventHandler.VrcEvent vrcEvent = new VRC_EventHandler.VrcEvent();
            vrcEvent.EventType           = VRC_EventHandler.VrcEventType.SendRPC;
            vrcEvent.ParameterObjects    = new GameObject[1];
            vrcEvent.ParameterObjects[0] = base.gameObject;
            vrcEvent.ParameterString     = "OnPickedUp";
            vrcEvent.ParameterInt        = 0;
            vrcEvent.ParameterBytes      = VRC_Serialization.ParameterEncoder(new object[0]);
            triggerEvent.Events.Add(vrcEvent);
            vrc_Trigger.Triggers.Add(triggerEvent);
            VRC_Trigger.TriggerEvent triggerEvent2 = new VRC_Trigger.TriggerEvent();
            triggerEvent2.TriggerType   = VRC_Trigger.TriggerType.OnDrop;
            triggerEvent2.BroadcastType = VRC_EventHandler.VrcBroadcastType.AlwaysUnbuffered;
            VRC_EventHandler.VrcEvent vrcEvent2 = new VRC_EventHandler.VrcEvent();
            vrcEvent2.EventType           = VRC_EventHandler.VrcEventType.SendRPC;
            vrcEvent2.ParameterObjects    = new GameObject[1];
            vrcEvent2.ParameterObjects[0] = base.gameObject;
            vrcEvent2.ParameterString     = "OnDropped";
            vrcEvent2.ParameterInt        = 0;
            vrcEvent2.ParameterBytes      = VRC_Serialization.ParameterEncoder(new object[0]);
            triggerEvent2.Events.Add(vrcEvent2);
            vrc_Trigger.Triggers.Add(triggerEvent2);
        }
示例#2
0
 // Token: 0x060059FF RID: 23039 RVA: 0x001F4950 File Offset: 0x001F2D50
 public static bool Serialize(VRC_DataStorage.VrcDataElement ds, object objectToStore)
 {
     ds.added    = (ds.type == VRC_DataStorage.VrcDataType.None);
     ds.modified = true;
     if (objectToStore is bool)
     {
         ds.valueBool = (bool)objectToStore;
         ds.type      = VRC_DataStorage.VrcDataType.Bool;
         return(true);
     }
     if (objectToStore is int)
     {
         ds.valueInt = (int)objectToStore;
         ds.type     = VRC_DataStorage.VrcDataType.Int;
         return(true);
     }
     if (objectToStore is float)
     {
         ds.valueFloat = (float)objectToStore;
         ds.type       = VRC_DataStorage.VrcDataType.Float;
         return(true);
     }
     if (objectToStore is string)
     {
         ds.valueString = (string)objectToStore;
         ds.type        = VRC_DataStorage.VrcDataType.String;
         return(true);
     }
     if (objectToStore is byte[])
     {
         ds.valueSerializedBytes = (byte[])objectToStore;
         ds.type = VRC_DataStorage.VrcDataType.SerializeBytes;
         return(true);
     }
     if (objectToStore is VRC_SerializableBehaviour)
     {
         ds.serializeComponent   = (VRC_SerializableBehaviour)objectToStore;
         ds.valueSerializedBytes = ((VRC_SerializableBehaviour)objectToStore).GetBytes();
         ds.type = VRC_DataStorage.VrcDataType.SerializeObject;
         return(true);
     }
     ds.valueSerializedBytes = VRC_Serialization.ParameterEncoder(new object[]
     {
         objectToStore
     });
     ds.type = VRC_DataStorage.VrcDataType.Other;
     return(true);
 }
示例#3
0
 // Token: 0x060059F4 RID: 23028 RVA: 0x001F3E1C File Offset: 0x001F221C
 public void CheckConsistency()
 {
     if (this.dataStorage.data.Length == 0 || this.timeOfNextConsistencyCheck - Time.time > 0f)
     {
         return;
     }
     this.timeOfNextConsistencyCheck = Time.time + UnityEngine.Random.Range(1f, 2f);
     if (this.dataHash != null && this.dataHash.Length != this.dataStorage.data.Length)
     {
         this.dataHash = null;
     }
     if (this.dataHash == null)
     {
         this.dataHash = new SHA1[this.dataStorage.data.Length];
     }
     for (int i = 0; i < this.dataHash.Length; i++)
     {
         if (this.dataStorage.data[i].modified)
         {
             this.dataHash[i] = null;
         }
         SHA1 sha = SHA1.Create();
         sha.ComputeHash(VRC_Serialization.ParameterEncoder(new object[]
         {
             this.dataStorage.data[i]
         }));
         bool flag = this.dataHash[i] == null || sha.HashSize != this.dataHash[i].HashSize || sha.Hash.Length != this.dataHash[i].Hash.Length;
         if (!flag)
         {
             for (int j = 0; j < sha.Hash.Length; j++)
             {
                 flag = (sha.Hash[j] != this.dataHash[i].Hash[j]);
                 if (flag)
                 {
                     break;
                 }
             }
         }
         if (flag)
         {
             this.dataStorage.data[i].modified = flag;
             this.dataHash[i] = sha;
             base.photonView.lastOnSerializeDataSent = null;
         }
     }
 }