Exemple #1
0
 // Token: 0x0600077B RID: 1915 RVA: 0x0003B2C1 File Offset: 0x000394C1
 public void SetType(ZDO.ObjectType type)
 {
     if (this.m_type == type)
     {
         return;
     }
     this.m_type = type;
     this.IncreseDataRevision();
 }
Exemple #2
0
 private void Awake()
 {
     if (ZNetView.m_forceDisableInit)
     {
         UnityEngine.Object.Destroy((UnityEngine.Object) this);
     }
     else
     {
         this.m_body = (Rigidbody)((Component)this).GetComponent <Rigidbody>();
         if (ZNetView.m_useInitZDO && ZNetView.m_initZDO == null)
         {
             ZLog.LogWarning((object)("Double ZNetview when initializing object " + ((UnityEngine.Object)((Component)this).get_gameObject()).get_name()));
         }
         if (ZNetView.m_initZDO != null)
         {
             this.m_zdo         = ZNetView.m_initZDO;
             ZNetView.m_initZDO = (ZDO)null;
             if (this.m_zdo.m_type != this.m_type && this.m_zdo.IsOwner())
             {
                 this.m_zdo.SetType(this.m_type);
             }
             if (this.m_zdo.m_distant != this.m_distant && this.m_zdo.IsOwner())
             {
                 this.m_zdo.SetDistant(this.m_distant);
             }
             if (this.m_syncInitialScale)
             {
                 ((Component)this).get_transform().set_localScale(this.m_zdo.GetVec3("scale", ((Component)this).get_transform().get_localScale()));
             }
             if (UnityEngine.Object.op_Implicit((UnityEngine.Object) this.m_body))
             {
                 this.m_body.Sleep();
             }
         }
         else
         {
             string prefabName = this.GetPrefabName();
             this.m_zdo = ZDOMan.instance.CreateNewZDO(((Component)this).get_transform().get_position());
             this.m_zdo.m_persistent = this.m_persistent;
             this.m_zdo.m_type       = this.m_type;
             this.m_zdo.m_distant    = this.m_distant;
             this.m_zdo.SetPrefab(prefabName.GetStableHashCode());
             this.m_zdo.SetRotation(((Component)this).get_transform().get_rotation());
             if (this.m_syncInitialScale)
             {
                 this.m_zdo.Set("scale", ((Component)this).get_transform().get_localScale());
             }
             if (ZNetView.m_ghostInit)
             {
                 this.m_ghost = true;
                 return;
             }
         }
         ZNetScene.instance.AddInstance(this.m_zdo, this);
     }
 }
Exemple #3
0
    public void Load(ZPackage pkg, int version)
    {
        this.m_ownerRevision = pkg.ReadUInt();
        this.m_dataRevision  = pkg.ReadUInt();
        this.m_persistent    = pkg.ReadBool();
        this.m_owner         = pkg.ReadLong();
        this.m_timeCreated   = pkg.ReadLong();
        this.m_pgwVersion    = pkg.ReadInt();
        if (version >= 16 && version < 24)
        {
            pkg.ReadInt();
        }
        if (version >= 23)
        {
            this.m_type = (ZDO.ObjectType)pkg.ReadSByte();
        }
        if (version >= 22)
        {
            this.m_distant = pkg.ReadBool();
        }
        if (version < 13)
        {
            int num1 = (int)pkg.ReadChar();
            int num2 = (int)pkg.ReadChar();
        }
        if (version >= 17)
        {
            this.m_prefab = pkg.ReadInt();
        }
        this.m_sector   = pkg.ReadVector2i();
        this.m_position = pkg.ReadVector3();
        this.m_rotation = pkg.ReadQuaternion();
        int num3 = (int)pkg.ReadChar();

        if (num3 > 0)
        {
            this.InitFloats();
            for (int index = 0; index < num3; ++index)
            {
                this.m_floats[pkg.ReadInt()] = pkg.ReadSingle();
            }
        }
        else
        {
            this.ReleaseFloats();
        }
        int num4 = (int)pkg.ReadChar();

        if (num4 > 0)
        {
            this.InitVec3();
            for (int index = 0; index < num4; ++index)
            {
                this.m_vec3[pkg.ReadInt()] = pkg.ReadVector3();
            }
        }
        else
        {
            this.ReleaseVec3();
        }
        int num5 = (int)pkg.ReadChar();

        if (num5 > 0)
        {
            this.InitQuats();
            for (int index = 0; index < num5; ++index)
            {
                this.m_quats[pkg.ReadInt()] = pkg.ReadQuaternion();
            }
        }
        else
        {
            this.ReleaseQuats();
        }
        int num6 = (int)pkg.ReadChar();

        if (num6 > 0)
        {
            this.InitInts();
            for (int index = 0; index < num6; ++index)
            {
                this.m_ints[pkg.ReadInt()] = pkg.ReadInt();
            }
        }
        else
        {
            this.ReleaseInts();
        }
        int num7 = (int)pkg.ReadChar();

        if (num7 > 0)
        {
            this.InitLongs();
            for (int index = 0; index < num7; ++index)
            {
                this.m_longs[pkg.ReadInt()] = pkg.ReadLong();
            }
        }
        else
        {
            this.ReleaseLongs();
        }
        int num8 = (int)pkg.ReadChar();

        if (num8 > 0)
        {
            this.InitStrings();
            for (int index = 0; index < num8; ++index)
            {
                this.m_strings[pkg.ReadInt()] = pkg.ReadString();
            }
        }
        else
        {
            this.ReleaseStrings();
        }
        if (version >= 17)
        {
            return;
        }
        this.m_prefab = this.GetInt("prefab", 0);
    }
Exemple #4
0
    public void Deserialize(ZPackage pkg)
    {
        this.m_persistent  = pkg.ReadBool();
        this.m_distant     = pkg.ReadBool();
        this.m_timeCreated = pkg.ReadLong();
        this.m_pgwVersion  = pkg.ReadInt();
        this.m_type        = (ZDO.ObjectType)pkg.ReadSByte();
        this.m_prefab      = pkg.ReadInt();
        this.m_rotation    = pkg.ReadQuaternion();
        int num1 = pkg.ReadInt();

        if ((num1 & 1) != 0)
        {
            this.InitFloats();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_floats[pkg.ReadInt()] = pkg.ReadSingle();
            }
        }
        else
        {
            this.ReleaseFloats();
        }
        if ((num1 & 2) != 0)
        {
            this.InitVec3();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_vec3[pkg.ReadInt()] = pkg.ReadVector3();
            }
        }
        else
        {
            this.ReleaseVec3();
        }
        if ((num1 & 4) != 0)
        {
            this.InitQuats();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_quats[pkg.ReadInt()] = pkg.ReadQuaternion();
            }
        }
        else
        {
            this.ReleaseQuats();
        }
        if ((num1 & 8) != 0)
        {
            this.InitInts();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_ints[pkg.ReadInt()] = pkg.ReadInt();
            }
        }
        else
        {
            this.ReleaseInts();
        }
        if ((num1 & 64) != 0)
        {
            this.InitLongs();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_longs[pkg.ReadInt()] = pkg.ReadLong();
            }
        }
        else
        {
            this.ReleaseLongs();
        }
        if ((num1 & 16) != 0)
        {
            this.InitStrings();
            int num2 = (int)pkg.ReadByte();
            for (int index = 0; index < num2; ++index)
            {
                this.m_strings[pkg.ReadInt()] = pkg.ReadString();
            }
        }
        else
        {
            this.ReleaseStrings();
        }
    }