public override StateResult Finish(IAppContext context, float time) { var dataReposity = context.GetDataRepository(); var buildFirstCacheResult = dataReposity.GetContainer <BuildFirstCacheResult>(DataKey.BuildFirstCacheResult); var res = buildFirstCacheResult.Read(); var stateResult = new StateResult(); stateResult.NextStateCode = StateResult.Error; stateResult.Result = StateResult.Error; if (res.result == BuildFirstCacheResult.Ok) { PrefsUtil.SetInt(PrefsKeys.AssetBundleInitializedKey, 1); PrefsUtil.Flush(); MyLog.InfoWithFrame(Tag, "BuildFirstCacheResult ok."); stateResult.NextStateCode = TestLoginStateCode.SetPServerState; stateResult.Result = StateResult.Ok; return(stateResult); } MyLog.InfoWithFrame(Tag, "BuildFirstCacheResult Fail!"); stateResult.ErrMsg = res.error; return(stateResult); }
public override StateResult Finish(IAppContext context, float time) { var dataReposity = context.GetDataRepository(); var buildFirstCacheResult = dataReposity.GetContainer <BuildFirstCacheResult>(DataKey.BuildFirstCacheResult); var res = buildFirstCacheResult.Read(); var assetBundleManager = context.GetResourceManager(); var stateResult = new StateResult(); stateResult.NextStateCode = StateResult.Error; stateResult.Result = StateResult.Error; if (res.result == BuildFirstCacheResult.Ok) { var initAssetKey = assetBundleManager.GetAssetBundleInitializedKey(); PrefsUtil.SetInt(initAssetKey, 1); PrefsUtil.Flush(); MyLog.InfoWithFrame(Tag, "BuildFirstCacheResult ok."); stateResult.NextStateCode = NetworkState.DownloadResources; stateResult.Result = StateResult.Ok; return(stateResult); } MyLog.InfoWithFrame(Tag, "BuildFirstCacheResult Fail!"); stateResult.ErrMsg = res.error; return(stateResult); }
public void SetEffectEnable(bool enable) { PrefsUtil.SetInt(PrefsKeys.EffectEnable, enable ? 1 : 0); PrefsUtil.Flush(); if (EffectPlayer) { EffectPlayer.mute = !enable; } }
public void Confirm() { var saleChannel = SaleChannel.text; PrefsUtil.SetString(TestLoginRecord.TestSaleChannel, saleChannel); var product = Product.text; PrefsUtil.SetString(TestLoginRecord.TestProduct, product); int clientVersion = 0; if (int.TryParse(ClientVersion.text, out clientVersion)) { PrefsUtil.SetInt(TestLoginRecord.TestClientVersion, clientVersion); } else { GetDialogManager().ShowToast("ClientVersion不对", 2); return; } int platform = 0; if (int.TryParse(Platform.text, out platform)) { PrefsUtil.SetInt(TestLoginRecord.TestPlatform, platform); } else { GetDialogManager().ShowToast("Platform 不对", 2); return; } var lastUsername = LastVisitorUsername.text; LoginRecord.LastVisitorUsername = lastUsername; var lastVisitorId = LasVisitorId.text; LoginRecord.LastVisitorId = lastVisitorId; PrefsUtil.Flush(); _isSetTestClientVersion.Write(true, Time.time); Hide(); }
public void Confirm() { var ip = Ip.text; int port = 0; if (int.TryParse(Port.text, out port)) { PrefsUtil.SetString(TestLoginRecord.PServerTestLoginIp, ip); PrefsUtil.SetInt(TestLoginRecord.PServerTestLoginPort, port); PrefsUtil.Flush(); _isSetTestLogin.Write(true, Time.time); Hide(); } else { GetDialogManager().ShowToast("端口不对", 2); } }
/// <summary> /// 将host和port保存到PlayerPrefs中。 /// </summary> /// <param name="host"></param> /// <param name="port"></param> private void SavePIP(string host, int port) { PrefsUtil.SetString(LastHostKey, host); PrefsUtil.SetInt(LastPortKey, port); PrefsUtil.Flush(); }
public void OnGUI() { if (GUILayout.Button("清空登陆类型")) { PrefsUtil.SetInt(LoginRecord.LoginTypeKey, LoginRecord.NoLogin); PrefsUtil.Flush(); } if (GUILayout.Button("清空DeviceId和Username")) { PrefsUtil.SetString(LoginRecord.VisitorIdKey, ""); PrefsUtil.SetString(LoginRecord.VisitorUsernameKey, ""); PrefsUtil.Flush(); } if (GUILayout.Button("清空公告")) { PrefsUtil.SetString(BillboardPanel.BillboardContentKey, ""); PrefsUtil.SetLong(BillboardPanel.BillboardTimestampKey, 0); PrefsUtil.Flush(); } if (GUILayout.Button("清空选牌类型引导")) { PrefsUtil.SetBool(PrefsKeys.HasGuideSelectPoker, false); PrefsUtil.Flush(); } if (GUILayout.Button(("清空记录选牌的方式"))) { PrefsUtil.DeleteKey(PrefsKeys.XuanDanZhangKey); PrefsUtil.DeleteKey(PrefsKeys.HasGuideSelectPoker); PrefsUtil.Flush(); } if (GUILayout.Button("清空更新记录")) { PrefsUtil.DeleteKey(LoginRecord.DontUpdateDateKey); PrefsUtil.Flush(); } _content = EditorGUILayout.TextField("版本号", _content); if (GUILayout.Button("清空初始化Cache记录")) { PrefsUtil.SetString("InitAssetKey", _content);; var key = PrefsKeys.AssetBundleInitializedKey + _content; PrefsUtil.DeleteKey(key); PrefsUtil.Flush(); } if (GUILayout.Button("清空所有记录的更新的AssetBundle记录")) { //路径 var fullPath = Application.streamingAssetsPath; //获取指定路径下面的所有资源文件 if (Directory.Exists(fullPath)) { var direction = new DirectoryInfo(fullPath); var files = direction.GetFiles("*", SearchOption.AllDirectories); Debug.Log(files.Length); for (var i = 0; i < files.Length; i++) { if (files[i].Name.EndsWith(".meta") || files[i].Name.EndsWith(".manifest")) { continue; } PrefsUtil.DeleteKey(files[i].Name); PrefsUtil.Flush(); Debug.Log("已清空:" + files[i].Name); } } } }