// Token: 0x060007F4 RID: 2036 RVA: 0x0003EA27 File Offset: 0x0003CC27 public static ZDO Create(ZDOMan man, ZDOID id, Vector3 position) { ZDO zdo = ZDOPool.Get(); zdo.Initialize(man, id, position); return(zdo); }
// Token: 0x060007D0 RID: 2000 RVA: 0x0003D640 File Offset: 0x0003B840 private void HandleDestroyedZDO(ZDOID uid) { if (uid.userID == this.m_myid && uid.id >= this.m_nextUid) { this.m_nextUid = uid.id + 1U; } ZDO zdo = this.GetZDO(uid); if (zdo == null) { return; } if (this.m_onZDODestroyed != null) { this.m_onZDODestroyed(zdo); } this.RemoveFromSector(zdo, zdo.GetSector()); this.m_objectsByID.Remove(zdo.m_uid); ZDOPool.Release(zdo); foreach (ZDOMan.ZDOPeer zdopeer in this.m_peers) { zdopeer.m_zdos.Remove(uid); } if (ZNet.instance.IsServer()) { long ticks = ZNet.instance.GetTime().Ticks; this.m_deadZDOs[uid] = ticks; } }
// Token: 0x060007F6 RID: 2038 RVA: 0x0003EA48 File Offset: 0x0003CC48 public static void Release(Dictionary <ZDOID, ZDO> objects) { foreach (ZDO zdo in objects.Values) { ZDOPool.Release(zdo); } }
// Token: 0x060007F5 RID: 2037 RVA: 0x0003EA37 File Offset: 0x0003CC37 public static ZDO Create(ZDOMan man) { ZDO zdo = ZDOPool.Get(); zdo.Initialize(man); return(zdo); }
// 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); }
// 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; }
// Token: 0x060007B6 RID: 1974 RVA: 0x0003C8F4 File Offset: 0x0003AAF4 public void ShutDown() { if (!ZNet.instance.IsServer()) { this.FlushClientObjects(); } ZDOPool.Release(this.m_objectsByID); this.m_objectsByID.Clear(); this.m_tempToSync.Clear(); this.m_tempToSyncDistant.Clear(); this.m_tempNearObjects.Clear(); this.m_tempRemoveList.Clear(); this.m_peers.Clear(); this.ResetSectorArray(); GC.Collect(); }
// Token: 0x060007BA RID: 1978 RVA: 0x0003CD68 File Offset: 0x0003AF68 private void RemoveOldGeneratedZDOS() { List <ZDOID> list = new List <ZDOID>(); foreach (KeyValuePair <ZDOID, ZDO> keyValuePair in this.m_objectsByID) { int pgwversion = keyValuePair.Value.GetPGWVersion(); if (pgwversion != 0 && pgwversion != ZoneSystem.instance.m_pgwVersion) { list.Add(keyValuePair.Key); this.RemoveFromSector(keyValuePair.Value, keyValuePair.Value.GetSector()); ZDOPool.Release(keyValuePair.Value); } } foreach (ZDOID key in list) { this.m_objectsByID.Remove(key); } ZLog.Log("Removed " + list.Count + " OLD generated ZDOS"); }
// Token: 0x060004C5 RID: 1221 RVA: 0x0002659C File Offset: 0x0002479C private void Update() { if (Input.GetKeyDown(KeyCode.F2)) { this.m_root.gameObject.SetActive(!this.m_root.gameObject.activeSelf); } if (this.m_root.gameObject.activeInHierarchy) { if (!ZNet.instance.IsServer() && ZNet.GetConnectionStatus() == ZNet.ConnectionStatus.Connected) { this.m_serverField.gameObject.SetActive(true); this.m_serverField.text = ZNet.GetServerString(); } else { this.m_serverField.gameObject.SetActive(false); } this.m_worldField.text = ZNet.instance.GetWorldName(); this.UpdateFps(); this.m_myPort.gameObject.SetActive(ZNet.instance.IsServer()); this.m_myPort.text = ZNet.instance.GetHostPort().ToString(); this.m_myUID.text = ZNet.instance.GetUID().ToString(); if (ZDOMan.instance != null) { this.m_zdos.text = ZDOMan.instance.NrOfObjects().ToString(); float num; float num2; ZDOMan.instance.GetAverageStats(out num, out num2); this.m_zdosSent.text = num.ToString("0.0"); this.m_zdosRecv.text = num2.ToString("0.0"); this.m_activePeers.text = ZNet.instance.GetNrOfPlayers().ToString(); } this.m_zdosPool.text = string.Concat(new object[] { ZDOPool.GetPoolActive(), " / ", ZDOPool.GetPoolSize(), " / ", ZDOPool.GetPoolTotal() }); if (ZNetScene.instance) { this.m_zdosInstances.text = ZNetScene.instance.NrOfInstances().ToString(); } float num3; float num4; int num5; float num6; float num7; ZNet.instance.GetNetStats(out num3, out num4, out num5, out num6, out num7); this.m_dataSent.text = (num6 / 1024f).ToString("0.0") + "kb/s"; this.m_dataRecv.text = (num7 / 1024f).ToString("0.0") + "kb/s"; this.m_ping.text = num5.ToString("0") + "ms"; this.m_quality.text = ((int)(num3 * 100f)).ToString() + "% / " + ((int)(num4 * 100f)).ToString() + "%"; this.m_clientSendQueue.text = ZDOMan.instance.GetClientChangeQueue().ToString(); this.m_nrOfConnections.text = ZNet.instance.GetPeerConnections().ToString(); string text = ""; foreach (ZNetPeer znetPeer in ZNet.instance.GetConnectedPeers()) { if (znetPeer.IsReady()) { text = string.Concat(new object[] { text, znetPeer.m_socket.GetEndPointString(), " UID: ", znetPeer.m_uid, "\n" }); } else { text = text + znetPeer.m_socket.GetEndPointString() + " connecting \n"; } } this.m_connections.text = text; List <ZNet.PlayerInfo> playerList = ZNet.instance.GetPlayerList(); float num8 = 16f; if (playerList.Count != this.m_playerListElements.Count) { foreach (GameObject obj in this.m_playerListElements) { UnityEngine.Object.Destroy(obj); } this.m_playerListElements.Clear(); for (int i = 0; i < playerList.Count; i++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_playerElement, this.m_playerList); (gameObject.transform as RectTransform).anchoredPosition = new Vector2(0f, (float)i * -num8); this.m_playerListElements.Add(gameObject); } float num9 = (float)playerList.Count * num8; num9 = Mathf.Max(this.m_playerListBaseSize, num9); this.m_playerList.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, num9); this.m_playerListScroll.value = 1f; } for (int j = 0; j < playerList.Count; j++) { ZNet.PlayerInfo playerInfo = playerList[j]; Text component = this.m_playerListElements[j].transform.Find("name").GetComponent <Text>(); Text component2 = this.m_playerListElements[j].transform.Find("hostname").GetComponent <Text>(); Component component3 = this.m_playerListElements[j].transform.Find("KickButton").GetComponent <Button>(); component.text = playerInfo.m_name; component2.text = playerInfo.m_host; component3.gameObject.SetActive(false); } this.m_connectButton.interactable = this.ValidHost(); } }