// Use this for initialization void Start () { Application.runInBackground = true; // Let the application be running while the window is not active. Debug.Log("LobbyController starting"); initGrids(); GameObject sharedES = GameObject.Find("SharedES"); SharedElectroServer gm = (SharedElectroServer)sharedES.GetComponent<SharedElectroServer>(); _es = gm.es; //_userName = gm.userName; _es.Engine.JoinRoomEvent += OnJoinRoom; /** * If you want to add chat in the lobby, you will need this line */ //_es.Engine.PublicMessageEvent += OnPublicMessage; _es.Engine.ConnectionClosedEvent += OnConnectionClosedEvent; _es.Engine.GenericErrorResponse += onGenericErrorResponse; _es.Engine.PluginMessageEvent += onPluginMessageEvent; Debug.Log("listeners added"); started = true; JoinRoom(); }
// Use this for initialization void Start () { Application.runInBackground = true; // Let the application be running while the window is not active. Debug.Log("GameController starting"); GameObject sharedES = GameObject.Find("SharedES"); SharedElectroServer gm = (SharedElectroServer)sharedES.GetComponent<SharedElectroServer>(); GameObject clockGobj = GameObject.Find("Clock"); clock = (Clock)clockGobj.GetComponent<Clock>(); _es = gm.es; me = gm.userName; _gameToJoin = gm.gameToJoin; _es.Engine.JoinRoomEvent += OnJoinRoom; _es.Engine.CreateOrJoinGameResponse += OnCreateOrJoinGameResponse; /** * If you want to add chat in the game, you will need this line */ //_es.Engine.PublicMessageEvent += OnPublicMessage; _es.Engine.ConnectionClosedEvent += OnConnectionClosedEvent; _es.Engine.GenericErrorResponse += onGenericErrorResponse; _es.Engine.PluginMessageEvent += onPluginMessageEvent; Debug.Log("listeners added"); started = true; initBoard(); JoinRoom(); }
public void Awake() { _renderLogin = true; // Allow Unity Application to run in background Application.runInBackground = true; /* * Init ES and instruct ES that events will be dispatched manually * (which is important for Unity based project communications) */ _es = new ElectroServer(); _es.Engine.Queueing = EsEngine.QueueDispatchType.External; /* * Register event listeners for ES messaging */ _es.Engine.ConnectionResponse += OnConnect; _es.Engine.LoginResponse += OnLogin; // Set default username _userName = ""; serverURL = host; serverPort = "" + port; }
public CServer() { es = new ElectroServer(); Debug.Log("Electro Server is created !!!"); es.Engine.ConnectionClosedEvent += OnConnectClosed; es.Engine.ConnectionResponse += OnConnectionResponse; es.Engine.LoginResponse += OnLoginResponse; es.Engine.ServerKickUserEvent += OnServerKickUser; es.Engine.GatewayKickUserRequest += OnGatewayKickUser; es.Engine.GenericErrorResponse += OnGenericError; es.Engine.PluginMessageEvent += OnPluginMessage; es.Engine.JoinRoomEvent += OnJoinRoom; es.Engine.LeaveRoomEvent += OnLeaveRoom; es.Engine.PublicMessageEvent += OnPublicMessage; es.Engine.CreateOrJoinGameResponse += OnCreateOrJoinGame; es.Engine.AddBuddiesResponse += OnAddBuddies; es.Engine.RemoveBuddiesResponse += OnRemoveBuddies; mustThreadConnecting = false; }
// We start working from here void Start() { Application.runInBackground = true; // Let the application be running while the window is not active. Debug.Log("NetworkController starting"); GameObject gameManager = GameObject.Find("_GameManager"); GameManager gm = (GameManager)gameManager.GetComponent<GameManager>(); _es = gm.es; _userName = gm.userName; gm.controller = this; //NOTE: if you modify this example to allow users to leave the scene without quitting the application //then you will need to remove the listeners before leaving the scene _es.Engine.JoinRoomEvent += OnJoinRoom; _es.Engine.PublicMessageEvent += OnPublicMessage; _es.Engine.ConnectionClosedEvent += OnConnectionClosedEvent; _es.Engine.GenericErrorResponse += onGenericErrorResponse; _es.Engine.PluginMessageEvent += onPluginMessageEvent; Log("listeners added"); started = true; JoinRoom(); }