void Start() { websocketConnection = gameObject.AddComponent <WebsocketConnection>(); connectionAgent = gameObject.AddComponent <ConnectionAgent>(); connectionAgent.connection = websocketConnection; game = GameObject.FindObjectOfType <Game>(); }
private bool Login(string connectionUrl, string authApiKey) { bool isConnected = false; ConnectionAgent = ConnectionAgentWebServer.GetInstance(connectionUrl, authApiKey); #if DEBUG isConnected = true; isConnected = ConnectionAgent.Connect(5000); #else isConnected = ConnectionAgent.Connect(5000); #endif return(isConnected); }
public static ConnectionAgent GetAgent() { lock (typeof(ChannelPool)) { if (_agent != null && _agent.GetChannel().IsConnected) { return(_agent); } TcpTransportChannel channel = new TcpTransportChannel("172.16.20.18", 20200); channel.Connect(); if (!channel.IsConnected) { return(null); } _agent = new ConnectionAgent(new MessageTransportChannel <BaseMessage>(channel, new BASProtocolStack()), Common.TransactionManager); return(_agent); } }
public void Init(int playerId, ConnectionAgent agent) { this.playerId = playerId; this.agent = agent; }