Пример #1
0
        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();
            }
        }
Пример #2
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
        }
        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);
        }
Пример #4
0
        private void Initialize()
        {
            #region 播放器

            if (BgmPlayer)
            {
                var bgmEnable = PrefsUtil.GetBool(PrefsKeys.BgmEnable, true);
                if (bgmEnable)
                {
                    PlayBgm();
                }
                else
                {
                    StopBgm();
                }

                var bgmVolume = Mathf.Clamp01(PrefsUtil.GetFloat(PrefsKeys.BgmVolumeKey, 1));
                BgmPlayer.volume = bgmVolume;
            }

            if (EffectPlayer)
            {
                var effectEnable = PrefsUtil.GetBool(PrefsKeys.EffectEnable, true);
                EffectPlayer.mute = !effectEnable;

                var effectVolume = Mathf.Clamp01(PrefsUtil.GetFloat(PrefsKeys.EffectVolumeKey, 1));
                EffectPlayer.volume = effectVolume;
            }

            #endregion

            #region 初始化女声

            _femaleASounds.Clear();

            if (Female2)
            {
                _femaleASounds.Add(PokerNumType.P2, Female2);
            }
            if (Female3)
            {
                _femaleASounds.Add(PokerNumType.P3, Female3);
            }
            if (Female4)
            {
                _femaleASounds.Add(PokerNumType.P4, Female4);
            }
            if (Female5)
            {
                _femaleASounds.Add(PokerNumType.P5, Female5);
            }
            if (Female6)
            {
                _femaleASounds.Add(PokerNumType.P6, Female6);
            }
            if (Female7)
            {
                _femaleASounds.Add(PokerNumType.P7, Female7);
            }
            if (Female8)
            {
                _femaleASounds.Add(PokerNumType.P8, Female8);
            }
            if (Female9)
            {
                _femaleASounds.Add(PokerNumType.P9, Female9);
            }
            if (Female10)
            {
                _femaleASounds.Add(PokerNumType.P10, Female10);
            }
            if (FemaleJ)
            {
                _femaleASounds.Add(PokerNumType.PJ, FemaleJ);
            }
            if (FemaleQ)
            {
                _femaleASounds.Add(PokerNumType.PQ, FemaleQ);
            }
            if (FemaleK)
            {
                _femaleASounds.Add(PokerNumType.PK, FemaleK);
            }
            if (FemaleA)
            {
                _femaleASounds.Add(PokerNumType.PA, FemaleA);
            }
            if (FemaleWX)
            {
                _femaleASounds.Add(PokerNumType.PX, FemaleWX);
            }
            if (FemaleWD)
            {
                _femaleASounds.Add(PokerNumType.PD, FemaleWD);
            }

            _femalePatternSounds.Clear();

            if (FemaleBuChu)
            {
                _femalePatternSounds.Add(PatternType.BUCHU, FemaleBuChu);
            }
            if (FemaleDuiZi)
            {
                _femalePatternSounds.Add(PatternType.AA, FemaleDuiZi);
            }
            if (FemaleSanDaiEr)
            {
                _femalePatternSounds.Add(PatternType.AAAXX, FemaleSanDaiEr);
            }
            if (FemaleSanLianDui)
            {
                _femalePatternSounds.Add(PatternType.AABBCC, FemaleSanLianDui);
            }
            if (FemaleSanZhang)
            {
                _femalePatternSounds.Add(PatternType.AAA, FemaleSanZhang);
            }
            if (FemaleShunZi)
            {
                _femalePatternSounds.Add(PatternType.ABCDE, FemaleShunZi);
            }
            if (FemaleFeiJi)
            {
                _femalePatternSounds.Add(PatternType.AAABBB, FemaleFeiJi);
            }
            if (FemaleZhaDan)
            {
                _femalePatternSounds.Add(PatternType.XXXX, FemaleZhaDan);
            }
            if (FemaleTongHuaShun)
            {
                _femalePatternSounds.Add(PatternType.SuperABCDE, FemaleTongHuaShun);
            }
            if (FemaleWangZha)
            {
                _femalePatternSounds.Add(PatternType.XXDD, FemaleWangZha);
            }

            #endregion

            #region 初始化男声

            _maleASounds.Clear();

            if (Male2)
            {
                _maleASounds.Add(PokerNumType.P2, Male2);
            }
            if (Male3)
            {
                _maleASounds.Add(PokerNumType.P3, Male3);
            }
            if (Male4)
            {
                _maleASounds.Add(PokerNumType.P4, Male4);
            }
            if (Male5)
            {
                _maleASounds.Add(PokerNumType.P5, Male5);
            }
            if (Male6)
            {
                _maleASounds.Add(PokerNumType.P6, Male6);
            }
            if (Male7)
            {
                _maleASounds.Add(PokerNumType.P7, Male7);
            }
            if (Male8)
            {
                _maleASounds.Add(PokerNumType.P8, Male8);
            }
            if (Male9)
            {
                _maleASounds.Add(PokerNumType.P9, Male9);
            }
            if (Male10)
            {
                _maleASounds.Add(PokerNumType.P10, Male10);
            }
            if (MaleJ)
            {
                _maleASounds.Add(PokerNumType.PJ, MaleJ);
            }
            if (MaleQ)
            {
                _maleASounds.Add(PokerNumType.PQ, MaleQ);
            }
            if (MaleK)
            {
                _maleASounds.Add(PokerNumType.PK, MaleK);
            }
            if (MaleA)
            {
                _maleASounds.Add(PokerNumType.PA, MaleA);
            }
            if (MaleWX)
            {
                _maleASounds.Add(PokerNumType.PX, MaleWX);
            }
            if (MaleWD)
            {
                _maleASounds.Add(PokerNumType.PD, MaleWD);
            }

            _malePatternSounds.Clear();

            if (MaleBuChu)
            {
                _malePatternSounds.Add(PatternType.BUCHU, MaleBuChu);
            }
            if (MaleDuiZi)
            {
                _malePatternSounds.Add(PatternType.AA, MaleDuiZi);
            }
            if (MaleSanDaiEr)
            {
                _malePatternSounds.Add(PatternType.AAAXX, MaleSanDaiEr);
            }
            if (MaleSanLianDui)
            {
                _malePatternSounds.Add(PatternType.AABBCC, MaleSanLianDui);
            }
            if (MaleSanZhang)
            {
                _malePatternSounds.Add(PatternType.AAA, MaleSanZhang);
            }
            if (MaleShunZi)
            {
                _malePatternSounds.Add(PatternType.ABCDE, MaleShunZi);
            }
            if (MaleFeiJi)
            {
                _malePatternSounds.Add(PatternType.AAABBB, MaleFeiJi);
            }
            if (MaleZhaDan)
            {
                _malePatternSounds.Add(PatternType.XXXX, MaleZhaDan);
            }
            if (MaleTongHuaShun)
            {
                _malePatternSounds.Add(PatternType.SuperABCDE, MaleTongHuaShun);
            }
            if (MaleWangZha)
            {
                _malePatternSounds.Add(PatternType.XXDD, MaleWangZha);
            }

            #endregion

            #region 特殊牌型音效

            _specPatternSounds.Clear();

            if (Airplane)
            {
                _specPatternSounds.Add(PatternType.AAABBB, Airplane);
            }
            if (HuoJian)
            {
                _specPatternSounds.Add(PatternType.XXDD, HuoJian);
            }
            if (TongHuaShun)
            {
                _specPatternSounds.Add(PatternType.SuperABCDE, TongHuaShun);
            }

            #endregion
        }
