/// <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()
        {
            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();
            }
        }
示例#3
0
        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();
            }
        }
示例#4
0
 public override void AfterShow()
 {
     PrefsUtil.SetLong(RankMeShowTimeKey, DateTime.Now.CurrentTimeMillis());
     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);
                    }
                }
            }
        }