// private void ReadGameData(Localization.Locale gamelang = null) { Localization.Locale lang = gamelang ?? (Localization.Locale)cboGameLanguage.SelectedItem; if (_localeGame == null || !lang.Code.Equals(_localeGame.Code)) { _localeGame = lang; string json; switch (lang.Index) { case 1: json = Properties.Resources.gamedata_ja; break; case 2: json = Properties.Resources.gamedata_de; break; case 3: json = Properties.Resources.gamedata_fr; break; case 4: json = Properties.Resources.gamedata_ko; break; default: json = Properties.Resources.gamedata_en; break; } GameData.Initialize(json); MsgLog.I("i-data-version", GameData.Version, GameData.Areas.Count, GameData.Instances.Count, GameData.Roulettes.Count, GameData.Fates.Count); } }
// private void ReadLocale(Localization.Locale uilang = null) { Localization.Locale lang = uilang ?? (Localization.Locale)cboUiLanguage.SelectedItem; if (_localeUi == null || !lang.Code.Equals(_localeUi.Code)) { _localeUi = lang; Localization.Initialize(Settings.PluginPath, lang.Code); } }
// private void ReadGameData(Localization.Locale gamelang = null) { Localization.Locale lang = gamelang ?? (Localization.Locale)cboGameLanguage.SelectedItem; if (_localeGame == null || !lang.Code.Equals(_localeGame.Code)) { _localeGame = lang; GameData.Initialize(Settings.PluginPath, lang.Code); MsgLog.Info("l-info-version", GameData.Version, GameData.Areas.Count, GameData.Instances.Count, GameData.Roulettes.Count, GameData.Fates.Count); } }
// private void ReadLocale(Localization.Locale uilang = null) { Localization.Locale lang = uilang ?? (Localization.Locale)cboUiLanguage.SelectedItem; if (_localeUi == null || !lang.Code.Equals(_localeUi.Code)) { _localeUi = lang; string json; switch (lang.Index) { case 1: json = Properties.Resources.locale_ja; break; case 4: json = Properties.Resources.locale_ko; break; default: json = Properties.Resources.locale_en; break; } Localization.Initialize(json); } }
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); 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 = Localization.GetText("e-setting-load", ex.Message); } xr.Close(); } } // game version int.TryParse(txtClientVersion.Text, out int clientversion); for (int i = 0; i < GameData.ClientVersions.Length; i++) { if (GameData.ClientVersions[i].Value == clientversion) { cboClientVersion.SelectedIndex = i; break; } } // locale _localeUi = (Localization.Locale)cboUiLanguage.SelectedItem; _localeGame = (Localization.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; }
// private void ActInitialize() { if (_isInActInit) { return; } _isInActInit = true; MsgLog.SetTextBox(rtxLogger); ActGlobals.oFormActMain.Shown -= OFormActMain_Shown; Localization.Locale defaultlocale = Localization.DefaultLocale; ReadLocale(defaultlocale); #if DEBUG && false MsgLog.D("ui-dbg", System.Environment.CurrentDirectory); MsgLog.D("ui-dbg", Settings.PluginPath); #endif ReadGameData(defaultlocale); _isPluginEnabled = true; cboUiLanguage.DataSource = Localization.Locales.Clone(); cboUiLanguage.DisplayMember = "Name"; cboUiLanguage.ValueMember = "Code"; cboGameLanguage.DataSource = Localization.Locales.Clone(); cboGameLanguage.DisplayMember = "Name"; cboGameLanguage.ValueMember = "Code"; cboClientVersion.DataSource = GameData.ClientVersions.Clone(); cboClientVersion.DisplayMember = "Name"; cboClientVersion.ValueMember = "Value"; cboClientVersion.SelectedIndex = 0; Dock = DockStyle.Fill; _actLabelStatus.Text = "Initializing..."; UpdateUiLanguage(); _actLabelStatus.Text = Localization.GetText("l-plugin-started"); _actTabPage.Text = Localization.GetText("app-name"); _actTabPage.Controls.Add(this); _srset = new SettingsSerializer(this); ReadSettings(); UpdateFates(); // string tagname = Settings.GetTagNameForUpdate(); if (!Settings.TagName.Equals(tagname)) { MsgLog.I("i-client-updated", tagname); if (!txtUpdateSkip.Text.Equals(tagname)) { Task.Run(() => { var res = MessageBox.Show( Localization.GetText("i-visit-updated"), Localization.GetText("app-name"), MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.Yes) { Process.Start("https://github.com/purutu/ACT.DFAssist/releases/latest"); } else { txtUpdateSkip.Text = tagname; SaveSettings(); } }); } } // PacketWorker.OnEventReceived += PacketWorker_OnEventReceived; PacketWorker.BeginMachina(); _isInActInit = false; }
// 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); 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 = Localization.GetText("l-settings-load-error", ex.Message); } xr.Close(); } } _localeUi = (Localization.Locale)cboUiLanguage.SelectedItem; _localeGame = (Localization.Locale)cboGameLanguage.SelectedItem; 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 (Exception) { } if (chkUseOverlay.Checked) { _frmOverlay.Show(); } else { _frmOverlay.Hide(); } Settings.UseOverlay = chkUseOverlay.Checked; // 색깔을 여기서 if (!string.IsNullOrWhiteSpace(cboLogBackground.Text)) { Color c = Color.FromName(cboLogBackground.Text); if (c.Equals(Color.Transparent)) { rtxLogger.BackColor = c; } } // CheckSoundEnable(); CheckTTSEnable(); // 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 (Exception) { } finally { btnLogFont.Text = $"{rtxLogger.Font.Name}, {rtxLogger.Font.Size}"; } }
// private void ActInitialize() { if (_isInActInit) { return; } _isInActInit = true; MsgLog.SetTextBox(rtxLogger); ActGlobals.oFormActMain.Shown -= OFormActMain_Shown; Localization.Locale defaultlocale = Localization.DefaultLocale; ReadLocale(defaultlocale); #if DEBUG MsgLog.Info("ui-dbg-msg", System.Environment.CurrentDirectory); MsgLog.Info("ui-dbg-msg", Settings.PluginPath); #endif ReadGameData(defaultlocale); _isPluginEnabled = true; cboUiLanguage.DataSource = Localization.Locales.Clone(); cboUiLanguage.DisplayMember = "Name"; cboUiLanguage.ValueMember = "Code"; cboGameLanguage.DataSource = Localization.Locales.Clone(); cboGameLanguage.DisplayMember = "Name"; cboGameLanguage.ValueMember = "Code"; Dock = DockStyle.Fill; _actLabelStatus.Text = "Initializing..."; UpdateUiLanguage(); _actLabelStatus.Text = Localization.GetText("l-plugin-started"); _actTabPage.Text = Localization.GetText("app-name"); _actTabPage.Controls.Add(this); _srset = new SettingsSerializer(this); ReadSettings(); UpdateFates(); UpdateProcesses(); if (_timer == null) { _timer = new Timer { Interval = 10000 }; _timer.Tick += _timer_Tick; } _timer.Enabled = true; _isInActInit = false; }