示例#1
0
        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();
            }
        }
        /// <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();
        }
示例#4
0
        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
        }