void checkDel() { List <int> delList = new List <int>(); for (int i = 0; i < socketUsedIDList.Count; i++) { if (socketList[socketUsedIDList[i]].del || !socketList[socketUsedIDList[i]].socket.Connected) { socketList[socketUsedIDList[i]].del = false; delList.Add(i); } } for (int i = 0; i < delList.Count; i++) { int id = socketUsedIDList[delList[i]]; SocketData so = socketList[id]; AddFreeID(id); Debug.Log("Disconnect from Game " + id); while (so.channels.Count > 0) { channel c = ChannelObjectList[so.channels[0]].GetComponent <channel>(); if (c != null) { c.UnregisterEntity(id); } } } }
void UnregisterEntity(int contID) { GameObject g = Channel.GetEntity(contID); Channel.UnregisterEntity(contID); if (g != null) { Destroy(g); } if (Channel.GetNetwork().IsClient() == false) { network_data.disconnect m = new network_data.disconnect(); m.set(contID, Channel.GetChannel()); byte[] data1 = network_utils.nData.Instance.SerializeMsg <network_data.disconnect>(m); Channel.SendToChannel(ref data1); } }