Пример #5
0
        public void InitComponents()
        {
            if (BGMToggle)
            {
                BGMToggle.isOn = PrefsUtil.GetBool(PrefsKeys.BgmEnable, true);
            }

            if (EffectToggle)
            {
                EffectToggle.isOn = PrefsUtil.GetBool(PrefsKeys.EffectEnable, true);
            }

            if (BgToggle)
            {
                BgToggle.isOn = IsBgOn();
            }

            if (DanZhangToggle)
            {
                DanZhangToggle.isOn = PrefsUtil.GetBool(PrefsKeys.XuanDanZhangKey, false);
            }

            var featureSwitch = _featureSwitch.Read();
            var enableSex     = featureSwitch != null && featureSwitch.personal_info;
            var enableWxShare = featureSwitch != null && featureSwitch.personal_info;

            // 除了ios平台,其他的平台上都不打开评价面板。
            var enableRating = false;
            // 不是微信用户的时候,可以升级账户。
            var user                    = _myUser.Read();
            var isWechatUser            = user != null && user.type == UserType.Wechat;
            var upgradeAccountBtnEnable = !isWechatUser;

#if UNITY_IOS
            enableRating = featureSwitch != null && featureSwitch.rating;
#endif
#if UNITY_ANDROID // 在小米模式下,需要关闭游客转正的功能。
            var configHolder = GetConfigHolder();
            if (configHolder.XiaoMiMode)
            {
                upgradeAccountBtnEnable = false;
            }
#endif
            if (UpgradeAccountBtn.gameObject.activeSelf != upgradeAccountBtnEnable)
            {
                UpgradeAccountBtn.gameObject.SetActive(upgradeAccountBtnEnable);
            }

            if (RankMeBtn && RankMeBtn.gameObject.activeSelf != enableRating)
            {
                RankMeBtn.gameObject.SetActive(enableRating);
            }

            if (ChangeSexBtn && ChangeSexBtn.gameObject.activeSelf != enableSex)
            {
                ChangeSexBtn.gameObject.SetActive(enableSex);
            }

            if (WxShareBtn && WxShareBtn.gameObject.activeSelf != enableWxShare)
            {
                WxShareBtn.gameObject.SetActive(enableWxShare);
            }
        }
Пример #6
0
 public bool IsBgOn()
 {
     return(PrefsUtil.GetBool(BgConstant.EnableBgKey, true));
 }