UI font setting (#18)

* UI font setting

* Fix detecting Bozja & Zadnor SK & CE

* update languages
This commit is contained in:
ksh 2021-06-19 21:07:01 +09:00 committed by GitHub
parent 5a9452d378
commit e59110cd2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 234 additions and 58 deletions

View file

@ -48,6 +48,8 @@ LANG=日本語
207=新たなアップデートがあります! {0} → {1} 207=新たなアップデートがあります! {0} → {1}
208=プラグインのウェブサイトでダウンロードしてください 208=プラグインのウェブサイトでダウンロードしてください
209=https://github.com/kshman/DutyContent/releases/latest 209=https://github.com/kshman/DutyContent/releases/latest
210=UIフォント
211=バージョン: {0} / {1}
300=コンテンツ 300=コンテンツ
301=コンテンツ 301=コンテンツ
@ -112,3 +114,4 @@ LANG=日本語
10022=このパゲットデータを使いますか?セーブします 10022=このパゲットデータを使いますか?セーブします
10023=選択 10023=選択
10024=コッピー 10024=コッピー
10025=地役: {0}

View file

@ -48,6 +48,8 @@ LANG=한국어(액토즈)
207=새 업데이트가 있습니다! {0} -> {1} 207=새 업데이트가 있습니다! {0} -> {1}
208=플러그인 웹사이트에서 받으세요. 208=플러그인 웹사이트에서 받으세요.
209=https://github.com/kshman/DutyContent/releases/latest 209=https://github.com/kshman/DutyContent/releases/latest
210=UI 글꼴
211=버전: {0} / {1}
300=임무 300=임무
301=콘텐츠 301=콘텐츠
@ -112,3 +114,4 @@ LANG=한국어(액토즈)
10022=패킷 데이터를 적용하고 덮어쓰실거예요? 10022=패킷 데이터를 적용하고 덮어쓰실거예요?
10023=선택함 10023=선택함
10024=복사함 10024=복사함
10025=지역: {0}

View file

@ -48,6 +48,8 @@ LANG=한국어
207=새 업데이트가 있습니다! {0} -> {1} 207=새 업데이트가 있습니다! {0} -> {1}
208=플러그인 웹사이트에서 받으세요. 208=플러그인 웹사이트에서 받으세요.
209=https://github.com/kshman/DutyContent/releases/latest 209=https://github.com/kshman/DutyContent/releases/latest
210=UI 글꼴
211=버전: {0} / {1}
300=듀티 300=듀티
301=콘텐츠 301=콘텐츠
@ -112,3 +114,4 @@ LANG=한국어
10022=패킷 데이터를 적용하고 덮어쓰실거예요? 10022=패킷 데이터를 적용하고 덮어쓰실거예요?
10023=선택함 10023=선택함
10024=카피함 10024=카피함
10025=지역: {0}

View file

@ -3,18 +3,16 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace DutyContent namespace DutyContent
{ {
class DcConfig class DcConfig
{ {
public static int PluginTag => 10; public static int PluginTag => 11;
public static Version PluginVersion => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; public static Version PluginVersion => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
public static bool PluginEnable { get; set; } public static bool PluginEnable { get; set; }
@ -32,7 +30,12 @@ namespace DutyContent
// //
public static string Language { get; set; } = ""; public static string Language { get; set; } = "";
public static bool DataRemoteUpdate { get; set; } = true; // true = use remote update public static bool DataRemoteUpdate { get; set; } = true; // true = use remote update
public static string UiFontFamily { get; set; } = "Microsoft Sans Serif";
// Microsoft Sans Serif / SegoUI
// GoyangIlsan R / Dotum / Malgun
// Bitstream Vera Sans Mono / Consolas
//
public static string BuildDataFileName(string header, string context, string ext) public static string BuildDataFileName(string header, string context, string ext)
{ {
return Path.Combine(DataPath, $"{header}-{context}.{ext}"); return Path.Combine(DataPath, $"{header}-{context}.{ext}");
@ -70,6 +73,7 @@ namespace DutyContent
sw.WriteLine("# config"); sw.WriteLine("# config");
sw.WriteLine("Language={0}", Language); sw.WriteLine("Language={0}", Language);
sw.WriteLine("DataRemoteUpdate={0}", DataRemoteUpdate); sw.WriteLine("DataRemoteUpdate={0}", DataRemoteUpdate);
sw.WriteLine("UiFontFamily={0}", UiFontFamily);
sw.WriteLine(); sw.WriteLine();
Duty.InternalSaveStream(sw); Duty.InternalSaveStream(sw);
@ -89,6 +93,7 @@ namespace DutyContent
Language = db["Language"]; Language = db["Language"];
DataRemoteUpdate = ThirdParty.Converter.ToBool(db["DataRemoteUpdate"], DataRemoteUpdate); DataRemoteUpdate = ThirdParty.Converter.ToBool(db["DataRemoteUpdate"], DataRemoteUpdate);
UiFontFamily = db.Get("UiFontFamily", UiFontFamily);
Duty.InternalReadFromDb(db); Duty.InternalReadFromDb(db);
} }

View file

@ -257,5 +257,14 @@ namespace DutyContent
Delubrum, Delubrum,
Zadnor, Zadnor,
} }
//
public static int SaveTheQueenTypeToCeBase(SaveTheQueenType stq)
{
return
stq == SaveTheQueenType.Bozja ? 30000 :
stq == SaveTheQueenType.Zadnor ? 30100 :
30100; // fail safe
}
} }
} }

