コード例 #1
0
    // Token: 0x060007BD RID: 1981 RVA: 0x0003CF50 File Offset: 0x0003B150
    public ZDO CreateNewZDO(ZDOID uid, Vector3 position)
    {
        ZDO zdo = ZDOPool.Create(this, uid, position);

        zdo.m_owner       = this.m_myid;
        zdo.m_timeCreated = ZNet.instance.GetTime().Ticks;
        this.m_objectsByID.Add(uid, zdo);
        return(zdo);
    }
コード例 #2
0
    // Token: 0x060007B9 RID: 1977 RVA: 0x0003CB88 File Offset: 0x0003AD88
    public void Load(BinaryReader reader, int version)
    {
        reader.ReadInt64();
        uint num  = reader.ReadUInt32();
        int  num2 = reader.ReadInt32();

        ZDOPool.Release(this.m_objectsByID);
        this.m_objectsByID.Clear();
        this.ResetSectorArray();
        ZLog.Log(string.Concat(new object[]
        {
            "Loading ",
            num2,
            " zdos , my id ",
            this.m_myid,
            " data version:",
            version
        }));
        ZPackage zpackage = new ZPackage();

        for (int i = 0; i < num2; i++)
        {
            ZDO zdo = ZDOPool.Create(this);
            zdo.m_uid = new ZDOID(reader);
            int    count = reader.ReadInt32();
            byte[] data  = reader.ReadBytes(count);
            zpackage.Load(data);
            zdo.Load(zpackage, version);
            zdo.SetOwner(0L);
            this.m_objectsByID.Add(zdo.m_uid, zdo);
            this.AddToSector(zdo, zdo.GetSector());
            if (zdo.m_uid.userID == this.m_myid && zdo.m_uid.id >= num)
            {
                num = zdo.m_uid.id + 1U;
            }
        }
        this.m_deadZDOs.Clear();
        int num3 = reader.ReadInt32();

        for (int j = 0; j < num3; j++)
        {
            ZDOID key   = new ZDOID(reader.ReadInt64(), reader.ReadUInt32());
            long  value = reader.ReadInt64();
            this.m_deadZDOs.Add(key, value);
            if (key.userID == this.m_myid && key.id >= num)
            {
                num = key.id + 1U;
            }
        }
        this.CapDeadZDOList();
        ZLog.Log("Loaded " + this.m_deadZDOs.Count + " dead zdos");
        this.RemoveOldGeneratedZDOS();
        this.m_nextUid = num;
    }