// Use this for initialization public void Start() { if (!GameSettings.Singleton.m_isSingle) { ShortConnect.Connect(GameSettings.Singleton.ServerIP, 10124, false); } }
// Update is called once per frame public void Update() { if (!GameSettings.Singleton.m_isSingle) { ShortConnect.Update(this); LongConnect.Update(this); } }
public static void CreateSesion(ShortNetPack sendPack, Action <ShortNetPack> callback) { if (m_parentGameObject == null) { m_parentGameObject = new GameObject("ShortConnectMgr"); GameObject.DontDestroyOnLoad(m_parentGameObject); } string sesionName = "Sesion" + (m_parentGameObject.transform.childCount + 1).ToString(); GameObject sesionGo = new GameObject(sesionName); sesionGo.transform.parent = m_parentGameObject.transform; ShortConnect connect = sesionGo.AddComponent <ShortConnect>(); byte[] msgData = connect.BuildMsgPack(sendPack); connect.StartConnect(msgData, callback); }
public void SendPacket(Packet p, ENConnectionType type = ENConnectionType.enShortConnect) { if (GameSettings.Singleton.m_isSingle) { VirtualServer.Singleton.ProcessMessage(p); } else { switch (type) { case ENConnectionType.enLongConnect: LongConnect.SendPacket(p); break; case ENConnectionType.enShortConnect: default: ShortConnect.SendPacket(p); break; } Debug.Log("Send Msg ,id = " + p.PacketID + " type:" + type); } }