public static AppNameConfigData Load() { if (!Directory.Exists(mConfigSavedDir)) { Directory.CreateDirectory(mConfigSavedDir); } if (!File.Exists(mConfigSavedDir + mConfigSavedFileName)) { var fileStream = File.Create(mConfigSavedDir + mConfigSavedFileName); fileStream.Close(); } AssetDatabase.Refresh(); var retConfigData = new AppNameConfigData(); var localizeConfig = SerializeHelper.LoadJson <LocalizeConfig> (mConfigSavedDir + mConfigSavedFileName); if (localizeConfig == null || localizeConfig.LanguageDatas == null || localizeConfig.LanguageDatas.Length == 0) { retConfigData.SupportedLanguageItems.Add(new LanguageData(4, Application.productName)); } else { retConfigData.SupportedLanguageItems.AddRange(localizeConfig.LanguageDatas); } return(retConfigData); }
public static PackageInfosRequestCache Get() { if (File.Exists(mFilePath)) { return(SerializeHelper.LoadJson <PackageInfosRequestCache>(mFilePath)); } return(new PackageInfosRequestCache()); }
public static FrameworkLocalVersion Get() { if (!File.Exists(SavedFilePath)) { return(new FrameworkLocalVersion()); } return(SerializeHelper.LoadJson <FrameworkLocalVersion>(SavedFilePath)); }
public static void Reload() { mPackageVersions.Clear(); var versionFiles = Array.FindAll(AssetDatabase.GetAllAssetPaths(), name => name.EndsWith("PackageVersion.json")); versionFiles.ForEach(fileName => { mPackageVersions.Add(SerializeHelper.LoadJson <PackageVersion>(fileName)); }); }
public static PackageVersion Load(string filePath) { if (filePath.EndsWith("/")) { filePath += "PackageVersion.json"; } else if (!filePath.EndsWith("PackageVersion.json")) { filePath += "/PackageVersion.json"; } return(SerializeHelper.LoadJson <PackageVersion>(filePath)); }
/// <summary> /// 异步的 /// </summary> public static void Get() { // 服务器里获取版本 // 假装 WebPlayerTemplates 是服务器 // 服务器的版本文件 var remoteJsonPath = Application.dataPath + "/WebPlayerTemplates/HotfixServer/hotfix.json"; Version = SerializeHelper.LoadJson <DLLVersion>(remoteJsonPath); Debug.Log("ServerJsonPath:" + Version.Version); }
public static PermissionConfig Load() { if (!Directory.Exists(mConfigSavedDir)) { Directory.CreateDirectory(mConfigSavedDir); } if (!File.Exists(mConfigSavedDir + mConfigSavedFileName)) { var fileStream = File.Create(mConfigSavedDir + mConfigSavedFileName); fileStream.Close(); } AssetDatabase.Refresh(); return(SerializeHelper.LoadJson <PermissionConfig> (mConfigSavedDir + mConfigSavedFileName)); }
public static QFrameworkConfigData Load() { mConfigSavedDir.CreateDirIfNotExists(); if (!File.Exists(mConfigSavedDir + mConfigSavedFileName)) { using (var fileStream = File.Create(mConfigSavedDir + mConfigSavedFileName)) { fileStream.Close(); } } var frameworkConfigData = SerializeHelper.LoadJson <QFrameworkConfigData>(mConfigSavedDir + mConfigSavedFileName); if (frameworkConfigData == null || string.IsNullOrEmpty(frameworkConfigData.Namespace)) { frameworkConfigData = new QFrameworkConfigData(); frameworkConfigData.Namespace = "QFramework.Example"; } return(frameworkConfigData); }
public static void Load() { // 获取本地的版本 // 从哪里获取 本地版本号 // 2. persistentDataPath // 从来没更新过就从 stream 加载 // 更新过 从 persistentDataPath // 怎么判断是否进行更新过 // 1. streamingAssetsPath var versionJsonPath = Application.streamingAssetsPath + "/" + AssetBundleSettings.GetPlatformForAssetBundles(Application.platform) + "/hotfix/hotfix.json"; var version = SerializeHelper.LoadJson <DLLVersion>(versionJsonPath); Version = version; Debug.Log("Local Version Loded:" + version.Version); }
public static FrameworkConfigData Load() { IOUtils.CreateDirIfNotExists(mConfigSavedDir); if (!File.Exists(mConfigSavedDir + mConfigSavedFileName)) { using (var fileStream = File.Create(mConfigSavedDir + mConfigSavedFileName)) { fileStream.Close(); } } var frameworkConfigData = SerializeHelper.LoadJson <FrameworkConfigData>(mConfigSavedDir + mConfigSavedFileName); if (frameworkConfigData == null || string.IsNullOrEmpty(frameworkConfigData.Namespace)) { frameworkConfigData = new FrameworkConfigData(); frameworkConfigData.Namespace = "Putao.ProjectName"; } return(frameworkConfigData); }
private void Start() { var tempProto = new ProtoBufTest { ID = 1, Msg = "Hello" }; var tempJson = new JsonTest { Age = 18 }; this.Sequence() .Until(() => { return(Input.GetKeyDown(KeyCode.P)); }) .Event(() => { string path = "Assets/TestJosn".CreateDirIfNotExists(); path += "/testPro.proto"; tempProto.SaveProtoBuff(path); }) .Begin(); this.Sequence() .Until(() => { return(Input.GetKeyDown(KeyCode.O)); }) .Event(() => { ProtoBufTest tempLoadBuf = SerializeHelper.LoadProtoBuff <ProtoBufTest>(Application.dataPath + "/TestJosn/testPro.proto"); Debug.Log(tempLoadBuf.ID); }) .Begin(); this.Sequence() .Until(() => { return(Input.GetKeyDown(KeyCode.A)); }) .Event(() => { string path = "Assets/TestJosn".CreateDirIfNotExists(); path += "/TestJson.json"; tempJson.SaveJson(path); }) .Begin(); this.Sequence() .Until(() => { return(Input.GetKeyDown(KeyCode.S)); }) .Event(() => { JsonTest tempLoadJson = SerializeHelper.LoadJson <JsonTest>(Application.dataPath + "/TestJosn/TestJson.json"); Debug.Log(tempLoadJson.Age); }) .Begin(); }
public static FrameworkLocalVersion Get() { return(SerializeHelper.LoadJson <FrameworkLocalVersion>(SavedFilePath)); }