void Start() { // application has to run in background Application.runInBackground = true; // register all incoming events wsListener = new WebsocketListener(); wsListener.onReady += this.OnReady; wsListener.onClose += this.OnClose; wsListener.onMessage += this.OnMessage; wsListener.onDeviceStateChange += OnDeviceStateChange; wsListener.onConnect += OnConnect; wsListener.onDisconnect += OnDisconnect; wsListener.onCustomDeviceStateChange += OnCustomDeviceStateChange; wsListener.onDeviceProfileChange += OnDeviceProfileChange; // check if game is running in webgl build if (Application.platform != RuntimePlatform.WebGLPlayer) { // start websocket connection wsServer = new WebSocketServer(Settings.webSocketPort); wsServer.AddWebSocketService <WebsocketListener>(Settings.WEBSOCKET_PATH, () => wsListener); wsServer.Start(); if (Settings.debug.info) { Debug.Log("AirConsole: Dev-Server started!"); } } else { // call external javascript init function Application.ExternalCall("onGameReady", this.autoScaleCanvas); } }
void Start() { // application has to run in background #if UNITY_ANDROID && !UNITY_EDITOR Application.runInBackground = false; #else Application.runInBackground = true; #endif // register all incoming events #if UNITY_ANDROID InitWebView(); wsListener = new WebsocketListener(webViewObject); wsListener.onLaunchApp += OnLaunchApp; wsListener.onUnityWebviewResize += OnUnityWebviewResize; wsListener.onUnityWebviewPlatformReady += OnUnityWebviewPlatformReady; Screen.sleepTimeout = SleepTimeout.NeverSleep; #else wsListener = new WebsocketListener(); #endif wsListener.onReady += this.OnReady; wsListener.onClose += this.OnClose; wsListener.onMessage += this.OnMessage; wsListener.onDeviceStateChange += OnDeviceStateChange; wsListener.onConnect += OnConnect; wsListener.onDisconnect += OnDisconnect; wsListener.onCustomDeviceStateChange += OnCustomDeviceStateChange; wsListener.onDeviceProfileChange += OnDeviceProfileChange; wsListener.onAdShow += OnAdShow; wsListener.onAdComplete += OnAdComplete; wsListener.onGameEnd += OnGameEnd; // check if game is running in webgl build if (Application.platform != RuntimePlatform.WebGLPlayer && Application.platform != RuntimePlatform.Android) { // start websocket connection wsServer = new WebSocketServer(Settings.webSocketPort); wsServer.AddWebSocketService <WebsocketListener> (Settings.WEBSOCKET_PATH, () => wsListener); wsServer.Start(); if (Settings.debug.info) { Debug.Log("AirConsole: Dev-Server started!"); } } else { if (Application.platform == RuntimePlatform.WebGLPlayer) { // call external javascript init function Application.ExternalCall("onGameReady", this.autoScaleCanvas); } } }
void Start () { // application has to run in background #if UNITY_ANDROID && !UNITY_EDITOR Application.runInBackground = false; #else Application.runInBackground = true; #endif // register all incoming events #if UNITY_ANDROID InitWebView(); wsListener = new WebsocketListener(webViewObject); wsListener.onLaunchApp += OnLaunchApp; wsListener.onUnityWebviewResize += OnUnityWebviewResize; wsListener.onUnityWebviewPlatformReady += OnUnityWebviewPlatformReady; SceneManager.sceneLoaded += OnSceneLoaded; Screen.sleepTimeout = SleepTimeout.NeverSleep; #else wsListener = new WebsocketListener (); #endif wsListener.onReady += this.OnReady; wsListener.onClose += this.OnClose; wsListener.onMessage += this.OnMessage; wsListener.onDeviceStateChange += OnDeviceStateChange; wsListener.onConnect += OnConnect; wsListener.onDisconnect += OnDisconnect; wsListener.onCustomDeviceStateChange += OnCustomDeviceStateChange; wsListener.onDeviceProfileChange += OnDeviceProfileChange; wsListener.onAdShow += OnAdShow; wsListener.onAdComplete += OnAdComplete; wsListener.onGameEnd += OnGameEnd; wsListener.onHighScores += OnHighScores; wsListener.onHighScoreStored += OnHighScoreStored; wsListener.onPersistentDataStored += OnPersistentDataStored; wsListener.onPersistentDataLoaded += OnPersistentDataLoaded; wsListener.onPremium += OnPremium; // check if game is running in webgl build if (Application.platform != RuntimePlatform.WebGLPlayer && Application.platform != RuntimePlatform.Android) { // start websocket connection wsServer = new WebSocketServer (Settings.webSocketPort); wsServer.AddWebSocketService<WebsocketListener> (Settings.WEBSOCKET_PATH, () => wsListener); wsServer.Start (); if (Settings.debug.info) { Debug.Log ("AirConsole: Dev-Server started!"); } } else { if (Application.platform == RuntimePlatform.WebGLPlayer) { // call external javascript init function Application.ExternalCall ("onGameReady", this.autoScaleCanvas); } } }
void Start() { // application has to run in background Application.runInBackground = true; // register all incoming events wsListener = new WebsocketListener(); wsListener.onReady += this.OnReady; wsListener.onClose += this.OnClose; wsListener.onMessage += this.OnMessage; wsListener.onDeviceStateChange += OnDeviceStateChange; wsListener.onConnect += OnConnect; wsListener.onDisconnect += OnDisconnect; wsListener.onCustomDeviceStateChange += OnCustomDeviceStateChange; wsListener.onDeviceProfileChange += OnDeviceProfileChange; // check if game is running in webgl build if (Application.platform != RuntimePlatform.WebGLPlayer) { // start websocket connection wsServer = new WebSocketServer(Settings.webSocketPort); wsServer.AddWebSocketService<WebsocketListener>(Settings.WEBSOCKET_PATH, () => wsListener); wsServer.Start(); if (Settings.debug.info) { Debug.Log("AirConsole: Dev-Server started!"); } } else { // call external javascript init function Application.ExternalCall("onGameReady", this.autoScaleCanvas); } }