View file

@ -346,6 +346,8 @@ namespace DutyContent
// //
public void UpdateUiLocale() public void UpdateUiLocale()
{ {
ThirdParty.FontUtilities.SimpleChangeFont(this, DcConfig.UiFontFamily, true);
_act_label.Text = MesgLog.Text(1); // Duty ready _act_label.Text = MesgLog.Text(1); // Duty ready
_act_tab.Text = MesgLog.Text(0); // FFXIV dc _act_tab.Text = MesgLog.Text(0); // FFXIV dc

View file

@ -108,6 +108,7 @@
<DependentUpon>UpdateNotifyForm.cs</DependentUpon> <DependentUpon>UpdateNotifyForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="ThirdParty\Converter.cs" /> <Compile Include="ThirdParty\Converter.cs" />
<Compile Include="ThirdParty\FontUtilities.cs" />
<Compile Include="ThirdParty\LineDb.cs" /> <Compile Include="ThirdParty\LineDb.cs" />
<Compile Include="ThirdParty\NativeMethods.cs" /> <Compile Include="ThirdParty\NativeMethods.cs" />
<Compile Include="ThirdParty\ThreadWorker.cs" /> <Compile Include="ThirdParty\ThreadWorker.cs" />

View file

@ -48,6 +48,8 @@ LANG=English
207=New update found! {0} -> {1} 207=New update found! {0} -> {1}
208=Visit DutyContent plugin repository for download. 208=Visit DutyContent plugin repository for download.
209=https://github.com/kshman/DutyContent/releases/latest 209=https://github.com/kshman/DutyContent/releases/latest
210=UI Font
211=Version: {0} / {1}
300=Duty 300=Duty
301=Contents 301=Contents
@ -112,3 +114,4 @@ LANG=English
10022=Apply and overwrite packet data? 10022=Apply and overwrite packet data?
10023=Selected 10023=Selected
10024=Copied 10024=Copied
10025=Area: {0}

View file

@ -29,37 +29,63 @@ namespace DutyContent.Tab
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.panel1 = new System.Windows.Forms.Panel(); this.pnlBase = new System.Windows.Forms.Panel();
this.btnUiFont = new System.Windows.Forms.Button();
this.lblUiFont = new System.Windows.Forms.Label();
this.rdoDataUpdateRemote = new System.Windows.Forms.RadioButton(); this.rdoDataUpdateRemote = new System.Windows.Forms.RadioButton();
this.rdoDataUpdateLocal = new System.Windows.Forms.RadioButton(); this.rdoDataUpdateLocal = new System.Windows.Forms.RadioButton();
this.lblDataUpdate = new System.Windows.Forms.Label(); this.lblDataUpdate = new System.Windows.Forms.Label();
this.lblCurrentLang = new System.Windows.Forms.Label(); this.lblCurrentLang = new System.Windows.Forms.Label();
this.cboDispLang = new System.Windows.Forms.ComboBox(); this.cboDispLang = new System.Windows.Forms.ComboBox();
this.lblDispLang = new System.Windows.Forms.Label(); this.lblDispLang = new System.Windows.Forms.Label();
this.panel1.SuspendLayout(); this.lblTag = new System.Windows.Forms.Label();
this.pnlBase.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// panel1 // pnlBase
// //
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.pnlBase.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pnlBase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.rdoDataUpdateRemote); this.pnlBase.Controls.Add(this.lblTag);
this.panel1.Controls.Add(this.rdoDataUpdateLocal); this.pnlBase.Controls.Add(this.btnUiFont);
this.panel1.Controls.Add(this.lblDataUpdate); this.pnlBase.Controls.Add(this.lblUiFont);
this.panel1.Controls.Add(this.lblCurrentLang); this.pnlBase.Controls.Add(this.rdoDataUpdateRemote);
this.panel1.Controls.Add(this.cboDispLang); this.pnlBase.Controls.Add(this.rdoDataUpdateLocal);
this.panel1.Controls.Add(this.lblDispLang); this.pnlBase.Controls.Add(this.lblDataUpdate);
this.panel1.Location = new System.Drawing.Point(12, 12); this.pnlBase.Controls.Add(this.lblCurrentLang);
this.panel1.Name = "panel1"; this.pnlBase.Controls.Add(this.cboDispLang);
this.panel1.Size = new System.Drawing.Size(776, 158); this.pnlBase.Controls.Add(this.lblDispLang);
this.panel1.TabIndex = 0; this.pnlBase.Location = new System.Drawing.Point(12, 12);
this.pnlBase.Name = "pnlBase";
this.pnlBase.Size = new System.Drawing.Size(776, 296);
this.pnlBase.TabIndex = 0;
//
// btnUiFont
//
this.btnUiFont.Location = new System.Drawing.Point(251, 165);
this.btnUiFont.Name = "btnUiFont";
this.btnUiFont.Size = new System.Drawing.Size(217, 38);
this.btnUiFont.TabIndex = 9;
this.btnUiFont.Text = "button1";
this.btnUiFont.UseVisualStyleBackColor = true;
this.btnUiFont.Click += new System.EventHandler(this.BtnUiFont_Click);
//
// lblUiFont
//
this.lblUiFont.AutoSize = true;
this.lblUiFont.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblUiFont.Location = new System.Drawing.Point(12, 165);
this.lblUiFont.Name = "lblUiFont";
this.lblUiFont.Size = new System.Drawing.Size(39, 20);
this.lblUiFont.TabIndex = 8;
this.lblUiFont.Text = "210";
// //
// rdoDataUpdateRemote // rdoDataUpdateRemote
// //
this.rdoDataUpdateRemote.AutoSize = true; this.rdoDataUpdateRemote.AutoSize = true;
this.rdoDataUpdateRemote.Checked = true; this.rdoDataUpdateRemote.Checked = true;
this.rdoDataUpdateRemote.Location = new System.Drawing.Point(251, 80); this.rdoDataUpdateRemote.Location = new System.Drawing.Point(251, 110);
this.rdoDataUpdateRemote.Name = "rdoDataUpdateRemote"; this.rdoDataUpdateRemote.Name = "rdoDataUpdateRemote";
this.rdoDataUpdateRemote.Size = new System.Drawing.Size(43, 17); this.rdoDataUpdateRemote.Size = new System.Drawing.Size(43, 17);
this.rdoDataUpdateRemote.TabIndex = 7; this.rdoDataUpdateRemote.TabIndex = 7;
@ -71,7 +97,7 @@ namespace DutyContent.Tab
// rdoDataUpdateLocal // rdoDataUpdateLocal
// //
this.rdoDataUpdateLocal.AutoSize = true; this.rdoDataUpdateLocal.AutoSize = true;
this.rdoDataUpdateLocal.Location = new System.Drawing.Point(251, 57); this.rdoDataUpdateLocal.Location = new System.Drawing.Point(251, 87);
this.rdoDataUpdateLocal.Name = "rdoDataUpdateLocal"; this.rdoDataUpdateLocal.Name = "rdoDataUpdateLocal";
this.rdoDataUpdateLocal.Size = new System.Drawing.Size(43, 17); this.rdoDataUpdateLocal.Size = new System.Drawing.Size(43, 17);
this.rdoDataUpdateLocal.TabIndex = 6; this.rdoDataUpdateLocal.TabIndex = 6;
@ -83,15 +109,15 @@ namespace DutyContent.Tab
// //
this.lblDataUpdate.AutoSize = true; this.lblDataUpdate.AutoSize = true;
this.lblDataUpdate.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblDataUpdate.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDataUpdate.Location = new System.Drawing.Point(12, 54); this.lblDataUpdate.Location = new System.Drawing.Point(12, 84);
this.lblDataUpdate.Name = "lblDataUpdate"; this.lblDataUpdate.Name = "lblDataUpdate";
this.lblDataUpdate.Size = new System.Drawing.Size(39, 20); this.lblDataUpdate.Size = new System.Drawing.Size(39, 20);
this.lblDataUpdate.TabIndex = 5; this.lblDataUpdate.TabIndex = 5;
this.lblDataUpdate.Text = "201"; this.lblDataUpdate.Text = "203";
// //
// lblCurrentLang // lblCurrentLang
// //
this.lblCurrentLang.Location = new System.Drawing.Point(318, 37); this.lblCurrentLang.Location = new System.Drawing.Point(318, 67);
this.lblCurrentLang.Name = "lblCurrentLang"; this.lblCurrentLang.Name = "lblCurrentLang";
this.lblCurrentLang.Size = new System.Drawing.Size(150, 15); this.lblCurrentLang.Size = new System.Drawing.Size(150, 15);
this.lblCurrentLang.TabIndex = 4; this.lblCurrentLang.TabIndex = 4;
@ -102,7 +128,7 @@ namespace DutyContent.Tab
// //
this.cboDispLang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboDispLang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboDispLang.FormattingEnabled = true; this.cboDispLang.FormattingEnabled = true;
this.cboDispLang.Location = new System.Drawing.Point(251, 13); this.cboDispLang.Location = new System.Drawing.Point(251, 43);
this.cboDispLang.Name = "cboDispLang"; this.cboDispLang.Name = "cboDispLang";
this.cboDispLang.Size = new System.Drawing.Size(217, 21); this.cboDispLang.Size = new System.Drawing.Size(217, 21);
this.cboDispLang.TabIndex = 1; this.cboDispLang.TabIndex = 1;
@ -112,35 +138,47 @@ namespace DutyContent.Tab
// //
this.lblDispLang.AutoSize = true; this.lblDispLang.AutoSize = true;
this.lblDispLang.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblDispLang.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblDispLang.Location = new System.Drawing.Point(12, 11); this.lblDispLang.Location = new System.Drawing.Point(12, 41);
this.lblDispLang.Name = "lblDispLang"; this.lblDispLang.Name = "lblDispLang";
this.lblDispLang.Size = new System.Drawing.Size(39, 20); this.lblDispLang.Size = new System.Drawing.Size(39, 20);
this.lblDispLang.TabIndex = 0; this.lblDispLang.TabIndex = 0;
this.lblDispLang.Text = "201"; this.lblDispLang.Text = "201";
// //
// lblTag
//
this.lblTag.AutoSize = true;
this.lblTag.Location = new System.Drawing.Point(27, 4);
this.lblTag.Name = "lblTag";
this.lblTag.Size = new System.Drawing.Size(35, 13);
this.lblTag.TabIndex = 10;
this.lblTag.Text = "label1";
//
// ConfigForm // ConfigForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true; this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.panel1); this.Controls.Add(this.pnlBase);
this.Name = "ConfigForm"; this.Name = "ConfigForm";
this.Text = "Config"; this.Text = "Config";
this.panel1.ResumeLayout(false); this.pnlBase.ResumeLayout(false);
this.panel1.PerformLayout(); this.pnlBase.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel pnlBase;
private System.Windows.Forms.Label lblDispLang; private System.Windows.Forms.Label lblDispLang;
private System.Windows.Forms.ComboBox cboDispLang; private System.Windows.Forms.ComboBox cboDispLang;
private System.Windows.Forms.Label lblCurrentLang; private System.Windows.Forms.Label lblCurrentLang;
private System.Windows.Forms.RadioButton rdoDataUpdateRemote; private System.Windows.Forms.RadioButton rdoDataUpdateRemote;
private System.Windows.Forms.RadioButton rdoDataUpdateLocal; private System.Windows.Forms.RadioButton rdoDataUpdateLocal;
private System.Windows.Forms.Label lblDataUpdate; private System.Windows.Forms.Label lblDataUpdate;
private System.Windows.Forms.Button btnUiFont;
private System.Windows.Forms.Label lblUiFont;
private System.Windows.Forms.Label lblTag;
} }
} }

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -64,6 +65,11 @@ namespace DutyContent.Tab
lblDataUpdate.Text = MesgLog.Text(203); lblDataUpdate.Text = MesgLog.Text(203);
rdoDataUpdateLocal.Text = MesgLog.Text(204); rdoDataUpdateLocal.Text = MesgLog.Text(204);
rdoDataUpdateRemote.Text = MesgLog.Text(205); rdoDataUpdateRemote.Text = MesgLog.Text(205);
lblUiFont.Text = MesgLog.Text(210);
btnUiFont.Text = DcConfig.UiFontFamily;
lblTag.Text = MesgLog.Text(211, DcConfig.PluginTag, DcConfig.PluginVersion);
} }
public static List<string> MakeConfigLangList() public static List<string> MakeConfigLangList()
@ -134,5 +140,32 @@ namespace DutyContent.Tab
{ {
InternalDataUpdate(true); InternalDataUpdate(true);
} }
private void BtnUiFont_Click(object sender, EventArgs e)
{
Font ret = (Font)WorkerAct.Invoker(new WorkerAct.ObjectReturnerDelegate(() =>
{
FontDialog dg = new FontDialog
{
Font = btnUiFont.Font,
FontMustExist = true,
AllowVerticalFonts = false,
AllowVectorFonts = false,
ShowColor = false,
ShowEffects = false,
MaxSize = 12,
MinSize = 12,
};
return dg.ShowDialog() == DialogResult.OK ? dg.Font : null;
}));
if (ret != null)
{
DcConfig.UiFontFamily = ret.Name;
DcControl.Self.UpdateUiLocale();
DcConfig.SaveConfig();
}
}
} }
} }

