Пример #1
0
        //
        private void ReadGame(Mesg.Locale locale = null)
        {
            Mesg.Locale loc = locale ?? (Mesg.Locale)cboGameLanguage.SelectedItem;

            if (_localeGame == null || !loc.Code.Equals(_localeGame.Code))
            {
                _localeGame = loc;

                string json;
                switch (loc.Code)
                {
                case "ja": json = Properties.Resources.dfas_ja; break;

                //case "de": json = Properties.Resources.dfas_de; break;
                //case "fr": json = Properties.Resources.dfas_fr; break;
                case "ko": json = Properties.Resources.dfas_ko; break;

                default: json = Properties.Resources.dfas_en; break;
                }
                GameData.Initialize(json);

                Mesg.I("i-data-version",
                       GameData.Areas.Count, GameData.Instances.Count,
                       GameData.Roulettes.Count, GameData.Fates.Count,
                       Settings.TagName);
            }
        }
Пример #2
0
        //
        private void ReadMesg(Mesg.Locale locale = null)
        {
            Mesg.Locale loc = locale ?? (Mesg.Locale)cboUiLanguage.SelectedItem;

            if (_localeUi == null || !loc.Code.Equals(_localeUi.Code))
            {
                _localeUi = loc;

                string json;
                switch (loc.Code)
                {
                case "ja": json = Properties.Resources.mesg_ja; break;

                case "ko": json = Properties.Resources.mesg_ko; break;

                default: json = Properties.Resources.mesg_en; break;
                }

                Mesg.Initialize(json);
            }
        }
Пример #3
0
        private void ReadSettings()
        {
            _srset.AddControlSetting("LocaleUi", cboUiLanguage);
            _srset.AddControlSetting("LocaleGame", cboGameLanguage);
            _srset.AddControlSetting("LogBackColor", cboLogBackground);
            _srset.AddControlSetting("LoggingWholeFATEs", chkWholeFates);
            _srset.AddControlSetting("UseOverlay", chkUseOverlay);
            _srset.AddControlSetting("OverlayLocation", txtOverayLocation);
            _srset.AddControlSetting("SelectedFates", txtSelectedFates);
            _srset.AddControlSetting("UseSound", chkUseSound);
            _srset.AddControlSetting("SoundFile", txtSoundFile);
            _srset.AddControlSetting("LogFont", txtLogFont);
            _srset.AddControlSetting("ClientVersion", txtClientVersion);
            _srset.AddControlSetting("UpdateSkip", txtUpdateSkip);
            //
            _srset.AddControlSetting("NotifyUseLine", chkNtfUseLine);
            _srset.AddControlSetting("NotifyLineToken", txtNtfLineToken);
            _srset.AddControlSetting("NotifyUseTelegram", chkNtfUseTelegram);
            _srset.AddControlSetting("NotifyTelegramId", txtNtfTelegramId);
            _srset.AddControlSetting("NotifyTelegramToken", txtNtfTelegramToken);
            //
            _srset.AddControlSetting("SoundFate", txtSoundFate);

            if (File.Exists(Settings.Path))
            {
                using (var fs = new FileStream(Settings.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    using (var xr = new XmlTextReader(fs))
                    {
                        try
                        {
                            while (xr.Read())
                            {
                                if (xr.NodeType != XmlNodeType.Element)
                                {
                                    continue;
                                }

                                if (xr.LocalName == "SettingsSerializer")
                                {
                                    _srset.ImportFromXml(xr);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            _actLabelStatus.Text = Mesg.GetText("e-setting-load", ex.Message);
                        }

                        xr.Close();
                    }
            }

            // game version
            int.TryParse(txtClientVersion.Text, out int clientversion);
            for (int i = 0; i < GameVersion.Versions.Length; i++)
            {
                if (GameVersion.Versions[i].Index == clientversion)
                {
                    cboClientVersion.SelectedIndex = i;
                    break;
                }
            }

            // locale
            _localeUi   = (Mesg.Locale)cboUiLanguage.SelectedItem;
            _localeGame = (Mesg.Locale)cboGameLanguage.SelectedItem;

            // fates
            Settings.LoggingWholeFates = chkWholeFates.Checked;

            try
            {
                var ss = txtOverayLocation.Text.Split(',');
                if (ss.Length == 2)
                {
                    Settings.OverlayLocation = new Point(int.Parse(ss[0].Trim()), int.Parse(ss[1].Trim()));
                    _frmOverlay.Location     = Settings.OverlayLocation;
                }
            }
            catch
            {
            }

            // overlay
            if (chkUseOverlay.Checked)
            {
                _frmOverlay.Show();
            }
            else
            {
                _frmOverlay.Hide();
            }

            Settings.UseOverlay = chkUseOverlay.Checked;

            // sound
            CheckSoundEnable();

            // font
            try
            {
                var ss = txtLogFont.Text.Split(',');
                if (ss.Length == 2)
                {
                    var font = new Font(ss[0], float.Parse(ss[1]), FontStyle.Regular, GraphicsUnit.Point);
                    if (font != null)
                    {
                        rtxLogger.Font = font;
                    }
                }
            }
            catch
            {
            }
            finally
            {
                btnLogFont.Text = $"{rtxLogger.Font.Name}, {rtxLogger.Font.Size}";
            }

            //
            CheckUseNotify();

            // background color
            if (!string.IsNullOrWhiteSpace(cboLogBackground.Text))
            {
                Color c = Color.FromName(cboLogBackground.Text);
                if (c.Equals(Color.Transparent))
                {
                    rtxLogger.BackColor = c;
                }
            }

            //
            _isInitSetting = true;
        }