diff --git a/Browser/Browser.csproj b/Browser/Browser.csproj index 280c7500b..b64ad8c17 100644 --- a/Browser/Browser.csproj +++ b/Browser/Browser.csproj @@ -15,6 +15,11 @@ EOBrowser v4.5.2 512 + false + + + true + publish\ true Disk @@ -27,13 +32,8 @@ true 0 1.0.0.%2a - false false true - - - true - AnyCPU @@ -44,6 +44,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -53,6 +54,7 @@ TRACE prompt 1 + false @@ -127,25 +129,6 @@ BrowserLib - - - {EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B} - 1 - 1 - 0 - aximp - False - - - {EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B} - 1 - 1 - 0 - tlbimp - False - True - - False diff --git a/Browser/CefOp/RequestHandler.cs b/Browser/CefOp/RequestHandler.cs index 3ed955a88..cb955aefb 100644 --- a/Browser/CefOp/RequestHandler.cs +++ b/Browser/CefOp/RequestHandler.cs @@ -8,17 +8,22 @@ namespace Browser.CefOp { - /// - /// レスポンスの置換制御を行います。 - /// public class RequestHandler : DefaultRequestHandler { + public delegate void RenderProcessTerminatedEventHandler(string message); + public event RenderProcessTerminatedEventHandler RenderProcessTerminated; + bool pixiSettingEnabled; - public RequestHandler(bool pixiSettingEnabled) : base() { + + public RequestHandler(bool pixiSettingEnabled) : base() + { this.pixiSettingEnabled = pixiSettingEnabled; } + /// + /// レスポンスの置換制御を行います。 + /// public override IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response) { if (pixiSettingEnabled && request.Url.Contains(@"/kcs2/index.php")) @@ -26,5 +31,47 @@ public override IResponseFilter GetResourceResponseFilter(IWebBrowser browserCon return base.GetResourceResponseFilter(browserControl, browser, frame, request, response); } + + /// + /// 特定の通信をブロックします。 + /// + public override CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback) + { + // ログイン直後に勝手に遷移させられ、ブラウザがホワイトアウトすることがあるためブロックする + if (request.Url.Contains(@"/rt.gsspat.jp/")) + { + return CefReturnValue.Cancel; + } + + return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback); + } + + /// + /// 描画プロセスが何らかの理由で落ちた際の処理を行います。 + /// + public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status) + { + // note: out of memory (例外コード: 0xe0000008) でクラッシュした場合、このイベントは呼ばれない + + string ret = "ブラウザの描画プロセスが"; + switch (status) + { + case CefTerminationStatus.AbnormalTermination: + ret += "正常に終了しませんでした。"; + break; + case CefTerminationStatus.ProcessWasKilled: + ret += "何者かによって殺害されました。"; + break; + case CefTerminationStatus.ProcessCrashed: + ret += "クラッシュしました。"; + break; + default: + ret += "謎の死を遂げました。"; + break; + } + ret += "再読み込みすると復帰します。"; + + RenderProcessTerminated(ret); + } } } diff --git a/Browser/CefOp/ScreenShotPacket.cs b/Browser/CefOp/ScreenShotPacket.cs index b0ec141cd..fa44dfc18 100644 --- a/Browser/CefOp/ScreenShotPacket.cs +++ b/Browser/CefOp/ScreenShotPacket.cs @@ -12,21 +12,24 @@ public class ScreenShotPacket { public string ID { get; } public string DataUrl; - private TaskCompletionSource taskSource; + public TaskCompletionSource TaskSource { get; } - public ScreenShotPacket(TaskCompletionSource source) : this("ss_" + Guid.NewGuid().ToString("N"), source) { } - public ScreenShotPacket(string id, TaskCompletionSource source) + public ScreenShotPacket() : this("ss_" + Guid.NewGuid().ToString("N")) { } + public ScreenShotPacket(string id) { ID = id; - taskSource = source; + TaskSource = new TaskCompletionSource(); } public void Complete(string dataurl) { DataUrl = dataurl; - taskSource.SetResult(ConvertToImage(dataurl)); + TaskSource.SetResult(this); } + public Bitmap GetImage() => ConvertToImage(DataUrl); + + public static Bitmap ConvertToImage(string dataurl) { if (dataurl == null || !dataurl.StartsWith("data:image/png")) diff --git a/Browser/FormBrowser.cs b/Browser/FormBrowser.cs index 9465603c5..b5225bbf9 100644 --- a/Browser/FormBrowser.cs +++ b/Browser/FormBrowser.cs @@ -223,22 +223,28 @@ void InitializeBrowser() CachePath = BrowserCachePath, Locale = "ja", AcceptLanguageList = "ja,en-US,en", // todo: いる? - LogSeverity = LogSeverity.Disable, + LogSeverity = LogSeverity.Error, + LogFile = "BrowserLog.log", }; if (!Configuration.HardwareAccelerationEnabled) settings.DisableGpuAcceleration(); settings.CefCommandLineArgs.Add("proxy-server", ProxySettings); + if (Configuration.ForceColorProfile) + settings.CefCommandLineArgs.Add("force-color-profile", "srgb"); CefSharpSettings.SubprocessExitIfParentProcessClosed = true; Cef.Initialize(settings, false, null); + var requestHandler = new RequestHandler(pixiSettingEnabled: Configuration.PreserveDrawingBuffer); + requestHandler.RenderProcessTerminated += (mes) => AddLog(3, mes); + Browser = new ChromiumWebBrowser(@"about:blank") { Dock = DockStyle.None, Size = SizeAdjuster.Size, - RequestHandler = new RequestHandler(pixiSettingEnabled: Configuration.PreserveDrawingBuffer), + RequestHandler = requestHandler, MenuHandler = new MenuHandler(), KeyboardHandler = new KeyboardHandler(), DragHandler = new DragHandler(), @@ -568,67 +574,56 @@ public void ApplyZoom() /// /// スクリーンショットを撮影します。 /// - private Task TakeScreenShot() + private async Task TakeScreenShot() { - var source = new TaskCompletionSource(); - - if (Browser == null || !Browser.IsBrowserInitialized) - return source.Task; - - - var browser = Browser.GetBrowser(); - - var KanColleFrame = GetKanColleFrame(); - - if (KanColleFrame == null) + var kancolleFrame = GetKanColleFrame(); + if (kancolleFrame == null) { AddLog(3, string.Format("艦これが読み込まれていないため、スクリーンショットを撮ることはできません。")); System.Media.SystemSounds.Beep.Play(); - return source.Task; + return null; } - var request = new ScreenShotPacket(source); - string script = $@" + Task InternalTakeScreenShot() + { + var request = new ScreenShotPacket(); + + if (Browser == null || !Browser.IsBrowserInitialized) + return request.TaskSource.Task; + + + string script = $@" (async function() {{ await CefSharp.BindObjectAsync('{request.ID}'); - var canvas = document.querySelector('canvas'); + let canvas = document.querySelector('canvas'); requestAnimationFrame(() => {{ - var dataurl = canvas.toDataURL('image/png'); + let dataurl = canvas.toDataURL('image/png'); {request.ID}.complete(dataurl); }}); }})(); "; - Browser.JavascriptObjectRepository.Register(request.ID, request, true); - KanColleFrame.ExecuteJavaScriptAsync(script); + Browser.JavascriptObjectRepository.Register(request.ID, request, true); + kancolleFrame.ExecuteJavaScriptAsync(script); - return source.Task; - } + return request.TaskSource.Task; + } + var result = await InternalTakeScreenShot(); - /// - /// ブラウザ画面のハードコピーを取得します。 - /// TakeScreenShot で SS が撮れない環境 (WebGL && preserveDrawingBuffer=false) で使用します。 - /// - private Task TakeHardScreenShot() - { - // スタイルシートが適用されていると仮定する + // ごみ掃除 + Browser.JavascriptObjectRepository.UnRegister(result.ID); + kancolleFrame.ExecuteJavaScriptAsync($@"delete {result.ID}"); - var bmp = new Bitmap(Browser.Width, Browser.Height, PixelFormat.Format24bppRgb); - using (var g = Graphics.FromImage(bmp)) - { - g.CopyFromScreen(Browser.PointToScreen(Browser.Location), new Point(0, 0), Browser.Size); - } - - // 同期処理でもいいが、TakeScreenShot とシグネチャを合わせるため - return Task.FromResult(bmp); + return result.GetImage(); } + /// /// スクリーンショットを撮影し、設定で指定された保存先に保存します。 /// @@ -643,10 +638,7 @@ public async Task SaveScreenShot() Bitmap image = null; try { - if (Configuration.HardwareAccelerationEnabled && !Configuration.PreserveDrawingBuffer) - image = await TakeHardScreenShot(); - else - image = await TakeScreenShot(); + image = await TakeScreenShot(); if (image == null) diff --git a/Browser/Program.cs b/Browser/Program.cs index 5c4a59a0f..a22405a48 100644 --- a/Browser/Program.cs +++ b/Browser/Program.cs @@ -33,7 +33,31 @@ private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object s { string asmname = args.Name.Split(",".ToCharArray(), 2)[0] + ".dll"; string arch = System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, Environment.Is64BitProcess ? "x64" : "x86", asmname); - return System.IO.File.Exists(arch) ? System.Reflection.Assembly.LoadFile(arch) : null; + + if (!System.IO.File.Exists(arch)) + return null; + + try + { + return System.Reflection.Assembly.LoadFile(arch); + } + catch (System.IO.FileNotFoundException) + { + if (MessageBox.Show( +$@"ブラウザコンポーネントがロードできませんでした。動作に必要な +「Microsoft Visual C++ 2015 再頒布可能パッケージ」 +がインストールされていないのが原因の可能性があります。 +ダウンロードページを開きますか? +(vc_redist.{(Environment.Is64BitProcess ? "x64" : "x86")}.exe をインストールしてください。)", + "CefSharp ロードエラー", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1) + == DialogResult.Yes) + { + System.Diagnostics.Process.Start(@"https://www.microsoft.com/ja-jp/download/details.aspx?id=53587"); + } + + // なんにせよ今回は起動できないのであきらめる + throw; + } } return null; } diff --git a/BrowserLib/IBrowserHost.cs b/BrowserLib/IBrowserHost.cs index ac43c9d15..7c2a12e29 100644 --- a/BrowserLib/IBrowserHost.cs +++ b/BrowserLib/IBrowserHost.cs @@ -187,5 +187,11 @@ public class BrowserConfiguration [DataMember] public bool PreserveDrawingBuffer { get; set; } + /// + /// カラープロファイルを sRGB 固定にするか + /// + [DataMember] + public bool ForceColorProfile { get; set; } + } } diff --git a/ElectronicObserver/Data/EquipmentDataMaster.cs b/ElectronicObserver/Data/EquipmentDataMaster.cs index 0e3850bd2..1398d351d 100644 --- a/ElectronicObserver/Data/EquipmentDataMaster.cs +++ b/ElectronicObserver/Data/EquipmentDataMaster.cs @@ -161,6 +161,13 @@ public class EquipmentDataMaster : ResponseWrapper, IIdentifiable public int IconType => (int)RawData.api_type[3]; + internal int[] equippableShipsAtExpansion = new int[0]; + /// + /// 拡張スロットに装備可能な艦船IDのリスト + /// + public IEnumerable EquippableShipsAtExpansion => equippableShipsAtExpansion; + + // 以降自作判定 // note: icontype の扱いについては再考の余地あり diff --git a/ElectronicObserver/Data/KCDatabase.cs b/ElectronicObserver/Data/KCDatabase.cs index 129995967..491afe36d 100644 --- a/ElectronicObserver/Data/KCDatabase.cs +++ b/ElectronicObserver/Data/KCDatabase.cs @@ -37,6 +37,11 @@ public sealed class KCDatabase /// public IDDictionary ShipTypes { get; private set; } + /// + /// 艦船グラフィックデータ + /// + public IDDictionary ShipGraphics { get; private set; } + /// /// 装備のマスターデータ /// @@ -154,6 +159,7 @@ private KCDatabase() MasterShips = new IDDictionary(); ShipTypes = new IDDictionary(); + ShipGraphics = new IDDictionary(); MasterEquipments = new IDDictionary(); EquipmentTypes = new IDDictionary(); Ships = new IDDictionary(); diff --git a/ElectronicObserver/Data/ShipDataMaster.cs b/ElectronicObserver/Data/ShipDataMaster.cs index fc1447d25..a8b87d0ea 100644 --- a/ElectronicObserver/Data/ShipDataMaster.cs +++ b/ElectronicObserver/Data/ShipDataMaster.cs @@ -43,10 +43,10 @@ public class ShipDataMaster : ResponseWrapper, IIdentifiable /// public ShipTypes ShipType => (ShipTypes)(int)RawData.api_stype; - /// - /// 艦型 - /// - public int ShipClass => (int)RawData.api_ctype; + /// + /// 艦型 + /// + public int ShipClass => (int)RawData.api_ctype; /// @@ -98,10 +98,10 @@ public class ShipDataMaster : ResponseWrapper, IIdentifiable /// public int NeedCatapult { get; internal set; } - /// - /// 改装に戦闘詳報が必要かどうか - /// - public int NeedActionReport { get; internal set; } + /// + /// 改装に戦闘詳報が必要かどうか + /// + public int NeedActionReport { get; internal set; } #region Parameters @@ -414,6 +414,27 @@ public ReadOnlyCollection DefaultSlot } + internal int[] specialEquippableCategory = null; + /// + /// 特殊装備カテゴリ 指定がない場合は null + /// + public IEnumerable SpecialEquippableCategories => specialEquippableCategory; + + /// + /// 装備可能なカテゴリ + /// + public IEnumerable EquippableCategories + { + get + { + if (specialEquippableCategory != null) + return SpecialEquippableCategories; + else + return KCDatabase.Instance.ShipTypes[(int)ShipType].EquippableCategories; + } + } + + /// /// 建造時間(分) /// @@ -464,25 +485,31 @@ public ReadOnlyCollection DefaultSlot /// - /// リソースのファイル/フォルダ名 + /// グラフィック設定データへの参照 /// - public string ResourceName => GetParameterElement()?.ResourceName ?? ""; + public ShipGraphicData GraphicData => KCDatabase.Instance.ShipGraphics[ShipID]; + /// + /// リソースのファイル/フォルダ名 + /// + public string ResourceName => GraphicData?.ResourceName ?? ""; /// /// 画像リソースのバージョン /// - public string ResourceGraphicVersion => GetParameterElement()?.ResourceGraphicVersion ?? ""; + public string ResourceGraphicVersion => GraphicData?.GraphicVersion ?? ""; /// /// ボイスリソースのバージョン /// - public string ResourceVoiceVersion => GetParameterElement()?.ResourceVoiceVersion ?? ""; + public string ResourceVoiceVersion => GraphicData?.VoiceVersion ?? ""; /// /// 母港ボイスリソースのバージョン /// - public string ResourcePortVoiceVersion => GetParameterElement()?.ResourcePortVoiceVersion ?? ""; + public string ResourcePortVoiceVersion => GraphicData?.PortVoiceVersion ?? ""; + + /// /// 衣替え艦:ベースとなる艦船ID diff --git a/ElectronicObserver/Data/ShipGraphicData.cs b/ElectronicObserver/Data/ShipGraphicData.cs new file mode 100644 index 000000000..7fc508efa --- /dev/null +++ b/ElectronicObserver/Data/ShipGraphicData.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data +{ + /// + /// 艦船のグラフィック設定情報を保持します。 + /// + public class ShipGraphicData : ResponseWrapper, IIdentifiable + { + /// + /// 艦船ID + /// + public int ShipID => (int)RawData.api_id; + + /// + /// リソースファイル名 + /// + public string ResourceName => RawData.api_filename; + + /// + /// 画像バージョン + /// + public string GraphicVersion => RawData.api_version[0]; + + /// + /// ボイスバージョン + /// + public string VoiceVersion => RawData.api_version[1]; + + /// + /// 母港ボイスバージョン + /// + public string PortVoiceVersion => RawData.api_version[2]; + + + /// + /// 母港での表示座標(通常時) + /// + public Point PortLocation => new Point((int)RawData.api_boko_n[0], (int)RawData.api_boko_n[1]); + + /// + /// 母港での表示座標(中破時) + /// + public Point PortLocationDamaged => new Point((int)RawData.api_boko_d[0], (int)RawData.api_boko_d[1]); + + + /// + /// 改修時の表示座標(通常時) + /// + public Point ModernizationLocation => new Point((int)RawData.api_kaisyu_n[0], (int)RawData.api_kaisyu_n[1]); + + /// + /// 改修時の表示座標(中破時) + /// + public Point ModernizationLocationDamaged => new Point((int)RawData.api_kaisyu_d[0], (int)RawData.api_kaisyu_d[1]); + + + /// + /// 改造時の表示座標(通常時) + /// + public Point RemodelLocation => new Point((int)RawData.api_kaizo_n[0], (int)RawData.api_kaizo_n[1]); + + /// + /// 改造時の表示座標(中破時) + /// + public Point RemodelLocationDamaged => new Point((int)RawData.api_kaizo_d[0], (int)RawData.api_kaizo_d[1]); + + + /// + /// 出撃時の表示座標(通常時) + /// + public Point SortieLocation => new Point((int)RawData.api_map_n[0], (int)RawData.api_map_n[1]); + + /// + /// 出撃時の表示座標(中破時) + /// + public Point SortieLocationDamaged => new Point((int)RawData.api_map_d[0], (int)RawData.api_map_d[1]); + + + /// + /// 味方側での演習開始時の表示座標(通常時) + /// + public Point PracticeFriendLocation => new Point((int)RawData.api_ensyuf_n[0], (int)RawData.api_ensyuf_n[1]); + + /// + /// 味方側での演習開始時の表示座標(中破時) + /// + public Point PracticeFriendLocationDamaged => new Point((int)RawData.api_ensyuf_d[0], (int)RawData.api_ensyuf_d[1]); + + + /// + /// 敵側での演習開始時の表示座標(通常時) + /// + public Point PracticeEnemyLocation => new Point((int)RawData.api_ensyuf_n[0], (int)RawData.api_ensyuf_n[1]); + + + /// + /// 戦闘時の表示座標(通常時) + /// + public Point BattleFriendLocation => new Point((int)RawData.api_battle_n[0], (int)RawData.api_battle_n[1]); + + /// + /// 戦闘時の表示座標(中破時) + /// + public Point BattleFriendLocationDamaged => new Point((int)RawData.api_battle_d[0], (int)RawData.api_battle_d[1]); + + + /// + /// ケッコンカッコカリ時の表示エリア + /// ≒ 顔座標 + /// + public Rectangle FaceArea => new Rectangle( + (int)RawData.api_weda[0], + (int)RawData.api_weda[1], + (int)RawData.api_wedb[0], + (int)RawData.api_wedb[1]); + + + public int ID => ShipID; + } +} diff --git a/ElectronicObserver/Data/ShipType.cs b/ElectronicObserver/Data/ShipType.cs index 37ef2ae5b..24b9179d5 100644 --- a/ElectronicObserver/Data/ShipType.cs +++ b/ElectronicObserver/Data/ShipType.cs @@ -42,10 +42,10 @@ public class ShipType : ResponseWrapper, IIdentifiable /// - /// 装備可否フラグ + /// 装備可能なカテゴリ一覧 /// - private HashSet _equipmentType; - public HashSet EquipmentType => _equipmentType; + private int[] _equippableCategories; + public ReadOnlyCollection EquippableCategories => Array.AsReadOnly(_equippableCategories); /// @@ -62,8 +62,7 @@ public class ShipType : ResponseWrapper, IIdentifiable public ShipType() : base() { - - _equipmentType = new HashSet(); + _equippableCategories = new int[0]; } public override void LoadFromResponse(string apiname, dynamic data) @@ -78,13 +77,16 @@ public override void LoadFromResponse(string apiname, dynamic data) if (IsAvailable) { - _equipmentType = new HashSet(); - foreach (KeyValuePair type in RawData.api_equip_type) + IEnumerable getType() { - - if ((double)type.Value != 0) - _equipmentType.Add(Convert.ToInt32(type.Key.Substring(7))); //skip api_id_ + foreach (KeyValuePair type in RawData.api_equip_type) + { + if ((double)type.Value != 0) + yield return Convert.ToInt32(type.Key.Substring(7)); //skip api_id_ + } } + + _equippableCategories = getType().ToArray(); } } diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index 8d158828e..0d40fdb7f 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -37,6 +37,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -46,6 +47,7 @@ TRACE prompt 4 + false 74eo.ico @@ -180,6 +182,7 @@ + @@ -455,7 +458,6 @@ DialogLocalAPILoader.cs - diff --git a/ElectronicObserver/Observer/kcsapi/api_get_member/ship3.cs b/ElectronicObserver/Observer/kcsapi/api_get_member/ship3.cs index 2881c4ceb..81aef6a2a 100644 --- a/ElectronicObserver/Observer/kcsapi/api_get_member/ship3.cs +++ b/ElectronicObserver/Observer/kcsapi/api_get_member/ship3.cs @@ -36,6 +36,77 @@ public override void OnResponseReceived(dynamic data) } } + + // 装備シナジー検出カッコカリ + if (ship.MasterShip.ASW.IsDetermined && + ship.MasterShip.Evasion.IsDetermined && + ship.MasterShip.LOS.IsDetermined) + { + int firepower = ship.FirepowerTotal - ship.FirepowerBase; + int torpedo = ship.TorpedoTotal - ship.TorpedoBase; + int aa = ship.AATotal - ship.AABase; + int armor = ship.ArmorTotal - ship.ArmorBase; + int asw = ship.ASWTotal - (ship.MasterShip.ASW.GetEstParameterMin(ship.Level) + ship.ASWModernized); + int evasion = ship.EvasionTotal - ship.MasterShip.Evasion.GetEstParameterMin(ship.Level); + int los = ship.LOSTotal - ship.MasterShip.LOS.GetEstParameterMin(ship.Level); + int luck = ship.LuckTotal - ship.LuckBase; + int range = ship.MasterShip.Range; + + foreach (var eq in ship.AllSlotInstanceMaster.Where(eq => eq != null)) + { + firepower -= eq.Firepower; + torpedo -= eq.Torpedo; + aa -= eq.AA; + armor -= eq.Armor; + asw -= eq.ASW; + evasion -= eq.Evasion; + los -= eq.LOS; + luck -= eq.Luck; + range = Math.Max(range, eq.Range); + } + + range = ship.Range - range; + + if (firepower != 0 || + torpedo != 0 || + aa != 0 || + armor != 0 || + asw != 0 || + evasion != 0 || + los != 0 || + luck != 0 || + range != 0) + { + var sb = new StringBuilder(); + sb.AppendFormat("装備シナジーを検出しました:{0} [{1}]; ", + ship.NameWithLevel, + string.Join(", ", ship.AllSlotInstance.Where(eq => eq != null).Select(eq => eq.NameWithLevel))); + + var a = new List(); + if (firepower != 0) + a.Add($"火力{firepower:+#;-#;0}"); + if (torpedo != 0) + a.Add($"雷装{torpedo:+#;-#;0}"); + if (aa != 0) + a.Add($"対空{aa:+#;-#;0}"); + if (armor != 0) + a.Add($"装甲{armor:+#;-#;0}"); + if (asw != 0) + a.Add($"対潜{asw:+#;-#;0}"); + if (evasion != 0) + a.Add($"回避{evasion:+#;-#;0}"); + if (los != 0) + a.Add($"索敵{los:+#;-#;0}"); + if (luck != 0) + a.Add($"運{luck:+#;-#;0}"); + if (range != 0) + a.Add($"射程{range:+#;-#;0}"); + + sb.Append(string.Join(", ", a)); + + Utility.Logger.Add(1, sb.ToString()); + } + } } //api_deck_data @@ -46,7 +117,6 @@ public override void OnResponseReceived(dynamic data) base.OnResponseReceived((object)data); } - public override string APIName => "api_get_member/ship3"; } diff --git a/ElectronicObserver/Observer/kcsapi/api_req_member/itemuse.cs b/ElectronicObserver/Observer/kcsapi/api_req_member/itemuse.cs index 2b6bbcb7a..3359d7699 100644 --- a/ElectronicObserver/Observer/kcsapi/api_req_member/itemuse.cs +++ b/ElectronicObserver/Observer/kcsapi/api_req_member/itemuse.cs @@ -15,7 +15,7 @@ public override void OnResponseReceived(dynamic data) { foreach (var elem in data.api_getitem) { - if (elem.api_slotitem()) + if (elem != null && elem.api_slotitem()) { var eq = new EquipmentData(); eq.LoadFromResponse(APIName, elem.api_slotitem); diff --git a/ElectronicObserver/Observer/kcsapi/api_start2.cs b/ElectronicObserver/Observer/kcsapi/api_start2.cs deleted file mode 100644 index 3660546bd..000000000 --- a/ElectronicObserver/Observer/kcsapi/api_start2.cs +++ /dev/null @@ -1,231 +0,0 @@ -using ElectronicObserver.Data; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ElectronicObserver.Observer.kcsapi -{ - [Obsolete] - public class api_start2_old : APIBase - { - - - public override void OnResponseReceived(dynamic data) - { - - KCDatabase db = KCDatabase.Instance; - - - //特別置換処理 - data.api_mst_stype[7].api_name = "巡洋戦艦"; - - - //api_mst_ship - foreach (var elem in data.api_mst_ship) - { - - int id = (int)elem.api_id; - if (db.MasterShips[id] == null) - { - var ship = new ShipDataMaster(); - ship.LoadFromResponse(APIName, elem); - db.MasterShips.Add(ship); - } - else - { - db.MasterShips[id].LoadFromResponse(APIName, elem); - } - } - - //改装関連のデータ設定 - foreach (var ship in db.MasterShips) - { - int remodelID = ship.Value.RemodelAfterShipID; - if (remodelID != 0) - { - db.MasterShips[remodelID].RemodelBeforeShipID = ship.Key; - } - } - - - //api_mst_slotitem_equiptype - foreach (var elem in data.api_mst_slotitem_equiptype) - { - - int id = (int)elem.api_id; - if (db.EquipmentTypes[id] == null) - { - var eqt = new EquipmentType(); - eqt.LoadFromResponse(APIName, elem); - db.EquipmentTypes.Add(eqt); - } - else - { - db.EquipmentTypes[id].LoadFromResponse(APIName, elem); - } - } - - - //api_mst_stype - foreach (var elem in data.api_mst_stype) - { - - int id = (int)elem.api_id; - if (db.ShipTypes[id] == null) - { - var spt = new ShipType(); - spt.LoadFromResponse(APIName, elem); - db.ShipTypes.Add(spt); - } - else - { - db.ShipTypes[id].LoadFromResponse(APIName, elem); - } - } - - - //api_mst_slotitem - foreach (var elem in data.api_mst_slotitem) - { - - int id = (int)elem.api_id; - if (db.MasterEquipments[id] == null) - { - var eq = new EquipmentDataMaster(); - eq.LoadFromResponse(APIName, elem); - db.MasterEquipments.Add(eq); - } - else - { - db.MasterEquipments[id].LoadFromResponse(APIName, elem); - } - } - - //api_mst_slotitemgraph - /* - foreach ( var elem in data.api_mst_slotitemgraph ) { - - int id = (int)elem.api_id; - EquipmentDataMaster eq = db.MasterEquipments[id]; - if ( eq != null ) { - eq.ResourceVersion = elem.api_version; - } - } - */ - - //api_mst_useitem - foreach (var elem in data.api_mst_useitem) - { - - int id = (int)elem.api_id; - if (db.MasterUseItems[id] == null) - { - var item = new UseItemMaster(); - item.LoadFromResponse(APIName, elem); - db.MasterUseItems.Add(item); - } - else - { - db.MasterUseItems[id].LoadFromResponse(APIName, elem); - } - } - - //api_mst_maparea - foreach (var elem in data.api_mst_maparea) - { - int id = (int)elem.api_id; - if (db.MapArea[id] == null) - { - var item = new MapAreaData(); - item.LoadFromResponse(APIName, elem); - db.MapArea.Add(item); - } - else - { - db.MapArea[id].LoadFromResponse(APIName, elem); - } - } - - //api_mst_mapinfo - foreach (var elem in data.api_mst_mapinfo) - { - - int id = (int)elem.api_id; - if (db.MapInfo[id] == null) - { - var item = new MapInfoData(); - item.LoadFromResponse(APIName, elem); - db.MapInfo.Add(item); - } - else - { - db.MapInfo[id].LoadFromResponse(APIName, elem); - } - } - - - //api_mst_mission - foreach (var elem in data.api_mst_mission) - { - - int id = (int)elem.api_id; - if (db.Mission[id] == null) - { - var item = new MissionData(); - item.LoadFromResponse(APIName, elem); - db.Mission.Add(item); - } - else - { - db.Mission[id].LoadFromResponse(APIName, elem); - } - - } - - - //api_mst_shipupgrade - Dictionary upgradeLevels = new Dictionary(); - foreach (var elem in data.api_mst_shipupgrade) - { - - int idbefore = (int)elem.api_current_ship_id; - int idafter = (int)elem.api_id; - var shipbefore = db.MasterShips[idbefore]; - var shipafter = db.MasterShips[idafter]; - int level = (int)elem.api_upgrade_level; - - if (upgradeLevels.ContainsKey(idafter)) - { - if (level < upgradeLevels[idafter]) - { - shipafter.RemodelBeforeShipID = idbefore; - upgradeLevels[idafter] = level; - } - } - else - { - shipafter.RemodelBeforeShipID = idbefore; - upgradeLevels.Add(idafter, level); - } - - if (shipbefore != null) - { - shipbefore.NeedBlueprint = (int)elem.api_drawing_count; - shipbefore.NeedCatapult = (int)elem.api_catapult_count; - shipbefore.NeedActionReport = (int)elem.api_report_count; - } - } - - - Utility.Logger.Add(2, "提督が鎮守府に着任しました。これより艦隊の指揮を執ります。"); - - base.OnResponseReceived((object)data); - } - - public override string APIName => "api_start2"; - } - - -} diff --git a/ElectronicObserver/Observer/kcsapi/api_start2/getData.cs b/ElectronicObserver/Observer/kcsapi/api_start2/getData.cs index fada7fd34..fb9234371 100644 --- a/ElectronicObserver/Observer/kcsapi/api_start2/getData.cs +++ b/ElectronicObserver/Observer/kcsapi/api_start2/getData.cs @@ -102,17 +102,6 @@ public override void OnResponseReceived(dynamic data) } } - //api_mst_slotitemgraph - /* - foreach ( var elem in data.api_mst_slotitemgraph ) { - - int id = (int)elem.api_id; - EquipmentDataMaster eq = db.MasterEquipments[id]; - if ( eq != null ) { - eq.ResourceVersion = elem.api_version; - } - } - */ //api_mst_useitem foreach (var elem in data.api_mst_useitem) @@ -188,7 +177,6 @@ public override void OnResponseReceived(dynamic data) Dictionary upgradeLevels = new Dictionary(); foreach (var elem in data.api_mst_shipupgrade) { - int idbefore = (int)elem.api_current_ship_id; int idafter = (int)elem.api_id; var shipbefore = db.MasterShips[idbefore]; @@ -218,6 +206,38 @@ public override void OnResponseReceived(dynamic data) } + foreach (var elem in data.api_mst_equip_ship) + { + int id = (int)elem.api_ship_id; + db.MasterShips[id].specialEquippableCategory = (int[])elem.api_equip_type; + } + + foreach (var elem in data.api_mst_equip_exslot_ship) + { + int id = (int)elem.api_slotitem_id; + db.MasterEquipments[id].equippableShipsAtExpansion = (int[])elem.api_ship_ids; + } + + + //api_mst_shipgraph + foreach (var elem in data.api_mst_shipgraph) + { + + int id = (int)elem.api_id; + if (db.ShipGraphics[id] == null) + { + var sgd = new ShipGraphicData(); + sgd.LoadFromResponse(APIName, elem); + db.ShipGraphics.Add(sgd); + } + else + { + db.ShipGraphics[id].LoadFromResponse(APIName, elem); + } + } + + + Utility.Logger.Add(2, "提督が鎮守府に着任しました。これより艦隊の指揮を執ります。"); base.OnResponseReceived((object)data); diff --git a/ElectronicObserver/Other/Information/apilist.txt b/ElectronicObserver/Other/Information/apilist.txt index c5a0b9025..a4fd90cc0 100644 --- a/ElectronicObserver/Other/Information/apilist.txt +++ b/ElectronicObserver/Other/Information/apilist.txt @@ -11,6 +11,7 @@ api_start2/getData :艦娘・装備固有データその他 api_mst_ship :艦船データ(艦娘) 衣替え艦娘のデータはshipgraphにしか存在しない api_id :艦娘固有ID api_sortno :図鑑番号 + api_sort_id :母港ソート順? api_name :艦娘名 api_yomi :艦娘名読み api_stype :艦種ID @@ -24,27 +25,29 @@ api_start2/getData :艦娘・装備固有データその他 api_tyku :対空 api_tais :対潜 [1] [0]=初期値 護衛空母にのみ存在 api_luck :運 - api_soku :速力 0=陸上基地, 5=低速, 10=高速 + api_soku :速力 0=陸上基地, 5=低速, 10=高速(, 15=高速+, 20=最速) api_leng :射程 0=無, 1=短, 2=中, 3=長, 4=超長 api_slot_num :スロット数 api_maxeq :艦載機搭載数 - api_buildtime :建造時間 分単位 + api_buildtime :建造時間 分単位 api_broken :解体資材 api_powup :近代化改修強化値 - api_backs :レアリティ - api_getmes :取得時台詞 - api_afterfuel :改装鋼材 - api_afterbull :改装弾薬 - api_fuel_max :消費燃料 - api_bull_max :消費弾薬 + api_backs :レアリティ 1=藍, 2=青, 3=水, 4=銀, 5=金, 6=虹, 7=輝虹, 8=桜虹 + api_getmes :取得時台詞 改行は"
" + api_afterfuel :改装時に必要な鋼材 + api_afterbull :改装時に必要な弾薬 + api_fuel_max :搭載燃料 + api_bull_max :搭載弾薬 api_voicef :ボイス設定フラグ ビットフラグ; 1=放置ボイス, 2=時報, 4=特殊放置ボイス 放置ボイスは5分おきに発声する(cond>=50でかつ特殊放置ボイス利用可能ならそれを発声) api_mst_ship :艦船データ(深海棲艦) api_id :艦船固有ID + api_sort_id :0 api_name :艦船名 - api_yomi :敵クラス + api_yomi :敵クラス "" or "-", "elite", "flagship" api_stype :艦種 + api_ctype :艦型? 1 api_soku :速力 api_slot_num :スロット数 @@ -66,8 +69,8 @@ api_start2/getData :艦娘・装備固有データその他 api_ensyue_n :演習(敵軍側) api_battle_n :戦闘 api_battle_d : - api_weda :ケッコンカッコカリの顔枠の左上? - api_wedb :〃右下? + api_weda :ケッコンカッコカリの顔枠の左上座標 + api_wedb :〃幅[0]と高さ[1] api_mst_slotitem_equiptype :装備カテゴリ api_id :カテゴリID(装備のtype[2]に対応) @@ -76,7 +79,7 @@ api_start2/getData :艦娘・装備固有データその他 api_mst_equip_exslot:補強スロットに装備可能なカテゴリ - api_mst_equip_exslot_ship :拡張スロットへの特殊装備 + api_mst_equip_exslot_ship :補強スロットへの特殊装備 api_slotitem_id :装備ID api_ship_ids :対象となる艦娘ID [] @@ -397,6 +400,9 @@ api_start2/getData :艦娘・装備固有データその他 api_price :価格 api_saleflg :販売中? api_season : + api_version :画像バージョン? + api_outside_id : + api_active_flag : api_mst_furnituregraph :可動家具プロパティ api_id :家具ID @@ -498,6 +504,10 @@ api_start2/getData :艦娘・装備固有データその他 api_id :音楽ID? api_name :曲名 + api_mst_equip_ship :特殊装備 + api_ship_id :艦船ID + api_equip_type :装備可能なカテゴリのリスト[] 当該艦の装備可否はこれで上書きされ、艦種の装備可否は無視される + api_req_member/get_incentive :褒賞関連 api_count :情報の個数 @@ -517,7 +527,11 @@ api_get_member/require_info :起動時情報群 api_kdock :工廠ドック状態 kdock と同じ api_useitem :消費アイテムリスト useitem と同じ アイテムを1つも保有していない場合は存在しない api_furniture :家具リスト furniture と同じ - api_extra_supply :臨時補給可否? [2] + api_extra_supply :臨時補給可否[2] [0]=遠征時, [1]=出撃時 + api_oss_setting :編成フィルタ設定 + api_language_type :0=日本語 + api_oss_items :各艦種の表示フラグ[8] + api_skin_id :母港スキンID api_get_member/basic :艦隊司令部情報 api_member_id :提督ID string @@ -570,7 +584,7 @@ api_port/port :母港情報 api_nowhp :現在HP api_maxhp :最大HP api_soku :速力 0=基地, 5=低速, 10=高速, 15=高速+, 20=最速 - api_leng :射程 + api_leng :射程 0=無, 1=短, 2=中, 3=長, 4=超長(, 5=超長+) api_slot :装備 -1=空き api_onslot :艦載機搭載数 api_slot_ex :補強スロット 0=未解放, -1=未装備 @@ -3151,13 +3165,13 @@ Request.api_req_member/itemuse :アイテム使用 api_req_member/itemuse :アイテム使用 api_caution_flag :確認ダイアログ(資源上限により無駄が出ますが本当に使いますか?)表示フラグ? 0=非表示 1=表示? - api_flag :1=アイテム 2=資源 - api_getitem :入手アイテム[] アイテム入手時のみ存在 - api_usemst :? 6=設計図 2=装備 5・6=アイテム + api_flag :1=アイテム 2=資源 3=両方 + api_getitem :入手アイテム[] アイテムがない場合は [null] になる + api_usemst :? 2=装備 5=アイテム 6=アイテム(設計図) api_mst_id :入手アイテムID api_getcount :入手アイテム個数 + api_slotitem :入手装備アイテム 装備入手時のみ存在 slot_item に準じる api_material :入手資源 資源入手時のみ存在 [燃料, 弾薬, 鋼材, ボーキ, 高速建造材, 高速修復材, 開発資材, 改修資材] - api_slotitem :入手装備アイテム 装備入手時のみ存在? slot_item に準じる api_req_furniture/music_list :ジュークボックスメニュー @@ -3216,13 +3230,18 @@ api_req_furniture/radio_play :母港ラジオ再生 (情報なし) -Request.api_req_member/set_oss_condition :??? - api_language_type :0 - api_oss_items[0] :1 - ... - api_oss_items[7] :1 +Request.api_req_member/set_oss_condition :艦船フィルタ変更 母港に戻った時に port より先に呼ばれる + api_language_type :0=日本語 1=英語 + api_oss_items[0] :戦艦級 0=無効, 1=有効 + api_oss_items[1] :航空母艦 + api_oss_items[2] :重巡級 + api_oss_items[3] :軽巡級 + api_oss_items[4] :駆逐艦 + api_oss_items[5] :海防艦 + api_oss_items[6] :潜水艦 + api_oss_items[7] :補助艦艇 -api_req_member/set_oss_condition :??? +api_req_member/set_oss_condition :艦船フィルタ変更 (情報なし) diff --git a/ElectronicObserver/Other/Information/kcmemo.md b/ElectronicObserver/Other/Information/kcmemo.md index 254c84847..5842004a5 100644 --- a/ElectronicObserver/Other/Information/kcmemo.md +++ b/ElectronicObserver/Other/Information/kcmemo.md @@ -2218,6 +2218,7 @@ if( 対潜改修値 >= 9 ) { |79|瑞雲(六三四空)|553|伊勢改二|火力+3|火力+3, 対空+2, 対潜+5, 索敵+6, 命中+1, 爆装+6|○| |81|瑞雲12型(六三四空)|(2), (26)|伊勢型改, 扶桑型改二|火力+2|火力+2, 対空+3, 対潜+6, 索敵+7, 命中+1, 爆装+9|○?| |81|瑞雲12型(六三四空)|553|伊勢改二|火力+3|火力+3, 対空+3, 対潜+6, 索敵+7, 命中+1, 爆装+9|○?| +|82|九七式艦攻(九三一空)|380, 529|大鷹改(二)|対潜+1, 回避+1|雷装+6, 対潜+8, 回避+1, 索敵+2|○| |100|彗星(江草隊)|553|伊勢改二|火力+4|火力+4, 対空+1, 対潜+5, 索敵+4, 命中+4, 爆装+13|○?| |104|35.6cm連装砲(ダズル迷彩)|149|金剛改二|火力+2|火力+17, 対空+5, 回避+1, 命中+1|○| |104|35.6cm連装砲(ダズル迷彩)|150, 152|比叡改二, 霧島改二|火力+1|火力+16, 対空+5, 回避+1, 命中+1|○| @@ -2258,7 +2259,8 @@ if( 対潜改修値 >= 9 ) { |292|彗星二二型(六三四空/熟練)|553|伊勢改二|火力+8, 対空+1, 回避+2|火力+8, 対空+3, 対潜+5, 回避+2, 索敵+2, 命中+3, 爆装+12|○?| |293|12cm単装砲改二|<28>, <66>|睦月型, 神風型|火力+2, 対空+1, 回避+3?|火力+3, 対空+1, 装甲+1, 回避+4, 命中+1?|○?| |293|12cm単装砲改二|<74>, <77>|占守型, 択捉型|火力+1, 対空+1, 回避+2?|火力+3, 対空+1, 装甲+1, 回避+3, 命中+1?|○?| -|297|12.7cm連装砲A型|<12>|吹雪型|回避+2|火力+2, 対空+1, 回避+2|○?| +|295|12.7cm連装砲A型改三(戦時改修)+高射装置|<12>|吹雪型|火力+2, 対空+2|火力+4, 対空+10, 装甲+1, 命中+1|○?| +|297|12.7cm連装砲A型|<12>|吹雪型|回避+2|火力+2, 対空+1, 回避+2|○| 備考: diff --git a/ElectronicObserver/Resource/Record/ShipParameterRecord.cs b/ElectronicObserver/Resource/Record/ShipParameterRecord.cs index 2e9f4eba3..fb8aa0b29 100644 --- a/ElectronicObserver/Resource/Record/ShipParameterRecord.cs +++ b/ElectronicObserver/Resource/Record/ShipParameterRecord.cs @@ -58,6 +58,10 @@ public class Parameter ///
public bool IsAvailable => !IsMinimumDefault && !IsMaximumDefault; + /// + /// 値が特定されているか + /// + public bool IsDetermined => IsAvailable && MinimumEstMin == MinimumEstMax; /// /// 最小値の初期値 diff --git a/ElectronicObserver/Utility/Configuration.cs b/ElectronicObserver/Utility/Configuration.cs index 6ff667999..8084f7d7b 100644 --- a/ElectronicObserver/Utility/Configuration.cs +++ b/ElectronicObserver/Utility/Configuration.cs @@ -76,11 +76,6 @@ public class ConfigConnection : ConfigPartBase /// public bool SaveResponse { get; set; } - /// - /// 通信内容保存:SWFを保存するか - /// - public bool SaveSWF { get; set; } - /// /// 通信内容保存:その他ファイルを保存するか /// @@ -133,7 +128,6 @@ public ConfigConnection() SaveDataPath = @"KCAPI"; SaveRequest = false; SaveResponse = true; - SaveSWF = false; SaveOtherFile = false; ApplyVersion = false; RegisterAsSystemProxy = false; @@ -948,6 +942,12 @@ public class ConfigFormBrowser : ConfigPartBase ///
public bool PreserveDrawingBuffer { get; set; } + /// + /// カラープロファイルを sRGB に固定するか + /// + public bool ForceColorProfile { get; set; } + + public ConfigFormBrowser() { ZoomRate = 1; @@ -967,6 +967,7 @@ public ConfigFormBrowser() ConfirmAtRefresh = true; HardwareAccelerationEnabled = true; PreserveDrawingBuffer = true; + ForceColorProfile = false; } } /// [ブラウザ]ウィンドウ diff --git a/ElectronicObserver/Utility/FleetImageGenerator.cs b/ElectronicObserver/Utility/FleetImageGenerator.cs index 29175f977..99979f86b 100644 --- a/ElectronicObserver/Utility/FleetImageGenerator.cs +++ b/ElectronicObserver/Utility/FleetImageGenerator.cs @@ -75,7 +75,7 @@ public static Bitmap GenerateCardBitmap(FleetImageArgument args) string fleetSearchingAbilityTitle = "索敵能力"; // for measure space of strings - Bitmap preimage = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + Bitmap preimage = new Bitmap(1, 1, PixelFormat.Format32bppArgb); Graphics preg = Graphics.FromImage(preimage); // Size Calculation @@ -169,10 +169,10 @@ public static Bitmap GenerateCardBitmap(FleetImageArgument args) preimage.Dispose(); - var bitmap = new Bitmap(entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + var bitmap = new Bitmap(entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, PixelFormat.Format32bppArgb); using (var g = Graphics.FromImage(bitmap)) { - + g.Clear(backgroundColor); if (!string.IsNullOrEmpty(args.BackgroundImagePath) && System.IO.File.Exists(args.BackgroundImagePath)) { @@ -484,7 +484,7 @@ public static Bitmap GenerateCutinBitmap(FleetImageArgument args) string fleetSearchingAbilityTitle = "索敵能力"; // for measure space of strings - Bitmap preimage = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + Bitmap preimage = new Bitmap(1, 1, PixelFormat.Format32bppArgb); Graphics preg = Graphics.FromImage(preimage); @@ -589,7 +589,7 @@ public static Bitmap GenerateCutinBitmap(FleetImageArgument args) preimage.Dispose(); - var bitmap = new Bitmap(entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + var bitmap = new Bitmap(entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, PixelFormat.Format32bppArgb); using (var g = Graphics.FromImage(bitmap)) { @@ -700,20 +700,9 @@ public static Bitmap GenerateCutinBitmap(FleetImageArgument args) shipPointer.X += shipIndexSize.Width; - // note: 現在のフォーマットに対応していない - //using (var shipNameImage = KCResourceHelper.LoadShipImage(ship.ShipID, false, KCResourceHelper.ResourceTypeShipName)) - //{ - // if (shipNameImage != null) - // { - // g.DrawImage(shipNameImage, new Rectangle(shipPointer + GetAlignmentOffset(ContentAlignment.MiddleLeft, shipNameSize, shipNameAreaSize), shipNameSize), - // shipNameImageAvailableArea, GraphicsUnit.Pixel); - // } - // else - { - // 画像がなければ文字列で艦名を描画する - g.DrawString(ship.Name, args.LargeFont, mainTextBrush, new Rectangle(shipPointer + GetAlignmentOffset(ContentAlignment.MiddleLeft, shipNameSize, shipNameAreaSize), shipNameSize), formatMiddleLeft); - } - //} + g.DrawString(ship.Name, args.LargeFont, mainTextBrush, new Rectangle(shipPointer + GetAlignmentOffset(ContentAlignment.MiddleLeft, shipNameSize, shipNameAreaSize), shipNameSize), formatMiddleLeft); + + shipPointer.X += shipNameSize.Width; @@ -748,13 +737,34 @@ void DrawParam(ResourceManager.IconContent icon, int value) shipPointer.X = shipPointerOrigin.X; - using (var shipImageOriginal = KCResourceHelper.LoadShipImage(ship.ShipID, args.ReflectDamageGraphic && ship.HPRate <= 0.5, KCResourceHelper.ResourceTypeShipCutin)) + + // 顔座標は通常時のみ存在するため、中破グラフィックは適用できない + using (var shipImageOriginal = KCResourceHelper.LoadShipImage(ship.ShipID, false, KCResourceHelper.ResourceTypeShipFull)) { if (shipImageOriginal != null) { - using (var shipImage = shipImageOriginal.Clone(new Rectangle(0, 0, shipImageOriginal.Width, shipImageOriginal.Height), PixelFormat.Format32bppArgb)) + using (var shipImage = new Bitmap(ShipCutinSize.Width, ShipCutinSize.Height, PixelFormat.Format32bppArgb)) { - using (var maskImage = new Bitmap(ShipCutinSize.Width, ShipCutinSize.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)) + using (var shipg = Graphics.FromImage(shipImage)) + { + shipg.InterpolationMode = InterpolationMode.HighQualityBicubic; + shipg.PixelOffsetMode = PixelOffsetMode.HighQuality; + + var face = ship.MasterShip.GraphicData.FaceArea; + var faceCenter = new PointF(face.X + face.Width / 2f, face.Y + face.Height / 2f); + + var zone = new PointF(ShipCutinSize.Width * 0.2f, ShipCutinSize.Height * 0.2f); + float rate = face.Height == 0 ? 1 : (ShipCutinSize.Height * 4f / 3f / face.Height); + + shipg.DrawImage(shipImageOriginal, new RectangleF( + -faceCenter.X * rate + zone.X, + -faceCenter.Y * rate + zone.Y, + shipImageOriginal.Width * rate, + shipImageOriginal.Height * rate + )); + } + + using (var maskImage = new Bitmap(ShipCutinSize.Width, ShipCutinSize.Height, PixelFormat.Format32bppArgb)) { // move to top using (var maskg = Graphics.FromImage(maskImage)) { @@ -959,7 +969,7 @@ public static Bitmap GenerateBannerBitmap(FleetImageArgument args) string fleetSearchingAbilityTitle = "索敵能力"; // for measure space of strings - Bitmap preimage = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + Bitmap preimage = new Bitmap(1, 1, PixelFormat.Format32bppArgb); Graphics preg = Graphics.FromImage(preimage); bool has5thSlot = args.FleetIDs @@ -1053,7 +1063,7 @@ public static Bitmap GenerateBannerBitmap(FleetImageArgument args) preimage.Dispose(); - var bitmap = new Bitmap(entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + var bitmap = new Bitmap(entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, PixelFormat.Format32bppArgb); using (var g = Graphics.FromImage(bitmap)) { @@ -1351,7 +1361,7 @@ public static Bitmap GenerateBaseAirCorpsImage(FleetImageArgument args) string baseDistanceTitle = "戦闘行動半径"; // for measure space of strings - Bitmap preimage = new Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + Bitmap preimage = new Bitmap(1, 1, PixelFormat.Format32bppArgb); Graphics preg = Graphics.FromImage(preimage); // Size Calculation @@ -1408,7 +1418,7 @@ public static Bitmap GenerateBaseAirCorpsImage(FleetImageArgument args) preimage.Dispose(); - var bitmap = new Bitmap(entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + var bitmap = new Bitmap(entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, PixelFormat.Format32bppArgb); using (var g = Graphics.FromImage(bitmap)) { @@ -1592,7 +1602,24 @@ public static Bitmap GenerateBaseAirCorpsImage(FleetImageArgument args) } - public static bool HasShipImage(int[] fleets, bool reflectDamageGraphic, string resourceType) + + public static bool HasShipImageBanner(int[] fleets, bool reflectDamageGraphic) + { + return HasShipImage(fleets, reflectDamageGraphic, KCResourceHelper.ResourceTypeShipBanner); + } + + public static bool HasShipImageCutin(int[] fleets, bool reflectDamageGraphic) + { + return HasShipImage(fleets, false, KCResourceHelper.ResourceTypeShipFull); + } + + public static bool HasShipImageCard(int[] fleets, bool reflectDamageGraphic) + { + return HasShipImage(fleets, reflectDamageGraphic, KCResourceHelper.ResourceTypeShipCard); + } + + + private static bool HasShipImage(int[] fleets, bool reflectDamageGraphic, string resourceType) { try { @@ -1708,7 +1735,7 @@ public ShipParameterData(ResourceManager.IconContent iconIndex, string name, Fun new ShipParameterData( ResourceManager.IconContent.ParameterTorpedo, "雷装", ship => ship.TorpedoTotal.ToString() ), new ShipParameterData( ResourceManager.IconContent.ParameterEvasion, "回避", ship => ship.EvasionTotal.ToString() ), new ShipParameterData( ResourceManager.IconContent.ParameterAA, "対空", ship => ship.AATotal.ToString() ), - new ShipParameterData( ResourceManager.IconContent.ParameterAircraft, "搭載", ship => ship.MasterShip.AircraftTotal.ToString() ), + new ShipParameterData( ResourceManager.IconContent.ParameterAircraft, "制空", ship => Calculator.GetAirSuperiority(ship).ToString() ), new ShipParameterData( ResourceManager.IconContent.ParameterASW, "対潜", ship => ship.ASWTotal.ToString() ), new ShipParameterData( ResourceManager.IconContent.ParameterSpeed, "速力", ship => Constants.GetSpeed( ship.Speed ), true ), new ShipParameterData( ResourceManager.IconContent.ParameterLOS, "索敵", ship => ship.LOSTotal.ToString() ), diff --git a/ElectronicObserver/Utility/SoftwareInformation.cs b/ElectronicObserver/Utility/SoftwareInformation.cs index 44b9d6e49..a93c6f2e4 100644 --- a/ElectronicObserver/Utility/SoftwareInformation.cs +++ b/ElectronicObserver/Utility/SoftwareInformation.cs @@ -29,20 +29,20 @@ public static class SoftwareInformation /// /// バージョン(日本語, ソフトウェア名を含みます) /// - public static string VersionJapanese => SoftwareNameJapanese + "四〇型"; + public static string VersionJapanese => SoftwareNameJapanese + "四〇型改"; /// /// バージョン(英語) /// - public static string VersionEnglish => "4.0.0"; + public static string VersionEnglish => "4.0.1"; /// /// 更新日時 /// - public static DateTime UpdateTime => DateTimeHelper.CSVStringToTime("2018/08/28 23:00:00"); + public static DateTime UpdateTime => DateTimeHelper.CSVStringToTime("2018/09/08 01:00:00"); diff --git a/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.cs b/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.cs index 951007884..d5661c281 100644 --- a/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.cs +++ b/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.cs @@ -242,7 +242,7 @@ private void UpdateAlbumPage(int equipmentID) sb.AppendLine("装備可能艦種:"); foreach (var stype in KCDatabase.Instance.ShipTypes.Values) { - if (stype.EquipmentType.Contains((int)eq.CategoryType)) + if (stype.EquippableCategories.Contains((int)eq.CategoryType)) sb.AppendLine(stype.Name); } ToolTipInfo.SetToolTip(EquipmentType, sb.ToString()); diff --git a/ElectronicObserver/Window/Dialog/DialogAlbumMasterShip.cs b/ElectronicObserver/Window/Dialog/DialogAlbumMasterShip.cs index 3f0dc849f..7dec4cd60 100644 --- a/ElectronicObserver/Window/Dialog/DialogAlbumMasterShip.cs +++ b/ElectronicObserver/Window/Dialog/DialogAlbumMasterShip.cs @@ -297,13 +297,21 @@ private void UpdateAlbumPage(int shipID) ShipType.Text = ship.IsLandBase ? "陸上施設" : ship.ShipTypeName; - if (ship.IsAbyssalShip) - ToolTipInfo.SetToolTip(ShipType, $"艦型ID: {ship.ShipClass}"); - else if (Constants.GetShipClass(ship.ShipClass) == "不明") - ToolTipInfo.SetToolTip(ShipType, $"艦型不明: {ship.ShipClass}"); - else - ToolTipInfo.SetToolTip(ShipType, $"{Constants.GetShipClass(ship.ShipClass)}: {ship.ShipClass}"); + { + var tip = new StringBuilder(); + if (ship.IsAbyssalShip) + tip.AppendLine($"艦型ID: {ship.ShipClass}"); + else if (Constants.GetShipClass(ship.ShipClass) == "不明") + tip.AppendLine($"艦型不明: {ship.ShipClass}"); + else + tip.AppendLine($"{Constants.GetShipClass(ship.ShipClass)}: {ship.ShipClass}"); + tip.AppendLine(); + tip.AppendLine("装備可能:"); + tip.AppendLine(GetEquippableString(shipID)); + + ToolTipInfo.SetToolTip(ShipType, tip.ToString()); + } ShipName.Text = ship.NameWithClass; ShipName.ForeColor = ship.GetShipNameColor(); ToolTipInfo.SetToolTip(ShipName, (!ship.IsAbyssalShip ? ship.NameReading + "\r\n" : "") + "(右クリックでコピー)"); @@ -735,6 +743,17 @@ private string GetParameterMax(ShipParameterRecord.Parameter param) } + private string GetEquippableString(int shipID) + { + var db = KCDatabase.Instance; + var ship = db.MasterShips[shipID]; + if (ship == null) + return ""; + + return string.Join("\r\n", ship.EquippableCategories.Select(id => db.EquipmentTypes[id].Name) + .Concat(db.MasterEquipments.Values.Where(eq => eq.EquippableShipsAtExpansion.Contains(shipID)).Select(eq => eq.Name + " (補強スロット)"))); + } + private void ParameterLevel_ValueChanged(object sender, EventArgs e) { diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs b/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs index bc71c53ca..578655255 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs @@ -29,8 +29,8 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - ElectronicObserver.Window.Control.StatusBarModule statusBarModule1 = new ElectronicObserver.Window.Control.StatusBarModule(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + ElectronicObserver.Window.Control.StatusBarModule statusBarModule2 = new ElectronicObserver.Window.Control.StatusBarModule(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.label19 = new System.Windows.Forms.Label(); @@ -46,7 +46,6 @@ private void InitializeComponent() this.Connection_PanelSaveData = new System.Windows.Forms.Panel(); this.Connection_ApplyVersion = new System.Windows.Forms.CheckBox(); this.Connection_SaveOtherFile = new System.Windows.Forms.CheckBox(); - this.Connection_SaveSWF = new System.Windows.Forms.CheckBox(); this.Connection_SaveResponse = new System.Windows.Forms.CheckBox(); this.Connection_SaveRequest = new System.Windows.Forms.CheckBox(); this.Connection_SaveDataPathSearch = new System.Windows.Forms.Button(); @@ -179,6 +178,8 @@ private void InitializeComponent() this.FormBattle_HideDuringBattle = new System.Windows.Forms.CheckBox(); this.FormBattle_IsScrollable = new System.Windows.Forms.CheckBox(); this.tabPage12 = new System.Windows.Forms.TabPage(); + this.FormBrowser_ForceColorProfile = new System.Windows.Forms.CheckBox(); + this.FormBrowser_PreserveDrawingBuffer = new System.Windows.Forms.CheckBox(); this.label20 = new System.Windows.Forms.Label(); this.FormBrowser_HardwareAccelerationEnabled = new System.Windows.Forms.CheckBox(); this.FormBrowser_IsDMMreloadDialogDestroyable = new System.Windows.Forms.CheckBox(); @@ -241,7 +242,6 @@ private void InitializeComponent() this.APIListBrowser = new System.Windows.Forms.OpenFileDialog(); this.Log_PlayTime = new System.Windows.Forms.Label(); this.PlayTimeTimer = new System.Windows.Forms.Timer(this.components); - this.FormBrowser_PreserveDrawingBuffer = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Connection_UpstreamProxyPort)).BeginInit(); @@ -445,7 +445,6 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.Connection_PanelSaveData.Controls.Add(this.Connection_ApplyVersion); this.Connection_PanelSaveData.Controls.Add(this.Connection_SaveOtherFile); - this.Connection_PanelSaveData.Controls.Add(this.Connection_SaveSWF); this.Connection_PanelSaveData.Controls.Add(this.Connection_SaveResponse); this.Connection_PanelSaveData.Controls.Add(this.Connection_SaveRequest); this.Connection_PanelSaveData.Controls.Add(this.Connection_SaveDataPathSearch); @@ -459,7 +458,7 @@ private void InitializeComponent() // Connection_ApplyVersion // this.Connection_ApplyVersion.AutoSize = true; - this.Connection_ApplyVersion.Location = new System.Drawing.Point(296, 32); + this.Connection_ApplyVersion.Location = new System.Drawing.Point(237, 32); this.Connection_ApplyVersion.Name = "Connection_ApplyVersion"; this.Connection_ApplyVersion.Size = new System.Drawing.Size(68, 19); this.Connection_ApplyVersion.TabIndex = 9; @@ -470,7 +469,7 @@ private void InitializeComponent() // Connection_SaveOtherFile // this.Connection_SaveOtherFile.AutoSize = true; - this.Connection_SaveOtherFile.Location = new System.Drawing.Point(231, 32); + this.Connection_SaveOtherFile.Location = new System.Drawing.Point(172, 32); this.Connection_SaveOtherFile.Name = "Connection_SaveOtherFile"; this.Connection_SaveOtherFile.Size = new System.Drawing.Size(59, 19); this.Connection_SaveOtherFile.TabIndex = 8; @@ -478,17 +477,6 @@ private void InitializeComponent() this.ToolTipInfo.SetToolTip(this.Connection_SaveOtherFile, "すべての通信ファイルを保存します。"); this.Connection_SaveOtherFile.UseVisualStyleBackColor = true; // - // Connection_SaveSWF - // - this.Connection_SaveSWF.AutoSize = true; - this.Connection_SaveSWF.Location = new System.Drawing.Point(172, 32); - this.Connection_SaveSWF.Name = "Connection_SaveSWF"; - this.Connection_SaveSWF.Size = new System.Drawing.Size(53, 19); - this.Connection_SaveSWF.TabIndex = 7; - this.Connection_SaveSWF.Text = "SWF"; - this.ToolTipInfo.SetToolTip(this.Connection_SaveSWF, "SWFファイルを保存します。"); - this.Connection_SaveSWF.UseVisualStyleBackColor = true; - // // Connection_SaveResponse // this.Connection_SaveResponse.AutoSize = true; @@ -629,12 +617,12 @@ private void InitializeComponent() // this.UI_RenderingTest.AutoSize = true; this.UI_RenderingTest.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - statusBarModule1.BarColor0Begin = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - statusBarModule1.BarColor0End = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - statusBarModule1.MaximumValue = 500; - statusBarModule1.PrevValue = 401; - statusBarModule1.Value = 401; - this.UI_RenderingTest.HPBar = statusBarModule1; + statusBarModule2.BarColor0Begin = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + statusBarModule2.BarColor0End = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + statusBarModule2.MaximumValue = 500; + statusBarModule2.PrevValue = 401; + statusBarModule2.Value = 401; + this.UI_RenderingTest.HPBar = statusBarModule2; this.UI_RenderingTest.Location = new System.Drawing.Point(16, 3); this.UI_RenderingTest.MainFontColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.UI_RenderingTest.Margin = new System.Windows.Forms.Padding(16, 3, 16, 3); @@ -1015,7 +1003,7 @@ private void InitializeComponent() this.Debug_SealingPanel.Controls.Add(this.Debug_APIListPathSearch); this.Debug_SealingPanel.Location = new System.Drawing.Point(0, 56); this.Debug_SealingPanel.Name = "Debug_SealingPanel"; - this.Debug_SealingPanel.Size = new System.Drawing.Size(696, 265); + this.Debug_SealingPanel.Size = new System.Drawing.Size(696, 259); this.Debug_SealingPanel.TabIndex = 1; // // Debug_APIListPath @@ -2096,6 +2084,7 @@ private void InitializeComponent() // // tabPage12 // + this.tabPage12.Controls.Add(this.FormBrowser_ForceColorProfile); this.tabPage12.Controls.Add(this.FormBrowser_PreserveDrawingBuffer); this.tabPage12.Controls.Add(this.label20); this.tabPage12.Controls.Add(this.FormBrowser_HardwareAccelerationEnabled); @@ -2120,11 +2109,34 @@ private void InitializeComponent() this.tabPage12.Text = "ブラウザ"; this.tabPage12.UseVisualStyleBackColor = true; // + // FormBrowser_ForceColorProfile + // + this.FormBrowser_ForceColorProfile.AutoSize = true; + this.FormBrowser_ForceColorProfile.Location = new System.Drawing.Point(6, 249); + this.FormBrowser_ForceColorProfile.Name = "FormBrowser_ForceColorProfile"; + this.FormBrowser_ForceColorProfile.Size = new System.Drawing.Size(216, 19); + this.FormBrowser_ForceColorProfile.TabIndex = 16; + this.FormBrowser_ForceColorProfile.Text = "カラープロファイルを sRGB に固定する *"; + this.ToolTipInfo.SetToolTip(this.FormBrowser_ForceColorProfile, "ブラウザの色合いがおかしい場合、有効にすると解決するかもしれません。\r\n再起動すると反映されます。"); + this.FormBrowser_ForceColorProfile.UseVisualStyleBackColor = true; + // + // FormBrowser_PreserveDrawingBuffer + // + this.FormBrowser_PreserveDrawingBuffer.AutoSize = true; + this.FormBrowser_PreserveDrawingBuffer.Location = new System.Drawing.Point(6, 224); + this.FormBrowser_PreserveDrawingBuffer.Name = "FormBrowser_PreserveDrawingBuffer"; + this.FormBrowser_PreserveDrawingBuffer.Size = new System.Drawing.Size(145, 19); + this.FormBrowser_PreserveDrawingBuffer.TabIndex = 15; + this.FormBrowser_PreserveDrawingBuffer.Text = "描画バッファを保持する *"; + this.ToolTipInfo.SetToolTip(this.FormBrowser_PreserveDrawingBuffer, "描画系で問題があった場合有効にすると改善するかもしれません。\r\n無効にするとパフォーマンスが向上する可能性があります。\r\n* この変更は再起動後に適用されます。\r" + + "\n"); + this.FormBrowser_PreserveDrawingBuffer.UseVisualStyleBackColor = true; + // // label20 // this.label20.AutoSize = true; this.label20.ForeColor = System.Drawing.Color.Red; - this.label20.Location = new System.Drawing.Point(32, 259); + this.label20.Location = new System.Drawing.Point(12, 295); this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(241, 15); this.label20.TabIndex = 14; @@ -2133,13 +2145,13 @@ private void InitializeComponent() // FormBrowser_HardwareAccelerationEnabled // this.FormBrowser_HardwareAccelerationEnabled.AutoSize = true; - this.FormBrowser_HardwareAccelerationEnabled.Location = new System.Drawing.Point(436, 6); + this.FormBrowser_HardwareAccelerationEnabled.Location = new System.Drawing.Point(6, 199); this.FormBrowser_HardwareAccelerationEnabled.Name = "FormBrowser_HardwareAccelerationEnabled"; this.FormBrowser_HardwareAccelerationEnabled.Size = new System.Drawing.Size(230, 19); this.FormBrowser_HardwareAccelerationEnabled.TabIndex = 13; this.FormBrowser_HardwareAccelerationEnabled.Text = "ハードウェアアクセラレーションを有効にする *"; - this.ToolTipInfo.SetToolTip(this.FormBrowser_HardwareAccelerationEnabled, "描画に GPU を使用するかを指定します。\r\n有効にするとパフォーマンスが向上する可能性があります。\r\n注意:有効な場合「描画バッファを保持する」が有効でないとス" + - "クリーンショットを原寸で撮影できなくなります。\r\n* この変更は再起動後に適用されます。\r\n"); + this.ToolTipInfo.SetToolTip(this.FormBrowser_HardwareAccelerationEnabled, "描画に GPU を使用するかを指定します。\r\n有効にするとパフォーマンスが向上する可能性があります。\r\n録画・配信で画面が映らなくなる場合、無効にすると改善される" + + "かもしれません。\r\n* この変更は再起動後に適用されます。\r\n"); this.FormBrowser_HardwareAccelerationEnabled.UseVisualStyleBackColor = true; // // FormBrowser_IsDMMreloadDialogDestroyable @@ -2551,7 +2563,7 @@ private void InitializeComponent() // this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(3, 336); + this.label10.Location = new System.Drawing.Point(3, 330); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(238, 15); this.label10.TabIndex = 5; @@ -2682,21 +2694,21 @@ private void InitializeComponent() this.BGMPlayer_ColumnContent, this.BGMPlayer_ColumnPath, this.BGMPlayer_ColumnSetting}); - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Meiryo UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.BGMPlayer_ControlGrid.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.Font = new System.Drawing.Font("Meiryo UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.BGMPlayer_ControlGrid.DefaultCellStyle = dataGridViewCellStyle2; this.BGMPlayer_ControlGrid.Location = new System.Drawing.Point(6, 35); this.BGMPlayer_ControlGrid.MultiSelect = false; this.BGMPlayer_ControlGrid.Name = "BGMPlayer_ControlGrid"; this.BGMPlayer_ControlGrid.RowHeadersVisible = false; this.BGMPlayer_ControlGrid.RowTemplate.Height = 21; this.BGMPlayer_ControlGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.BGMPlayer_ControlGrid.Size = new System.Drawing.Size(684, 285); + this.BGMPlayer_ControlGrid.Size = new System.Drawing.Size(684, 279); this.BGMPlayer_ControlGrid.TabIndex = 0; this.BGMPlayer_ControlGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.BGMPlayer_ControlGrid_CellContentClick); this.BGMPlayer_ControlGrid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.BGMPlayer_ControlGrid_CellFormatting); @@ -2794,18 +2806,6 @@ private void InitializeComponent() this.PlayTimeTimer.Interval = 1000; this.PlayTimeTimer.Tick += new System.EventHandler(this.PlayTimeTimer_Tick); // - // FormBrowser_PreserveDrawingBuffer - // - this.FormBrowser_PreserveDrawingBuffer.AutoSize = true; - this.FormBrowser_PreserveDrawingBuffer.Location = new System.Drawing.Point(436, 31); - this.FormBrowser_PreserveDrawingBuffer.Name = "FormBrowser_PreserveDrawingBuffer"; - this.FormBrowser_PreserveDrawingBuffer.Size = new System.Drawing.Size(145, 19); - this.FormBrowser_PreserveDrawingBuffer.TabIndex = 15; - this.FormBrowser_PreserveDrawingBuffer.Text = "描画バッファを保持する *"; - this.ToolTipInfo.SetToolTip(this.FormBrowser_PreserveDrawingBuffer, "無効化するとパフォーマンスが向上する可能性があります。\r\n注意:「ハードウェアアクセラレーション」が有効な時、これが有効でないと原寸でスクリーンショットが撮影でき" + - "なくなります。\r\n* この変更は再起動後に適用されます。"); - this.FormBrowser_PreserveDrawingBuffer.UseVisualStyleBackColor = true; - // // DialogConfiguration // this.AcceptButton = this.ButtonOK; @@ -2939,7 +2939,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; private System.Windows.Forms.CheckBox Connection_SaveOtherFile; - private System.Windows.Forms.CheckBox Connection_SaveSWF; private System.Windows.Forms.CheckBox Connection_SaveResponse; private System.Windows.Forms.CheckBox Connection_SaveRequest; private System.Windows.Forms.TextBox Connection_SaveDataPath; @@ -3110,5 +3109,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label19; private System.Windows.Forms.Label label20; private System.Windows.Forms.CheckBox FormBrowser_PreserveDrawingBuffer; + private System.Windows.Forms.CheckBox FormBrowser_ForceColorProfile; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.cs b/ElectronicObserver/Window/Dialog/DialogConfiguration.cs index 337a444cd..796b88cf6 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.cs +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.cs @@ -325,7 +325,6 @@ public void FromConfiguration(Configuration.ConfigurationData config) Connection_SaveDataPath.Text = config.Connection.SaveDataPath; Connection_SaveRequest.Checked = config.Connection.SaveRequest; Connection_SaveResponse.Checked = config.Connection.SaveResponse; - Connection_SaveSWF.Checked = config.Connection.SaveSWF; Connection_SaveOtherFile.Checked = config.Connection.SaveOtherFile; Connection_ApplyVersion.Checked = config.Connection.ApplyVersion; Connection_RegisterAsSystemProxy.Checked = config.Connection.RegisterAsSystemProxy; @@ -469,6 +468,7 @@ public void FromConfiguration(Configuration.ConfigurationData config) FormBrowser_ScreenShotSaveMode.SelectedIndex = config.FormBrowser.ScreenShotSaveMode - 1; FormBrowser_HardwareAccelerationEnabled.Checked = config.FormBrowser.HardwareAccelerationEnabled; FormBrowser_PreserveDrawingBuffer.Checked = config.FormBrowser.PreserveDrawingBuffer; + FormBrowser_ForceColorProfile.Checked = config.FormBrowser.ForceColorProfile; if (!config.FormBrowser.IsToolMenuVisible) FormBrowser_ToolMenuDockStyle.SelectedIndex = 4; @@ -522,7 +522,6 @@ public void ToConfiguration(Configuration.ConfigurationData config) config.Connection.SaveDataPath = Connection_SaveDataPath.Text.Trim(@"\ """.ToCharArray()); config.Connection.SaveRequest = Connection_SaveRequest.Checked; config.Connection.SaveResponse = Connection_SaveResponse.Checked; - config.Connection.SaveSWF = Connection_SaveSWF.Checked; config.Connection.SaveOtherFile = Connection_SaveOtherFile.Checked; config.Connection.ApplyVersion = Connection_ApplyVersion.Checked; @@ -689,6 +688,7 @@ public void ToConfiguration(Configuration.ConfigurationData config) config.FormBrowser.AvoidTwitterDeterioration = FormBrowser_ScreenShotFormat_AvoidTwitterDeterioration.Checked; config.FormBrowser.HardwareAccelerationEnabled = FormBrowser_HardwareAccelerationEnabled.Checked; config.FormBrowser.PreserveDrawingBuffer = FormBrowser_PreserveDrawingBuffer.Checked; + config.FormBrowser.ForceColorProfile = FormBrowser_ForceColorProfile.Checked; if (FormBrowser_ToolMenuDockStyle.SelectedIndex == 4) { config.FormBrowser.IsToolMenuVisible = false; diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.resx b/ElectronicObserver/Window/Dialog/DialogConfiguration.resx index 872f1d224..3ba630777 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.resx +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.resx @@ -120,6 +120,9 @@ 17, 17 + + 17, 17 + True diff --git a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs index ecddbae4d..07d90b225 100644 --- a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs +++ b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs @@ -101,8 +101,8 @@ private void LoadConfiguration() OutputPath.Text = config.LastOutputPath; try { - SaveImageDialog.FileName = System.IO.Path.GetFileName(config.LastOutputPath); - SaveImageDialog.InitialDirectory = string.IsNullOrWhiteSpace(config.LastOutputPath) ? "" : System.IO.Path.GetDirectoryName(config.LastOutputPath); + SaveImageDialog.FileName = Path.GetFileName(config.LastOutputPath); + SaveImageDialog.InitialDirectory = string.IsNullOrWhiteSpace(config.LastOutputPath) ? "" : Path.GetDirectoryName(config.LastOutputPath); } catch (Exception) { @@ -219,19 +219,7 @@ private int ImageType return 0; } } - private string GetResourceType(int imageType) - { - switch (imageType) - { - case 0: - default: - return KCResourceHelper.ResourceTypeShipCard; - case 1: - return KCResourceHelper.ResourceTypeShipCutin; - case 2: - return KCResourceHelper.ResourceTypeShipBanner; - } - } + private int[] ToFleetIDs() { return new[]{ @@ -286,7 +274,7 @@ private void ApplyGeneralFont_Click(object sender, EventArgs e) private void SelectGeneralFont_Click(object sender, EventArgs e) { fontDialog1.Font = GeneralFont; - if (fontDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) + if (fontDialog1.ShowDialog() == DialogResult.OK) { GeneralFont = fontDialog1.Font; TextGeneralFont.Text = SerializableFont.FontToString(GeneralFont, true); @@ -296,7 +284,7 @@ private void SelectGeneralFont_Click(object sender, EventArgs e) private void SelectFont_Click(object sender, EventArgs e, int index) { fontDialog1.Font = SerializableFont.StringToFont(TextFontList[index].Text, true); - if (fontDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) + if (fontDialog1.ShowDialog() == DialogResult.OK) { TextFontList[index].Text = SerializableFont.FontToString(fontDialog1.Font, true); } @@ -306,7 +294,7 @@ private void SelectFont_Click(object sender, EventArgs e, int index) private void SearchBackgroundImagePath_Click(object sender, EventArgs e) { OpenImageDialog.FileName = BackgroundImagePath.Text; - if (OpenImageDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + if (OpenImageDialog.ShowDialog() == DialogResult.OK) { BackgroundImagePath.Text = OpenImageDialog.FileName; } @@ -438,10 +426,8 @@ private void ButtonOK_Click(object sender, EventArgs e) } else { - using (var image = GenerateFleetImage(args, mode)) { - Clipboard.SetImage(image); } } @@ -500,22 +486,43 @@ private void ImageTypeCard_CheckedChanged(object sender, EventArgs e) { if (ImageTypeCard.Checked) HorizontalShipCount.Value = 2; + + UpdateButtonAlert(); } private void ImageTypeCutin_CheckedChanged(object sender, EventArgs e) { if (ImageTypeCutin.Checked) HorizontalShipCount.Value = 1; + + UpdateButtonAlert(); } private void ImageTypeBanner_CheckedChanged(object sender, EventArgs e) { if (ImageTypeBanner.Checked) HorizontalShipCount.Value = 2; + + UpdateButtonAlert(); } + private bool HasShipImage() + { + switch (ImageType) + { + case 0: + return FleetImageGenerator.HasShipImageCard(ToFleetIDs(), ReflectDamageGraphic.Checked); + case 1: + return FleetImageGenerator.HasShipImageCutin(ToFleetIDs(), ReflectDamageGraphic.Checked); + case 2: + return FleetImageGenerator.HasShipImageBanner(ToFleetIDs(), ReflectDamageGraphic.Checked); + default: + return true; + } + } + private void UpdateButtonAlert() { @@ -523,18 +530,15 @@ private void UpdateButtonAlert() if (!Utility.Configuration.Config.Connection.SaveReceivedData || !Utility.Configuration.Config.Connection.SaveOtherFile) { - visibility = true; ButtonAlert.Text = "艦船画像保存設定が無効です(詳細表示...)"; - } - if (!FleetImageGenerator.HasShipImage(ToFleetIDs(), ReflectDamageGraphic.Checked, GetResourceType(ImageType))) - { + if (!HasShipImage()) + { visibility = true; ButtonAlert.Text = "艦船画像が足りません(詳細表示...)"; - } ButtonAlert.Visible = visibility; @@ -544,8 +548,9 @@ private void UpdateButtonAlert() private void ButtonAlert_Click(object sender, EventArgs e) { + var config = Utility.Configuration.Config.Connection; - if (!Utility.Configuration.Config.Connection.SaveReceivedData || !Utility.Configuration.Config.Connection.SaveOtherFile) + if (!config.SaveReceivedData || !config.SaveOtherFile) { if (MessageBox.Show("編成画像を出力するためには、艦船画像を保存する設定を有効にする必要があります。\r\n有効にしますか?", @@ -553,22 +558,38 @@ private void ButtonAlert_Click(object sender, EventArgs e) == System.Windows.Forms.DialogResult.Yes) { - if (!Utility.Configuration.Config.Connection.SaveReceivedData) + if (!config.SaveReceivedData) { - Utility.Configuration.Config.Connection.SaveReceivedData = true; - Utility.Configuration.Config.Connection.SaveResponse = false; // もともと不要にしていたユーザーには res は邪魔なだけだと思うので + config.SaveReceivedData = true; + config.SaveResponse = false; // もともと不要にしていたユーザーには res は邪魔なだけだと思うので } - Utility.Configuration.Config.Connection.SaveOtherFile = true; + config.SaveOtherFile = true; UpdateButtonAlert(); } } - if (!FleetImageGenerator.HasShipImage(ToFleetIDs(), ReflectDamageGraphic.Checked, GetResourceType(ImageType))) + if (!HasShipImage()) { + string needs; + switch (ImageType) + { + case 0: + needs = "艦これ本体の「編成」画面から、各艦の詳細を開くと"; + break; + case 1: + needs = "この編成で戦闘を開始すると"; + break; + case 2: + needs = "艦これ本体の「編成」画面を開くと"; + break; + default: + needs = "艦これ本体で必要な画像を表示させると"; + break; + } - MessageBox.Show("現在の艦隊を出力するための艦船画像データが不足しています。\r\n\r\nキャッシュを削除したのち再読み込みを行い、\r\n艦これ本体側で出力したい艦隊の編成ページを開くと\r\n艦船画像データが保存されます。", + MessageBox.Show("現在の艦隊を出力するための艦船画像データが不足しています。\r\n\r\nキャッシュを削除したのち再読み込みを行い、\r\n" + needs + "\r\n艦船画像データが保存されます。", "艦船画像データ不足", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); UpdateButtonAlert(); @@ -615,12 +636,10 @@ private void Title_TextChanged(object sender, EventArgs e) { try { - string replaceTo = Path.GetDirectoryName(OutputPath.Text) + "\\" + Title.Text + Path.GetExtension(OutputPath.Text); if (OutputPath.Text != replaceTo) OutputPath.Text = replaceTo; - } catch (Exception) { @@ -669,9 +688,7 @@ private void AutoSetFileNameToDate_CheckedChanged(object sender, EventArgs e) { try { - OutputPath.Text = Path.GetDirectoryName(OutputPath.Text) + "\\" + Utility.Mathematics.DateTimeHelper.GetTimeStamp() + Path.GetExtension(OutputPath.Text); - } catch (Exception) { @@ -690,7 +707,6 @@ private void SyncronizeTitleAndFileName_CheckedChanged(object sender, EventArgs if (string.IsNullOrWhiteSpace(OutputPath.Text)) { Title_TextChanged(sender, e); - } else { @@ -706,13 +722,13 @@ private void SearchOutputPath_Click(object sender, EventArgs e) try { - SaveImageDialog.FileName = System.IO.Path.GetFileName(OutputPath.Text); - SaveImageDialog.InitialDirectory = string.IsNullOrWhiteSpace(OutputPath.Text) ? "" : System.IO.Path.GetDirectoryName(OutputPath.Text); + SaveImageDialog.FileName = Path.GetFileName(OutputPath.Text); + SaveImageDialog.InitialDirectory = string.IsNullOrWhiteSpace(OutputPath.Text) ? "" : Path.GetDirectoryName(OutputPath.Text); } catch (Exception) { } - if (SaveImageDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + if (SaveImageDialog.ShowDialog() == DialogResult.OK) { OutputPath.Text = SaveImageDialog.FileName; } diff --git a/ElectronicObserver/Window/Dialog/DialogShipGraphicViewer.cs b/ElectronicObserver/Window/Dialog/DialogShipGraphicViewer.cs index bdae29cfa..d9d0fc140 100644 --- a/ElectronicObserver/Window/Dialog/DialogShipGraphicViewer.cs +++ b/ElectronicObserver/Window/Dialog/DialogShipGraphicViewer.cs @@ -404,9 +404,25 @@ private void DrawingPanel_Paint(object sender, PaintEventArgs e) Font, Brushes.DimGray, new PointF(0, 0)); } - e.Graphics.DrawImage(CurrentImage, new RectangleF((panelSize.Width - imgSize.Width) / 2 + ImageOffset.X, (panelSize.Height - imgSize.Height) / 2 + ImageOffset.Y, imgSize.Width, imgSize.Height)); + var location = new PointF((panelSize.Width - imgSize.Width) / 2 + ImageOffset.X, (panelSize.Height - imgSize.Height) / 2 + ImageOffset.Y); + e.Graphics.DrawImage(CurrentImage, new RectangleF(location.X, location.Y, imgSize.Width, imgSize.Height)); + /*// face recognition test + { + var ship = GetShipFromPath(ImagePathList[CurrentIndex]); + if (ship != null) + { + var rect = ship.GraphicData.WeddingArea; + e.Graphics.DrawRectangle(Pens.Magenta, + (float)(panelSize.Width / 2.0 + ((double)rect.X / CurrentImage.Width - 0.5) * CurrentImage.Width * zoomRate + ImageOffset.X), + (float)(panelSize.Height / 2.0 + ((double)rect.Y / CurrentImage.Height - 0.5) * CurrentImage.Height * zoomRate + ImageOffset.Y), + (float)(rect.Width * zoomRate), + (float)(rect.Height * zoomRate)); + } + } + //*/ + if (AdvMode) { DrawAdvMode(e.Graphics); diff --git a/ElectronicObserver/Window/FormBrowserHost.cs b/ElectronicObserver/Window/FormBrowserHost.cs index 658d1db66..d65ee4065 100644 --- a/ElectronicObserver/Window/FormBrowserHost.cs +++ b/ElectronicObserver/Window/FormBrowserHost.cs @@ -239,6 +239,7 @@ public BrowserLib.BrowserConfiguration Configuration config.ConfirmAtRefresh = c.ConfirmAtRefresh; config.HardwareAccelerationEnabled = c.HardwareAccelerationEnabled; config.PreserveDrawingBuffer = c.PreserveDrawingBuffer; + config.ForceColorProfile = c.ForceColorProfile; return config; } @@ -266,6 +267,7 @@ public void ConfigurationUpdated(BrowserLib.BrowserConfiguration config) c.ConfirmAtRefresh = config.ConfirmAtRefresh; c.HardwareAccelerationEnabled = config.HardwareAccelerationEnabled; c.PreserveDrawingBuffer = config.PreserveDrawingBuffer; + c.ForceColorProfile = config.ForceColorProfile; // volume if (Utility.Configuration.Config.BGMPlayer.SyncBrowserMute) diff --git a/ElectronicObserver/Window/FormMain.cs b/ElectronicObserver/Window/FormMain.cs index 24bff2332..884bcaa15 100644 --- a/ElectronicObserver/Window/FormMain.cs +++ b/ElectronicObserver/Window/FormMain.cs @@ -754,6 +754,8 @@ private async void StripMenu_Debug_LoadInitialAPI_Click(object sender, EventArgs ofd.Title = "APIリストをロード"; ofd.Filter = "API List|*.txt|File|*"; ofd.InitialDirectory = Utility.Configuration.Config.Connection.SaveDataPath; + if (!string.IsNullOrWhiteSpace(Utility.Configuration.Config.Debug.APIListPath)) + ofd.FileName = Utility.Configuration.Config.Debug.APIListPath; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { @@ -1556,6 +1558,6 @@ private void StripMenu_View_Json_Click(object sender, EventArgs e) #endregion - + } }