public override Task <bool> OpenAsyncTask() { if (IsOpen) { throw new TTransportException(TTransportException.ExceptionType.AlreadyOpen, "Socket already connected"); } m_Socket = new WebGLSocket(); return(m_Socket.ConnectAsync(m_URL)); }
// Use this for initialization internal void Start() { UnityEngine.Application.targetFrameRate = 30; #if (UNITY_IOS || UNITY_ANDROID) && !(UNITY_EDITOR) QualitySettings.vSyncCount = 2; #endif try { if (!GameControler.IsInited) { // register to game thread ArkProfiler.RegisterOutput(LogicSystem.LogFromGfx); // register to gfx thread, output to game console ArkProfiler.RegisterOutput2(UnityEngine.Debug.Log); // register file read handler FileReaderProxy.RegisterReadFileHandler(EngineReadFileProxy, EngineFileExistsProxy); /// Unity Editor: <path_to_project_folder>/Assets /// iOS player: <path_to_player_app_bundle>/<AppName.app>/Data (this folder is read only, use Application.persistentDataPath to save data). /// Android: Normally it would point directly to the APK. The exception is if you are running a split binary build in which case it points to the the OBB instead. string dataPath = UnityEngine.Application.dataPath; /// Point to data path which have write permission string persistentDataPath = Application.persistentDataPath; /// Point to readonly data, note some platofrm like android points to compressed apk, witch cant be directory accesssed, use www. etc instead string streamingAssetsPath = UnityEngine.Application.streamingAssetsPath; /// Point to temp data path, may clean by system string tempPath = UnityEngine.Application.temporaryCachePath; LogicSystem.LogFromGfx("dataPath:{0} persistentDataPath:{1} streamingAssetsPath:{2} tempPath:{3}", dataPath, persistentDataPath, streamingAssetsPath, tempPath); Debug.Log(string.Format("dataPath:{0} persistentDataPath:{1} streamingAssetsPath:{2} tempPath:{3}", dataPath, persistentDataPath, streamingAssetsPath, tempPath)); // store log in tempPath, others to persistentDataPath #if !UNITY_EDITOR GlobalVariables.Instance.IsDevice = true; #else // if in editor, use streamingAssetsPath instead GlobalVariables.Instance.IsDevice = false; #endif #if UNITY_ANDROID || UNITY_WEBGL if (!UnityEngine.Application.isEditor) { streamingAssetsPath = persistentDataPath + "/Tables"; } #endif #if UNITY_WEBGL // init web socket before gamelogic initialize m_WebSocket = new WebGLSocket(); ArkCrossEngine.Network.WebSocketWrapper.Instance.SetInstance(m_WebSocket); #endif LogSystem.OnOutput2 = (Log_Type type, string msg) => { #if DEBUG if (Log_Type.LT_Error == type) { UnityEngine.Debug.LogError(msg); } else if (Log_Type.LT_Info != type) { UnityEngine.Debug.LogWarning(msg); } #endif }; GameControler.Init(tempPath, streamingAssetsPath); NormLog.Instance.Init(); NormLog.Instance.Record(GameEventCode.GameStart); LogicSystem.LogFromGfx("game log saved to: {0}", tempPath); } // try preload all skills used by npc in spec scene, also character LogicSystem.OnAfterLoadScene += AfterLoadScene; } catch (Exception ex) { LogicSystem.LogErrorFromGfx("GameLogic.Start throw exception:{0}\n{1}", ex.Message, ex.StackTrace); Debug.Log(string.Format("GameLogic.Start throw exception:{0}\n{1}", ex.Message, ex.StackTrace)); } }