Esempio n. 1
0
 // Token: 0x06005A01 RID: 23041 RVA: 0x001F4B5B File Offset: 0x001F2F5B
 private void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
 {
     if (stream.isWriting)
     {
         VRC_DataStorageInternal.SerializeDataStorage(this, stream);
     }
     else
     {
         VRC_DataStorageInternal.DeserializeDataStorage(this, stream);
     }
     this.UnblockReady();
 }
Esempio n. 2
0
    // Token: 0x06005A02 RID: 23042 RVA: 0x001F4B84 File Offset: 0x001F2F84
    private static void SerializeDataStorage(VRC_DataStorageInternal dataStorage, PhotonStream stream)
    {
        if (dataStorage == null)
        {
            stream.SendNext(0);
        }
        else
        {
            stream.SendNext(dataStorage.GetElementCount());
            for (int i = 0; i < dataStorage.GetElementCount(); i++)
            {
                VRC_DataStorage.VrcDataElement element = dataStorage.GetElement(i);
                stream.SendNext(element.type);
                stream.SendNext(element.name);
                stream.SendNext(element.mirror);
                switch (element.type)
                {
                case VRC_DataStorage.VrcDataType.Bool:
                    stream.SendNext(dataStorage.Get <bool>(i));
                    break;

                case VRC_DataStorage.VrcDataType.Int:
                    stream.SendNext(dataStorage.Get <int>(i));
                    break;

                case VRC_DataStorage.VrcDataType.Float:
                    stream.SendNext(dataStorage.Get <float>(i));
                    break;

                case VRC_DataStorage.VrcDataType.String:
                    stream.SendNext(dataStorage.Get <string>(i));
                    break;

                case VRC_DataStorage.VrcDataType.SerializeBytes:
                case VRC_DataStorage.VrcDataType.SerializeObject:
                case VRC_DataStorage.VrcDataType.Other:
                {
                    byte[] obj = dataStorage.Get <byte[]>(i);
                    stream.SendNext(obj);
                    break;
                }
                }
            }
        }
    }
Esempio n. 3
0
    // Token: 0x06005A03 RID: 23043 RVA: 0x001F4CA8 File Offset: 0x001F30A8
    private static void DeserializeDataStorage(VRC_DataStorageInternal dataStorage, PhotonStream stream)
    {
        int count = (int)stream.ReceiveNext();

        if (dataStorage != null)
        {
            dataStorage.Resize(count);
        }
        for (int i = 0; i < dataStorage.GetElementCount(); i++)
        {
            VRC_DataStorage.VrcDataElement element = dataStorage.GetElement(i);
            element.type   = (VRC_DataStorage.VrcDataType)stream.ReceiveNext();
            element.name   = (string)stream.ReceiveNext();
            element.mirror = (VRC_DataStorage.VrcDataMirror)stream.ReceiveNext();
            switch (element.type)
            {
            case VRC_DataStorage.VrcDataType.Bool:
                dataStorage.Set <bool>(i, (bool)stream.ReceiveNext());
                break;

            case VRC_DataStorage.VrcDataType.Int:
                dataStorage.Set <int>(i, (int)stream.ReceiveNext());
                break;

            case VRC_DataStorage.VrcDataType.Float:
                dataStorage.Set <float>(i, (float)stream.ReceiveNext());
                break;

            case VRC_DataStorage.VrcDataType.String:
                dataStorage.Set <string>(i, (string)stream.ReceiveNext());
                break;

            case VRC_DataStorage.VrcDataType.SerializeBytes:
            case VRC_DataStorage.VrcDataType.SerializeObject:
            case VRC_DataStorage.VrcDataType.Other:
            {
                byte[] value = (byte[])stream.ReceiveNext();
                dataStorage.Set <byte[]>(i, value);
                break;
            }
            }
        }
    }
Esempio n. 4
0
    // Token: 0x060059F8 RID: 23032 RVA: 0x001F4148 File Offset: 0x001F2548
    public static int GetElementIndex(VRC_DataStorage ds, string name)
    {
        VRC_DataStorageInternal component = ds.gameObject.GetComponent <VRC_DataStorageInternal>();

        return(component.GetElementIndex(name));
    }