//--------------------------------------------------------------------- public PathMgr(_eEditorRunSourcePlatform editor_mode_runsources_platform, bool use_persistent) { UsePersistent = use_persistent; #if !UNITY_EDITOR UsePersistent = true; #endif EditorModeRunsourcesPlatform = editor_mode_runsources_platform; switch (EditorModeRunsourcesPlatform) { case _eEditorRunSourcePlatform.Android: NeedCombinePath = "ANDROID"; break; case _eEditorRunSourcePlatform.IOS: NeedCombinePath = "IOS"; break; case _eEditorRunSourcePlatform.PC: NeedCombinePath = "PC"; break; default: break; } // PathAssets { string p = Path.Combine(Environment.CurrentDirectory, "./Assets/"); var di = new DirectoryInfo(p); PathAssets = di.FullName; } // PathSettings { string p = Path.Combine(Environment.CurrentDirectory, "./Assets/Settings/"); var di = new DirectoryInfo(p); PathSettings = di.FullName; } // PathSettingsUser { string p = Path.Combine(Environment.CurrentDirectory, "./Assets/SettingsUser/"); var di = new DirectoryInfo(p); PathSettingsUser = di.FullName; } PathLuaRootPersistent = combinePersistentDataPath("Script.Lua/"); PathLaunchRootPersistent = combinePersistentDataPath("Resources.KingTexasLaunch/"); { string p = Path.Combine(Environment.CurrentDirectory, "./Assets/Script.Lua/"); var di = new DirectoryInfo(p); PathLuaRootAssets = di.FullName; } }
} // Launch配置信息 //--------------------------------------------------------------------- public CasinosConfig(_eEditorRunSourcePlatform editor_mode_runsources_platform) { switch (editor_mode_runsources_platform) { case _eEditorRunSourcePlatform.Android: Platform = "ANDROID"; break; case _eEditorRunSourcePlatform.IOS: Platform = "IOS"; break; case _eEditorRunSourcePlatform.PC: Platform = "PC"; break; default: break; } Channel = ""; GoMain = GameObject.Find(StringDef.GoMainObj); VersionBundle = Application.version; // 读取VersionCommonPersistent VersionCommonPersistent = string.Empty; if (PlayerPrefs.HasKey("VersionCommonPersistent")) { VersionCommonPersistent = PlayerPrefs.GetString("VersionCommonPersistent"); } // 读取VersionDataPersistent VersionDataPersistent = string.Empty; if (PlayerPrefs.HasKey("VersionDataPersistent")) { VersionDataPersistent = PlayerPrefs.GetString("VersionDataPersistent"); } var launch_info = Resources.Load("LaunchInfo") as TextAsset; LaunchInfoResources = JsonUtility.FromJson <LaunchInfo>(launch_info.text); }
//--------------------------------------------------------------------- public CasinosConfig(_eEditorRunSourcePlatform editor_mode_runsources_platform) { switch (editor_mode_runsources_platform) { case _eEditorRunSourcePlatform.Android: Platform = "ANDROID"; break; case _eEditorRunSourcePlatform.IOS: Platform = "IOS"; break; case _eEditorRunSourcePlatform.PC: Platform = "PC"; break; default: break; } VersionBundle = Application.version; }
//--------------------------------------------------------------------- public PathMgr(_eEditorRunSourcePlatform editor_mode_runsources_platform) { Sb = new StringBuilder(256); EditorModeRunsourcesPlatform = editor_mode_runsources_platform; switch (EditorModeRunsourcesPlatform) { case _eEditorRunSourcePlatform.Android: CombinePlatform = "ANDROID"; break; case _eEditorRunSourcePlatform.IOS: CombinePlatform = "IOS"; break; case _eEditorRunSourcePlatform.PC: CombinePlatform = "PC"; break; default: break; } // WWWPersistentDataPath { WWWPersistentDataPath = #if UNITY_STANDALONE_WIN && UNITY_EDITOR "file:///" + Application.persistentDataPath + "/" + CombinePlatform; #elif UNITY_ANDROID && UNITY_EDITOR "file:///" + Application.persistentDataPath + "/" + CombinePlatform; #elif UNITY_IPHONE && UNITY_EDITOR "file:///" + Application.persistentDataPath + "/" + CombinePlatform; #elif UNITY_ANDROID "file:///" + Application.persistentDataPath; #elif UNITY_IPHONE "file:///" + Application.persistentDataPath; #else string.Empty; #endif } // PersistentDataPath { PersistentDataPath = #if UNITY_STANDALONE_WIN && UNITY_EDITOR Application.persistentDataPath + "/" + CombinePlatform; #elif UNITY_ANDROID && UNITY_EDITOR Application.persistentDataPath + "/" + CombinePlatform; #elif UNITY_IPHONE && UNITY_EDITOR Application.persistentDataPath + "/" + CombinePlatform; #elif UNITY_ANDROID Application.persistentDataPath; #elif UNITY_IPHONE Application.persistentDataPath; #else string.Empty; #endif } // StreamingAssetsPath { StreamingAssetsPath = #if UNITY_EDITOR Application.streamingAssetsPath; #elif UNITY_IPHONE Application.streamingAssetsPath; #elif UNITY_ANDROID Application.streamingAssetsPath; #endif StreamingAssetsPath += "/" + EditorModeRunsourcesPlatform.ToString(); } // WWWStreamingAssetsPath { WWWStreamingAssetsPath = #if UNITY_EDITOR "file:///" + Application.streamingAssetsPath; #elif UNITY_IPHONE "file:///" + Application.streamingAssetsPath; #elif UNITY_ANDROID "jar:file://" + Application.dataPath + "!/assets"; #endif WWWStreamingAssetsPath += "/" + EditorModeRunsourcesPlatform.ToString(); } // PathAssets { string p = Path.Combine(Environment.CurrentDirectory, "./Assets/"); var di = new DirectoryInfo(p); PathAssets = di.FullName; } // PathSettings { string p = Path.Combine(Environment.CurrentDirectory, "./Assets/Settings/"); var di = new DirectoryInfo(p); PathSettings = di.FullName; } // PathSettingsUser { string p = Path.Combine(Environment.CurrentDirectory, "./Assets/SettingsUser/"); var di = new DirectoryInfo(p); PathSettingsUser = di.FullName; } }
//--------------------------------------------------------------------- public CasinosContext(CasinosListener listener, bool use_persistent, string lua_project_listener_name, string ui_pathroot, string resourcesrow_pathroot, string ab_resource_title, string lotteryticket_factoryname) { _eEditorRunSourcePlatform editor_runsorce = _eEditorRunSourcePlatform.Android; #if UNITY_STANDALONE_WIN editor_runsorce = _eEditorRunSourcePlatform.PC; #elif UNITY_ANDROID && UNITY_EDITOR editor_runsorce = _eEditorRunSourcePlatform.Android; #elif UNITY_ANDROID editor_runsorce = _eEditorRunSourcePlatform.Android; #elif UNITY_IPHONE editor_runsorce = _eEditorRunSourcePlatform.IOS; #endif Instance = this; ABResourcePathTitle = ab_resource_title; ResourcesRowPathRoot = resourcesrow_pathroot; UiPathRoot = ui_pathroot; WeiChatIsInstalled = true; ShowWeiChat = true; UseBindPhoneAndWeiChat = false; LuaProjectListenerName = lua_project_listener_name; LotteryTicketFactoryName = lotteryticket_factoryname; UseLan = true; _checkLan(); #if UNITY_EDITOR IsEditor = true; #else IsEditor = false; #endif #if UNITY_IPHONE || UNITY_STANDALONE_OSX || UNITY_DASHBOARD_WIDGET || UNITY_STANDALONE_LINUX || UNITY_WEBPLAYER IsSqliteUnity = true; #else IsSqliteUnity = false; #endif #if IsDev IsDev = true; #else IsDev = false; #endif #if UNITY_IOS PlatformName = "IOS"; string version = UnityEngine.iOS.Device.systemVersion; var arr_version = version.Split('.'); int first_version_code = 0; if (arr_version.Length > 0) { int.TryParse(arr_version[0].ToString(), out first_version_code); } if (first_version_code < 9) { UseHttps = false; } else { UseHttps = true; } UnityIOS = true; UnityAndroid = false; #elif UNITY_ANDROID PlatformName = "ANDROID"; UseHttps = false; UnityAndroid = true; UnityIOS = false; #elif UNITY_STANDALONE_WIN PlatformName = "PC"; #endif NativeMgr = new NativeMgr(); PathMgr = new PathMgr(editor_runsorce, use_persistent);// 初始化PathMgr FTMgr = new FTMgr(); Stopwatch = new System.Diagnostics.Stopwatch(); Stopwatch.Start(); TimerShaft = new TimerShaft(); Listener = listener; MemoryStream = new MemoryStream(); SB = new StringBuilder(); Config = new CasinosConfig(editor_runsorce); //Config = GameObject.FindObjectOfType<MbCasinosConfig>(); //Config.FormatConfigUrl(); //UserConfig = GameObject.FindObjectOfType<MbCasinosUserConfig>(); // 初始化系统参数 { #if UNITY_EDITOR Application.runInBackground = false; Screen.sleepTimeout = SleepTimeout.SystemSetting; #else Application.runInBackground = true; Screen.sleepTimeout = SleepTimeout.NeverSleep; #endif Time.fixedDeltaTime = 0.03f; QualitySettings.vSyncCount = 1; //Application.targetFrameRate = 30; } // 初始化日志 { EbLog.NoteCallback = Debug.Log; EbLog.WarningCallback = Debug.LogWarning; EbLog.ErrorCallback = Debug.LogError; } if (NativeAPIMsgReceiverListner == null) { NativeAPIMsgReceiverListner = new NativeAPIMsgReceiverListener(); } if (AsyncAssetLoaderMgr == null) { AsyncAssetLoaderMgr = new AsyncAssetLoaderMgr(); } AsyncAssetLoadGroup = AsyncAssetLoaderMgr.createAsyncAssetLoadGroup(); NetBridge = new NetBridge(); PlayerPrefs = new CasinosPlayerPrefs(); TextureMgr = new TextureMgr(); UIObjectFactory.SetLoaderExtension(typeof(GLoaderEx)); CasinosLua = new CasinosLua(); SoundMgr = new CSoundMgr(); HeadIconMgr = new HeadIconMgr(); //CopyStreamingAssetsToPersistentDataPath = new CopyStreamingAssetsToPersistentDataPath(); //Launch = new Launch(); }
//--------------------------------------------------------------------- public CasinosContext(bool force_use_resouceslaunch, bool force_use_dataoss) { Instance = this; _eEditorRunSourcePlatform editor_runsorce = _eEditorRunSourcePlatform.Android; #if UNITY_STANDALONE_WIN editor_runsorce = _eEditorRunSourcePlatform.PC; #elif UNITY_ANDROID && UNITY_EDITOR editor_runsorce = _eEditorRunSourcePlatform.Android; #elif UNITY_ANDROID editor_runsorce = _eEditorRunSourcePlatform.Android; #elif UNITY_IPHONE editor_runsorce = _eEditorRunSourcePlatform.IOS; #endif #if UNITY_EDITOR IsEditor = true; #else IsEditor = false; #endif #if UNITY_IPHONE || UNITY_STANDALONE_OSX || UNITY_DASHBOARD_WIDGET || UNITY_STANDALONE_LINUX || UNITY_WEBPLAYER IsSqliteUnity = true; #else IsSqliteUnity = false; #endif #if UNITY_IOS string version = UnityEngine.iOS.Device.systemVersion; var arr_version = version.Split('.'); int first_version_code = 0; if (arr_version.Length > 0) { int.TryParse(arr_version[0].ToString(), out first_version_code); } if (first_version_code < 9) { UseHttps = false; } else { UseHttps = true; } UnityIOS = true; UnityAndroid = false; #elif UNITY_ANDROID UseHttps = false; UnityAndroid = true; UnityIOS = false; #elif UNITY_STANDALONE_WIN #endif Stopwatch = new System.Diagnostics.Stopwatch(); Stopwatch.Start(); TimerShaft = new TimerShaft(); MemoryStream = new MemoryStream(); SB = new StringBuilder(); FTMgr = new FTMgr(); PathMgr = new PathMgr(editor_runsorce, force_use_resouceslaunch, force_use_dataoss);// 初始化PathMgr Config = new CasinosConfig(editor_runsorce); NativeMgr = new NativeMgr(); SpineMgr = new SpineMgr(); // 初始化系统参数 { #if UNITY_EDITOR Application.runInBackground = false; Screen.sleepTimeout = SleepTimeout.SystemSetting; QualitySettings.vSyncCount = 0; Application.targetFrameRate = -1; #else Application.runInBackground = true; Screen.sleepTimeout = SleepTimeout.NeverSleep; QualitySettings.vSyncCount = 1; Application.targetFrameRate = 60; #endif } if (NativeAPIMsgReceiverListner == null) { NativeAPIMsgReceiverListner = new NativeAPIMsgReceiverListener(); } if (AsyncAssetLoaderMgr == null) { AsyncAssetLoaderMgr = new AsyncAssetLoaderMgr(); } AsyncAssetLoadGroup = AsyncAssetLoaderMgr.createAsyncAssetLoadGroup(); NetMgr = new NetMgr(); PlayerPrefs = new CasinosPlayerPrefs(); TextureMgr = new TextureMgr(); UIObjectFactory.SetLoaderExtension(typeof(GLoaderEx)); LuaMgr = new LuaMgr(); SoundMgr = new SoundMgr(); HeadIconMgr = new HeadIconMgr(); }