Пример #1
0
    // Token: 0x06000887 RID: 2183 RVA: 0x00041908 File Offset: 0x0003FB08
    private void RemoveObjects(List <ZDO> currentNearObjects, List <ZDO> currentDistantObjects)
    {
        int frameCount = Time.frameCount;

        foreach (ZDO zdo in currentNearObjects)
        {
            zdo.m_tempRemoveEarmark = frameCount;
        }
        foreach (ZDO zdo2 in currentDistantObjects)
        {
            zdo2.m_tempRemoveEarmark = frameCount;
        }
        this.m_tempRemoved.Clear();
        foreach (ZNetView znetView in this.m_instances.Values)
        {
            if (znetView.GetZDO().m_tempRemoveEarmark != frameCount)
            {
                this.m_tempRemoved.Add(znetView);
            }
        }
        for (int i = 0; i < this.m_tempRemoved.Count; i++)
        {
            ZNetView znetView2 = this.m_tempRemoved[i];
            ZDO      zdo3      = znetView2.GetZDO();
            znetView2.ResetZDO();
            UnityEngine.Object.Destroy(znetView2.gameObject);
            if (!zdo3.m_persistent && zdo3.IsOwner())
            {
                ZDOMan.instance.DestroyZDO(zdo3);
            }
            this.m_instances.Remove(zdo3);
        }
    }
Пример #2
0
    // Token: 0x0600087D RID: 2173 RVA: 0x000414C0 File Offset: 0x0003F6C0
    public void Destroy(GameObject go)
    {
        ZNetView component = go.GetComponent <ZNetView>();

        if (component && component.GetZDO() != null)
        {
            ZDO zdo = component.GetZDO();
            component.ResetZDO();
            this.m_instances.Remove(zdo);
            if (zdo.IsOwner())
            {
                ZDOMan.instance.DestroyZDO(zdo);
            }
        }
        UnityEngine.Object.Destroy(go);
    }
Пример #3
0
        private static bool Prefix(ref ZNetScene __instance, ref List<ZDO> currentNearObjects, ref List<ZDO> currentDistantObjects)
        {
            int frameCount = Time.frameCount;

            foreach (ZDO currentNearObject in currentNearObjects)
                currentNearObject.m_tempRemoveEarmark = frameCount;
            foreach (ZDO currentDistantObject in currentDistantObjects)
                currentDistantObject.m_tempRemoveEarmark = frameCount;

            __instance.m_tempRemoved.Clear();

            foreach (ZNetView znetView in __instance.m_instances.Values)
            {
                if (znetView.GetZDO().m_tempRemoveEarmark != frameCount)
                    __instance.m_tempRemoved.Add(znetView);
            }

            for (int index = 0; index < __instance.m_tempRemoved.Count; ++index)
            {
                ZNetView znetView = __instance.m_tempRemoved[index];

                ZDO zdo = znetView.GetZDO();

                znetView.ResetZDO();

                UnityEngine.Object.Destroy((UnityEngine.Object)znetView.gameObject);

                if (!zdo.m_persistent && zdo.IsOwner())
                    ZDOMan.instance.DestroyZDO(zdo);

                __instance.m_instances.Remove(zdo);
            }

            // Skip original code.
            return false;
        }