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(); } }
private PwGroupView(GroupBaseActivity act, PwGroup pw) : base(act) { _groupBaseActivity = act; View gv = Inflate(act, Resource.Layout.group_list_entry, null); _textview = (TextView)gv.FindViewById(Resource.Id.group_text); float size = PrefsUtil.GetListTextSize(act); _textview.TextSize = size; _label = (TextView)gv.FindViewById(Resource.Id.group_label); _label.TextSize = size - 8; Database db = App.Kp2a.FindDatabaseForElement(pw); gv.FindViewById(Resource.Id.group_icon_bkg).Visibility = db.DrawableFactory.IsWhiteIconSet ? ViewStates.Visible : ViewStates.Gone; gv.FindViewById(Resource.Id.icon).Visibility = ViewStates.Visible; gv.FindViewById(Resource.Id.check_mark).Visibility = ViewStates.Invisible; PopulateView(gv, pw); LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent); AddView(gv, lp); }
private void MayShowRankMeDialog() { #if UNITY_IOS var featureSwitch = _featureSwitch.Read(); var isEnableRating = featureSwitch.rating; if (!isEnableRating) { return; } var shown = PrefsUtil.GetBool(RankMeDialog.RankMeShowKey, false); if (shown) { return; } var time = PrefsUtil.GetLong(RankMeDialog.RankMeShowTimeKey, 0); var nowTime = DateTime.Now.CurrentTimeMillis(); // 改回一天。 var dayTime = 1000 * 3600 * 24; if (nowTime - time > dayTime) { _dialogManager.ShowDialog <RankMeDialog>(DialogName.RankMeDialog); } #endif }
private PwEntryView(GroupBaseActivity groupActivity, PwEntry pw, int pos) : base(groupActivity) { _groupActivity = groupActivity; View ev = Inflate(groupActivity, Resource.Layout.entry_list_entry, null); _textView = (TextView)ev.FindViewById(Resource.Id.entry_text); _textView.TextSize = PrefsUtil.GetListTextSize(groupActivity); ev.FindViewById(Resource.Id.entry_icon_bkg).Visibility = App.Kp2a.GetDb().DrawableFactory.IsWhiteIconSet ? ViewStates.Visible : ViewStates.Gone; _textviewDetails = (TextView)ev.FindViewById(Resource.Id.entry_text_detail); _textviewDetails.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity); _textgroupFullPath = (TextView)ev.FindViewById(Resource.Id.group_detail); _textgroupFullPath.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity); _showDetail = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean( groupActivity.GetString(Resource.String.ShowUsernameInList_key), Resources.GetBoolean(Resource.Boolean.ShowUsernameInList_default)); _showGroupFullPath = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean( groupActivity.GetString(Resource.String.ShowGroupnameInSearchResult_key), Resources.GetBoolean(Resource.Boolean.ShowGroupnameInSearchResult_default)); _isSearchResult = _groupActivity is keepass2android.search.SearchResults; PopulateView(ev, pw, pos); LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); AddView(ev, lp); }
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); }
/// <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 override void Initialize(IAppContext context, float time) { var network = NetworkType.NetworkTypeOf(Application.internetReachability); var remoteAPI = context.GetRemoteAPI(); var configHolder = context.GetConfigHolder(); var dialog = context.GetDialogManager(); var clientVersion = PrefsUtil.GetInt(TestLoginRecord.TestClientVersion, 0); var platform = PrefsUtil.GetInt(TestLoginRecord.TestPlatform, 0); var saleChannel = PrefsUtil.GetString(TestLoginRecord.TestSaleChannel, null); var product = PrefsUtil.GetString(TestLoginRecord.TestProduct, null); // 发送ClientVersion命令。 remoteAPI.GetVersionData( clientVersion, // 如果传给服务器端的是null,则服务器端会设置成默认的渠道。 // 所以不必担心,直接使用SaleChannel。 saleChannel, product, platform, network, SystemInfo.deviceModel, GetDeviceId(context) ); }
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 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 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(); } }
public void OnZhengLieToggleChange(bool isSelected) { if (isSelected) { PrefsUtil.SetBool(PrefsKeys.XuanDanZhangKey, false); PrefsUtil.Flush(); } }
public override void BeforeShow() { var xuanDanZhang = PrefsUtil.GetBool(PrefsKeys.XuanDanZhangKey, false); DanZhangToggle.isOn = xuanDanZhang; ZhengLieToggle.isOn = !xuanDanZhang; DanZhangToggle.onValueChanged.AddListener(OnDanZhangToggleChange); ZhengLieToggle.onValueChanged.AddListener(OnZhengLieToggleChange); }
/** * 用户登录回复 */ public object loginAck(byte[] data) { UserLoginAck loginAction = UserLoginAck.Parser.ParseFrom(data); PrefsUtil.Set(PrefsUtil.ServiceId, loginAction.ServiceId); Debug.Log("登录成功!"); return(loginAction); }
public void SetEffectEnable(bool enable) { PrefsUtil.SetInt(PrefsKeys.EffectEnable, enable ? 1 : 0); PrefsUtil.Flush(); if (EffectPlayer) { EffectPlayer.mute = !enable; } }
protected internal void initVal() { // ID Text IDText = settingView.Find <Text>("ID"); IDText.text = UserManager.getUserInfoFromUserDefault().id.ToString(); // Music Status int MusicStatus = PrefsUtil.GetInt("setting_music") > 0 ? PrefsUtil.GetInt("setting_music") : 0; Text MusicStatusText = settingView.Find <Text>("Option_Music/Status"); MusicStatusText.text = MusicStatus > 0 ? "开" : "关"; Image MusicStatusImg = settingView.Find <Image>("Option_Music/Button"); if (MusicStatus > 0) { MusicStatusImg.SetLocalImage("Textures/main/setting_btn_open"); } else { MusicStatusImg.SetLocalImage("Textures/main/setting_btn_close"); } // Sound Status int SoundStatus = PrefsUtil.GetInt("setting_sound") > 0 ? PrefsUtil.GetInt("setting_sound") : 0; Text SoundStatusText = settingView.Find <Text>("Option_Sound/Status"); SoundStatusText.text = SoundStatus > 0 ? "开" : "关"; Image SoundStatusImg = settingView.Find <Image>("Option_Sound/Button"); if (SoundStatus > 0) { SoundStatusImg.SetLocalImage("Textures/main/setting_btn_open"); } else { SoundStatusImg.SetLocalImage("Textures/main/setting_btn_close"); } // Vibrate Status int VibrateStatus = PrefsUtil.GetInt("setting_vibrate") > 0 ? PrefsUtil.GetInt("setting_vibrate") : 0; Text VibrateStatusText = settingView.Find <Text>("Option_Vibrate/Status"); VibrateStatusText.text = VibrateStatus > 0 ? "开" : "关"; Image VibrateStatusImg = settingView.Find <Image>("Option_Vibrate/Button"); if (VibrateStatus > 0) { VibrateStatusImg.SetLocalImage("Textures/main/setting_btn_open"); } else { VibrateStatusImg.SetLocalImage("Textures/main/setting_btn_close"); } }
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 SetBgmVolume(float volume) { var vol = Mathf.Clamp01(volume); PrefsUtil.SetFloat(PrefsKeys.BgmVolumeKey, vol); PrefsUtil.Flush(); if (BgmPlayer) { BgmPlayer.volume = vol; } }
/** * 用户登录 */ public void loginReq() { UserLoginReq loginReq = new UserLoginReq(); loginReq.UserId = UserManager.Instance().authModel.user_id; loginReq.UniqueId = "888"; loginReq.Token = UserManager.Instance().authModel.token; loginReq.ConnectTo = PrefsUtil.GetString(PrefsUtil.ServiceId); loginReq.IsReconnect = 0; NetCore.Instance.Send(Api.ENetMsgId.user_login_req, loginReq); }
public bool InitiateIfNeeded() { var initAssetKey = GetAssetBundleInitializedKey(); var initialized = PrefsUtil.GetInt(initAssetKey, 0); if (initialized != 0) { SetBuildFirstCacheResult(BuildFirstCacheResult.Ok, ""); return(false); } StartCoroutine(BuildFirstCache()); return(true); }
public override void Show() { if (_tweener != null) { _tweener.Kill(); _tweener = null; } if (Content) { if (!Content.gameObject.activeSelf) { Content.gameObject.SetActive(true); } Content.localScale = new Vector3(0, 0, 1); if (ContentTxt) { ContentTxt.text = null; } _tweener = Content .DOScale(new Vector3(1, 1, 1), ShowAnimationTime) .SetEase(Ease.OutBack) .OnComplete(() => { if (ContentTxt) { ContentTxt.text = PrefsUtil.GetString(BillboardContentKey, "无内容"); } }); } if (BgCover) { if (!BgCover.gameObject.activeSelf) { BgCover.gameObject.SetActive(true); } BgCover.color = new Color(0, 0, 0, 0); } if (BgCover) { _bgTweener = BgCover .DOFade(150f / 255f, ShowAnimationTime) .SetEase(Ease.Linear); } }
/// <summary> /// 显示保存的公告。 /// </summary> private void ShowSavedBillboard() { var read = _billboardRead.Read(); var content = PrefsUtil.GetString(BillboardContentKey, null); if (!read && !string.IsNullOrEmpty(content)) { Show(); } else { Hide(); } }
private PwEntryView(GroupBaseActivity groupActivity, PwEntry pw, int pos) : base(groupActivity) { _groupActivity = groupActivity; View ev = Inflate(groupActivity, Resource.Layout.entry_list_entry, null); _textView = (TextView)ev.FindViewById(Resource.Id.entry_text); _textView.TextSize = PrefsUtil.GetListTextSize(groupActivity); Database db; try { db = App.Kp2a.FindDatabaseForElement(pw); } catch (Exception e) { //for some reason, since Android 12 we get here when the database is reloaded (after making remote changes and selecting sync) //we can just ignore this. Console.WriteLine(e); return; } ev.FindViewById(Resource.Id.entry_icon_bkg).Visibility = db.DrawableFactory.IsWhiteIconSet ? ViewStates.Visible : ViewStates.Gone; _textviewDetails = (TextView)ev.FindViewById(Resource.Id.entry_text_detail); _textviewDetails.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity); _textgroupFullPath = (TextView)ev.FindViewById(Resource.Id.group_detail); _textgroupFullPath.TextSize = PrefsUtil.GetListDetailTextSize(groupActivity); _showDetail = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean( groupActivity.GetString(Resource.String.ShowUsernameInList_key), Resources.GetBoolean(Resource.Boolean.ShowUsernameInList_default)); _showGroupFullPath = PreferenceManager.GetDefaultSharedPreferences(groupActivity).GetBoolean( groupActivity.GetString(Resource.String.ShowGroupnameInSearchResult_key), Resources.GetBoolean(Resource.Boolean.ShowGroupnameInSearchResult_default)); _isSearchResult = _groupActivity is keepass2android.search.SearchResults; PopulateView(ev, pw, pos); LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); AddView(ev, lp); }
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 SetBgmEnable(bool enable) { PrefsUtil.SetBool(PrefsKeys.BgmEnable, enable); PrefsUtil.Flush(); if (BgmPlayer) { if (enable) { PlayBgm(); } else { StopBgm(); } } }
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 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); } }
private void OnEnable() { var dataRepository = GetDataRepository(); _isSetTestClientVersion = dataRepository.GetContainer <bool>(DataKey.IsSetTestClientVersion); var clientVersion = PrefsUtil.GetInt(TestLoginRecord.TestClientVersion, 0); var saleChannel = PrefsUtil.GetString(TestLoginRecord.TestSaleChannel, null); var product = PrefsUtil.GetString(TestLoginRecord.TestProduct, null); var platform = PrefsUtil.GetInt(TestLoginRecord.TestPlatform, 0); var lastUserName = LoginRecord.LastVisitorUsername; var lastVisitorId = LoginRecord.LastVisitorId; if (!string.IsNullOrEmpty(saleChannel)) { SaleChannel.text = saleChannel; } if (!string.IsNullOrEmpty(product)) { Product.text = product; } if (!string.IsNullOrEmpty(lastUserName)) { LastVisitorUsername.text = lastUserName; } if (!string.IsNullOrEmpty(lastVisitorId)) { LasVisitorId.text = lastVisitorId; } if (clientVersion != 0) { ClientVersion.text = clientVersion + ""; } if (platform != 0) { Platform.text = platform + ""; } }