protected override void DoHandle(VersionResult versionResult) { _versionResult.Write(versionResult, Time.time); // 如果成功获取VersionResult数据,则保存Launcher大图。 if (versionResult.result != ResultCode.OK) { return; } // version >= 6.4.0 不再处理SplashScreen的广告位。 // 保存游戏界面背景。 var inGameConfig = versionResult.in_game_config; if (inGameConfig != null) { PrefsUtil.SetString(BgConstant.GameBgKey, inGameConfig.game_bg); PrefsUtil.SetString(BgConstant.GameBgUrlKey, inGameConfig.game_bg_url); PrefsUtil.Flush(); } // 保存公告。 var billboard = versionResult.billboard_6_2; if (billboard != null) { PrefsUtil.SetString(BillboardPanel.BillboardContentKey, billboard.content); PrefsUtil.SetLong(BillboardPanel.BillboardTimestampKey, billboard.timestamp); PrefsUtil.Flush(); } }
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 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 void OnGUI() { if (GUILayout.Button("清空记录")) { PrefsUtil.DeleteKey(RankMeDialog.RankMeShowKey); PrefsUtil.DeleteKey(RankMeDialog.RankMeShowTimeKey); PrefsUtil.Flush(); } var shown = PrefsUtil.GetBool(RankMeDialog.RankMeShowKey, false); var newValue = EditorGUILayout.Toggle("已显示", shown); if (newValue != shown) { PrefsUtil.SetBool(RankMeDialog.RankMeShowKey, newValue); PrefsUtil.Flush(); } var time = PrefsUtil.GetLong(RankMeDialog.RankMeShowTimeKey, 0); EditorGUILayout.LabelField("显示时间: " + time); if (GUILayout.Button("设置为当前时间")) { PrefsUtil.SetLong(RankMeDialog.RankMeShowTimeKey, DateTime.Now.CurrentTimeMillis()); PrefsUtil.Flush(); } _days = EditorGUILayout.FloatField("天数变化", _days); if (GUILayout.Button("设置天数变化")) { time = PrefsUtil.GetLong(RankMeDialog.RankMeShowTimeKey, 0); PrefsUtil.SetLong(RankMeDialog.RankMeShowTimeKey, time + (long)(1000 * 3600 * 24 * _days)); PrefsUtil.Flush(); } }
/// <summary> /// 刷新内容其实是刷新是否有新内容这个事情。 /// </summary> private void RefreshContent() { var version = _versionResult.Read(); if (version == null) { return; } var billboard = version.billboard_6_2; if (billboard == null) { ShowSavedBillboard(); return; } var timestamp = PrefsUtil.GetLong(BillboardTimestampKey, 0); if (timestamp < billboard.timestamp) { // 更新公告栏的内容。 PrefsUtil.SetString(BillboardContentKey, billboard.content); PrefsUtil.SetLong(BillboardTimestampKey, billboard.timestamp); PrefsUtil.Flush(); } // 显示公告栏。 ShowSavedBillboard(); }
public void OnGUI() { EditorGUILayout.LabelField("公告栏时间戳", "" + PrefsUtil.GetLong(BillboardPanel.BillboardTimestampKey, 0)); // EditorGUILayout.LabelField("公告栏已读", PrefsUtil.GetBool(BillboardPanel.BillboardReadFlagKey, false) ? "是" : "否"); EditorGUILayout.LabelField("公告栏内容:"); var content = PrefsUtil.GetString(BillboardPanel.BillboardContentKey, null); if (!string.IsNullOrEmpty(content)) { EditorGUILayout.LabelField(content); } if (GUILayout.Button("清空公告板记录")) { PrefsUtil.DeleteKey(BillboardPanel.BillboardContentKey); PrefsUtil.DeleteKey(BillboardPanel.BillboardTimestampKey); // PrefsUtil.DeleteKey(BillboardPanel.BillboardReadFlagKey); PrefsUtil.Flush(); } if (GUILayout.Button("清空配置")) { PlayerPrefs.DeleteAll(); PlayerPrefs.Save(); } }
public void OnZhengLieToggleChange(bool isSelected) { if (isSelected) { PrefsUtil.SetBool(PrefsKeys.XuanDanZhangKey, false); PrefsUtil.Flush(); } }
public void SetEffectEnable(bool enable) { PrefsUtil.SetInt(PrefsKeys.EffectEnable, enable ? 1 : 0); PrefsUtil.Flush(); if (EffectPlayer) { EffectPlayer.mute = !enable; } }
public void SetBgmVolume(float volume) { var vol = Mathf.Clamp01(volume); PrefsUtil.SetFloat(PrefsKeys.BgmVolumeKey, vol); PrefsUtil.Flush(); if (BgmPlayer) { BgmPlayer.volume = vol; } }
public static void SaveAuthCode(string authCode) { if (string.IsNullOrEmpty(authCode)) { PrefsUtil.DeleteKey(WechatAuthCode); } else { PrefsUtil.SetString(WechatAuthCode, authCode); } PrefsUtil.Flush(); }
public static void SaveOpenId(string openId) { if (string.IsNullOrEmpty(openId)) { PrefsUtil.DeleteKey(WechatOpenId); } else { PrefsUtil.SetString(WechatOpenId, openId); } PrefsUtil.Flush(); }
public void SetEffectVolume(float volume) { var vol = Mathf.Clamp01(volume); PrefsUtil.SetFloat(PrefsKeys.EffectVolumeKey, vol); PrefsUtil.Flush(); if (EffectPlayer) { EffectPlayer.volume = vol; } }
public void Auth(string deviceId) { MyLog.InfoWithFrame(name, string.Format("Get deviceId {0}", deviceId)); _authResult = null; LoginRecord.RemoveOpenId(); LoginRecord.RemoveAuthCode(); PrefsUtil.Flush(); #if UNITY_ANDROID _android.WxAuth(deviceId); #endif #if UNITY_IOS _ios.WxAuth(deviceId); #endif }
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 SetBgmEnable(bool enable) { PrefsUtil.SetBool(PrefsKeys.BgmEnable, enable); PrefsUtil.Flush(); if (BgmPlayer) { if (enable) { PlayBgm(); } else { StopBgm(); } } }
public void GoRank() { _appId = GetConfigHolder().AppId; if (string.IsNullOrEmpty(_appId)) { return; } GetIosSDK().OpenUrl(string.Format("itms-apps://itunes.apple.com/app/id{0}", _appId)); // _ios.OpenProductPage(_appId, null); PrefsUtil.SetBool(RankMeShowKey, true); PrefsUtil.Flush(); GetAnalyticManager().Event("rank_me_panel_go"); 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); } }
public void Confirm() { PrefsUtil.SetBool(PrefsKeys.HasGuideSelectPoker, true); PrefsUtil.Flush(); Hide(); }
public static void RemoveOpenId() { PrefsUtil.DeleteKey(WechatOpenId); PrefsUtil.Flush(); }
/// <summary> /// 保存所有的属性。 /// </summary> public static void SaveAll() { 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); } } } }
public static void RemoveAuthCode() { PrefsUtil.DeleteKey(WechatAuthCode); PrefsUtil.Flush(); }
/// <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 override void AfterShow() { PrefsUtil.SetLong(RankMeShowTimeKey, DateTime.Now.CurrentTimeMillis()); PrefsUtil.Flush(); }
private IEnumerator DownloadResource() { var pip = _context.GetPIPLogic(); if (pip.IsTest()) { SetDownloadResourceResult(DownloadResourceResult.Ok, ""); yield break; } var data = pip.GetPIPData(); if (data == null) { SetDownloadResourceResult(DownloadResourceResult.Error, string.Format( "获取下载资源失败,请重新登陆\n【错误码{0}】)", NetworkStateErrorCode.DownloadResourcesFailCode)); yield break; } if (data.Assets != null && data.Assets.Length > 0) { var downloadAssetBundleInfo = new DownloadAssetBundleInfo(); downloadAssetBundleInfo.LoadType = DownloadAssetBundleInfo.DownloadType.Download; downloadAssetBundleInfo.TotalCount = data.Assets.Length; downloadAssetBundleInfo.CompleteCount = 0; foreach (var asset in data.Assets) { if (asset == null) { continue; } //已下载过相同版本 if (GetLastAssetVersion(asset.Asset) != null && GetLastAssetVersion(asset.Asset).Version == asset.Version) { continue; } _downloadAssetBundleInfo.Write(downloadAssetBundleInfo, Time.time); var req = UnityWebRequest.GetAssetBundle(asset.Url, (uint)asset.Version, (uint)0); req.SendWebRequest(); while (!req.isDone) { yield return(null); } if (req.isNetworkError || req.isHttpError) { MyLog.ErrorWithFrame(name, asset.Url + " download fail "); SetDownloadResourceResult(DownloadResourceResult.Error, string.Format( "下载资源失败,请重新登陆\n【错误码{0}】)", NetworkStateErrorCode.DownloadResourcesFailCode)); yield break; } try { var assetJson = JsonUtility.ToJson(asset); PrefsUtil.SetString(asset.Asset, assetJson); PrefsUtil.Flush(); downloadAssetBundleInfo.CompleteCount++; //只卸载没有被cache的临时的assetbundle if (!HasCached(asset.Asset)) { var assetBundle = DownloadHandlerAssetBundle.GetContent(req); if (assetBundle) { assetBundle.Unload(false); } } } catch (Exception e) { MyLog.ErrorWithFrame(name, asset.Url + " download fail with error :" + e); continue; } } } yield return(null); _downloadAssetBundleInfo.ClearAndInvalidate(Time.time); SetDownloadResourceResult(DownloadResourceResult.Ok, ""); MyLog.InfoWithFrame(name, " download all resource succ >>>>>>>>>>>>>>>>> UnloadAllAssetBundles >>>>>>>>>>>"); }
public void SetBgOn(bool on) { PrefsUtil.SetBool(BgConstant.EnableBgKey, on); PrefsUtil.Flush(); }
public void OnDanZhangModeChange() { PrefsUtil.SetBool(PrefsKeys.XuanDanZhangKey, DanZhangToggle.isOn); PrefsUtil.Flush(); }