//! Starts the server connection interface. Initializes the state listener. Captures the game product name public void Awake() { #if UNITY_EDITOR this.gameId = UnityEditor.PlayerSettings.productName; #else StringBuilder uniqueGameId = new StringBuilder(96); if (0 == GameInterface.getGameIdentifier(uniqueGameId, (uint)uniqueGameId.Capacity)) { this.gameId = uniqueGameId.ToString(); } else { this.gameId = ""; } #endif if (this.gameId.Equals("")) { Debug.LogError("Product name not set!"); } GameInterface.startServerInterface(); this.stateListener = new StateListener(); this.stateListener.HandleMessage += HandleStateUpdate; GameInterface.setHidden(); //analytics = EscAnalytics.Instance; //analytics.Initialize(KEYWORD_GAME_ENGINE, this.gameId, "1.0", false); //analytics.TrackGameSessionBegin(); }
/** * Initialize the client controller interface with the client's unique identifier and the server address. * Also, initializes a state listener to handle state updates * * @see Esc.Server * @see Esc.StateListner */ public void Awake() { this.server = new Server(GAME_ENGINE); this.clientIpAddress = Network.player.ipAddress; if ("" == ClientConnection.serverAddress) { ClientConnection.serverAddress = DEFAULT_SERVER_ADDRESS; } this.stateListener = new StateListener(); this.stateListener.HandleMessage += HandleStateUpdate; this.stateListener.Connect(); this.client = new Client(this.Udid()); ControllerInterface.startClientInterface(ClientConnection.serverAddress); }