View file

@ -9,8 +9,6 @@ using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using System.Collections.Specialized;
namespace DutyContent.Tab namespace DutyContent.Tab
{ {
@ -21,12 +19,16 @@ namespace DutyContent.Tab
// //
private bool _is_lock_fate; private bool _is_lock_fate;
private short _last_fate = 0;
//
private bool _is_packet_finder; private bool _is_packet_finder;
private DcContent.SaveTheQueenType _stq_type = DcContent.SaveTheQueenType.No; private DcContent.SaveTheQueenType _stq_type = DcContent.SaveTheQueenType.No;
private DcConfig.PacketConfig _new_packet; private DcConfig.PacketConfig _new_packet;
//
private Dictionary<string, string> _packet_list = new Dictionary<string, string>(); private Dictionary<string, string> _packet_list = new Dictionary<string, string>();
//private OrderedDictionary _packet_list = new OrderedDictionary();
// //
private Overlay.DutyOvForm _overlay; private Overlay.DutyOvForm _overlay;
@ -54,10 +56,6 @@ namespace DutyContent.Tab
RefreshDatasetList(); RefreshDatasetList();
RefreshPacketList(); RefreshPacketList();
//
var font = new Font(DcConfig.Duty.LogFontFamily, DcConfig.Duty.LogFontSize, FontStyle.Regular, GraphicsUnit.Point);
txtContentLog.Font = font;
btnLogFont.Font = font;
btnLogFont.Text = $"{DcConfig.Duty.LogFontFamily}, {DcConfig.Duty.LogFontSize}"; btnLogFont.Text = $"{DcConfig.Duty.LogFontFamily}, {DcConfig.Duty.LogFontSize}";
// //
@ -179,6 +177,11 @@ namespace DutyContent.Tab
btnPacketStart.Text = MesgLog.Text(10007); btnPacketStart.Text = MesgLog.Text(10007);
btnPacketApply.Text = MesgLog.Text(10009); btnPacketApply.Text = MesgLog.Text(10009);
//
var logfont = new Font(DcConfig.Duty.LogFontFamily, DcConfig.Duty.LogFontSize, FontStyle.Regular);
txtContentLog.Font = logfont;
btnLogFont.Font = logfont;
} }
public void PacketHandler(string pid, byte[] message) public void PacketHandler(string pid, byte[] message)
@ -220,6 +223,8 @@ namespace DutyContent.Tab
NotifyFate(fate); NotifyFate(fate);
_overlay.PlayFate(fate); _overlay.PlayFate(fate);
} }
_last_fate = (short)fcode;
} }
} }
else if (chkShowDebug.Checked && data[0] == 62 && data[8] > 0) // more than 0% else if (chkShowDebug.Checked && data[0] == 62 && data[8] > 0) // more than 0%
@ -231,6 +236,8 @@ namespace DutyContent.Tab
var fate = DcContent.TryFate(fcode); var fate = DcContent.TryFate(fcode);
if (fate == null) if (fate == null)
LogDebug("unknown fate {0}% \"{1}\"", data[8], fcode); LogDebug("unknown fate {0}% \"{1}\"", data[8], fcode);
_last_fate = (short)fcode;
} }
} }
} }
@ -328,12 +335,17 @@ namespace DutyContent.Tab
// 10[1] status 0=end, 1=register, 2=entry, 3=progress // 10[1] status 0=end, 1=register, 2=entry, 3=progress
// 12[1] progress percentage // 12[1] progress percentage
var stq = if (_stq_type == DcContent.SaveTheQueenType.No)
_stq_type == DcContent.SaveTheQueenType.Bozja ? 30000 : {
_stq_type == DcContent.SaveTheQueenType.Zadnor ? 30100 : if (IsFateForSouthernBozja(_last_fate))
30100; // temporary _stq_type = DcContent.SaveTheQueenType.Bozja;
else if (IsFateForZadnor(_last_fate))
_stq_type = DcContent.SaveTheQueenType.Zadnor;
else
_stq_type = DcContent.SaveTheQueenType.Zadnor;
}
var ce = stq + data[8]; var ce = data[8] + DcContent.SaveTheQueenTypeToCeBase(_stq_type);
var stat = data[10]; var stat = data[10];
if (stat == 0 /* || data[10] == 3 */) if (stat == 0 /* || data[10] == 3 */)
@ -381,8 +393,10 @@ namespace DutyContent.Tab
(zone_id == 921) ? DcContent.SaveTheQueenType.Zadnor : (zone_id == 921) ? DcContent.SaveTheQueenType.Zadnor :
DcContent.SaveTheQueenType.No; DcContent.SaveTheQueenType.No;
LogInstance(10025, zone_name);
if (chkShowDebug.Checked) if (chkShowDebug.Checked)
LogDebug("Zone: {0} \"{1}\"", zone_id, zone_name); LogDebug("Zone: {0}", zone_id);
} }
// //
@ -1099,9 +1113,9 @@ namespace DutyContent.Tab
_is_packet_finder = false; _is_packet_finder = false;
PacketFinderResetUi(false); PacketFinderResetUi(false);
// is this good idea? // select custom
// no bad idea DcConfig.Duty.PacketSet = DcConfig.PacketConfig.DefaultSetNameCustom;
//cboPacketset.SelectedIndex = 0; RefreshPacketList();
} }
} }
@ -1130,8 +1144,6 @@ namespace DutyContent.Tab
if (lstPacketInfo.SelectedIndices.Count != 1) if (lstPacketInfo.SelectedIndices.Count != 1)
return; return;
//MesgLog.Write("double clicked: {0}", lstPacketInfo.SelectedIndices[0]);
var v = int.MaxValue; var v = int.MaxValue;
switch (lstPacketInfo.SelectedIndices[0]) switch (lstPacketInfo.SelectedIndices[0])
@ -1182,25 +1194,52 @@ namespace DutyContent.Tab
} }
private static readonly short[] _packet_target_fates =
{
// middle la noscea // middle la noscea
private static readonly short[] _fates_middle_la_noscea =
{
553, 649, 687, 688, 693, 717, 553, 649, 687, 688, 693, 717,
220, 221, 222, 223, 225, 226, 227, 229, 231, 233, 235, 237, 238, 239, 240, 220, 221, 222, 223, 225, 226, 227, 229, 231, 233, 235, 237, 238, 239, 240,
1387, 1387,
};
// southern bozja front // southern bozja front
private static readonly short[] _fates_southern_bojza =
{
1597, 1598, 1599, 1597, 1598, 1599,
1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609,
1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619,
1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628,
};
// zadnor // zadnor
private static readonly short[] _fates_zadnor =
{
1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724,
1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732,
1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742,
}; };
//
private bool IsFateInFindList(short code)
{
return
_fates_middle_la_noscea.Contains(code) ||
_fates_southern_bojza.Contains(code) ||
_fates_zadnor.Contains(code);
}
//
private bool IsFateForSouthernBozja(short code)
{
return _fates_southern_bojza.Contains(code);
}
//
private bool IsFateForZadnor(short code)
{
return _fates_zadnor.Contains(code);
}
// //
private void PacketFinderHandler(byte[] message) private void PacketFinderHandler(byte[] message)
{ {
@ -1211,7 +1250,7 @@ namespace DutyContent.Tab
if (_new_packet.OpFate == 0 && data.Length > 4 && data[0] == 0x3E) if (_new_packet.OpFate == 0 && data.Length > 4 && data[0] == 0x3E)
{ {
var cc = BitConverter.ToInt16(data, 4); var cc = BitConverter.ToInt16(data, 4);
if (_packet_target_fates.Contains(cc) && _new_packet.OpFate != opcode) if (IsFateInFindList(cc) && _new_packet.OpFate != opcode)
{ {
_new_packet.OpFate = opcode; _new_packet.OpFate = opcode;
@ -1221,6 +1260,8 @@ namespace DutyContent.Tab
lstPacketInfo.Items[0].SubItems[3].Text = _new_packet.OpFate.ToString(); lstPacketInfo.Items[0].SubItems[3].Text = _new_packet.OpFate.ToString();
}); });
_last_fate = cc;
return; return;
} }
} }
@ -1343,11 +1384,17 @@ namespace DutyContent.Tab
if (ok) if (ok)
{ {
var stq = if (_stq_type == DcContent.SaveTheQueenType.No)
_stq_type == DcContent.SaveTheQueenType.Bozja ? 30000 : {
_stq_type == DcContent.SaveTheQueenType.Zadnor ? 30100 : if (IsFateForSouthernBozja(_last_fate))
30100; // temporary _stq_type = DcContent.SaveTheQueenType.Bozja;
var ce = DcContent.GetFate(code + stq); else if (IsFateForZadnor(_last_fate))
_stq_type = DcContent.SaveTheQueenType.Zadnor;
else
_stq_type = DcContent.SaveTheQueenType.Zadnor;
}
var ce = DcContent.GetFate(code + DcContent.SaveTheQueenTypeToCeBase(_stq_type));
var li = new ListViewItem(new string[] var li = new ListViewItem(new string[]
{ {

29
ThirdParty/FontUtilities.cs vendored Normal file
View file

@ -0,0 +1,29 @@
using System.Drawing;
using System.Windows.Forms;
namespace DutyContent.ThirdParty
{
// https://www.codeproject.com/Questions/1080006/How-can-change-application-font-in-runtime
public static class FontUtilities
{
public static void SimpleChangeFont(Control ctrl, string fontname, bool recursive = false)
{
ctrl.Font = new Font(fontname, ctrl.Font.Size, ctrl.Font.Style, GraphicsUnit.Point);
if (recursive)
InternalRecursiveChangeFont(fontname, ctrl.Controls);
}
private static void InternalRecursiveChangeFont(string fontname, Control.ControlCollection ctrls)
{
foreach (Control c in ctrls)
{
c.Font = new Font(fontname, c.Font.Size, c.Font.Style, GraphicsUnit.Point);
if (c.Controls.Count > 0)
InternalRecursiveChangeFont(fontname, c.Controls);
}
}
}
}