From 2be875904711646e56cf7c39112cecc2cd2f6d12 Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 4 Mar 2017 03:12:59 +0900 Subject: [PATCH 01/16] =?UTF-8?q?SwfExtractor=20=E3=82=92=E5=8F=96?= =?UTF-8?q?=E3=82=8A=E8=BE=BC=E3=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 3 +++ SwfExtractor | 1 + 2 files changed, 4 insertions(+) create mode 160000 SwfExtractor diff --git a/.gitmodules b/.gitmodules index 41bcf7620..dc1d5f551 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "DockPanelSuite"] path = DockPanelSuite url = https://github.com/andanteyk/dockpanelsuite.git +[submodule "SwfExtractor"] + path = SwfExtractor + url = https://github.com/andanteyk/SwfExtractor.git diff --git a/SwfExtractor b/SwfExtractor new file mode 160000 index 000000000..df01e43b2 --- /dev/null +++ b/SwfExtractor @@ -0,0 +1 @@ +Subproject commit df01e43b26089ca2f984107875da36ef47ea0a58 From cb78669d7a7fad575664c71362d8f7384b8e46de Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 8 Apr 2017 01:50:23 +0900 Subject: [PATCH 02/16] =?UTF-8?q?=E7=B7=A8=E6=88=90=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E5=87=BA=E5=8A=9B=E6=A9=9F=E8=83=BD=E3=81=AE=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=20(CardType,=20WIP)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * リソース:艦載機レベル画像の追加 --- ElectronicObserver.sln | 10 +- ElectronicObserver/Assets.zip | Bin 181329 -> 184320 bytes .../Assets/Level/AircraftLevel0.png | Bin 0 -> 174 bytes .../Assets/Level/AircraftLevel1.png | Bin 0 -> 194 bytes .../Assets/Level/AircraftLevel2.png | Bin 0 -> 195 bytes .../Assets/Level/AircraftLevel3.png | Bin 0 -> 195 bytes .../Assets/Level/AircraftLevel4.png | Bin 0 -> 203 bytes .../Assets/Level/AircraftLevel5.png | Bin 0 -> 207 bytes .../Assets/Level/AircraftLevel6.png | Bin 0 -> 207 bytes .../Assets/Level/AircraftLevel7.png | Bin 0 -> 213 bytes ElectronicObserver/ElectronicObserver.csproj | 5 + .../Resource/ResourceManager.cs | 17 + .../Utility/FleetImageGenerator.cs | 850 ++++++++++++++++++ .../Window/FormFleet.Designer.cs | 38 +- ElectronicObserver/Window/FormFleet.cs | 371 ++++++++ 15 files changed, 1276 insertions(+), 15 deletions(-) create mode 100644 ElectronicObserver/Assets/Level/AircraftLevel0.png create mode 100644 ElectronicObserver/Assets/Level/AircraftLevel1.png create mode 100644 ElectronicObserver/Assets/Level/AircraftLevel2.png create mode 100644 ElectronicObserver/Assets/Level/AircraftLevel3.png create mode 100644 ElectronicObserver/Assets/Level/AircraftLevel4.png create mode 100644 ElectronicObserver/Assets/Level/AircraftLevel5.png create mode 100644 ElectronicObserver/Assets/Level/AircraftLevel6.png create mode 100644 ElectronicObserver/Assets/Level/AircraftLevel7.png create mode 100644 ElectronicObserver/Utility/FleetImageGenerator.cs diff --git a/ElectronicObserver.sln b/ElectronicObserver.sln index 06dcd7ba6..e5b5fd194 100644 --- a/ElectronicObserver.sln +++ b/ElectronicObserver.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElectronicObserver", "ElectronicObserver\ElectronicObserver.csproj", "{A9ABEC50-1BFC-4C69-87AE-C68DB6004F68}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Browser", "Browser\Browser.csproj", "{87A2B596-57D0-48BB-B522-895782D7A6FC}" @@ -9,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrowserLib", "BrowserLib\Br EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "DockPanelSuite\WinFormsUI\WinFormsUI.csproj", "{C75532C4-765B-418E-B09B-46D36B2ABDB1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwfExtractor", "SwfExtractor\SwfExtractor\SwfExtractor.csproj", "{44244148-D3FE-4D71-AA8F-CACB54AC53C1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -31,6 +35,10 @@ Global {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Debug|Any CPU.Build.0 = Debug|Any CPU {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|Any CPU.ActiveCfg = Release|Any CPU {C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|Any CPU.Build.0 = Release|Any CPU + {44244148-D3FE-4D71-AA8F-CACB54AC53C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44244148-D3FE-4D71-AA8F-CACB54AC53C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44244148-D3FE-4D71-AA8F-CACB54AC53C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44244148-D3FE-4D71-AA8F-CACB54AC53C1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ElectronicObserver/Assets.zip b/ElectronicObserver/Assets.zip index 7fe3fdcaf26df70682dde1d3f5e49383107b0fe3..fc19bb271b8c332e14935b5ea689bd0d1a134445 100644 GIT binary patch delta 2352 zcmccE!QHTcn=indnT3l11Pqy5yf*SBL@=M*SHHP1f?0=o2dn?)@)iMR5Tm)PeS23s zqr%(CKHE5=%z$danxF(PkajFCPAw_c_em{F&Cv%LD*_bcU?^NI;vT%ybk{r}ZygZJ zqbqgHEJ`j)Oe+CvG?;v`Kyz|kup-xUfrk^rZvFb*uRi%ffT}{{Bd2+KeTrhsCkv}Y zh^u#eF(@=J*uY_6uasU74+cXxowXmH|+9s#jyoQ;xjfdy; z{LPXZ?7y#JmwY<8Fhy9u8)*6Z@5a3#%MTN@+z8e3bNZ(DIl-2fVp=|b&%((E+ufIF zPPo|{e#j(|`NE`ZADh07rtMc9(<&zm9u?N_2U>0_rOHQ~<;JL%hnM;Ml>~*dapR*` zuuyhLI0p3l|2_Zy|1W%%%qA~4ahXG!c^v2E7G4K$Gj=Xk-97v6h@?!Lyz#EE{v@FF zAG*_ecLDut#praXTiRbHA)#W*@`69B8JgKn#7t&fDXc#O=$zAw_T>}j95WQ>Bv*vTWZC0& z4y&}i(W;GwvL*%@2|e`+8a9cAi;v&xVAaaXJ0mPDDam5WoBFuS_7v01*Wl2Z19Z+J zT|v90Fm%jOom2Vq%#yh2in&bciMqD2GR``F>i;*)|Nr6t|LZpYRaI3~)b4~N zetG2S6Q!`MAoh!w;p20q+}8@{YuH2`xO(Ts>2o&GF^}I^wq4EiJjAp7R*~bf>RrEf zt||7)U}6aHW@M6QKommLca$(03fWG$(%HA>5+jTjT{1nslu2y6U@22DHw&y4YlOVZEJKw&* z$aJDeR2Ydywh^<;gn0;L;kr_ghw70^b`%>8(QRCsG`XPg&ILx9`Hbh4fi}WuWE(LH zN@N@7l%WM7(878|1!074$Y&=_c8JxZuD ze~798+4#ED;Ty#TrW`T%oV?_l%8%@x?SY3aqy9Q+A#kQqCK{mo@WE(LHKV%#8 zEAiQAif$u!Yjgw1!o(H!e}NX(!x$)O6|;OpwlTK~pN(edHoji}wHah%=F?RSDnKv7 zXs{RS86dd>vj{`BF}oU{jppb!a__s+0kZKM_fuw&jW9aEo0Sci@_}{uVTP(;28Mzf ICT1WP04vZM{Qv*} delta 225 zcmZozz6Wh_Ge&NQNje|0RR-rSc3on diff --git a/ElectronicObserver/Assets/Level/AircraftLevel0.png b/ElectronicObserver/Assets/Level/AircraftLevel0.png new file mode 100644 index 0000000000000000000000000000000000000000..f3cd343e302d6fbe832c56c3ead403531f875f9d GIT binary patch literal 174 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4&HkfC?Kha6CZv%n*= zn1O*?7=#%aX3dcR3bL1Y`ns~;=MdqMR@(aek0($_HZvrm#5q4VH#M&W$Yo$~E=o-- zNlj5G&n(GMaQE~LNYP7W2Z{@Mx;TbdoK8-VU|pOb(!<2Tz`!EFz}RZPstBab)78&q Iol`;+0H;(a9RL6T literal 0 HcmV?d00001 diff --git a/ElectronicObserver/Assets/Level/AircraftLevel1.png b/ElectronicObserver/Assets/Level/AircraftLevel1.png new file mode 100644 index 0000000000000000000000000000000000000000..665923322b282d13764bc51922f9fcc4c0dd239a GIT binary patch literal 194 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4$}8W)^mS#w&mqPjBlxV+svIaJn;8;O;+&tGo0?YwNR@|NnXY|G)7B#u*YCEQ{HCqztkS bBp5O)^mS#w&mqPjBhD{1-w7xrn;8;O;+&tGo0?YwNR@|NnXY|9|p^P6i(yk)}XqH(m+T bgbhGTt}*dA#?~BG2btyR>gTe~DWM4fRAw@X literal 0 HcmV?d00001 diff --git a/ElectronicObserver/Assets/Level/AircraftLevel3.png b/ElectronicObserver/Assets/Level/AircraftLevel3.png new file mode 100644 index 0000000000000000000000000000000000000000..56f990902dd265402130de2602103292b95fac7b GIT binary patch literal 195 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4$}8W)^mS#w&mqPjBUg4z{TWb5HZvrm#5q4VH#M&W$Yo$~E=o-- zNlj5G&n(GMaQE~LNYP7W2a2nEx;TbdoK8*vff@h*|Nry)|NqCSj~RS;M4AGb-FPKT b6E*-X*&HYowD9_JQ;=Dnu6{1-oD!M<{~k3m literal 0 HcmV?d00001 diff --git a/ElectronicObserver/Assets/Level/AircraftLevel4.png b/ElectronicObserver/Assets/Level/AircraftLevel4.png new file mode 100644 index 0000000000000000000000000000000000000000..5271c05a918f7e271c1f37420993709f5299f1cf GIT binary patch literal 203 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4$}8W)^mS#w&mqPjqk8=8xkEr9+02lL66gHf+|;}hAeVu`xhOTU zBsE2$JhLQ2!QIn0AVn{g9Vo8v>Eak-aXR^j{rrdj|G(z>FL{E+hexC-F@b>@1XLL< kr8=&3v3eyXnFvTqFuY$aP*|OkwgF_Or>mdKI;Vst0EPH9761SM literal 0 HcmV?d00001 diff --git a/ElectronicObserver/Assets/Level/AircraftLevel5.png b/ElectronicObserver/Assets/Level/AircraftLevel5.png new file mode 100644 index 0000000000000000000000000000000000000000..9899bcd705f364afbfdd3cf7c5deb95b426e5068 GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4$}8W)^mS#w&mqPjqpeW-_$W|FHZvrm#5q4VH#M&W$Yo$~E=o-- zNlj5G&n(GMaQE~LNYP7W2Z|eex;TbdoKF5>KmXzX|F3!eOG-#cOt^W3NsW!`pn*XH sqwNO|-V+xcmW1g92njE4JaK@5;ZdH#@vj058X$8$UHx3vIVCg!0D)dP4FCWD literal 0 HcmV?d00001 diff --git a/ElectronicObserver/Assets/Level/AircraftLevel6.png b/ElectronicObserver/Assets/Level/AircraftLevel6.png new file mode 100644 index 0000000000000000000000000000000000000000..2540a7d613084300a73fbcb1b8672e8a4b773266 GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4$}8W)^mS#w&mqPjV|Z6wYClj&HZvrm#5q4VH#M&W$Yo$~E=o-- zNlj5G&n(GMaQE~LNYP7W2Z|eex;TbdoKF5>KmXzX|F3!eOG-#c6m0y+sK&;1(7>R9 rG5&#|@Px&U9%~~OsHnLyPi$ml5Y#l3jobAo3uLaRtDnm{r-UW|BeORb literal 0 HcmV?d00001 diff --git a/ElectronicObserver/Assets/Level/AircraftLevel7.png b/ElectronicObserver/Assets/Level/AircraftLevel7.png new file mode 100644 index 0000000000000000000000000000000000000000..92edb9d62fa4ee327955cf33226e46c2d174d884 GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4$}8W)^mS#w&mqPjV|n?^q+XzqY-UJAiF1B#Zfaf$kjuc}T$Gwv zlA5AWo>`Ki;O^-gkfN8$4ivZaba4!^IGy~%e*VM%|6lX`mz0o@m~c~t(TgWBX@Qu+ yb + @@ -815,6 +816,10 @@ {c75532c4-765b-418e-b09b-46d36b2abdb1} WinFormsUI + + {44244148-d3fe-4d71-aa8f-cacb54ac53c1} + SwfExtractor + diff --git a/ElectronicObserver/Resource/ResourceManager.cs b/ElectronicObserver/Resource/ResourceManager.cs index e8fd67254..d90e4d8ff 100644 --- a/ElectronicObserver/Resource/ResourceManager.cs +++ b/ElectronicObserver/Resource/ResourceManager.cs @@ -139,6 +139,14 @@ public enum IconContent { BattleFormationEnemyDiamond, BattleFormationEnemyEchelon, BattleFormationEnemyLineAbreast, + AircraftLevel0, + AircraftLevel1, + AircraftLevel2, + AircraftLevel3, + AircraftLevel4, + AircraftLevel5, + AircraftLevel6, + AircraftLevel7, } public enum EquipmentContent { @@ -345,6 +353,15 @@ private void LoadFromArchive( string path ) { LoadImageFromArchive( Icons, archive, mstpath + @"Battle/FormationEnemy04.png", "Battle_FormationEnemy_Echelon" ); LoadImageFromArchive( Icons, archive, mstpath + @"Battle/FormationEnemy05.png", "Battle_FormationEnemy_LineAbreast" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Level/AircraftLevel0.png", "Level_AircraftLevel_0" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Level/AircraftLevel1.png", "Level_AircraftLevel_1" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Level/AircraftLevel2.png", "Level_AircraftLevel_2" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Level/AircraftLevel3.png", "Level_AircraftLevel_3" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Level/AircraftLevel4.png", "Level_AircraftLevel_4" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Level/AircraftLevel5.png", "Level_AircraftLevel_5" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Level/AircraftLevel6.png", "Level_AircraftLevel_6" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Level/AircraftLevel7.png", "Level_AircraftLevel_7" ); + // ------------------------ equipments ------------------------ diff --git a/ElectronicObserver/Utility/FleetImageGenerator.cs b/ElectronicObserver/Utility/FleetImageGenerator.cs new file mode 100644 index 000000000..c0f846b0f --- /dev/null +++ b/ElectronicObserver/Utility/FleetImageGenerator.cs @@ -0,0 +1,850 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SwfExtractor; +using System.Windows.Forms; +using ElectronicObserver.Data; +using ElectronicObserver.Utility.Data; +using ElectronicObserver.Resource; +using System.Drawing.Drawing2D; + +namespace ElectronicObserver.Utility { + + public class FleetImageGenerator { + + protected static readonly Size MaxValueSize = new Size( int.MaxValue, int.MaxValue ); + + protected static readonly Size ShipBannerSize = new Size( 160, 40 ); + protected static readonly Size ShipCardSize = new Size( 218, 300 ); + protected static readonly Size ShipCutinSize = new Size( 665, 121 ); + protected static readonly Size ShipNameSize = new Size( 436, 63 ); + protected static readonly Size ShipSupplySize = new Size( 474, 47 ); + + protected static readonly Size EquipmentCardSize = new Size( 260, 260 ); + protected static readonly Size EquipmentIconSize = new Size( 16, 16 ); + + protected static readonly int ShipBannerNormalID = 1; + protected static readonly int ShipBannerDamagedID = 3; + protected static readonly int ShipCardNormalID = 5; + protected static readonly int ShipCardDamagedID = 7; + protected static readonly int ShipCutinNormalID = 21; + protected static readonly int ShipCutinDamagedID = 23; + protected static readonly int ShipNameID = 25; + protected static readonly int ShipSupplyNormalID = 27; + protected static readonly int ShipSupplyDamagedID = 29; + + + + + public static Bitmap GenerateImageTest() { + throw new NotImplementedException(); + } + + + protected static Size RenderShipTest( Bitmap bmp, Graphics g, FleetImageArgument args, Point origin, ShipData ship ) { + + var formatMiddleLeft = GetTextFormat( ContentAlignment.MiddleLeft ); + var formatMiddleCenter = GetTextFormat( ContentAlignment.MiddleCenter ); + var formatMiddleRight = GetTextFormat( ContentAlignment.MiddleRight ); + + Color mainColor = Color.FromArgb( 0xf0, 0xf0, 0xf0 ); + Color parameterNameColor = Color.Teal; + Color aircraftEnableColor = mainColor; + Color aircraftDisableColor = Color.Gray; + + Size shipNameSize = TextRenderer.MeasureText( g, "千代田航改二", args.LargeFont, MaxValueSize, formatMiddleLeft ); + Size equipmentNameSize = TextRenderer.MeasureText( g, "三式戦 飛燕一型丁", args.MediumFont, MaxValueSize, formatMiddleLeft ); + Size parameterSize = TextRenderer.MeasureText( g, "999", args.MediumFont, MaxValueSize, formatMiddleRight ); + Size levelSize = TextRenderer.MeasureText( g, "Lv", args.SmallFont, MaxValueSize, formatMiddleLeft ); + Size parameterNameSize = TextRenderer.MeasureText( g, "耐久", args.SmallFont, MaxValueSize, formatMiddleCenter ); + + Size nameAreaSize = new Size( shipNameSize.Width + levelSize.Width + parameterSize.Width, Max( shipNameSize.Height, levelSize.Height, parameterSize.Height ) ); + Size equipmentAreaUnitSize = new Size( parameterSize.Width + EquipmentIconSize.Width + equipmentNameSize.Width, Max( parameterSize.Height, EquipmentIconSize.Height, equipmentNameSize.Height ) ); + Size equipmentAreaSize = new Size( equipmentAreaUnitSize.Width, equipmentAreaUnitSize.Height * 6 ); + Size parameterAreaUnitSize = new Size( EquipmentIconSize.Width + parameterNameSize.Width + parameterSize.Width, Max( EquipmentIconSize.Height + parameterNameSize.Height + parameterSize.Height ) ); + Size parameterAreaSize = new Size( parameterAreaUnitSize.Width * 2, parameterAreaUnitSize.Height * 6 ); + + Size leftPaneSize = new Size( Max( nameAreaSize.Width, equipmentAreaSize.Width, parameterSize.Width ), nameAreaSize.Height + equipmentAreaSize.Height + parameterSize.Height ); + + Size entireSize = new Size( leftPaneSize.Width + ShipCardSize.Width, Max( leftPaneSize.Height, ShipCardSize.Height ) ); + + + Point ptr = new Point( origin.X, origin.Y ); + TextRenderer.DrawText( g, ship.Name, args.LargeFont, new Rectangle( ptr.X, ptr.Y, shipNameSize.Width, nameAreaSize.Height ), mainColor, formatMiddleLeft ); + ptr.X += leftPaneSize.Width - levelSize.Width - parameterSize.Width; + TextRenderer.DrawText( g, "Lv", args.SmallFont, new Rectangle( ptr.X, ptr.Y, levelSize.Width, nameAreaSize.Height ), parameterNameColor, formatMiddleLeft ); + ptr.X -= levelSize.Width; + TextRenderer.DrawText( g, ship.Level.ToString(), args.SmallFont, new Rectangle( ptr.X, ptr.Y, parameterSize.Width, nameAreaSize.Height ), mainColor, formatMiddleRight ); + + ptr.X = origin.X; + ptr.Y += nameAreaSize.Height; + + + for ( int i = 0; i < 6; i++ ) { + + int aircraftCurrent, aircraftMax; + EquipmentData eq; + bool isInvalid; + + if ( i < 5 ) { + aircraftCurrent = ship.Aircraft[i]; + aircraftMax = ship.MasterShip.Aircraft[i]; + eq = ship.SlotInstance[i]; + isInvalid = i >= ship.SlotSize; + } else { + aircraftCurrent = aircraftMax = 0; + eq = ship.ExpansionSlotInstance; + isInvalid = ship.IsExpansionSlotAvailable; + } + + ptr.X = origin.X; + + // aircraft slot + if ( !isInvalid ) { + if ( aircraftMax > 0 ) { + Color col; + if ( Calculator.IsAircraft( eq == null ? -1 : eq.EquipmentID, true, true ) ) { + col = aircraftEnableColor; + } else { + col = aircraftDisableColor; + } + + TextRenderer.DrawText( g, aircraftMax.ToString(), args.SmallFont, new Rectangle( ptr.X, ptr.Y, parameterSize.Width, equipmentAreaUnitSize.Height ), col, formatMiddleRight ); + } + + ptr.X += parameterSize.Width; + } + + + // icon + { + int index; + + if ( eq == null ) { + if ( isInvalid ) + index = (int)ResourceManager.EquipmentContent.Locked; + else + index = (int)ResourceManager.EquipmentContent.Nothing; + } else if ( (int)ResourceManager.EquipmentContent.Nothing < eq.MasterEquipment.IconType && eq.MasterEquipment.IconType < (int)ResourceManager.EquipmentContent.Locked ) { + index = eq.MasterEquipment.IconType; + } else { + index = (int)ResourceManager.EquipmentContent.Unknown; + } + + g.DrawImage( ResourceManager.Instance.Equipments.Images[index], ptr.X, ptr.Y + equipmentAreaUnitSize.Height / 2 - EquipmentIconSize.Height / 2 ); + + ptr.X += EquipmentIconSize.Width; + } + + // equipment name + { + TextRenderer.DrawText( g, eq.Name, args.MediumFont, new Rectangle( ptr.X, ptr.Y, equipmentNameSize.Width, equipmentAreaUnitSize.Height ), mainColor, formatMiddleRight ); + } + + ptr.Y += parameterAreaUnitSize.Height; + } + + + ptr.X = origin.X; + + + var parameterList = new[] { + new { + image = (int)ResourceManager.IconContent.ParameterHP, + name = "耐久", + value = ship.HPMax.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterFirepower, + name = "火力", + value = ship.FirepowerTotal.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterArmor, + name = "装甲", + value = ship.ArmorTotal.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterTorpedo, + name = "雷装", + value = ship.TorpedoTotal.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterEvasion, + name = "回避", + value = ship.EvasionTotal.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterAA, + name = "対空", + value = ship.AATotal.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterAircraft, + name = "搭載", + value = ship.MasterShip.AircraftTotal.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterASW, + name = "対潜", + value = ship.ASWTotal.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterSpeed, + name = "速力", + value = Constants.GetSpeed( ship.Speed ), + }, + new { + image = (int)ResourceManager.IconContent.ParameterLOS, + name = "索敵", + value = ship.LOSTotal.ToString(), + }, + new { + image = (int)ResourceManager.IconContent.ParameterRange, + name = "射程", + value = Constants.GetRange( ship.Range ), + }, + new { + image = (int)ResourceManager.IconContent.ParameterLuck, + name = "運", + value = ship.LuckTotal.ToString(), + }, + }; + + + for ( int i = 0; i < parameterList.Length; i++ ) { + Point pttr = new Point( ptr.X + parameterAreaUnitSize.Width * ( i % 2 ), ptr.Y + parameterAreaUnitSize.Height * ( i / 2 ) ); + + g.DrawImage( ResourceManager.Instance.Icons.Images[parameterList[i].image], pttr.X, pttr.Y + parameterAreaUnitSize.Height / 2 - EquipmentIconSize.Height / 2 ); + pttr.X += EquipmentIconSize.Width; + + TextRenderer.DrawText( g, parameterList[i].name, args.SmallFont, new Rectangle( pttr.X, pttr.Y, parameterNameSize.Width, parameterAreaUnitSize.Height ), parameterNameColor, formatMiddleCenter ); + pttr.X += parameterNameSize.Width; + + TextRenderer.DrawText( g, parameterList[i].value, args.MediumFont, new Rectangle( pttr.X, pttr.Y, parameterSize.Width, parameterAreaUnitSize.Height ), mainColor, formatMiddleRight ); + } + + + ptr.X = origin.X + leftPaneSize.Width; + ptr.Y = origin.Y; + + try { + string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + ship.MasterShip.ResourceName + ".swf"; + if ( System.IO.File.Exists( shipSwfPath ) ) { + + var shipSwf = new SwfParser(); + shipSwf.Parse( shipSwfPath ); + + var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == ShipCardNormalID ); + using ( var shipImage = imgtag.ExtractImage() ) { + g.DrawImage( shipImage, new Rectangle( ptr.X, ptr.Y, ShipCardSize.Width, ShipCardSize.Height ) ); + } + } + } catch ( Exception ) { + } + + return entireSize; + } + + + + + public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { + + var formatMiddleLeft = GetStringFormat( ContentAlignment.MiddleLeft ); + var formatMiddleCenter = GetStringFormat( ContentAlignment.MiddleCenter ); + var formatMiddleRight = GetStringFormat( ContentAlignment.MiddleRight ); + + Color backgroundColor = Color.FromArgb( 0xff, 0xff, 0xff ); + Color mainTextColor = Color.FromArgb( 0x0f, 0x0f, 0x0f ); + Color subTextColor = Color.FromArgb( 0x00, 0x88, 0x88 ); + Color shadowColor = Color.FromArgb( 0x88, 0x88, 0x88 ); + Color disabledColor = Color.FromArgb( 0xaa, 0xaa, 0xaa ); + Color aircraftLevelLowColor = Color.FromArgb( 0x00, 0xff, 0xff ); + Color aircraftLevelHighColor = Color.FromArgb( 0xff, 0x88, 0x00 ); + + var mainTextBrush = new SolidBrush( mainTextColor ); + var subTextBrush = new SolidBrush( subTextColor ); + var shadowBrush = new SolidBrush( shadowColor ); + var disabledBrush = new SolidBrush( disabledColor ); + var aircraftLevelLowBrush = new SolidBrush( aircraftLevelLowColor ); + var aircraftLevelHighBrush = new SolidBrush( aircraftLevelHighColor ); + + var linePen = new Pen( subTextColor ); + + + string fleetAirSuperiorityTitle = "制空戦力"; + string fleetSearchingAbilityTitle = "索敵能力"; + + // for measure space of strings + Bitmap preimage = new Bitmap( 1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); + Graphics preg = Graphics.FromImage( preimage ); + + // Size Calculation + Size titleSize = string.IsNullOrWhiteSpace( args.Title ) ? Size.Empty : MeasureString( preg, args.Title, args.TitleFont, MaxValueSize, formatMiddleCenter ); + Size commentSize = string.IsNullOrWhiteSpace( args.Comment ) ? Size.Empty : MeasureString( preg, args.Comment, args.MediumFont, MaxValueSize, formatMiddleLeft ); + + Size fleetNameSize = MeasureString( preg, "大正義日独伊三国褐色同盟", args.LargeFont, MaxValueSize, formatMiddleLeft ); // kanji 12 char + Size fleetAirSuperiorityTitleSize = MeasureString( preg, fleetAirSuperiorityTitle, args.SmallFont, MaxValueSize, formatMiddleLeft ); + Size fleetAirSuperiorityValueEstimatedSize = MeasureString( preg, "8888", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + Size fleetSearchingAbilityTitleSize = MeasureString( preg, fleetSearchingAbilityTitle, args.SmallFont, MaxValueSize, formatMiddleLeft ); + Size fleetSearchingAbilityValueEstimatedSize = MeasureString( preg, "-888.88", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + + Size shipIndexSize = MeasureString( preg, "#4:", args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + Size shipNameSize = MeasureString( preg, "千代田航改二", args.LargeFont, MaxValueSize, formatMiddleLeft ); // kanji 6 char + Size equipmentNameSize = MeasureString( preg, "三式戦 飛燕一型丁", args.MediumFont, MaxValueSize, formatMiddleLeft ); // kanji 9 char + Size mediumDigit3Size = MeasureString( preg, "888", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + Size smallDigit3Size = MeasureString( preg, "888", args.SmallDigitFont, MaxValueSize, formatMiddleRight ); + Size levelSize = MeasureString( preg, "Lv.", args.SmallDigitFont, MaxValueSize, formatMiddleLeft ); + Size parameterNameSize = MeasureString( preg, "耐久", args.SmallFont, MaxValueSize, formatMiddleCenter ); + Size parameterValueSize = Max( MeasureString( preg, "高速+", args.MediumFont, MaxValueSize, formatMiddleRight ), mediumDigit3Size ); + Size equipmentLevelSize = MeasureString( preg, "+10", args.SmallDigitFont, MaxValueSize, formatMiddleRight ); + + Size parameterAreaInnerMargin = new Size( 16, 0 ); + Size fleetParameterAreaInnerMargin = new Size( 16, 0 ); + Padding shipNameAreaMargin = new Padding( 0, 0, 0, 2 ); + Padding equipmentAreaMargin = new Padding( 0, 0, 0, 2 ); + Padding parameterAreaMargin = new Padding( 0, 0, 0, 2 ); + Padding shipValuePaneMargin = new Padding(); + Padding shipImagePaneMargin = new Padding(); + Padding shipPaneUnitMargin = new Padding( 2 ); + Padding shipPaneMargin = new Padding(); + Padding fleetParameterAreaMargin = new Padding( 8, 0, 0, 4 ); + Padding fleetPaneUnitMargin = new Padding( 4 ); + Padding fleetPaneMargin = new Padding(); + Padding titleMargin = new Padding( 0, 0, 0, 2 ); + Padding commentMargin = new Padding( 2 ); + Padding commentPadding = new Padding( 2 ); + Padding entireMargin = new Padding(); + int lineMargin = 4; + + Size shipNameAreaSize = SumWidthMaxHeight( shipIndexSize, shipNameSize, levelSize, mediumDigit3Size ); + Size equipmentAreaUnitSize = SumWidthMaxHeight( smallDigit3Size, EquipmentIconSize, equipmentNameSize, EquipmentIconSize, equipmentLevelSize ); + Size equipmentAreaSize = new Size( equipmentAreaUnitSize.Width, equipmentAreaUnitSize.Height * 6 ); + Size parameterAreaUnitSize = SumWidthMaxHeight( EquipmentIconSize, parameterNameSize, parameterValueSize ); + Size parameterAreaSize = new Size( parameterAreaUnitSize.Width * 2, parameterAreaUnitSize.Height * 6 ) + parameterAreaInnerMargin; + + Size shipValuePaneSize = MaxWidthSumHeight( shipNameAreaSize + shipNameAreaMargin.Size, equipmentAreaSize + equipmentAreaMargin.Size, parameterAreaSize + parameterAreaMargin.Size ); + Size shipImagePaneSize = ShipCardSize; + Size shipPaneUnitSize = SumWidthMaxHeight( shipValuePaneSize + shipValuePaneMargin.Size, shipImagePaneSize + shipImagePaneMargin.Size ); + Size shipPaneSize = new Size( + ( shipPaneUnitSize.Width + shipPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalShipCount, 6 ), + ( shipPaneUnitSize.Height + shipPaneUnitMargin.Vertical ) * (int)Math.Ceiling( 6.0 / args.HorizontalShipCount ) ); + + Size fleetParameterAreaSize = SumWidthMaxHeight( + EquipmentIconSize, fleetAirSuperiorityTitleSize, fleetAirSuperiorityValueEstimatedSize, fleetParameterAreaInnerMargin, + EquipmentIconSize, fleetSearchingAbilityTitleSize, fleetSearchingAbilityValueEstimatedSize ); + + Size fleetPaneUnitSize; + bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width + shipPaneMargin.Horizontal; + if ( isFleetNameAndParametersAreSameLine ) { + fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize + shipPaneMargin.Size ); + } else { + fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize + shipPaneMargin.Size ); + } + + Size fleetPaneSize = new Size( ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalFleetCount, args.FleetIDs.Length ), + ( fleetPaneUnitSize.Height + fleetPaneUnitMargin.Vertical ) * (int)Math.Ceiling( (double)args.FleetIDs.Length / args.HorizontalFleetCount ) ); + + Size commentAreaSize = commentSize + commentPadding.Size; + + Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize + fleetPaneMargin.Size, commentAreaSize + commentMargin.Size ); + + // anchor + shipNameSize.Width = shipValuePaneSize.Width - shipIndexSize.Width - levelSize.Width - mediumDigit3Size.Width; + shipNameAreaSize.Width = shipValuePaneSize.Width; + equipmentNameSize.Width = shipValuePaneSize.Width - smallDigit3Size.Width - EquipmentIconSize.Width - EquipmentIconSize.Width - equipmentLevelSize.Width; + equipmentAreaUnitSize.Width = shipValuePaneSize.Width; + Size equipmentNameSizeExtended = SumWidthMaxHeight( equipmentNameSize, EquipmentIconSize, equipmentLevelSize ); + + var equipmentNameBrush = new LinearGradientBrush( new Rectangle( 0, 0, equipmentNameSize.Width * 2 + EquipmentIconSize.Width * 2 + equipmentLevelSize.Width, equipmentAreaUnitSize.Height ), Color.Black, Color.Black, LinearGradientMode.Horizontal ); // color is ignored + { + var blend = new ColorBlend(); + blend.Positions = new[] { 0f, (float)( equipmentNameSizeExtended.Width - EquipmentIconSize.Width - EquipmentIconSize.Width / 2 ) / equipmentNameBrush.Rectangle.Width, (float)( equipmentNameSizeExtended.Width - EquipmentIconSize.Width / 2 ) / equipmentNameBrush.Rectangle.Width, 1f }; + blend.Colors = new[] { mainTextColor, mainTextColor, Color.FromArgb( 0, mainTextColor ), Color.FromArgb( 0, mainTextColor ) }; + equipmentNameBrush.InterpolationColors = blend; + } + equipmentNameBrush.GammaCorrection = true; + + preg.Dispose(); + preimage.Dispose(); + + + var bitmap = new Bitmap( entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); + using ( var g = Graphics.FromImage( bitmap ) ) { + + g.Clear( backgroundColor ); + if ( !string.IsNullOrEmpty( args.BackgroundImagePath ) && System.IO.File.Exists( args.BackgroundImagePath ) ) { + try { + using ( var backgroundImage = new Bitmap( args.BackgroundImagePath ) ) { + using ( var backgroundBrush = new TextureBrush( backgroundImage, WrapMode.Tile ) ) { + g.FillRectangle( backgroundBrush, new Rectangle( 0, 0, bitmap.Width, bitmap.Height ) ); + } + } + + } catch ( Exception ) { + } + } + + + Point masterPointer = new Point( entireMargin.Left, entireMargin.Top ); + + // title + if ( !titleSize.IsEmpty ) { + g.DrawString( args.Title, args.TitleFont, shadowBrush, new Rectangle( masterPointer + GetAlignmentOffset( ContentAlignment.TopCenter, titleSize, entireSize ) + new Size( 2, 2 ), titleSize ), formatMiddleCenter ); + g.DrawString( args.Title, args.TitleFont, mainTextBrush, new Rectangle( masterPointer + GetAlignmentOffset( ContentAlignment.TopCenter, titleSize, entireSize ), titleSize ), formatMiddleCenter ); + } + masterPointer.Y += titleSize.Height; + + + for ( int fleetIndex = 0; fleetIndex < args.FleetIDs.Length; fleetIndex++ ) { + int fleetID = args.FleetIDs[fleetIndex]; + FleetData fleet = KCDatabase.Instance.Fleet[fleetID]; + Point fleetPointerOrigin = masterPointer + new Size( + ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * ( fleetIndex % args.HorizontalFleetCount ) + fleetPaneUnitMargin.Left, + ( fleetPaneUnitSize.Height + fleetPaneUnitMargin.Vertical ) * ( fleetIndex / args.HorizontalFleetCount ) + fleetPaneUnitMargin.Top ); + Point fleetPointer = fleetPointerOrigin; + + if ( fleet == null ) + continue; + + // fleet name + g.DrawString( fleet.Name, args.LargeFont, mainTextBrush, new Rectangle( fleetPointer, fleetNameSize ), formatMiddleLeft ); + if ( isFleetNameAndParametersAreSameLine ) { + fleetPointer.X += fleetNameSize.Width; + fleetPointer.Y += fleetNameSize.Height - fleetParameterAreaSize.Height; + } else { + fleetPointer.Y += fleetNameSize.Height; + } + + // fleet specs + fleetPointer.X += fleetParameterAreaMargin.Left; + fleetPointer.Y += fleetParameterAreaMargin.Top; + { // fighter power + var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, parameterAreaUnitSize ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.CarrierBasedFighter], iconpos.X, iconpos.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); + fleetPointer.X += EquipmentIconSize.Width; + + g.DrawString( fleetAirSuperiorityTitle, args.SmallFont, subTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, fleetAirSuperiorityTitleSize, fleetParameterAreaSize ), fleetAirSuperiorityTitleSize ), formatMiddleLeft ); + fleetPointer.X += fleetAirSuperiorityTitleSize.Width; + + Size paramValueSize = MeasureString( g, fleet.GetAirSuperiority().ToString(), args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + g.DrawString( fleet.GetAirSuperiority().ToString(), args.MediumDigitFont, mainTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, paramValueSize, fleetParameterAreaSize ), paramValueSize ), formatMiddleLeft ); + fleetPointer.X += paramValueSize.Width + fleetParameterAreaInnerMargin.Width; + } + { // searching ability + var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, parameterAreaUnitSize ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.CarrierBasedRecon], iconpos.X, iconpos.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); + fleetPointer.X += EquipmentIconSize.Width; + + g.DrawString( fleetSearchingAbilityTitle, args.SmallFont, subTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, fleetSearchingAbilityTitleSize, fleetParameterAreaSize ), fleetSearchingAbilityTitleSize ), formatMiddleLeft ); + fleetPointer.X += fleetAirSuperiorityTitleSize.Width; + + Size paramValueSize = MeasureString( g, fleet.GetSearchingAbilityString(), args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + g.DrawString( fleet.GetSearchingAbilityString(), args.MediumDigitFont, mainTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, paramValueSize, parameterAreaUnitSize ), paramValueSize ), formatMiddleLeft ); + fleetPointer.X += paramValueSize.Width + fleetParameterAreaInnerMargin.Width; + } + + fleetPointer.X = fleetPointerOrigin.X; + fleetPointer.Y += parameterAreaUnitSize.Height; + + g.DrawLine( linePen, fleetPointer + new Size( lineMargin, 0 ), fleetPointer + new Size( shipPaneSize.Width - lineMargin, 0 ) ); + fleetPointer.Y += fleetParameterAreaMargin.Bottom; + + + for ( int shipIndex = 0; shipIndex < 6; shipIndex++ ) { + ShipData ship = fleet.MembersInstance[shipIndex]; + Point shipPointerOrigin = fleetPointer + new Size( + ( shipPaneUnitSize.Width + shipPaneUnitMargin.Horizontal ) * ( shipIndex % args.HorizontalShipCount ) + shipPaneUnitMargin.Left, + ( shipPaneUnitSize.Height + shipPaneUnitMargin.Vertical ) * ( shipIndex / args.HorizontalShipCount ) + shipPaneUnitMargin.Top ); + Point shipPointer = shipPointerOrigin; + + + if ( ship == null ) + continue; + + g.DrawString( string.Format( "#{0}:", shipIndex + 1 ), args.MediumDigitFont, subTextBrush, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, shipIndexSize, shipNameAreaSize ), shipIndexSize ), formatMiddleLeft ); + shipPointer.X += shipIndexSize.Width; + + // ship name + g.DrawString( ship.Name, args.LargeFont, mainTextBrush, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, shipNameSize, shipNameAreaSize ), shipNameSize ), formatMiddleLeft ); + shipPointer.X += shipNameSize.Width; + + // level + g.DrawString( "Lv.", args.SmallDigitFont, subTextBrush, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.BottomLeft, levelSize, shipNameAreaSize ), levelSize ), formatMiddleLeft ); + shipPointer.X += levelSize.Width; + g.DrawString( ship.Level.ToString(), args.MediumDigitFont, mainTextBrush, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.BottomLeft, mediumDigit3Size, shipNameAreaSize ), mediumDigit3Size ), formatMiddleRight ); + + shipPointer.X = shipPointerOrigin.X; + shipPointer.Y += shipNameAreaSize.Height; + g.DrawLine( linePen, shipPointer + new Size( lineMargin, 0 ), shipPointer + new Size( shipValuePaneSize.Width - lineMargin, 0 ) ); + shipPointer.Y += shipNameAreaMargin.Bottom; + + // equipments + for ( int equipmentIndex = 0; equipmentIndex < 6; equipmentIndex++ ) { + EquipmentData eq = ship.AllSlotInstance[equipmentIndex]; + Point equipmentPointer = shipPointer + new Size( 0, equipmentAreaUnitSize.Height * equipmentIndex ); + + + int aircraftMax = equipmentIndex < 5 ? ship.MasterShip.Aircraft[equipmentIndex] : 0; + + if ( aircraftMax > 0 ) { + Brush aircraftBrush; + if ( eq != null && Calculator.IsAircraft( eq.EquipmentID, true, true ) ) { + aircraftBrush = mainTextBrush; + } else { + aircraftBrush = disabledBrush; + } + + g.DrawString( aircraftMax.ToString(), args.SmallDigitFont, aircraftBrush, new Rectangle( equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, smallDigit3Size, equipmentAreaUnitSize ), smallDigit3Size ), formatMiddleRight ); + } + equipmentPointer.X += smallDigit3Size.Width; + + bool isOutOfSlot = equipmentIndex >= ship.SlotSize && !( equipmentIndex == 5 && ship.IsExpansionSlotAvailable ); + + Size equipmentIconOffset = GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, equipmentAreaUnitSize ); + g.DrawImage( GetEquipmentIcon( eq != null ? eq.EquipmentID : -1, isOutOfSlot ), + equipmentPointer.X + equipmentIconOffset.Width, equipmentPointer.Y + equipmentIconOffset.Height, EquipmentIconSize.Width, EquipmentIconSize.Height ); + equipmentPointer.X += EquipmentIconSize.Width; + + string equipmentName; + if ( eq != null ) { + equipmentName = eq.Name; + } else if ( isOutOfSlot ) { + equipmentName = ""; + } else { + equipmentName = "(なし)"; + } + equipmentNameBrush.ResetTransform(); + if ( eq != null && eq.AircraftLevel > 0 ) { + equipmentNameBrush.TranslateTransform( equipmentPointer.X - EquipmentIconSize.Width - equipmentLevelSize.Width, 0 ); + } else if ( eq != null && eq.Level > 0 ) { + equipmentNameBrush.TranslateTransform( equipmentPointer.X - EquipmentIconSize.Width, 0 ); + } else { + equipmentNameBrush.TranslateTransform( equipmentPointer.X, 0 ); + } + g.DrawString( equipmentName, args.MediumFont, equipmentNameBrush, new Rectangle( equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, equipmentNameSizeExtended, equipmentAreaUnitSize ), equipmentNameSizeExtended ), formatMiddleLeft ); + equipmentPointer.X += equipmentNameSize.Width; + + if ( eq != null ) { + + if ( 0 <= eq.AircraftLevel && eq.AircraftLevel <= 7 ) { + var point = equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, equipmentAreaUnitSize ); + g.DrawImage( ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.AircraftLevel0 + eq.AircraftLevel], point.X, point.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); + } + equipmentPointer.X += EquipmentIconSize.Width; + + if ( eq.Level > 0 ) { + g.DrawString( "+" + eq.Level, args.SmallDigitFont, subTextBrush, new Rectangle( equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, equipmentLevelSize, equipmentAreaUnitSize ), equipmentLevelSize ), formatMiddleRight ); + } + + } + + } + shipPointer.Y += equipmentAreaSize.Height; + g.DrawLine( linePen, shipPointer + new Size( lineMargin, 0 ), shipPointer + new Size( shipValuePaneSize.Width - lineMargin, 0 ) ); + shipPointer.Y += equipmentAreaMargin.Bottom; + + + // parameters + for ( int parameterIndex = 0; parameterIndex < ParameterDataList.Length; parameterIndex++ ) { + Point parameterPointer = shipPointer + GetAlignmentOffset( ContentAlignment.TopCenter, parameterAreaSize, shipValuePaneSize ) + new Size( ( parameterAreaUnitSize.Width + parameterAreaInnerMargin.Width ) * ( parameterIndex % 2 ), ( parameterAreaUnitSize.Height + parameterAreaInnerMargin.Height ) * ( parameterIndex / 2 ) ); + var paramdata = ParameterDataList[parameterIndex]; + + Size parameterIconOffset = GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, parameterAreaUnitSize ); + g.DrawImage( paramdata.Icon, parameterPointer.X + parameterIconOffset.Width, parameterPointer.Y + parameterIconOffset.Height, + EquipmentIconSize.Width, EquipmentIconSize.Height ); + parameterPointer.X += EquipmentIconSize.Width; + + g.DrawString( paramdata.Name, args.SmallFont, subTextBrush, new Rectangle( parameterPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, parameterNameSize, parameterAreaUnitSize ), parameterNameSize ), formatMiddleCenter ); + parameterPointer.X += parameterNameSize.Width; + + g.DrawString( paramdata.ValueSelector( ship ), paramdata.IsCharacter ? args.MediumFont : args.MediumDigitFont, mainTextBrush, + new Rectangle( parameterPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, parameterValueSize, parameterAreaUnitSize ), parameterValueSize ), formatMiddleRight ); + + } + shipPointer.Y += parameterAreaSize.Height; + g.DrawLine( linePen, shipPointer + new Size( lineMargin, 0 ), shipPointer + new Size( shipValuePaneSize.Width - lineMargin, 0 ) ); + + + // ship image + shipPointer.X = shipPointerOrigin.X + shipValuePaneSize.Width; + shipPointer.Y = shipPointerOrigin.Y; + DrawShipSwfImage( g, ship.MasterShip.ResourceName, args.ReflectDamageGraphic && ship.HPRate <= 0.5 ? ShipCardDamagedID : ShipCardNormalID, shipPointer.X, shipPointer.Y, ShipCardSize ); + } + } + + masterPointer.Y += fleetPaneSize.Height; + g.DrawLine( linePen, masterPointer + new Size( lineMargin, 0 ), masterPointer + new Size( fleetPaneSize.Width - commentMargin.Horizontal - lineMargin, 0 ) ); + + + if ( !commentSize.IsEmpty ) { + var commentPointer = masterPointer + new Size( commentMargin.Left, commentMargin.Top ); + commentPointer += new Size( commentPadding.Left, commentPadding.Top ); + g.DrawString( args.Comment, args.MediumFont, mainTextBrush, new Rectangle( commentPointer, commentSize ), formatMiddleLeft ); + } + } + + + if ( args.AvoidTwitterDeterioration ) { + // 不透明ピクセルのみだと jpeg 化されてしまうため、1px だけわずかに透明にする + Color temp = bitmap.GetPixel( bitmap.Width - 1, bitmap.Height - 1 ); + bitmap.SetPixel( bitmap.Width - 1, bitmap.Height - 1, Color.FromArgb( 252, temp.R, temp.G, temp.B ) ); + } + + + mainTextBrush.Dispose(); + shadowBrush.Dispose(); + disabledBrush.Dispose(); + subTextBrush.Dispose(); + aircraftLevelLowBrush.Dispose(); + aircraftLevelHighBrush.Dispose(); + + equipmentNameBrush.Dispose(); + + linePen.Dispose(); + + return bitmap; + } + + + + + // management + + protected static Size MeasureString( Graphics g, string text, Font font, Size areaSize, StringFormat format ) { + return Size.Round( g.MeasureString( text, font, new SizeF( areaSize.Width, areaSize.Height ), format ) ); + /* + var f = new StringFormat( format ); + f.SetMeasurableCharacterRanges( new[] { new CharacterRange( 0, text.Length ) } ); + RectangleF rect = new RectangleF( 0, 0, areaSize.Width, areaSize.Height ); + var regions = g.MeasureCharacterRanges( text, font, rect, f ); + return Rectangle.Round( regions[0].GetBounds( g ) ).Size; + //*/ + } + + protected static int Max( params int[] values ) { + return values.Max(); + } + + protected static Size Max( params Size[] values ) { + return new Size( values.Max( s => s.Width ), values.Max( s => s.Height ) ); + } + + protected static int MaxWidth( params Size[] values ) { + return values.Max( s => s.Width ); + } + protected static int MaxHeight( params Size[] values ) { + return values.Max( s => s.Height ); + } + protected static int SumWidth( params Size[] values ) { + return values.Sum( s => s.Width ); + } + protected static int SumHeight( params Size[] values ) { + return values.Sum( s => s.Height ); + } + protected static Size SumWidthMaxHeight( params Size[] values ) { + return new Size( SumWidth( values ), MaxHeight( values ) ); + } + protected static Size MaxWidthSumHeight( params Size[] values ) { + return new Size( MaxWidth( values ), SumHeight( values ) ); + } + + protected static Image GetEquipmentIcon( int equipmentID, bool isOutOfSlot ) { + var eq = KCDatabase.Instance.MasterEquipments[equipmentID]; + + if ( eq == null ) { + if ( isOutOfSlot ) + return ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.Locked]; + else + return ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.Nothing]; + + } else { + if ( 0 < eq.IconType && eq.IconType < (int)ResourceManager.EquipmentContent.Locked ) + return ResourceManager.Instance.Equipments.Images[eq.IconType]; + else + return ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.Unknown]; + } + } + + + protected class ShipParameterData { + public readonly Image Icon; + public readonly string Name; + public readonly Func ValueSelector; + public readonly bool IsCharacter; + + public ShipParameterData( ResourceManager.IconContent iconIndex, string name, Func selector, bool isCharacter = false ) { + Icon = ResourceManager.Instance.Icons.Images[(int)iconIndex]; + Name = name; + ValueSelector = selector; + IsCharacter = isCharacter; + } + } + + protected static readonly ShipParameterData[] ParameterDataList = new[] { + new ShipParameterData( ResourceManager.IconContent.ParameterHP, "耐久", ship => ship.HPMax.ToString() ), + new ShipParameterData( ResourceManager.IconContent.ParameterFirepower, "火力", ship => ship.FirepowerTotal.ToString() ), + new ShipParameterData( ResourceManager.IconContent.ParameterArmor, "装甲", ship => ship.ArmorTotal.ToString() ), + 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.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() ), + new ShipParameterData( ResourceManager.IconContent.ParameterRange, "射程", ship => Constants.GetRange( ship.Range ), true ), + new ShipParameterData( ResourceManager.IconContent.ParameterLuck, "運", ship => ship.LuckTotal.ToString() ), + }; + + + protected static bool DrawShipSwfImage( Graphics g, string resourceID, int characterID, int x, int y, Size size ) { + try { + string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + resourceID + ".swf"; + if ( System.IO.File.Exists( shipSwfPath ) ) { + + var shipSwf = new SwfParser(); + shipSwf.Parse( shipSwfPath ); + + var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == characterID ); + using ( var shipImage = imgtag.ExtractImage() ) { + g.DrawImage( shipImage, new Rectangle( x, y, size.Width, size.Height ) ); + } + } + + return true; + } catch ( Exception ) { + return false; + } + } + + protected static Size GetAlignmentOffset( ContentAlignment alignment, Size content, Size container ) { + switch ( alignment ) { + case ContentAlignment.TopLeft: + default: + return new Size( 0, 0 ); + case ContentAlignment.TopCenter: + return new Size( ( container.Width - content.Width ) / 2, 0 ); + case ContentAlignment.TopRight: + return new Size( container.Width - content.Width, 0 ); + case ContentAlignment.MiddleLeft: + return new Size( 0, ( container.Height - content.Height ) / 2 ); + case ContentAlignment.MiddleCenter: + return new Size( ( container.Width - content.Width ) / 2, ( container.Height - content.Height ) / 2 ); + case ContentAlignment.MiddleRight: + return new Size( container.Width - content.Width, ( container.Height - content.Height ) / 2 ); + case ContentAlignment.BottomLeft: + return new Size( 0, container.Height - content.Height ); + case ContentAlignment.BottomCenter: + return new Size( ( container.Width - content.Width ) / 2, container.Height - content.Height ); + case ContentAlignment.BottomRight: + return new Size( container.Width - content.Width, container.Height - content.Height ); + } + } + + + + protected static TextFormatFlags GetTextFormat( ContentAlignment alignment ) { + + TextFormatFlags textformat = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; + + switch ( alignment ) { + case ContentAlignment.TopLeft: + textformat |= TextFormatFlags.Top | TextFormatFlags.Left; break; + case ContentAlignment.TopCenter: + textformat |= TextFormatFlags.Top | TextFormatFlags.HorizontalCenter; break; + case ContentAlignment.TopRight: + textformat |= TextFormatFlags.Top | TextFormatFlags.Right; break; + case ContentAlignment.MiddleLeft: + textformat |= TextFormatFlags.VerticalCenter | TextFormatFlags.Left; break; + case ContentAlignment.MiddleCenter: + textformat |= TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter; break; + case ContentAlignment.MiddleRight: + textformat |= TextFormatFlags.VerticalCenter | TextFormatFlags.Right; break; + case ContentAlignment.BottomLeft: + textformat |= TextFormatFlags.Bottom | TextFormatFlags.Left; break; + case ContentAlignment.BottomCenter: + textformat |= TextFormatFlags.Bottom | TextFormatFlags.HorizontalCenter; break; + case ContentAlignment.BottomRight: + textformat |= TextFormatFlags.Bottom | TextFormatFlags.Right; break; + } + + return textformat; + + } + + protected static StringFormat GetStringFormat( ContentAlignment alignment ) { + + var format = new StringFormat( StringFormat.GenericDefault ); + format.Trimming = StringTrimming.None; + format.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap; + + switch ( alignment ) { + case ContentAlignment.TopLeft: + format.Alignment = StringAlignment.Near; + format.LineAlignment = StringAlignment.Near; + break; + case ContentAlignment.TopCenter: + format.Alignment = StringAlignment.Center; + format.LineAlignment = StringAlignment.Near; + break; + case ContentAlignment.TopRight: + format.Alignment = StringAlignment.Far; + format.LineAlignment = StringAlignment.Near; + break; + case ContentAlignment.MiddleLeft: + format.Alignment = StringAlignment.Near; + format.LineAlignment = StringAlignment.Center; + break; + case ContentAlignment.MiddleCenter: + format.Alignment = StringAlignment.Center; + format.LineAlignment = StringAlignment.Center; + break; + case ContentAlignment.MiddleRight: + format.Alignment = StringAlignment.Far; + format.LineAlignment = StringAlignment.Center; + break; + case ContentAlignment.BottomLeft: + format.Alignment = StringAlignment.Near; + format.LineAlignment = StringAlignment.Far; + break; + case ContentAlignment.BottomCenter: + format.Alignment = StringAlignment.Center; + format.LineAlignment = StringAlignment.Far; + break; + case ContentAlignment.BottomRight: + format.Alignment = StringAlignment.Far; + format.LineAlignment = StringAlignment.Far; + break; + } + + return format; + } + } + + public class FleetImageArgument { + + public int[] FleetIDs; + public int HorizontalFleetCount; + public int HorizontalShipCount; + + public bool ReflectDamageGraphic; + public bool AvoidTwitterDeterioration; + + public Font TitleFont; + public Font LargeFont; + public Font MediumFont; + public Font SmallFont; + public Font MediumDigitFont; + public Font SmallDigitFont; + + public string BackgroundImagePath; + + public string Title; + public string Comment; + } + +} diff --git a/ElectronicObserver/Window/FormFleet.Designer.cs b/ElectronicObserver/Window/FormFleet.Designer.cs index b41599dd1..26b4de2f8 100644 --- a/ElectronicObserver/Window/FormFleet.Designer.cs +++ b/ElectronicObserver/Window/FormFleet.Designer.cs @@ -30,10 +30,11 @@ private void InitializeComponent() { this.ContextMenuFleet_CopyFleet = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet_CopyFleetDeckBuilder = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet_CopyKanmusuList = new System.Windows.Forms.ToolStripMenuItem(); - this.ContextMenuFleet_Capture = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); this.ContextMenuFleet_AntiAirDetails = new System.Windows.Forms.ToolStripMenuItem(); + this.ContextMenuFleet_Capture = new System.Windows.Forms.ToolStripMenuItem(); + this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); + this.ContextMenuFleet_OutputFleetImage = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet.SuspendLayout(); this.SuspendLayout(); // @@ -83,9 +84,10 @@ private void InitializeComponent() { this.ContextMenuFleet_CopyKanmusuList, this.toolStripSeparator1, this.ContextMenuFleet_AntiAirDetails, - this.ContextMenuFleet_Capture}); + this.ContextMenuFleet_Capture, + this.ContextMenuFleet_OutputFleetImage}); this.ContextMenuFleet.Name = "ContextMenuFleet"; - this.ContextMenuFleet.Size = new System.Drawing.Size(228, 142); + this.ContextMenuFleet.Size = new System.Drawing.Size(228, 164); this.ContextMenuFleet.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuFleet_Opening); // // ContextMenuFleet_CopyFleet @@ -109,6 +111,18 @@ private void InitializeComponent() { this.ContextMenuFleet_CopyKanmusuList.Text = "艦隊晒しページへコピー(&R)"; this.ContextMenuFleet_CopyKanmusuList.Click += new System.EventHandler(this.ContextMenuFleet_CopyKanmusuList_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(224, 6); + // + // ContextMenuFleet_AntiAirDetails + // + this.ContextMenuFleet_AntiAirDetails.Name = "ContextMenuFleet_AntiAirDetails"; + this.ContextMenuFleet_AntiAirDetails.Size = new System.Drawing.Size(227, 22); + this.ContextMenuFleet_AntiAirDetails.Text = "対空砲火の詳細表示(&A)"; + this.ContextMenuFleet_AntiAirDetails.Click += new System.EventHandler(this.ContextMenuFleet_AntiAirDetails_Click); + // // ContextMenuFleet_Capture // this.ContextMenuFleet_Capture.Name = "ContextMenuFleet_Capture"; @@ -116,11 +130,6 @@ private void InitializeComponent() { this.ContextMenuFleet_Capture.Text = "この画面をキャプチャ(&S)"; this.ContextMenuFleet_Capture.Click += new System.EventHandler(this.ContextMenuFleet_Capture_Click); // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(224, 6); - // // ToolTipInfo // this.ToolTipInfo.AutoPopDelay = 30000; @@ -128,12 +137,12 @@ private void InitializeComponent() { this.ToolTipInfo.ReshowDelay = 100; this.ToolTipInfo.ShowAlways = true; // - // ContextMenuFleet_AntiAirDetails + // ContextMenuFleet_OutputFleetImage // - this.ContextMenuFleet_AntiAirDetails.Name = "ContextMenuFleet_AntiAirDetails"; - this.ContextMenuFleet_AntiAirDetails.Size = new System.Drawing.Size(227, 22); - this.ContextMenuFleet_AntiAirDetails.Text = "対空砲火の詳細表示(&A)"; - this.ContextMenuFleet_AntiAirDetails.Click += new System.EventHandler(this.ContextMenuFleet_AntiAirDetails_Click); + this.ContextMenuFleet_OutputFleetImage.Name = "ContextMenuFleet_OutputFleetImage"; + this.ContextMenuFleet_OutputFleetImage.Size = new System.Drawing.Size(227, 22); + this.ContextMenuFleet_OutputFleetImage.Text = "編成画像を出力(仮)"; + this.ContextMenuFleet_OutputFleetImage.Click += new System.EventHandler(this.ContextMenuFleet_OutputFleetImage_Click); // // FormFleet // @@ -170,5 +179,6 @@ private void InitializeComponent() { private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_CopyFleetDeckBuilder; private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_CopyKanmusuList; private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_AntiAirDetails; + private System.Windows.Forms.ToolStripMenuItem ContextMenuFleet_OutputFleetImage; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index e0b4e3c29..ab4b134b0 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -7,6 +7,7 @@ using ElectronicObserver.Window.Control; using ElectronicObserver.Window.Dialog; using ElectronicObserver.Window.Support; +using SwfExtractor; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -1100,6 +1101,376 @@ protected override string GetPersistString() { + private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e ) { + + bool reflectDamage = true; + + + + + var args = new Utility.FleetImageArgument(); + args.FleetIDs = new int[] { 1, 2 }; + args.HorizontalFleetCount = 2; + args.HorizontalShipCount = 2; + args.ReflectDamageGraphic = true; + args.AvoidTwitterDeterioration = true; + args.TitleFont = new Font( "Meiryo UI", 32, FontStyle.Bold, GraphicsUnit.Pixel ); + args.LargeFont = new Font( "Meiryo UI", 24, FontStyle.Regular, GraphicsUnit.Pixel ); + args.MediumFont = new Font( "Meiryo UI", 16, FontStyle.Regular, GraphicsUnit.Pixel ); + args.SmallFont = new Font( "Meiryo UI", 12, FontStyle.Regular, GraphicsUnit.Pixel ); + args.MediumDigitFont = new Font( "Meiryo UI", 16, FontStyle.Regular, GraphicsUnit.Pixel ); + args.SmallDigitFont = new Font( "Meiryo UI", 12, FontStyle.Regular, GraphicsUnit.Pixel ); + args.BackgroundImagePath = @""; + args.Title = "適当にタイトルを入力"; + args.Comment = "コメント部分です。\r\nここに適当な文字列を入力することができます。ねこです \r\nよろしくおねがいします"; + + using ( var image = Utility.FleetImageGenerator.GenerateTestBitmap( args ) ) { + string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; + image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); + System.Diagnostics.Process.Start( savePath ); + } + + args.TitleFont.Dispose(); + args.LargeFont.Dispose(); + args.MediumFont.Dispose(); + args.SmallFont.Dispose(); + args.MediumDigitFont.Dispose(); + args.SmallDigitFont.Dispose(); + return; + + + // layout testing + switch ( 3 ) { + case 1: // card + + using ( var image = new Bitmap( 900, 900 ) ) { + using ( var g = Graphics.FromImage( image ) ) { + + var font = Font; + var characterBrush = Brushes.Black; + int lineHeight = 16; + int shipWidth = 450; + + g.Clear( Color.White ); + + + var members = KCDatabase.Instance.Fleet[FleetID].MembersInstance; + + for ( int shipIndex = 0; shipIndex < members.Count; shipIndex++ ) { + + var ship = members[shipIndex]; + Point shipOffset = new Point( shipIndex % 2 * shipWidth, shipIndex / 2 * 300 ); + + + if ( ship == null ) + continue; + + + try { + string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + ship.MasterShip.ResourceName + ".swf"; + if ( System.IO.File.Exists( shipSwfPath ) ) { + + var shipSwf = new SwfParser(); + shipSwf.Parse( shipSwfPath ); + + var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == ( reflectDamage && ship.HPRate <= 0.5 ? 7 : 5 ) ); + using ( var shipImage = imgtag.ExtractImage() ) { + g.DrawImage( shipImage, new Rectangle( shipOffset.X + shipWidth - 218, shipOffset.Y, 218, 300 ) ); + } + } + } catch ( Exception ) { + } + + g.DrawString( ship.NameWithLevel, font, characterBrush, shipOffset.X + 0, shipOffset.Y + 0 ); + shipOffset.Y += lineHeight * 2; + + for ( int slotIndex = 0; slotIndex < ship.AllSlot.Count; slotIndex++ ) { + int icon; + string name; + var eq = ship.AllSlotInstance[slotIndex]; + int aircraft = slotIndex < ship.MasterShip.Aircraft.Count ? ship.MasterShip.Aircraft[slotIndex] : 0; + + Point slotOffset = new Point( shipOffset.X + 0, shipOffset.Y + slotIndex * lineHeight ); + + if ( eq == null ) { + if ( slotIndex < ship.SlotSize ) { + icon = (int)ResourceManager.EquipmentContent.Nothing; + name = "(なし)"; + } else { + icon = (int)ResourceManager.EquipmentContent.Locked; + name = ""; + } + } else { + if ( eq.MasterEquipment.IconType <= 0 || (int)ResourceManager.EquipmentContent.Locked <= eq.MasterEquipment.IconType ) { + icon = (int)ResourceManager.EquipmentContent.Unknown; + name = eq.NameWithLevel; + } else { + icon = eq.MasterEquipment.IconType; + name = eq.NameWithLevel; + } + } + + if ( aircraft > 0 && eq != null && Calculator.IsAircraft( eq.EquipmentID, true, true ) ) + g.DrawString( aircraft.ToString(), font, characterBrush, slotOffset.X, slotOffset.Y ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[icon], slotOffset.X + 16, slotOffset.Y, 16, 16 ); + g.DrawString( name, font, characterBrush, slotOffset.X + 32, slotOffset.Y ); + } + + shipOffset.Y += lineHeight * 7; + + { + Point paramOffset = new Point( shipOffset.X, shipOffset.Y ); + + var list = new[] { + new { image = ResourceManager.IconContent.ParameterHP, param = ship.HPMax.ToString() }, + new { image = ResourceManager.IconContent.ParameterFirepower, param = ship.FirepowerTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterArmor, param = ship.ArmorTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterTorpedo, param = ship.TorpedoTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterEvasion, param = ship.EvasionTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterAA, param = ship.AATotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterAircraft, param = ship.AircraftTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterASW, param = ship.ASWTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterSpeed, param = Constants.GetSpeed( ship.Speed ) }, + new { image = ResourceManager.IconContent.ParameterLOS, param = ship.LOSTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterRange, param = Constants.GetRange( ship.Range ) }, + new { image = ResourceManager.IconContent.ParameterLuck, param = ship.LuckTotal.ToString() }, + }; + + var icons = Resource.ResourceManager.Instance.Icons; + + for ( int i = 0; i < list.Length; i++ ) { + g.DrawImage( icons.Images[(int)list[i].image], paramOffset.X + i % 2 * 100, paramOffset.Y + i / 2 * lineHeight, 16, 16 ); + g.DrawString( list[i].param, font, characterBrush, paramOffset.X + i % 2 * 100 + 16, paramOffset.Y + i / 2 * lineHeight ); + } + } + } + + + image.SetPixel( 0, 0, Color.FromArgb( 252, image.GetPixel( 0, 0 ) ) ); + string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; + image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); + System.Diagnostics.Process.Start( savePath ); + } + } + + break; + + case 2: // cutin + using ( var image = new Bitmap( 665, 121 * 6 ) ) { + using ( var g = Graphics.FromImage( image ) ) { + + var font = Font; + var characterBrush = Brushes.Black; + int lineHeight = 16; + int shipWidth = 450; + Color backColor = Color.White; + + g.Clear( backColor ); + + + var members = KCDatabase.Instance.Fleet[FleetID].MembersInstance; + + for ( int shipIndex = 0; shipIndex < members.Count; shipIndex++ ) { + + var ship = members[shipIndex]; + Point shipOffset = new Point( 0, shipIndex * 121 ); + + + if ( ship == null ) + continue; + + + try { + string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + ship.MasterShip.ResourceName + ".swf"; + if ( System.IO.File.Exists( shipSwfPath ) ) { + + var shipSwf = new SwfParser(); + shipSwf.Parse( shipSwfPath ); + + var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == ( reflectDamage && ship.HPRate <= 0.5 ? 23 : 21 ) ); + using ( var shipImage = imgtag.ExtractImage() ) { + g.DrawImage( shipImage, new Rectangle( shipOffset.X, shipOffset.Y, 665, 121 ) ); + } + } + } catch ( Exception ) { + } + + + shipOffset.X += 332; + using ( var brush = new System.Drawing.Drawing2D.LinearGradientBrush( new Rectangle( shipOffset.X, shipOffset.Y, 111, 121 ), Color.Transparent, backColor, System.Drawing.Drawing2D.LinearGradientMode.Horizontal ) ) { + brush.GammaCorrection = true; + g.FillRectangle( brush, new Rectangle( shipOffset.X, shipOffset.Y, 111, 121 ) ); + } + g.FillRectangle( Brushes.White, new Rectangle( shipOffset.X + 111, shipOffset.Y, 333 - 111, 121 ) ); + + shipOffset.X += 100; + + g.DrawString( ship.NameWithLevel, font, characterBrush, shipOffset.X, shipOffset.Y ); + shipOffset.Y += lineHeight; + + + for ( int slotIndex = 0; slotIndex < ship.AllSlot.Count; slotIndex++ ) { + int icon; + string name; + var eq = ship.AllSlotInstance[slotIndex]; + int aircraft = slotIndex < ship.MasterShip.Aircraft.Count ? ship.MasterShip.Aircraft[slotIndex] : 0; + + Point slotOffset = new Point( shipOffset.X + 0, shipOffset.Y + slotIndex * lineHeight ); + + if ( eq == null ) { + if ( slotIndex < ship.SlotSize ) { + icon = (int)ResourceManager.EquipmentContent.Nothing; + name = "(なし)"; + } else { + icon = (int)ResourceManager.EquipmentContent.Locked; + name = ""; + } + } else { + if ( eq.MasterEquipment.IconType <= 0 || (int)ResourceManager.EquipmentContent.Locked <= eq.MasterEquipment.IconType ) { + icon = (int)ResourceManager.EquipmentContent.Unknown; + name = eq.NameWithLevel; + } else { + icon = eq.MasterEquipment.IconType; + name = eq.NameWithLevel; + } + } + + if ( aircraft > 0 && eq != null && Calculator.IsAircraft( eq.EquipmentID, true, true ) ) + g.DrawString( aircraft.ToString(), font, characterBrush, slotOffset.X, slotOffset.Y ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[icon], slotOffset.X + 16, slotOffset.Y, 16, 16 ); + g.DrawString( name, font, characterBrush, slotOffset.X + 32, slotOffset.Y ); + } + + } + + + image.SetPixel( 0, 0, Color.FromArgb( 252, image.GetPixel( 0, 0 ) ) ); + string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; + image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); + System.Diagnostics.Process.Start( savePath ); + } + } + break; + + case 3: // banner + using ( var image = new Bitmap( 800, 480 ) ) { + using ( var g = Graphics.FromImage( image ) ) { + + var font = Font; + var characterBrush = Brushes.Black; + int lineHeight = 16; + int shipWidth = 400; + int shipHeight = 160; + Color backColor = Color.White; + var icons = ResourceManager.Instance.Icons; + + g.Clear( backColor ); + + + var members = KCDatabase.Instance.Fleet[FleetID].MembersInstance; + + for ( int shipIndex = 0; shipIndex < members.Count; shipIndex++ ) { + + var ship = members[shipIndex]; + Point shipOffset = new Point( shipIndex % 2 * shipWidth, shipIndex / 2 * shipHeight ); + + + if ( ship == null ) + continue; + + + try { + string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + ship.MasterShip.ResourceName + ".swf"; + if ( System.IO.File.Exists( shipSwfPath ) ) { + + var shipSwf = new SwfParser(); + shipSwf.Parse( shipSwfPath ); + + var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == ( reflectDamage && ship.HPRate <= 0.5 ? 3 : 1 ) ); + using ( var shipImage = imgtag.ExtractImage() ) { + g.DrawImage( shipImage, new Rectangle( shipOffset.X + 400 - 160, shipOffset.Y, 160, 40 ) ); + } + } + } catch ( Exception ) { + } + + + g.DrawString( ship.Name, font, characterBrush, shipOffset.X, shipOffset.Y + lineHeight * 0 ); + g.DrawString( string.Format( "Lv. {0} / next. {1}", ship.Level, ship.ExpNext ), font, characterBrush, shipOffset.X, shipOffset.Y + lineHeight * 1 ); + + g.DrawImage( icons.Images[(int)ResourceManager.IconContent.ParameterHP], shipOffset.X, shipOffset.Y + lineHeight * 2, 16, 16 ); + g.DrawString( string.Format( "HP: {0} / {1}", ship.HPCurrent, ship.HPMax ), font, characterBrush, shipOffset.X + 16, shipOffset.Y + lineHeight * 2 ); + + { + Point paramOffset = new Point( shipOffset.X, shipOffset.Y + lineHeight * 4 ); + + var list = new[] { + new { image = ResourceManager.IconContent.ParameterFirepower, param = ship.FirepowerTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterTorpedo, param = ship.TorpedoTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterAA, param = ship.AATotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterArmor, param = ship.ArmorTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterSpeed, param = Constants.GetSpeed( ship.Speed ) }, + new { image = ResourceManager.IconContent.ParameterASW, param = ship.ASWTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterEvasion, param = ship.EvasionTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterLOS, param = ship.LOSTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterLuck, param = ship.LuckTotal.ToString() }, + new { image = ResourceManager.IconContent.ParameterRange, param = Constants.GetRange( ship.Range ) }, + }; + + for ( int i = 0; i < list.Length; i++ ) { + g.DrawImage( icons.Images[(int)list[i].image], paramOffset.X + i / 5 * 80, paramOffset.Y + i % 5 * lineHeight, 16, 16 ); + g.DrawString( list[i].param, font, characterBrush, paramOffset.X + i / 5 * 80 + 16, paramOffset.Y + i % 5 * lineHeight ); + } + } + + + for ( int slotIndex = 0; slotIndex < ship.AllSlot.Count; slotIndex++ ) { + int icon; + string name; + var eq = ship.AllSlotInstance[slotIndex]; + int aircraft = slotIndex < ship.MasterShip.Aircraft.Count ? ship.MasterShip.Aircraft[slotIndex] : 0; + + Point slotOffset = new Point( shipOffset.X + 160, shipOffset.Y + 48 + slotIndex * lineHeight ); + + if ( eq == null ) { + if ( slotIndex < ship.SlotSize ) { + icon = (int)ResourceManager.EquipmentContent.Nothing; + name = "(なし)"; + } else { + icon = (int)ResourceManager.EquipmentContent.Locked; + name = ""; + } + } else { + if ( eq.MasterEquipment.IconType <= 0 || (int)ResourceManager.EquipmentContent.Locked <= eq.MasterEquipment.IconType ) { + icon = (int)ResourceManager.EquipmentContent.Unknown; + name = eq.NameWithLevel; + } else { + icon = eq.MasterEquipment.IconType; + name = eq.NameWithLevel; + } + } + + if ( aircraft > 0 && eq != null && Calculator.IsAircraft( eq.EquipmentID, true, true ) ) + g.DrawString( aircraft.ToString(), font, characterBrush, slotOffset.X, slotOffset.Y ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[icon], slotOffset.X + 16, slotOffset.Y, 16, 16 ); + g.DrawString( name, font, characterBrush, slotOffset.X + 32, slotOffset.Y ); + } + + + } + + + image.SetPixel( 0, 0, Color.FromArgb( 252, image.GetPixel( 0, 0 ) ) ); + string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; + image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); + System.Diagnostics.Process.Start( savePath ); + } + } + break; + } + } + + } } From 97f4af8bb204d67fe7d6a430ddeedec533dece62 Mon Sep 17 00:00:00 2001 From: Andante Date: Tue, 11 Apr 2017 23:23:10 +0900 Subject: [PATCH 03/16] =?UTF-8?q?=E7=94=BB=E5=83=8F=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=EF=BC=9A=E3=82=AB=E3=83=83=E3=83=88=E3=82=A4=E3=83=B3=E3=83=95?= =?UTF-8?q?=E3=82=A9=E3=83=BC=E3=83=9E=E3=83=83=E3=83=88=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=82=AB=E3=83=83=E3=82=B3=E3=82=AB=E3=83=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Utility/FleetImageGenerator.cs | 408 +++++++++++++++++- ElectronicObserver/Window/FormFleet.cs | 6 +- 2 files changed, 402 insertions(+), 12 deletions(-) diff --git a/ElectronicObserver/Utility/FleetImageGenerator.cs b/ElectronicObserver/Utility/FleetImageGenerator.cs index c0f846b0f..7b3848258 100644 --- a/ElectronicObserver/Utility/FleetImageGenerator.cs +++ b/ElectronicObserver/Utility/FleetImageGenerator.cs @@ -10,6 +10,8 @@ using ElectronicObserver.Utility.Data; using ElectronicObserver.Resource; using System.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.Runtime.InteropServices; namespace ElectronicObserver.Utility { @@ -424,7 +426,7 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { fleetPointer.X += fleetParameterAreaMargin.Left; fleetPointer.Y += fleetParameterAreaMargin.Top; { // fighter power - var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, parameterAreaUnitSize ); + var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, fleetParameterAreaSize ); g.DrawImage( ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.CarrierBasedFighter], iconpos.X, iconpos.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); fleetPointer.X += EquipmentIconSize.Width; @@ -436,7 +438,7 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { fleetPointer.X += paramValueSize.Width + fleetParameterAreaInnerMargin.Width; } { // searching ability - var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, parameterAreaUnitSize ); + var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, fleetParameterAreaSize ); g.DrawImage( ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.CarrierBasedRecon], iconpos.X, iconpos.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); fleetPointer.X += EquipmentIconSize.Width; @@ -444,12 +446,12 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { fleetPointer.X += fleetAirSuperiorityTitleSize.Width; Size paramValueSize = MeasureString( g, fleet.GetSearchingAbilityString(), args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); - g.DrawString( fleet.GetSearchingAbilityString(), args.MediumDigitFont, mainTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, paramValueSize, parameterAreaUnitSize ), paramValueSize ), formatMiddleLeft ); + g.DrawString( fleet.GetSearchingAbilityString(), args.MediumDigitFont, mainTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, paramValueSize, fleetParameterAreaSize ), paramValueSize ), formatMiddleLeft ); fleetPointer.X += paramValueSize.Width + fleetParameterAreaInnerMargin.Width; } fleetPointer.X = fleetPointerOrigin.X; - fleetPointer.Y += parameterAreaUnitSize.Height; + fleetPointer.Y += fleetParameterAreaSize.Height; g.DrawLine( linePen, fleetPointer + new Size( lineMargin, 0 ), fleetPointer + new Size( shipPaneSize.Width - lineMargin, 0 ) ); fleetPointer.Y += fleetParameterAreaMargin.Bottom; @@ -613,6 +615,381 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { + + public static Bitmap GenerateCutinBitmap( FleetImageArgument args ) { + + var formatMiddleLeft = GetStringFormat( ContentAlignment.MiddleLeft ); + var formatMiddleCenter = GetStringFormat( ContentAlignment.MiddleCenter ); + var formatMiddleRight = GetStringFormat( ContentAlignment.MiddleRight ); + + Color backgroundColor = Color.FromArgb( 0xff, 0xff, 0xff ); + Color mainTextColor = Color.FromArgb( 0x0f, 0x0f, 0x0f ); + Color subTextColor = Color.FromArgb( 0x00, 0x88, 0x88 ); + Color shadowColor = Color.FromArgb( 0x88, 0x88, 0x88 ); + Color disabledColor = Color.FromArgb( 0xaa, 0xaa, 0xaa ); + Color aircraftLevelLowColor = Color.FromArgb( 0x00, 0xff, 0xff ); + Color aircraftLevelHighColor = Color.FromArgb( 0xff, 0x88, 0x00 ); + + var mainTextBrush = new SolidBrush( mainTextColor ); + var subTextBrush = new SolidBrush( subTextColor ); + var shadowBrush = new SolidBrush( shadowColor ); + var disabledBrush = new SolidBrush( disabledColor ); + var aircraftLevelLowBrush = new SolidBrush( aircraftLevelLowColor ); + var aircraftLevelHighBrush = new SolidBrush( aircraftLevelHighColor ); + + var linePen = new Pen( subTextColor ); + + + string fleetAirSuperiorityTitle = "制空戦力"; + string fleetSearchingAbilityTitle = "索敵能力"; + + // for measure space of strings + Bitmap preimage = new Bitmap( 1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); + Graphics preg = Graphics.FromImage( preimage ); + + // Size Calculation + Size titleSize = string.IsNullOrWhiteSpace( args.Title ) ? Size.Empty : MeasureString( preg, args.Title, args.TitleFont, MaxValueSize, formatMiddleCenter ); + Size commentSize = string.IsNullOrWhiteSpace( args.Comment ) ? Size.Empty : MeasureString( preg, args.Comment, args.MediumFont, MaxValueSize, formatMiddleLeft ); + + Size fleetNameSize = MeasureString( preg, "大正義日独伊三国褐色同盟", args.LargeFont, MaxValueSize, formatMiddleLeft ); // kanji 12 char + Size fleetAirSuperiorityTitleSize = MeasureString( preg, fleetAirSuperiorityTitle, args.SmallFont, MaxValueSize, formatMiddleLeft ); + Size fleetAirSuperiorityValueEstimatedSize = MeasureString( preg, "8888", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + Size fleetSearchingAbilityTitleSize = MeasureString( preg, fleetSearchingAbilityTitle, args.SmallFont, MaxValueSize, formatMiddleLeft ); + Size fleetSearchingAbilityValueEstimatedSize = MeasureString( preg, "-888.88", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + + Size shipIndexSize = MeasureString( preg, "#4:", args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + Size equipmentNameSize = MeasureString( preg, "61cm五連装(酸素)魚雷", args.MediumFont, MaxValueSize, formatMiddleLeft ); // kanji 9 char + Size mediumDigit3Size = MeasureString( preg, "888", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + Size smallDigit3Size = MeasureString( preg, "888", args.SmallDigitFont, MaxValueSize, formatMiddleRight ); + Size levelSize = MeasureString( preg, "Lv.", args.SmallDigitFont, MaxValueSize, formatMiddleLeft ); + Size equipmentLevelSize = MeasureString( preg, "+10", args.SmallDigitFont, MaxValueSize, formatMiddleRight ); + Rectangle shipNameImageAvailableArea = new Rectangle( 100, 0, ShipNameSize.Width - 124, ShipNameSize.Height - 16 ); + + Size fleetParameterAreaInnerMargin = new Size( 16, 0 ); + Padding shipNameAreaMargin = new Padding( 0, 0, 0, 2 ); + Padding equipmentAreaMargin = new Padding( 0, 0, 0, 2 ); + Padding shipPaneUnitMargin = new Padding( 2 ); + Padding shipPaneMargin = new Padding(); + Padding fleetParameterAreaMargin = new Padding( 8, 0, 0, 4 ); + Padding fleetPaneUnitMargin = new Padding( 4 ); + Padding fleetPaneMargin = new Padding(); + Padding titleMargin = new Padding( 0, 0, 0, 2 ); + Padding commentMargin = new Padding( 2 ); + Padding commentPadding = new Padding( 2 ); + Padding entireMargin = new Padding(); + int lineMargin = 4; + + Size shipNameSize = shipNameImageAvailableArea.Size; + Size shipNameAreaSize = SumWidthMaxHeight( shipIndexSize, shipNameSize, levelSize, mediumDigit3Size ); + Size equipmentAreaUnitSize = SumWidthMaxHeight( smallDigit3Size, EquipmentIconSize, equipmentNameSize, equipmentLevelSize ); + Size equipmentAreaSize = new Size( equipmentAreaUnitSize.Width, equipmentAreaUnitSize.Height * 6 ); + + Size shipPaneUnitSize = new Size( Max( shipNameAreaSize.Width + equipmentAreaSize.Width, ShipCutinSize.Width ), + Max( shipNameAreaSize.Height + ShipCutinSize.Height, equipmentAreaSize.Height ) ); // SumWidthMaxHeight( MaxWidthSumHeight( shipNameAreaSize, ShipCutinSize ), equipmentAreaSize + equipmentAreaMargin.Size ); + Size shipPaneSize = new Size( + ( shipPaneUnitSize.Width + shipPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalShipCount, 6 ), + ( shipPaneUnitSize.Height + shipPaneUnitMargin.Vertical ) * (int)Math.Ceiling( 6.0 / args.HorizontalShipCount ) ); + + Size fleetParameterAreaSize = SumWidthMaxHeight( + EquipmentIconSize, fleetAirSuperiorityTitleSize, fleetAirSuperiorityValueEstimatedSize, fleetParameterAreaInnerMargin, + EquipmentIconSize, fleetSearchingAbilityTitleSize, fleetSearchingAbilityValueEstimatedSize ); + + Size fleetPaneUnitSize; + bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width + shipPaneMargin.Horizontal; + if ( isFleetNameAndParametersAreSameLine ) { + fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize + shipPaneMargin.Size ); + } else { + fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize + shipPaneMargin.Size ); + } + + Size fleetPaneSize = new Size( ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalFleetCount, args.FleetIDs.Length ), + ( fleetPaneUnitSize.Height + fleetPaneUnitMargin.Vertical ) * (int)Math.Ceiling( (double)args.FleetIDs.Length / args.HorizontalFleetCount ) ); + + Size commentAreaSize = commentSize + commentPadding.Size; + + Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize + fleetPaneMargin.Size, commentAreaSize + commentMargin.Size ); + + + Size equipmentNameSizeExtended = SumWidthMaxHeight( equipmentNameSize, equipmentLevelSize ); + + var equipmentNameBrush = new LinearGradientBrush( new Rectangle( 0, 0, equipmentNameSize.Width * 2 + equipmentLevelSize.Width, equipmentAreaUnitSize.Height ), Color.Black, Color.Black, LinearGradientMode.Horizontal ); // color is ignored + { + var blend = new ColorBlend(); + blend.Positions = new[] { 0f, (float)( equipmentNameSizeExtended.Width - EquipmentIconSize.Width ) / equipmentNameBrush.Rectangle.Width, (float)( equipmentNameSizeExtended.Width ) / equipmentNameBrush.Rectangle.Width, 1f }; + blend.Colors = new[] { mainTextColor, mainTextColor, Color.FromArgb( 0, mainTextColor ), Color.FromArgb( 0, mainTextColor ) }; + equipmentNameBrush.InterpolationColors = blend; + } + equipmentNameBrush.GammaCorrection = true; + + var shipImageMaskBrush = new LinearGradientBrush( new Rectangle( 0, 0, ShipCutinSize.Width, ShipCutinSize.Height ), Color.Black, Color.Black, LinearGradientMode.Horizontal ); + { + var blend = new ColorBlend(); + blend.Positions = new[] { 0f, Math.Min( (float)( shipPaneUnitSize.Width - equipmentAreaSize.Width - 16 ) / ShipCutinSize.Width, 1f ), Math.Min( (float)( shipPaneUnitSize.Width - equipmentAreaSize.Width + 16 ) / ShipCutinSize.Width, 1f ), 1f }; + blend.Colors = new[] { Color.White, Color.White, Color.FromArgb( 0xff, 0x11, 0x11, 0x11 ), Color.FromArgb( 0xff, 0x11, 0x11, 0x11 ) }; + shipImageMaskBrush.InterpolationColors = blend; + } + + + preg.Dispose(); + preimage.Dispose(); + + + var bitmap = new Bitmap( entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); + using ( var g = Graphics.FromImage( bitmap ) ) { + + g.Clear( backgroundColor ); + if ( !string.IsNullOrEmpty( args.BackgroundImagePath ) && System.IO.File.Exists( args.BackgroundImagePath ) ) { + try { + using ( var backgroundImage = new Bitmap( args.BackgroundImagePath ) ) { + using ( var backgroundBrush = new TextureBrush( backgroundImage, WrapMode.Tile ) ) { + g.FillRectangle( backgroundBrush, new Rectangle( 0, 0, bitmap.Width, bitmap.Height ) ); + } + } + + } catch ( Exception ) { + } + } + + + Point masterPointer = new Point( entireMargin.Left, entireMargin.Top ); + + // title + if ( !titleSize.IsEmpty ) { + g.DrawString( args.Title, args.TitleFont, shadowBrush, new Rectangle( masterPointer + GetAlignmentOffset( ContentAlignment.TopCenter, titleSize, entireSize ) + new Size( 2, 2 ), titleSize ), formatMiddleCenter ); + g.DrawString( args.Title, args.TitleFont, mainTextBrush, new Rectangle( masterPointer + GetAlignmentOffset( ContentAlignment.TopCenter, titleSize, entireSize ), titleSize ), formatMiddleCenter ); + } + masterPointer.Y += titleSize.Height; + + + for ( int fleetIndex = 0; fleetIndex < args.FleetIDs.Length; fleetIndex++ ) { + int fleetID = args.FleetIDs[fleetIndex]; + FleetData fleet = KCDatabase.Instance.Fleet[fleetID]; + Point fleetPointerOrigin = masterPointer + new Size( + ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * ( fleetIndex % args.HorizontalFleetCount ) + fleetPaneUnitMargin.Left, + ( fleetPaneUnitSize.Height + fleetPaneUnitMargin.Vertical ) * ( fleetIndex / args.HorizontalFleetCount ) + fleetPaneUnitMargin.Top ); + Point fleetPointer = fleetPointerOrigin; + + if ( fleet == null ) + continue; + + // fleet name + g.DrawString( fleet.Name, args.LargeFont, mainTextBrush, new Rectangle( fleetPointer, fleetNameSize ), formatMiddleLeft ); + if ( isFleetNameAndParametersAreSameLine ) { + fleetPointer.X += fleetNameSize.Width; + fleetPointer.Y += fleetNameSize.Height - fleetParameterAreaSize.Height; + } else { + fleetPointer.Y += fleetNameSize.Height; + } + + // fleet specs + fleetPointer.X += fleetParameterAreaMargin.Left; + fleetPointer.Y += fleetParameterAreaMargin.Top; + { // fighter power + var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, fleetParameterAreaSize ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.CarrierBasedFighter], iconpos.X, iconpos.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); + fleetPointer.X += EquipmentIconSize.Width; + + g.DrawString( fleetAirSuperiorityTitle, args.SmallFont, subTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, fleetAirSuperiorityTitleSize, fleetParameterAreaSize ), fleetAirSuperiorityTitleSize ), formatMiddleLeft ); + fleetPointer.X += fleetAirSuperiorityTitleSize.Width; + + Size paramValueSize = MeasureString( g, fleet.GetAirSuperiority().ToString(), args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + g.DrawString( fleet.GetAirSuperiority().ToString(), args.MediumDigitFont, mainTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, paramValueSize, fleetParameterAreaSize ), paramValueSize ), formatMiddleLeft ); + fleetPointer.X += paramValueSize.Width + fleetParameterAreaInnerMargin.Width; + } + { // searching ability + var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, fleetParameterAreaSize ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.CarrierBasedRecon], iconpos.X, iconpos.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); + fleetPointer.X += EquipmentIconSize.Width; + + g.DrawString( fleetSearchingAbilityTitle, args.SmallFont, subTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, fleetSearchingAbilityTitleSize, fleetParameterAreaSize ), fleetSearchingAbilityTitleSize ), formatMiddleLeft ); + fleetPointer.X += fleetAirSuperiorityTitleSize.Width; + + Size paramValueSize = MeasureString( g, fleet.GetSearchingAbilityString(), args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + g.DrawString( fleet.GetSearchingAbilityString(), args.MediumDigitFont, mainTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, paramValueSize, fleetParameterAreaSize ), paramValueSize ), formatMiddleLeft ); + fleetPointer.X += paramValueSize.Width + fleetParameterAreaInnerMargin.Width; + } + + fleetPointer.X = fleetPointerOrigin.X; + fleetPointer.Y += fleetParameterAreaSize.Height; + + g.DrawLine( linePen, fleetPointer + new Size( lineMargin, 0 ), fleetPointer + new Size( shipPaneSize.Width - lineMargin, 0 ) ); + fleetPointer.Y += fleetParameterAreaMargin.Bottom; + + + for ( int shipIndex = 0; shipIndex < 6; shipIndex++ ) { + ShipData ship = fleet.MembersInstance[shipIndex]; + Point shipPointerOrigin = fleetPointer + new Size( + ( shipPaneUnitSize.Width + shipPaneUnitMargin.Horizontal ) * ( shipIndex % args.HorizontalShipCount ) + shipPaneUnitMargin.Left, + ( shipPaneUnitSize.Height + shipPaneUnitMargin.Vertical ) * ( shipIndex / args.HorizontalShipCount ) + shipPaneUnitMargin.Top ); + Point shipPointer = shipPointerOrigin; + + //g.DrawRectangle( Pens.Teal, new Rectangle( shipPointer, shipPaneUnitSize ) ); + + if ( ship == null ) + continue; + + g.DrawString( string.Format( "#{0}:", shipIndex + 1 ), args.MediumDigitFont, subTextBrush, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, shipIndexSize, shipNameAreaSize ), shipIndexSize ), formatMiddleLeft ); + shipPointer.X += shipIndexSize.Width; + + using ( var shipNameImage = GetShipSwfImage( ship.MasterShip.ResourceName, ShipNameID ) ) { + if ( shipNameImage != null ) { + g.DrawImage( shipNameImage, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, shipNameSize, shipNameAreaSize ), shipNameSize ), + shipNameImageAvailableArea, GraphicsUnit.Pixel ); + } + } + shipPointer.X += shipNameSize.Width; + + g.DrawString( "Lv.", args.SmallDigitFont, subTextBrush, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.BottomLeft, levelSize, shipNameAreaSize ), levelSize ), formatMiddleLeft ); + shipPointer.X += levelSize.Width; + + g.DrawString( ship.Level.ToString(), args.MediumDigitFont, mainTextBrush, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.BottomLeft, mediumDigit3Size, shipNameAreaSize ), mediumDigit3Size ), formatMiddleRight ); + + shipPointer.X = shipPointerOrigin.X; + + + using ( var shipImageOriginal = GetShipSwfImage( ship.MasterShip.ResourceName, args.ReflectDamageGraphic && ship.HPRate <= 0.5 ? ShipCutinDamagedID : ShipCutinNormalID ) ) { + using ( var shipImage = shipImageOriginal.Clone( new Rectangle( 0, 0, shipImageOriginal.Width, shipImageOriginal.Height ), PixelFormat.Format32bppArgb ) ) { + using ( var maskImage = new Bitmap( ShipCutinSize.Width, ShipCutinSize.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb ) ) { // move to top + using ( var maskg = Graphics.FromImage( maskImage ) ) { + maskg.Clear( Color.Black ); + maskg.FillRectangle( shipImageMaskBrush, new Rectangle( 0, 0, maskImage.Width, maskImage.Height ) ); + } + + BitmapData imageData = shipImage.LockBits( new Rectangle( 0, 0, shipImage.Width, shipImage.Height ), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb ); + byte[] imageCanvas = new byte[imageData.Width * imageData.Height * 4]; + Marshal.Copy( imageData.Scan0, imageCanvas, 0, imageCanvas.Length ); + + BitmapData maskData = maskImage.LockBits( new Rectangle( 0, 0, maskImage.Width, maskImage.Height ), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb ); + byte[] maskCanvas = new byte[maskData.Width * maskData.Height * 4]; + Marshal.Copy( maskData.Scan0, maskCanvas, 0, maskCanvas.Length ); + + + for ( int y = 0; y < imageData.Height; y++ ) { + for ( int x = 0; x < imageData.Width; x++ ) { + imageCanvas[( y * imageData.Width + x ) * 4 + 3] = (byte)( (int)imageCanvas[( y * imageData.Width + x ) * 4 + 3] * maskCanvas[( y * maskData.Width + x ) * 4 + 0] / 255 ); + } + } + + Marshal.Copy( imageCanvas, 0, imageData.Scan0, imageCanvas.Length ); + shipImage.UnlockBits( imageData ); + maskImage.UnlockBits( maskData ); + + } + + var shipOffset = GetAlignmentOffset( ContentAlignment.BottomLeft, ShipCutinSize, shipPaneUnitSize ); + g.DrawImage( shipImage, shipPointer.X + shipOffset.Width, shipPointer.Y + shipOffset.Height, ShipCutinSize.Width, ShipCutinSize.Height ); + + } + } + + + + // equipments + Point equipmentPointerOrigin = shipPointer + GetAlignmentOffset( ContentAlignment.BottomRight, equipmentAreaSize, shipPaneUnitSize ); + for ( int equipmentIndex = 0; equipmentIndex < 6; equipmentIndex++ ) { + EquipmentData eq = ship.AllSlotInstance[equipmentIndex]; + Point equipmentPointer = equipmentPointerOrigin + new Size( 0, equipmentAreaUnitSize.Height * equipmentIndex ); + + + int aircraftMax = equipmentIndex < 5 ? ship.MasterShip.Aircraft[equipmentIndex] : 0; + + if ( aircraftMax > 0 ) { + Brush aircraftBrush; + if ( eq != null && Calculator.IsAircraft( eq.EquipmentID, true, true ) ) { + aircraftBrush = mainTextBrush; + } else { + aircraftBrush = disabledBrush; + } + + g.DrawString( aircraftMax.ToString(), args.SmallDigitFont, aircraftBrush, new Rectangle( equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, smallDigit3Size, equipmentAreaUnitSize ), smallDigit3Size ), formatMiddleRight ); + } + equipmentPointer.X += smallDigit3Size.Width; + + bool isOutOfSlot = equipmentIndex >= ship.SlotSize && !( equipmentIndex == 5 && ship.IsExpansionSlotAvailable ); + + Size equipmentIconOffset = GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, equipmentAreaUnitSize ); + g.DrawImage( GetEquipmentIcon( eq != null ? eq.EquipmentID : -1, isOutOfSlot ), + equipmentPointer.X + equipmentIconOffset.Width, equipmentPointer.Y + equipmentIconOffset.Height, EquipmentIconSize.Width, EquipmentIconSize.Height ); + equipmentPointer.X += EquipmentIconSize.Width; + + string equipmentName; + if ( eq != null ) { + equipmentName = eq.Name; + } else if ( isOutOfSlot ) { + equipmentName = ""; + } else { + equipmentName = "(なし)"; + } + equipmentNameBrush.ResetTransform(); + if ( eq != null && eq.Level > 0 ) { + equipmentNameBrush.TranslateTransform( equipmentPointer.X - EquipmentIconSize.Width, 0 ); + } else { + equipmentNameBrush.TranslateTransform( equipmentPointer.X, 0 ); + } + g.DrawString( equipmentName, args.MediumFont, equipmentNameBrush, new Rectangle( equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, equipmentNameSizeExtended, equipmentAreaUnitSize ), equipmentNameSizeExtended ), formatMiddleLeft ); + equipmentPointer.X += equipmentNameSize.Width; + + if ( eq != null ) { + + if ( eq.Level > 0 ) { + g.DrawString( "+" + eq.Level, args.SmallDigitFont, subTextBrush, new Rectangle( equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, equipmentLevelSize, equipmentAreaUnitSize ), equipmentLevelSize ), formatMiddleRight ); + } + + } + + } + + } + + } + + + masterPointer.Y += fleetPaneSize.Height; + g.DrawLine( linePen, masterPointer + new Size( lineMargin, 0 ), masterPointer + new Size( fleetPaneSize.Width - commentMargin.Horizontal - lineMargin, 0 ) ); + + + if ( !commentSize.IsEmpty ) { + var commentPointer = masterPointer + new Size( commentMargin.Left, commentMargin.Top ); + commentPointer += new Size( commentPadding.Left, commentPadding.Top ); + g.DrawString( args.Comment, args.MediumFont, mainTextBrush, new Rectangle( commentPointer, commentSize ), formatMiddleLeft ); + } + } + + if ( args.AvoidTwitterDeterioration ) { + // 不透明ピクセルのみだと jpeg 化されてしまうため、1px だけわずかに透明にする + Color temp = bitmap.GetPixel( bitmap.Width - 1, bitmap.Height - 1 ); + bitmap.SetPixel( bitmap.Width - 1, bitmap.Height - 1, Color.FromArgb( 252, temp.R, temp.G, temp.B ) ); + } + + + mainTextBrush.Dispose(); + shadowBrush.Dispose(); + disabledBrush.Dispose(); + subTextBrush.Dispose(); + aircraftLevelLowBrush.Dispose(); + aircraftLevelHighBrush.Dispose(); + + equipmentNameBrush.Dispose(); + shipImageMaskBrush.Dispose(); + + linePen.Dispose(); + + return bitmap; + } + + + + + + + + + + + + + + // management protected static Size MeasureString( Graphics g, string text, Font font, Size areaSize, StringFormat format ) { @@ -702,6 +1079,21 @@ public ShipParameterData( ResourceManager.IconContent iconIndex, string name, Fu protected static bool DrawShipSwfImage( Graphics g, string resourceID, int characterID, int x, int y, Size size ) { + try { + using ( var shipImage = GetShipSwfImage( resourceID, characterID ) ) { + if ( shipImage == null ) + return false; + + g.DrawImage( shipImage, new Rectangle( x, y, size.Width, size.Height ) ); + } + + return true; + } catch ( Exception ) { + return false; + } + } + + protected static Bitmap GetShipSwfImage( string resourceID, int characterID ) { try { string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + resourceID + ".swf"; if ( System.IO.File.Exists( shipSwfPath ) ) { @@ -710,14 +1102,12 @@ protected static bool DrawShipSwfImage( Graphics g, string resourceID, int chara shipSwf.Parse( shipSwfPath ); var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == characterID ); - using ( var shipImage = imgtag.ExtractImage() ) { - g.DrawImage( shipImage, new Rectangle( x, y, size.Width, size.Height ) ); - } + return imgtag.ExtractImage(); } - return true; + return null; } catch ( Exception ) { - return false; + return null; } } diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index ab4b134b0..0934af5e5 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -1111,7 +1111,7 @@ private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e var args = new Utility.FleetImageArgument(); args.FleetIDs = new int[] { 1, 2 }; args.HorizontalFleetCount = 2; - args.HorizontalShipCount = 2; + args.HorizontalShipCount = 1; args.ReflectDamageGraphic = true; args.AvoidTwitterDeterioration = true; args.TitleFont = new Font( "Meiryo UI", 32, FontStyle.Bold, GraphicsUnit.Pixel ); @@ -1124,7 +1124,7 @@ private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e args.Title = "適当にタイトルを入力"; args.Comment = "コメント部分です。\r\nここに適当な文字列を入力することができます。ねこです \r\nよろしくおねがいします"; - using ( var image = Utility.FleetImageGenerator.GenerateTestBitmap( args ) ) { + using ( var image = Utility.FleetImageGenerator.GenerateCutinBitmap( args ) ) { string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); System.Diagnostics.Process.Start( savePath ); @@ -1140,7 +1140,7 @@ private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e // layout testing - switch ( 3 ) { + switch ( 2 ) { case 1: // card using ( var image = new Bitmap( 900, 900 ) ) { From 2ee5acbf09c6bb0d54a74b0b621553c4d55a2a4f Mon Sep 17 00:00:00 2001 From: Andante Date: Thu, 13 Apr 2017 19:41:53 +0900 Subject: [PATCH 04/16] =?UTF-8?q?=E7=B7=A8=E6=88=90=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E5=87=BA=E5=8A=9B=EF=BC=9A=E3=83=90=E3=83=8A=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=82=A4=E3=83=97=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Utility/FleetImageGenerator.cs | 292 +++++++++++++++++- ElectronicObserver/Window/FormFleet.cs | 6 +- 2 files changed, 294 insertions(+), 4 deletions(-) diff --git a/ElectronicObserver/Utility/FleetImageGenerator.cs b/ElectronicObserver/Utility/FleetImageGenerator.cs index 7b3848258..46e0d4b06 100644 --- a/ElectronicObserver/Utility/FleetImageGenerator.cs +++ b/ElectronicObserver/Utility/FleetImageGenerator.cs @@ -940,7 +940,7 @@ public static Bitmap GenerateCutinBitmap( FleetImageArgument args ) { } } - + } @@ -981,7 +981,297 @@ public static Bitmap GenerateCutinBitmap( FleetImageArgument args ) { + public static Bitmap GenerateBannerBitmap( FleetImageArgument args ) { + + var formatMiddleLeft = GetStringFormat( ContentAlignment.MiddleLeft ); + var formatMiddleCenter = GetStringFormat( ContentAlignment.MiddleCenter ); + var formatMiddleRight = GetStringFormat( ContentAlignment.MiddleRight ); + + Color backgroundColor = Color.FromArgb( 0xff, 0xff, 0xff ); + Color mainTextColor = Color.FromArgb( 0x0f, 0x0f, 0x0f ); + Color subTextColor = Color.FromArgb( 0x00, 0x88, 0x88 ); + Color shadowColor = Color.FromArgb( 0x88, 0x88, 0x88 ); + Color disabledColor = Color.FromArgb( 0xaa, 0xaa, 0xaa ); + Color aircraftLevelLowColor = Color.FromArgb( 0x00, 0xff, 0xff ); + Color aircraftLevelHighColor = Color.FromArgb( 0xff, 0x88, 0x00 ); + + var mainTextBrush = new SolidBrush( mainTextColor ); + var subTextBrush = new SolidBrush( subTextColor ); + var shadowBrush = new SolidBrush( shadowColor ); + var disabledBrush = new SolidBrush( disabledColor ); + var aircraftLevelLowBrush = new SolidBrush( aircraftLevelLowColor ); + var aircraftLevelHighBrush = new SolidBrush( aircraftLevelHighColor ); + + var linePen = new Pen( subTextColor ); + + + string fleetAirSuperiorityTitle = "制空戦力"; + string fleetSearchingAbilityTitle = "索敵能力"; + + // for measure space of strings + Bitmap preimage = new Bitmap( 1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); + Graphics preg = Graphics.FromImage( preimage ); + + // Size Calculation + Size titleSize = string.IsNullOrWhiteSpace( args.Title ) ? Size.Empty : MeasureString( preg, args.Title, args.TitleFont, MaxValueSize, formatMiddleCenter ); + Size commentSize = string.IsNullOrWhiteSpace( args.Comment ) ? Size.Empty : MeasureString( preg, args.Comment, args.MediumFont, MaxValueSize, formatMiddleLeft ); + + Size fleetNameSize = MeasureString( preg, "大正義日独伊三国褐色同盟", args.LargeFont, MaxValueSize, formatMiddleLeft ); // kanji 12 char + Size fleetAirSuperiorityTitleSize = MeasureString( preg, fleetAirSuperiorityTitle, args.SmallFont, MaxValueSize, formatMiddleLeft ); + Size fleetAirSuperiorityValueEstimatedSize = MeasureString( preg, "8888", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + Size fleetSearchingAbilityTitleSize = MeasureString( preg, fleetSearchingAbilityTitle, args.SmallFont, MaxValueSize, formatMiddleLeft ); + Size fleetSearchingAbilityValueEstimatedSize = MeasureString( preg, "-888.88", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + + Size shipIndexSize = MeasureString( preg, "#4:", args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + Size equipmentNameSize = MeasureString( preg, "61cm五連装(酸素)魚雷", args.SmallFont, MaxValueSize, formatMiddleLeft ); // kanji 9 char + Size mediumDigit3Size = MeasureString( preg, "888", args.MediumDigitFont, MaxValueSize, formatMiddleRight ); + Size smallDigit3Size = MeasureString( preg, "888", args.SmallDigitFont, MaxValueSize, formatMiddleRight ); + Size levelSize = MeasureString( preg, "Lv.", args.SmallDigitFont, MaxValueSize, formatMiddleLeft ); + Size equipmentLevelSize = MeasureString( preg, "+10", args.SmallDigitFont, MaxValueSize, formatMiddleRight ); + + Size fleetParameterAreaInnerMargin = new Size( 16, 0 ); + Padding shipNameAreaMargin = new Padding( 0, 0, 0, 2 ); + Padding equipmentAreaMargin = new Padding( 0, 0, 0, 2 ); + Padding shipPaneUnitMargin = new Padding( 2 ); + Padding shipPaneMargin = new Padding(); + Padding fleetParameterAreaMargin = new Padding( 8, 0, 0, 4 ); + Padding fleetPaneUnitMargin = new Padding( 4 ); + Padding fleetPaneMargin = new Padding(); + Padding titleMargin = new Padding( 0, 0, 0, 2 ); + Padding commentMargin = new Padding( 2 ); + Padding commentPadding = new Padding( 2 ); + Padding entireMargin = new Padding(); + int lineMargin = 4; + + Size shipBannerSize = ShipBannerSize; + Size shipNameAreaSize = SumWidthMaxHeight( ShipBannerSize, smallDigit3Size ); + Size equipmentAreaUnitSize = SumWidthMaxHeight( EquipmentIconSize, equipmentNameSize, equipmentLevelSize ); + Size equipmentAreaSize = new Size( equipmentAreaUnitSize.Width, equipmentAreaUnitSize.Height * 6 ); + + Size shipPaneUnitSize = MaxWidthSumHeight( shipNameAreaSize, equipmentAreaSize ); + Size shipPaneSize = new Size( + ( shipPaneUnitSize.Width + shipPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalShipCount, 6 ), + ( shipPaneUnitSize.Height + shipPaneUnitMargin.Vertical ) * (int)Math.Ceiling( 6.0 / args.HorizontalShipCount ) ); + + Size fleetParameterAreaSize = SumWidthMaxHeight( + EquipmentIconSize, fleetAirSuperiorityTitleSize, fleetAirSuperiorityValueEstimatedSize, fleetParameterAreaInnerMargin, + EquipmentIconSize, fleetSearchingAbilityTitleSize, fleetSearchingAbilityValueEstimatedSize ); + Size fleetPaneUnitSize; + bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width + shipPaneMargin.Horizontal; + if ( isFleetNameAndParametersAreSameLine ) { + fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize + shipPaneMargin.Size ); + } else { + fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize + shipPaneMargin.Size ); + } + + Size fleetPaneSize = new Size( ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalFleetCount, args.FleetIDs.Length ), + ( fleetPaneUnitSize.Height + fleetPaneUnitMargin.Vertical ) * (int)Math.Ceiling( (double)args.FleetIDs.Length / args.HorizontalFleetCount ) ); + + Size commentAreaSize = commentSize + commentPadding.Size; + + Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize + fleetPaneMargin.Size, commentAreaSize + commentMargin.Size ); + + + Size equipmentNameSizeExtended = SumWidthMaxHeight( equipmentNameSize, equipmentLevelSize ); + + var equipmentNameBrush = new LinearGradientBrush( new Rectangle( 0, 0, equipmentNameSize.Width * 2 + equipmentLevelSize.Width, equipmentAreaUnitSize.Height ), Color.Black, Color.Black, LinearGradientMode.Horizontal ); // color is ignored + { + var blend = new ColorBlend(); + blend.Positions = new[] { 0f, (float)( equipmentNameSizeExtended.Width - EquipmentIconSize.Width ) / equipmentNameBrush.Rectangle.Width, (float)( equipmentNameSizeExtended.Width ) / equipmentNameBrush.Rectangle.Width, 1f }; + blend.Colors = new[] { mainTextColor, mainTextColor, Color.FromArgb( 0, mainTextColor ), Color.FromArgb( 0, mainTextColor ) }; + equipmentNameBrush.InterpolationColors = blend; + } + equipmentNameBrush.GammaCorrection = true; + + + preg.Dispose(); + preimage.Dispose(); + + + var bitmap = new Bitmap( entireSize.Width + entireMargin.Horizontal, entireSize.Height + entireMargin.Vertical, System.Drawing.Imaging.PixelFormat.Format32bppArgb ); + using ( var g = Graphics.FromImage( bitmap ) ) { + + g.Clear( backgroundColor ); + if ( !string.IsNullOrEmpty( args.BackgroundImagePath ) && System.IO.File.Exists( args.BackgroundImagePath ) ) { + try { + using ( var backgroundImage = new Bitmap( args.BackgroundImagePath ) ) { + using ( var backgroundBrush = new TextureBrush( backgroundImage, WrapMode.Tile ) ) { + g.FillRectangle( backgroundBrush, new Rectangle( 0, 0, bitmap.Width, bitmap.Height ) ); + } + } + + } catch ( Exception ) { + } + } + + + Point masterPointer = new Point( entireMargin.Left, entireMargin.Top ); + + // title + if ( !titleSize.IsEmpty ) { + g.DrawString( args.Title, args.TitleFont, shadowBrush, new Rectangle( masterPointer + GetAlignmentOffset( ContentAlignment.TopCenter, titleSize, entireSize ) + new Size( 2, 2 ), titleSize ), formatMiddleCenter ); + g.DrawString( args.Title, args.TitleFont, mainTextBrush, new Rectangle( masterPointer + GetAlignmentOffset( ContentAlignment.TopCenter, titleSize, entireSize ), titleSize ), formatMiddleCenter ); + } + masterPointer.Y += titleSize.Height; + + + for ( int fleetIndex = 0; fleetIndex < args.FleetIDs.Length; fleetIndex++ ) { + int fleetID = args.FleetIDs[fleetIndex]; + FleetData fleet = KCDatabase.Instance.Fleet[fleetID]; + Point fleetPointerOrigin = masterPointer + new Size( + ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * ( fleetIndex % args.HorizontalFleetCount ) + fleetPaneUnitMargin.Left, + ( fleetPaneUnitSize.Height + fleetPaneUnitMargin.Vertical ) * ( fleetIndex / args.HorizontalFleetCount ) + fleetPaneUnitMargin.Top ); + Point fleetPointer = fleetPointerOrigin; + + if ( fleet == null ) + continue; + + // fleet name + g.DrawString( fleet.Name, args.LargeFont, mainTextBrush, new Rectangle( fleetPointer, fleetNameSize ), formatMiddleLeft ); + if ( isFleetNameAndParametersAreSameLine ) { + fleetPointer.X += fleetNameSize.Width; + fleetPointer.Y += fleetNameSize.Height - fleetParameterAreaSize.Height; + } else { + fleetPointer.Y += fleetNameSize.Height; + } + + // fleet specs + fleetPointer.X += fleetParameterAreaMargin.Left; + fleetPointer.Y += fleetParameterAreaMargin.Top; + { // fighter power + var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, fleetParameterAreaSize ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.CarrierBasedFighter], iconpos.X, iconpos.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); + fleetPointer.X += EquipmentIconSize.Width; + + g.DrawString( fleetAirSuperiorityTitle, args.SmallFont, subTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, fleetAirSuperiorityTitleSize, fleetParameterAreaSize ), fleetAirSuperiorityTitleSize ), formatMiddleLeft ); + fleetPointer.X += fleetAirSuperiorityTitleSize.Width; + + Size paramValueSize = MeasureString( g, fleet.GetAirSuperiority().ToString(), args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + g.DrawString( fleet.GetAirSuperiority().ToString(), args.MediumDigitFont, mainTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, paramValueSize, fleetParameterAreaSize ), paramValueSize ), formatMiddleLeft ); + fleetPointer.X += paramValueSize.Width + fleetParameterAreaInnerMargin.Width; + } + { // searching ability + var iconpos = fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, fleetParameterAreaSize ); + g.DrawImage( ResourceManager.Instance.Equipments.Images[(int)ResourceManager.EquipmentContent.CarrierBasedRecon], iconpos.X, iconpos.Y, EquipmentIconSize.Width, EquipmentIconSize.Height ); + fleetPointer.X += EquipmentIconSize.Width; + + g.DrawString( fleetSearchingAbilityTitle, args.SmallFont, subTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, fleetSearchingAbilityTitleSize, fleetParameterAreaSize ), fleetSearchingAbilityTitleSize ), formatMiddleLeft ); + fleetPointer.X += fleetAirSuperiorityTitleSize.Width; + + Size paramValueSize = MeasureString( g, fleet.GetSearchingAbilityString(), args.MediumDigitFont, MaxValueSize, formatMiddleLeft ); + g.DrawString( fleet.GetSearchingAbilityString(), args.MediumDigitFont, mainTextBrush, new Rectangle( fleetPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, paramValueSize, fleetParameterAreaSize ), paramValueSize ), formatMiddleLeft ); + fleetPointer.X += paramValueSize.Width + fleetParameterAreaInnerMargin.Width; + } + + fleetPointer.X = fleetPointerOrigin.X; + fleetPointer.Y += fleetParameterAreaSize.Height; + + g.DrawLine( linePen, fleetPointer + new Size( lineMargin, 0 ), fleetPointer + new Size( shipPaneSize.Width - lineMargin, 0 ) ); + fleetPointer.Y += fleetParameterAreaMargin.Bottom; + + + for ( int shipIndex = 0; shipIndex < 6; shipIndex++ ) { + ShipData ship = fleet.MembersInstance[shipIndex]; + Point shipPointerOrigin = fleetPointer + new Size( + ( shipPaneUnitSize.Width + shipPaneUnitMargin.Horizontal ) * ( shipIndex % args.HorizontalShipCount ) + shipPaneUnitMargin.Left, + ( shipPaneUnitSize.Height + shipPaneUnitMargin.Vertical ) * ( shipIndex / args.HorizontalShipCount ) + shipPaneUnitMargin.Top ); + Point shipPointer = shipPointerOrigin; + + //g.DrawRectangle( Pens.Teal, new Rectangle( shipPointer, shipPaneUnitSize ) ); + + if ( ship == null ) + continue; + + //g.DrawString( string.Format( "#{0}:", shipIndex + 1 ), args.MediumDigitFont, subTextBrush, new Rectangle( shipPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, shipIndexSize, shipNameAreaSize ), shipIndexSize ), formatMiddleLeft ); + //shipPointer.X += shipIndexSize.Width; + + DrawShipSwfImage( g, ship.MasterShip.ResourceName, args.ReflectDamageGraphic && ship.HPRate <= 0.5 ? ShipBannerDamagedID : ShipBannerNormalID, shipPointer.X, shipPointer.Y, ShipBannerSize ); + shipPointer.X += shipBannerSize.Width; + + g.DrawString( ship.Level.ToString(), args.SmallDigitFont, subTextBrush, new Rectangle( shipPointer, smallDigit3Size ), formatMiddleLeft ); + + shipPointer.X = shipPointerOrigin.X; + shipPointer.Y += shipNameAreaSize.Height; + + + // equipments + Point equipmentPointerOrigin = shipPointer; + for ( int equipmentIndex = 0; equipmentIndex < 6; equipmentIndex++ ) { + EquipmentData eq = ship.AllSlotInstance[equipmentIndex]; + Point equipmentPointer = equipmentPointerOrigin + new Size( 0, equipmentAreaUnitSize.Height * equipmentIndex ); + + + bool isOutOfSlot = equipmentIndex >= ship.SlotSize && !( equipmentIndex == 5 && ship.IsExpansionSlotAvailable ); + + Size equipmentIconOffset = GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, equipmentAreaUnitSize ); + g.DrawImage( GetEquipmentIcon( eq != null ? eq.EquipmentID : -1, isOutOfSlot ), + equipmentPointer.X + equipmentIconOffset.Width, equipmentPointer.Y + equipmentIconOffset.Height, EquipmentIconSize.Width, EquipmentIconSize.Height ); + equipmentPointer.X += EquipmentIconSize.Width; + + string equipmentName; + if ( eq != null ) { + equipmentName = eq.Name; + } else if ( isOutOfSlot ) { + equipmentName = ""; + } else { + equipmentName = "(なし)"; + } + equipmentNameBrush.ResetTransform(); + if ( eq != null && eq.Level > 0 ) { + equipmentNameBrush.TranslateTransform( equipmentPointer.X - EquipmentIconSize.Width, 0 ); + } else { + equipmentNameBrush.TranslateTransform( equipmentPointer.X, 0 ); + } + g.DrawString( equipmentName, args.SmallFont, equipmentNameBrush, new Rectangle( equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, equipmentNameSizeExtended, equipmentAreaUnitSize ), equipmentNameSizeExtended ), formatMiddleLeft ); + equipmentPointer.X += equipmentNameSize.Width; + + if ( eq != null ) { + + if ( eq.Level > 0 ) { + g.DrawString( "+" + eq.Level, args.SmallDigitFont, subTextBrush, new Rectangle( equipmentPointer + GetAlignmentOffset( ContentAlignment.MiddleLeft, equipmentLevelSize, equipmentAreaUnitSize ), equipmentLevelSize ), formatMiddleRight ); + } + + } + + } + + } + + } + + + masterPointer.Y += fleetPaneSize.Height; + g.DrawLine( linePen, masterPointer + new Size( lineMargin, 0 ), masterPointer + new Size( fleetPaneSize.Width - commentMargin.Horizontal - lineMargin, 0 ) ); + + + if ( !commentSize.IsEmpty ) { + var commentPointer = masterPointer + new Size( commentMargin.Left, commentMargin.Top ); + commentPointer += new Size( commentPadding.Left, commentPadding.Top ); + g.DrawString( args.Comment, args.MediumFont, mainTextBrush, new Rectangle( commentPointer, commentSize ), formatMiddleLeft ); + } + } + + if ( args.AvoidTwitterDeterioration ) { + // 不透明ピクセルのみだと jpeg 化されてしまうため、1px だけわずかに透明にする + Color temp = bitmap.GetPixel( bitmap.Width - 1, bitmap.Height - 1 ); + bitmap.SetPixel( bitmap.Width - 1, bitmap.Height - 1, Color.FromArgb( 252, temp.R, temp.G, temp.B ) ); + } + + + mainTextBrush.Dispose(); + shadowBrush.Dispose(); + disabledBrush.Dispose(); + subTextBrush.Dispose(); + aircraftLevelLowBrush.Dispose(); + aircraftLevelHighBrush.Dispose(); + + equipmentNameBrush.Dispose(); + + linePen.Dispose(); + + return bitmap; + } diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index 0934af5e5..f5eccd474 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -1111,7 +1111,7 @@ private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e var args = new Utility.FleetImageArgument(); args.FleetIDs = new int[] { 1, 2 }; args.HorizontalFleetCount = 2; - args.HorizontalShipCount = 1; + args.HorizontalShipCount = 2; args.ReflectDamageGraphic = true; args.AvoidTwitterDeterioration = true; args.TitleFont = new Font( "Meiryo UI", 32, FontStyle.Bold, GraphicsUnit.Pixel ); @@ -1124,7 +1124,7 @@ private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e args.Title = "適当にタイトルを入力"; args.Comment = "コメント部分です。\r\nここに適当な文字列を入力することができます。ねこです \r\nよろしくおねがいします"; - using ( var image = Utility.FleetImageGenerator.GenerateCutinBitmap( args ) ) { + using ( var image = Utility.FleetImageGenerator.GenerateBannerBitmap( args ) ) { string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); System.Diagnostics.Process.Start( savePath ); @@ -1140,7 +1140,7 @@ private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e // layout testing - switch ( 2 ) { + switch ( 3 ) { case 1: // card using ( var image = new Bitmap( 900, 900 ) ) { From 5af34b712e2f90ac28a3a70450077ac4db373e91 Mon Sep 17 00:00:00 2001 From: RadarNyan Date: Wed, 30 Nov 2016 01:01:59 +0900 Subject: [PATCH 05/16] Convert Bundled Record File to User-set Encoding --- ElectronicObserver/Resource/ResourceManager.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ElectronicObserver/Resource/ResourceManager.cs b/ElectronicObserver/Resource/ResourceManager.cs index 3b029e90d..c035db916 100644 --- a/ElectronicObserver/Resource/ResourceManager.cs +++ b/ElectronicObserver/Resource/ResourceManager.cs @@ -500,7 +500,15 @@ public static bool CopyFromArchive( string archivePath, string source, string de try { - entry.ExtractToFile( destination ); + if (source.StartsWith("Record/") && Utility.Configuration.Config.Log.FileEncodingID != 4) { + using (var filetoconvert = GetStreamFromArchive(source)) { + filetoconvert.Position = 0; + string fileread = new StreamReader(filetoconvert, Encoding.GetEncoding(932)).ReadToEnd(); + File.WriteAllText(destination, fileread, Utility.Configuration.Config.Log.FileEncoding); + } + } else { + entry.ExtractToFile( destination ); + } Utility.Logger.Add( 2, string.Format( "{0} をコピーしました。", entrypath ) ); } catch ( Exception ex ) { From 0e93f6ced11f24b965a92426f06dfb475ec5faf2 Mon Sep 17 00:00:00 2001 From: Andante Date: Tue, 18 Apr 2017 03:00:25 +0900 Subject: [PATCH 06/16] =?UTF-8?q?Assets.zip=E3=81=8B=E3=82=89=E3=81=AE?= =?UTF-8?q?=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=B3=E3=83=94=E3=83=BC=E6=99=82=E3=81=AB=E3=82=A8?= =?UTF-8?q?=E3=83=B3=E3=82=B3=E3=83=BC=E3=83=87=E3=82=A3=E3=83=B3=E3=82=B0?= =?UTF-8?q?=E3=82=92=E8=87=AA=E5=8B=95=E5=A4=89=E6=8F=9B=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ElectronicObserver/Data/ShipGroupManager.cs | 2 +- .../Resource/Record/RecordManager.cs | 2 +- .../Resource/ResourceManager.cs | 28 +++++++++++++++---- ElectronicObserver/Utility/Configuration.cs | 2 +- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ElectronicObserver/Data/ShipGroupManager.cs b/ElectronicObserver/Data/ShipGroupManager.cs index b51b5636a..ce2012904 100644 --- a/ElectronicObserver/Data/ShipGroupManager.cs +++ b/ElectronicObserver/Data/ShipGroupManager.cs @@ -67,7 +67,7 @@ public int GetUniqueID() { public ShipGroupManager Load() { - ResourceManager.CopyFromArchive( DefaultFilePath.Replace( "\\", "/" ), DefaultFilePath ); + ResourceManager.CopyDocumentFromArchive( DefaultFilePath.Replace( "\\", "/" ), DefaultFilePath ); return (ShipGroupManager)Load( DefaultFilePath ); } diff --git a/ElectronicObserver/Resource/Record/RecordManager.cs b/ElectronicObserver/Resource/Record/RecordManager.cs index ce20c843d..cc9a1d452 100644 --- a/ElectronicObserver/Resource/Record/RecordManager.cs +++ b/ElectronicObserver/Resource/Record/RecordManager.cs @@ -55,7 +55,7 @@ public bool Load( bool logging = true ) { bool succeeded = true; - ResourceManager.CopyFromArchive( "Record/" + ShipParameter.FileName, MasterPath + "\\" + ShipParameter.FileName ); + ResourceManager.CopyDocumentFromArchive( "Record/" + ShipParameter.FileName, MasterPath + "\\" + ShipParameter.FileName ); succeeded &= EnemyFleet.Load( MasterPath ); succeeded &= ShipParameter.Load( MasterPath ); diff --git a/ElectronicObserver/Resource/ResourceManager.cs b/ElectronicObserver/Resource/ResourceManager.cs index c035db916..9d6d52543 100644 --- a/ElectronicObserver/Resource/ResourceManager.cs +++ b/ElectronicObserver/Resource/ResourceManager.cs @@ -476,8 +476,9 @@ private static Icon LoadIconFromArchive( ZipArchive arc, string path ) { /// アーカイブ内のファイルのパス。 /// 出力するファイルのパス。 /// true の場合、ファイルが既に存在するときコピーを中止します。 + /// エンコーディングを shift-jis から現在設定に合わせて変換するか。 /// コピーに成功すれば true 。それ以外は false 。 - public static bool CopyFromArchive( string archivePath, string source, string destination, bool checkexist = true ) { + public static bool CopyFromArchive( string archivePath, string source, string destination, bool checkexist = true, bool convertEncoding = false ) { if ( checkexist && File.Exists( destination ) ) { return false; @@ -500,11 +501,13 @@ public static bool CopyFromArchive( string archivePath, string source, string de try { - if (source.StartsWith("Record/") && Utility.Configuration.Config.Log.FileEncodingID != 4) { - using (var filetoconvert = GetStreamFromArchive(source)) { + if ( convertEncoding && Utility.Configuration.Config.Log.FileEncodingID != 4 ) { + using ( var filetoconvert = GetStreamFromArchive( source ) ) { filetoconvert.Position = 0; - string fileread = new StreamReader(filetoconvert, Encoding.GetEncoding(932)).ReadToEnd(); - File.WriteAllText(destination, fileread, Utility.Configuration.Config.Log.FileEncoding); + using ( var convertStream = new StreamReader( filetoconvert, Encoding.GetEncoding( 932 ) ) ) { + string fileread = convertStream.ReadToEnd(); + File.WriteAllText( destination, fileread, Utility.Configuration.Config.Log.FileEncoding ); + } } } else { entry.ExtractToFile( destination ); @@ -529,11 +532,24 @@ public static bool CopyFromArchive( string archivePath, string source, string de /// アーカイブ内のファイルのパス。 /// 出力するファイルのパス。 /// true の場合、ファイルが既に存在するときコピーを中止します。 + /// エンコーディングを shift-jis から現在設定に合わせて変換するか。 /// コピーに成功すれば true 。それ以外は false 。 - public static bool CopyFromArchive( string source, string destination, bool checkexist = true ) { + public static bool CopyFromArchive( string source, string destination, bool checkexist = true, bool convertEncoding = false ) { return CopyFromArchive( AssetFilePath, source, destination, checkexist ); } + + /// + /// アーカイブの中から文書ファイルをコピーします。エンコーディングは現在設定に合わせて自動で変更されます。 + /// + /// アーカイブ内のファイルのパス。 + /// 出力するファイルのパス。 + /// コピーに成功すれば true 。それ以外は false 。 + public static bool CopyDocumentFromArchive( string source, string destination ) { + return CopyFromArchive( AssetFilePath, source, destination, true, true ); + } + + /// /// アーカイブからファイルを選択し、ストリームを開きます。 /// diff --git a/ElectronicObserver/Utility/Configuration.cs b/ElectronicObserver/Utility/Configuration.cs index 746b2fd45..c25be941e 100644 --- a/ElectronicObserver/Utility/Configuration.cs +++ b/ElectronicObserver/Utility/Configuration.cs @@ -1565,7 +1565,7 @@ private void CheckUpdate( Form mainForm ) { Directory.CreateDirectory( defaultRecordPath ); - ElectronicObserver.Resource.ResourceManager.CopyFromArchive( "Record/" + currentRecord.FileName, Path.Combine( defaultRecordPath, currentRecord.FileName ) ); + ElectronicObserver.Resource.ResourceManager.CopyDocumentFromArchive( "Record/" + currentRecord.FileName, Path.Combine( defaultRecordPath, currentRecord.FileName ) ); var defaultRecord = new ShipParameterRecord(); defaultRecord.Load( defaultRecordPath ); From 4f22cd186fa5373c1033996dc128fbf1f6a0d7e3 Mon Sep 17 00:00:00 2001 From: Andante Date: Tue, 18 Apr 2017 04:18:37 +0900 Subject: [PATCH 07/16] =?UTF-8?q?=E8=89=A6=E9=9A=8A=EF=BC=9A=E5=86=85?= =?UTF-8?q?=E9=83=A8=E7=86=9F=E7=B7=B4=E5=BA=A6=E3=82=92=E8=80=83=E6=85=AE?= =?UTF-8?q?=E3=81=97=E3=81=A6=E5=88=B6=E7=A9=BA=E5=80=A4=E3=82=92=E7=AF=84?= =?UTF-8?q?=E5=9B=B2=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 水上戦闘機の改修による制空値ボーナスに対応 --- ElectronicObserver/Data/FleetData.cs | 20 ++ ElectronicObserver/Utility/Configuration.cs | 6 + ElectronicObserver/Utility/Data/Calculator.cs | 53 ++-- .../Dialog/DialogConfiguration.Designer.cs | 262 +++++++++--------- .../Window/Dialog/DialogConfiguration.cs | 2 + .../Window/Dialog/DialogConfiguration.resx | 3 - ElectronicObserver/Window/FormBaseAirCorps.cs | 11 +- ElectronicObserver/Window/FormFleet.cs | 29 +- 8 files changed, 224 insertions(+), 162 deletions(-) diff --git a/ElectronicObserver/Data/FleetData.cs b/ElectronicObserver/Data/FleetData.cs index 087c77d33..34ebf920f 100644 --- a/ElectronicObserver/Data/FleetData.cs +++ b/ElectronicObserver/Data/FleetData.cs @@ -458,6 +458,26 @@ public int GetAirSuperiority() { } } + /// + /// 現在の設定に応じて、制空戦力を表す文字列を取得します。 + /// + /// + public string GetAirSuperiorityString() { + switch ( Utility.Configuration.Config.FormFleet.AirSuperiorityMethod ) { + case 0: + default: + return Calculator.GetAirSuperiorityIgnoreLevel( this ).ToString(); + case 1: { + int min = Calculator.GetAirSuperiority( this, false ); + int max = Calculator.GetAirSuperiority( this, true ); + + if ( Utility.Configuration.Config.FormFleet.ShowAirSuperiorityRange && min < max ) + return string.Format( "{0} ~ {1}", min, max ); + else + return min.ToString(); + } + } + } /// /// 現在の設定に応じて、索敵能力を取得します。 diff --git a/ElectronicObserver/Utility/Configuration.cs b/ElectronicObserver/Utility/Configuration.cs index c25be941e..83b7cb3b6 100644 --- a/ElectronicObserver/Utility/Configuration.cs +++ b/ElectronicObserver/Utility/Configuration.cs @@ -647,6 +647,11 @@ public class ConfigFormFleet : ConfigPartBase { /// public int FixedShipNameWidth { get; set; } + /// + /// 制空戦力を範囲表示するか + /// + public bool ShowAirSuperiorityRange { get; set; } + public ConfigFormFleet() { ShowAircraft = true; SearchingAbilityMethod = 4; @@ -661,6 +666,7 @@ public ConfigFormFleet() { BlinkAtCompletion = true; ShowConditionIcon = true; FixedShipNameWidth = 40; + ShowAirSuperiorityRange = false; } } /// [艦隊]ウィンドウ diff --git a/ElectronicObserver/Utility/Data/Calculator.cs b/ElectronicObserver/Utility/Data/Calculator.cs index dbed85452..5be465c73 100644 --- a/ElectronicObserver/Utility/Data/Calculator.cs +++ b/ElectronicObserver/Utility/Data/Calculator.cs @@ -57,6 +57,7 @@ public static int GetParameterFromLevel( int min, int max, int lv ) { private static readonly Dictionary LevelBonus = new Dictionary() { { 6, 0.2 }, // 艦上戦闘機 { 7, 0.25 }, // 艦上爆撃機 + { 45, 0.2 }, // 水上戦闘機 }; @@ -69,8 +70,9 @@ public static int GetParameterFromLevel( int min, int max, int lv ) { /// 艦載機熟練度。既定値は 0 です。 /// 改修レベル。既定値は 0 です。 /// 基地航空隊による防空戦かどうか。 + /// 艦載機の内部熟練度が当該レベルで最大値であるとして計算するか。falseなら最小値として計算します。 /// - public static int GetAirSuperiority( int equipmentID, int count, int aircraftLevel = 0, int level = 0, bool isAirDefense = false ) { + public static int GetAirSuperiority( int equipmentID, int count, int aircraftLevel = 0, int level = 0, bool isAirDefense = false, bool isAircraftExpMaximum = false ) { if ( count <= 0 ) return 0; @@ -92,8 +94,18 @@ public static int GetAirSuperiority( int equipmentID, int count, int aircraftLev interceptorBonus = eq.Evasion * 1.5; } + int aircraftExp; + if ( isAircraftExpMaximum ) { + if ( aircraftLevel < 7 ) + aircraftExp = AircraftExpTable[aircraftLevel + 1] - 1; + else + aircraftExp = AircraftExpTable.Last(); + } else { + aircraftExp = AircraftExpTable[aircraftLevel]; + } + return (int)( ( eq.AA + levelBonus * level + interceptorBonus ) * Math.Sqrt( count ) - + Math.Sqrt( AircraftExpTable[aircraftLevel] / 10.0 ) + + Math.Sqrt( aircraftExp / 10.0 ) + ( AircraftLevelBonus.ContainsKey( category ) ? AircraftLevelBonus[category][aircraftLevel] : 0 ) ); } @@ -109,17 +121,6 @@ public static int GetAirSuperiority( int[] slot, int[] aircraft ) { return slot.Select( ( eq, i ) => GetAirSuperiority( eq, aircraft[i] ) ).Sum(); } - /// - /// 制空戦力を求めます。 - /// - /// 各スロットの装備IDリスト。 - /// 艦載機搭載量。 - /// 各スロットの艦載機熟練度。 - /// - public static int GetAirSuperiority( int[] slot, int[] aircraft, int[] level ) { - - return slot.Select( ( eq, i ) => GetAirSuperiority( eq, aircraft[i], level[i] ) ).Sum(); - } /// @@ -158,11 +159,12 @@ public static int GetAirSuperiority( int[] fleet, int[][] slot ) { /// 制空戦力を求めます。 /// /// 対象の艦船。 - public static int GetAirSuperiority( ShipData ship ) { + public static int GetAirSuperiority( ShipData ship, bool isAircraftLevelMaximum = false ) { if ( ship == null ) return 0; - return ship.SlotInstance.Select( ( eq, i ) => eq == null ? 0 : GetAirSuperiority( eq.EquipmentID, ship.Aircraft[i], eq.AircraftLevel, eq.Level ) ).Sum(); + return ship.SlotInstance.Select( ( eq, i ) => eq == null ? 0 : + GetAirSuperiority( eq.EquipmentID, ship.Aircraft[i], eq.AircraftLevel, eq.Level, false, isAircraftLevelMaximum ) ).Sum(); } /// @@ -180,10 +182,10 @@ public static int GetAirSuperiority( ShipDataMaster ship ) { /// 制空戦力を求めます。 /// /// 対象の艦隊。 - public static int GetAirSuperiority( FleetData fleet ) { + public static int GetAirSuperiority( FleetData fleet, bool isAircraftLevelMaximum = false ) { if ( fleet == null ) return 0; - return fleet.MembersWithoutEscaped.Select( ship => GetAirSuperiority( ship ) ).Sum(); + return fleet.MembersWithoutEscaped.Select( ship => GetAirSuperiority( ship, isAircraftLevelMaximum ) ).Sum(); } @@ -191,7 +193,7 @@ public static int GetAirSuperiority( FleetData fleet ) { /// 基地航空隊の制空戦力を求めます。 /// /// 対象の基地航空隊。 - public static int GetAirSuperiority( BaseAirCorpsData aircorps ) { + public static int GetAirSuperiority( BaseAirCorpsData aircorps, bool isAircraftLevelMaximum = false ) { if ( aircorps == null ) return 0; @@ -202,7 +204,7 @@ public static int GetAirSuperiority( BaseAirCorpsData aircorps ) { if ( sq == null || sq.State != 1 ) continue; - air += GetAirSuperiority( sq, aircorps.ActionKind == 2 ); + air += GetAirSuperiority( sq, aircorps.ActionKind == 2, isAircraftLevelMaximum ); if ( aircorps.ActionKind != 2 ) continue; @@ -230,7 +232,7 @@ public static int GetAirSuperiority( BaseAirCorpsData aircorps ) { /// 基地航空中隊の制空戦力を求めます。 /// /// 対象の基地航空中隊。 - public static int GetAirSuperiority( BaseAirCorpsSquadron squadron, bool isAirDefense = false ) { + public static int GetAirSuperiority( BaseAirCorpsSquadron squadron, bool isAirDefense = false, bool isAircraftLevelMaximum = false ) { if ( squadron == null || squadron.State != 1 ) return 0; @@ -238,7 +240,7 @@ public static int GetAirSuperiority( BaseAirCorpsSquadron squadron, bool isAirDe if ( eq == null ) return 0; - return GetAirSuperiority( eq.EquipmentID, squadron.AircraftCurrent, eq.AircraftLevel, eq.Level, isAirDefense ); + return GetAirSuperiority( eq.EquipmentID, squadron.AircraftCurrent, eq.AircraftLevel, eq.Level, isAirDefense, isAircraftLevelMaximum ); } @@ -250,12 +252,13 @@ public static int GetAirSuperiority( BaseAirCorpsSquadron squadron, bool isAirDe /// public static int GetAirSuperiorityAtMaxLevel( int[] fleet, int[][] slot ) { return fleet.Select( id => KCDatabase.Instance.MasterShips[id] ) - .Select( ( ship, i ) => ship == null ? 0 : GetAirSuperiority( slot[i], ship.Aircraft.ToArray(), new int[] { 8, 8, 8, 8, 8 } ) ).Sum(); + .Select( ( ship, i ) => ship == null ? 0 : + slot[i].Select( ( eqid, k ) => GetAirSuperiority( eqid, ship.Aircraft[k], 7, 10, false, true ) ).Sum() ).Sum(); } /// - /// 艦載機熟練度を無視した制空戦力を求めます。 + /// 艦載機熟練度・改修レベルを無視した制空戦力を求めます。 /// /// 対象の艦船。 public static int GetAirSuperiorityIgnoreLevel( ShipData ship ) { @@ -265,7 +268,7 @@ public static int GetAirSuperiorityIgnoreLevel( ShipData ship ) { } /// - /// 艦載機熟練度を無視した制空戦力を求めます。 + /// 艦載機熟練度・改修レベルを無視した制空戦力を求めます。 /// /// 対象の艦隊。 public static int GetAirSuperiorityIgnoreLevel( FleetData fleet ) { @@ -922,7 +925,7 @@ public static int GetNightAttackKind( int[] slot, int attackerShipID, int defene mainguncnt++; break; case 4: //副砲 - subguncnt++; + subguncnt++; break; case 5: case 32: //魚雷 diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs b/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs index 53a26c560..34f531ecf 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs @@ -24,7 +24,7 @@ protected override void Dispose( bool disposing ) { /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.Connection_UpstreamProxyAddress = new System.Windows.Forms.TextBox(); @@ -116,9 +116,15 @@ private void InitializeComponent() { this.label13 = new System.Windows.Forms.Label(); this.FormFleet_ShowAircraft = new System.Windows.Forms.CheckBox(); this.tabPage9 = new System.Windows.Forms.TabPage(); + this.label38 = new System.Windows.Forms.Label(); + this.label37 = new System.Windows.Forms.Label(); + this.FormArsenal_MaxShipNameWidth = new System.Windows.Forms.NumericUpDown(); this.FormArsenal_BlinkAtCompletion = new System.Windows.Forms.CheckBox(); this.FormArsenal_ShowShipName = new System.Windows.Forms.CheckBox(); this.tabPage19 = new System.Windows.Forms.TabPage(); + this.label39 = new System.Windows.Forms.Label(); + this.label36 = new System.Windows.Forms.Label(); + this.FormDock_MaxShipNameWidth = new System.Windows.Forms.NumericUpDown(); this.FormDock_BlinkAtCompletion = new System.Windows.Forms.CheckBox(); this.tabPage16 = new System.Windows.Forms.TabPage(); this.label34 = new System.Windows.Forms.Label(); @@ -127,6 +133,7 @@ private void InitializeComponent() { this.FormHeadquarters_Visibility = new System.Windows.Forms.CheckedListBox(); this.FormHeadquarters_BlinkAtMaximum = new System.Windows.Forms.CheckBox(); this.tabPage18 = new System.Windows.Forms.TabPage(); + this.FormCompass_IsScrollable = new System.Windows.Forms.CheckBox(); this.FormCompass_CandidateDisplayCount = new System.Windows.Forms.NumericUpDown(); this.label2 = new System.Windows.Forms.Label(); this.tabPage10 = new System.Windows.Forms.TabPage(); @@ -223,13 +230,7 @@ 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.FormCompass_IsScrollable = new System.Windows.Forms.CheckBox(); - this.label36 = new System.Windows.Forms.Label(); - this.FormDock_MaxShipNameWidth = new System.Windows.Forms.NumericUpDown(); - this.label37 = new System.Windows.Forms.Label(); - this.FormArsenal_MaxShipNameWidth = new System.Windows.Forms.NumericUpDown(); - this.label38 = new System.Windows.Forms.Label(); - this.label39 = new System.Windows.Forms.Label(); + this.FormFleet_ShowAirSuperiorityRange = new System.Windows.Forms.CheckBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Connection_UpstreamProxyPort)).BeginInit(); @@ -248,7 +249,9 @@ private void InitializeComponent() { this.tabPage8.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.FormFleet_FixedShipNameWidth)).BeginInit(); this.tabPage9.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.FormArsenal_MaxShipNameWidth)).BeginInit(); this.tabPage19.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.FormDock_MaxShipNameWidth)).BeginInit(); this.tabPage16.SuspendLayout(); this.tabPage18.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.FormCompass_CandidateDisplayCount)).BeginInit(); @@ -270,8 +273,6 @@ private void InitializeComponent() { this.tabPage17.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.BGMPlayer_VolumeAll)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.BGMPlayer_ControlGrid)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.FormDock_MaxShipNameWidth)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.FormArsenal_MaxShipNameWidth)).BeginInit(); this.SuspendLayout(); // // tabControl1 @@ -916,7 +917,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(576, 237); + this.Debug_SealingPanel.Size = new System.Drawing.Size(576, 235); this.Debug_SealingPanel.TabIndex = 1; // // Debug_APIListPath @@ -1132,6 +1133,7 @@ private void InitializeComponent() { // // tabPage8 // + this.tabPage8.Controls.Add(this.FormFleet_ShowAirSuperiorityRange); this.tabPage8.Controls.Add(this.FormFleet_ShowAircraftLevelByNumber); this.tabPage8.Controls.Add(this.label35); this.tabPage8.Controls.Add(this.FormFleet_FixedShipNameWidth); @@ -1367,13 +1369,55 @@ private void InitializeComponent() { this.tabPage9.Controls.Add(this.FormArsenal_MaxShipNameWidth); this.tabPage9.Controls.Add(this.FormArsenal_BlinkAtCompletion); this.tabPage9.Controls.Add(this.FormArsenal_ShowShipName); - this.tabPage9.Location = new System.Drawing.Point(4, 24); + this.tabPage9.Location = new System.Drawing.Point(4, 22); this.tabPage9.Name = "tabPage9"; this.tabPage9.Padding = new System.Windows.Forms.Padding(3); - this.tabPage9.Size = new System.Drawing.Size(562, 258); + this.tabPage9.Size = new System.Drawing.Size(562, 260); this.tabPage9.TabIndex = 1; this.tabPage9.Text = "工廠"; this.tabPage9.UseVisualStyleBackColor = true; + // + // label38 + // + this.label38.AutoSize = true; + this.label38.Location = new System.Drawing.Point(6, 57); + this.label38.Name = "label38"; + this.label38.Size = new System.Drawing.Size(101, 15); + this.label38.TabIndex = 12; + this.label38.Text = "艦名の最大横幅:"; + // + // label37 + // + this.label37.AutoSize = true; + this.label37.Location = new System.Drawing.Point(179, 57); + this.label37.Name = "label37"; + this.label37.Size = new System.Drawing.Size(21, 15); + this.label37.TabIndex = 11; + this.label37.Text = "px"; + // + // FormArsenal_MaxShipNameWidth + // + this.FormArsenal_MaxShipNameWidth.Location = new System.Drawing.Point(113, 55); + this.FormArsenal_MaxShipNameWidth.Maximum = new decimal(new int[] { + 999, + 0, + 0, + 0}); + this.FormArsenal_MaxShipNameWidth.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.FormArsenal_MaxShipNameWidth.Name = "FormArsenal_MaxShipNameWidth"; + this.FormArsenal_MaxShipNameWidth.Size = new System.Drawing.Size(60, 23); + this.FormArsenal_MaxShipNameWidth.TabIndex = 10; + this.FormArsenal_MaxShipNameWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.ToolTipInfo.SetToolTip(this.FormArsenal_MaxShipNameWidth, "艦名の表示幅の最大値を指定します。"); + this.FormArsenal_MaxShipNameWidth.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); // // FormArsenal_BlinkAtCompletion // @@ -1401,13 +1445,55 @@ private void InitializeComponent() { this.tabPage19.Controls.Add(this.label36); this.tabPage19.Controls.Add(this.FormDock_MaxShipNameWidth); this.tabPage19.Controls.Add(this.FormDock_BlinkAtCompletion); - this.tabPage19.Location = new System.Drawing.Point(4, 24); + this.tabPage19.Location = new System.Drawing.Point(4, 22); this.tabPage19.Name = "tabPage19"; this.tabPage19.Padding = new System.Windows.Forms.Padding(3); - this.tabPage19.Size = new System.Drawing.Size(562, 258); + this.tabPage19.Size = new System.Drawing.Size(562, 260); this.tabPage19.TabIndex = 8; this.tabPage19.Text = "入渠"; this.tabPage19.UseVisualStyleBackColor = true; + // + // label39 + // + this.label39.AutoSize = true; + this.label39.Location = new System.Drawing.Point(6, 32); + this.label39.Name = "label39"; + this.label39.Size = new System.Drawing.Size(101, 15); + this.label39.TabIndex = 12; + this.label39.Text = "艦名の最大横幅:"; + // + // label36 + // + this.label36.AutoSize = true; + this.label36.Location = new System.Drawing.Point(179, 32); + this.label36.Name = "label36"; + this.label36.Size = new System.Drawing.Size(21, 15); + this.label36.TabIndex = 11; + this.label36.Text = "px"; + // + // FormDock_MaxShipNameWidth + // + this.FormDock_MaxShipNameWidth.Location = new System.Drawing.Point(113, 30); + this.FormDock_MaxShipNameWidth.Maximum = new decimal(new int[] { + 999, + 0, + 0, + 0}); + this.FormDock_MaxShipNameWidth.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.FormDock_MaxShipNameWidth.Name = "FormDock_MaxShipNameWidth"; + this.FormDock_MaxShipNameWidth.Size = new System.Drawing.Size(60, 23); + this.FormDock_MaxShipNameWidth.TabIndex = 10; + this.FormDock_MaxShipNameWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.ToolTipInfo.SetToolTip(this.FormDock_MaxShipNameWidth, "艦名の表示幅の最大値を指定します。"); + this.FormDock_MaxShipNameWidth.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); // // FormDock_BlinkAtCompletion // @@ -1426,10 +1512,10 @@ private void InitializeComponent() { this.tabPage16.Controls.Add(this.label26); this.tabPage16.Controls.Add(this.FormHeadquarters_Visibility); this.tabPage16.Controls.Add(this.FormHeadquarters_BlinkAtMaximum); - this.tabPage16.Location = new System.Drawing.Point(4, 24); + this.tabPage16.Location = new System.Drawing.Point(4, 22); this.tabPage16.Name = "tabPage16"; this.tabPage16.Padding = new System.Windows.Forms.Padding(3); - this.tabPage16.Size = new System.Drawing.Size(562, 258); + this.tabPage16.Size = new System.Drawing.Size(562, 260); this.tabPage16.TabIndex = 6; this.tabPage16.Text = "司令部"; this.tabPage16.UseVisualStyleBackColor = true; @@ -1469,7 +1555,7 @@ private void InitializeComponent() { this.FormHeadquarters_Visibility.IntegralHeight = false; this.FormHeadquarters_Visibility.Location = new System.Drawing.Point(6, 46); this.FormHeadquarters_Visibility.Name = "FormHeadquarters_Visibility"; - this.FormHeadquarters_Visibility.Size = new System.Drawing.Size(150, 206); + this.FormHeadquarters_Visibility.Size = new System.Drawing.Size(150, 208); this.FormHeadquarters_Visibility.TabIndex = 1; // // FormHeadquarters_BlinkAtMaximum @@ -1487,14 +1573,25 @@ private void InitializeComponent() { this.tabPage18.Controls.Add(this.FormCompass_IsScrollable); this.tabPage18.Controls.Add(this.FormCompass_CandidateDisplayCount); this.tabPage18.Controls.Add(this.label2); - this.tabPage18.Location = new System.Drawing.Point(4, 24); + this.tabPage18.Location = new System.Drawing.Point(4, 22); this.tabPage18.Name = "tabPage18"; this.tabPage18.Padding = new System.Windows.Forms.Padding(3); - this.tabPage18.Size = new System.Drawing.Size(562, 258); + this.tabPage18.Size = new System.Drawing.Size(562, 260); this.tabPage18.TabIndex = 7; this.tabPage18.Text = "羅針盤"; this.tabPage18.UseVisualStyleBackColor = true; // + // FormCompass_IsScrollable + // + this.FormCompass_IsScrollable.AutoSize = true; + this.FormCompass_IsScrollable.Location = new System.Drawing.Point(6, 35); + this.FormCompass_IsScrollable.Name = "FormCompass_IsScrollable"; + this.FormCompass_IsScrollable.Size = new System.Drawing.Size(144, 19); + this.FormCompass_IsScrollable.TabIndex = 6; + this.FormCompass_IsScrollable.Text = "スクロールバーを表示する"; + this.ToolTipInfo.SetToolTip(this.FormCompass_IsScrollable, "表示エリアがはみ出した場合にスクロールバーを表示するかを指定します。\r\n収まりきった場合は表示しません。"); + this.FormCompass_IsScrollable.UseVisualStyleBackColor = true; + // // FormCompass_CandidateDisplayCount // this.FormCompass_CandidateDisplayCount.Location = new System.Drawing.Point(143, 6); @@ -2465,21 +2562,21 @@ private void InitializeComponent() { this.BGMPlayer_ColumnContent, this.BGMPlayer_ColumnPath, this.BGMPlayer_ColumnSetting}); - 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; + 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; 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(564, 255); + this.BGMPlayer_ControlGrid.Size = new System.Drawing.Size(564, 253); 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); @@ -2576,100 +2673,16 @@ private void InitializeComponent() { this.PlayTimeTimer.Interval = 1000; this.PlayTimeTimer.Tick += new System.EventHandler(this.PlayTimeTimer_Tick); // - // FormCompass_IsScrollable + // FormFleet_ShowAirSuperiorityRange // - this.FormCompass_IsScrollable.AutoSize = true; - this.FormCompass_IsScrollable.Location = new System.Drawing.Point(6, 35); - this.FormCompass_IsScrollable.Name = "FormCompass_IsScrollable"; - this.FormCompass_IsScrollable.Size = new System.Drawing.Size(144, 19); - this.FormCompass_IsScrollable.TabIndex = 6; - this.FormCompass_IsScrollable.Text = "スクロールバーを表示する"; - this.ToolTipInfo.SetToolTip(this.FormCompass_IsScrollable, "表示エリアがはみ出した場合にスクロールバーを表示するかを指定します。\r\n収まりきった場合は表示しません。"); - this.FormCompass_IsScrollable.UseVisualStyleBackColor = true; - // - // label36 - // - this.label36.AutoSize = true; - this.label36.Location = new System.Drawing.Point(179, 32); - this.label36.Name = "label36"; - this.label36.Size = new System.Drawing.Size(21, 15); - this.label36.TabIndex = 11; - this.label36.Text = "px"; - // - // FormDock_MaxShipNameWidth - // - this.FormDock_MaxShipNameWidth.Location = new System.Drawing.Point(113, 30); - this.FormDock_MaxShipNameWidth.Maximum = new decimal(new int[] { - 999, - 0, - 0, - 0}); - this.FormDock_MaxShipNameWidth.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.FormDock_MaxShipNameWidth.Name = "FormDock_MaxShipNameWidth"; - this.FormDock_MaxShipNameWidth.Size = new System.Drawing.Size(60, 23); - this.FormDock_MaxShipNameWidth.TabIndex = 10; - this.FormDock_MaxShipNameWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.ToolTipInfo.SetToolTip(this.FormDock_MaxShipNameWidth, "艦名の表示幅の最大値を指定します。"); - this.FormDock_MaxShipNameWidth.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // label37 - // - this.label37.AutoSize = true; - this.label37.Location = new System.Drawing.Point(179, 57); - this.label37.Name = "label37"; - this.label37.Size = new System.Drawing.Size(21, 15); - this.label37.TabIndex = 11; - this.label37.Text = "px"; - // - // FormArsenal_MaxShipNameWidth - // - this.FormArsenal_MaxShipNameWidth.Location = new System.Drawing.Point(113, 55); - this.FormArsenal_MaxShipNameWidth.Maximum = new decimal(new int[] { - 999, - 0, - 0, - 0}); - this.FormArsenal_MaxShipNameWidth.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.FormArsenal_MaxShipNameWidth.Name = "FormArsenal_MaxShipNameWidth"; - this.FormArsenal_MaxShipNameWidth.Size = new System.Drawing.Size(60, 23); - this.FormArsenal_MaxShipNameWidth.TabIndex = 10; - this.FormArsenal_MaxShipNameWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.ToolTipInfo.SetToolTip(this.FormArsenal_MaxShipNameWidth, "艦名の表示幅の最大値を指定します。"); - this.FormArsenal_MaxShipNameWidth.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - // - // label38 - // - this.label38.AutoSize = true; - this.label38.Location = new System.Drawing.Point(6, 57); - this.label38.Name = "label38"; - this.label38.Size = new System.Drawing.Size(101, 15); - this.label38.TabIndex = 12; - this.label38.Text = "艦名の最大横幅:"; - // - // label39 - // - this.label39.AutoSize = true; - this.label39.Location = new System.Drawing.Point(6, 32); - this.label39.Name = "label39"; - this.label39.Size = new System.Drawing.Size(101, 15); - this.label39.TabIndex = 12; - this.label39.Text = "艦名の最大横幅:"; + this.FormFleet_ShowAirSuperiorityRange.AutoSize = true; + this.FormFleet_ShowAirSuperiorityRange.Location = new System.Drawing.Point(6, 213); + this.FormFleet_ShowAirSuperiorityRange.Name = "FormFleet_ShowAirSuperiorityRange"; + this.FormFleet_ShowAirSuperiorityRange.Size = new System.Drawing.Size(150, 19); + this.FormFleet_ShowAirSuperiorityRange.TabIndex = 17; + this.FormFleet_ShowAirSuperiorityRange.Text = "制空戦力を範囲表示する"; + this.ToolTipInfo.SetToolTip(this.FormFleet_ShowAirSuperiorityRange, "制空戦力の範囲を「内部熟練度最小~最大」として範囲表示するかを指定します。\r\n通常、制空戦力は最低の内部熟練度を持つとして計算されます。"); + this.FormFleet_ShowAirSuperiorityRange.UseVisualStyleBackColor = true; // // DialogConfiguration // @@ -2719,8 +2732,10 @@ private void InitializeComponent() { ((System.ComponentModel.ISupportInitialize)(this.FormFleet_FixedShipNameWidth)).EndInit(); this.tabPage9.ResumeLayout(false); this.tabPage9.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.FormArsenal_MaxShipNameWidth)).EndInit(); this.tabPage19.ResumeLayout(false); this.tabPage19.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.FormDock_MaxShipNameWidth)).EndInit(); this.tabPage16.ResumeLayout(false); this.tabPage16.PerformLayout(); this.tabPage18.ResumeLayout(false); @@ -2757,8 +2772,6 @@ private void InitializeComponent() { this.tabPage17.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.BGMPlayer_VolumeAll)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.BGMPlayer_ControlGrid)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.FormDock_MaxShipNameWidth)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.FormArsenal_MaxShipNameWidth)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -2971,5 +2984,6 @@ private void InitializeComponent() { private System.Windows.Forms.NumericUpDown FormDock_MaxShipNameWidth; private System.Windows.Forms.Label label38; private System.Windows.Forms.Label label39; + private System.Windows.Forms.CheckBox FormFleet_ShowAirSuperiorityRange; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.cs b/ElectronicObserver/Window/Dialog/DialogConfiguration.cs index 467ed7089..fded1e0c9 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.cs +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.cs @@ -358,6 +358,7 @@ public void FromConfiguration( Configuration.ConfigurationData config ) { FormFleet_BlinkAtCompletion.Checked = config.FormFleet.BlinkAtCompletion; FormFleet_ShowConditionIcon.Checked = config.FormFleet.ShowConditionIcon; FormFleet_FixedShipNameWidth.Value = config.FormFleet.FixedShipNameWidth; + FormFleet_ShowAirSuperiorityRange.Checked = config.FormFleet.ShowAirSuperiorityRange; FormHeadquarters_BlinkAtMaximum.Checked = config.FormHeadquarters.BlinkAtMaximum; FormHeadquarters_Visibility.Items.Clear(); @@ -578,6 +579,7 @@ public void ToConfiguration( Configuration.ConfigurationData config ) { config.FormFleet.BlinkAtCompletion = FormFleet_BlinkAtCompletion.Checked; config.FormFleet.ShowConditionIcon = FormFleet_ShowConditionIcon.Checked; config.FormFleet.FixedShipNameWidth = (int)FormFleet_FixedShipNameWidth.Value; + config.FormFleet.ShowAirSuperiorityRange = FormFleet_ShowAirSuperiorityRange.Checked; config.FormHeadquarters.BlinkAtMaximum = FormHeadquarters_BlinkAtMaximum.Checked; { diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.resx b/ElectronicObserver/Window/Dialog/DialogConfiguration.resx index 3ba630777..872f1d224 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.resx +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.resx @@ -120,9 +120,6 @@ 17, 17 - - 17, 17 - True diff --git a/ElectronicObserver/Window/FormBaseAirCorps.cs b/ElectronicObserver/Window/FormBaseAirCorps.cs index f7eb3303d..0de7d8ea1 100644 --- a/ElectronicObserver/Window/FormBaseAirCorps.cs +++ b/ElectronicObserver/Window/FormBaseAirCorps.cs @@ -176,7 +176,16 @@ public void Update( int baseAirCorpsID ) { { int airSuperiority = Calculator.GetAirSuperiority( corps ); - AirSuperiority.Text = airSuperiority.ToString(); + if ( Utility.Configuration.Config.FormFleet.ShowAirSuperiorityRange ) { + int airSuperiority_max = Calculator.GetAirSuperiority( corps, true ); + if ( airSuperiority < airSuperiority_max ) + AirSuperiority.Text = string.Format( "{0} ~ {1}", airSuperiority, airSuperiority_max ); + else + AirSuperiority.Text = airSuperiority.ToString(); + } else { + AirSuperiority.Text = airSuperiority.ToString(); + } + ToolTipInfo.SetToolTip( AirSuperiority, string.Format( "確保: {0}\r\n優勢: {1}\r\n均衡: {2}\r\n劣勢: {3}\r\n", (int)( airSuperiority / 3.0 ), diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index 19c6a9fd6..cc9a49afa 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -174,7 +174,7 @@ public void Update( FleetData fleet ) { { int airSuperiority = fleet.GetAirSuperiority(); bool includeLevel = Utility.Configuration.Config.FormFleet.AirSuperiorityMethod == 1; - AirSuperiority.Text = airSuperiority.ToString(); + AirSuperiority.Text = fleet.GetAirSuperiorityString(); ToolTipInfo.SetToolTip( AirSuperiority, string.Format( "確保: {0}\r\n優勢: {1}\r\n均衡: {2}\r\n劣勢: {3}\r\n({4}: {5})\r\n", (int)( airSuperiority / 3.0 ), @@ -596,18 +596,29 @@ private string GetEquipmentString( ShipData ship ) { } { - int airsup; - if ( Utility.Configuration.Config.FormFleet.AirSuperiorityMethod == 1 ) - airsup = Calculator.GetAirSuperiority( ship ); - else - airsup = Calculator.GetAirSuperiorityIgnoreLevel( ship ); + int airsup_min; + int airsup_max; + if ( Utility.Configuration.Config.FormFleet.AirSuperiorityMethod == 1 ) { + airsup_min = Calculator.GetAirSuperiority( ship, false ); + airsup_max = Calculator.GetAirSuperiority( ship, true ); + } else { + airsup_min = airsup_max = Calculator.GetAirSuperiorityIgnoreLevel( ship ); + } int airbattle = ship.AirBattlePower; - if ( airsup > 0 ) { + if ( airsup_min > 0 ) { + + string airsup_str; + if ( Utility.Configuration.Config.FormFleet.ShowAirSuperiorityRange && airsup_min < airsup_max ) { + airsup_str = string.Format( "{0} ~ {1}", airsup_min, airsup_max ); + } else { + airsup_str = airsup_min.ToString(); + } + if ( airbattle > 0 ) - sb.AppendFormat( "制空戦力: {0} / 航空威力: {1}\r\n", airsup, airbattle ); + sb.AppendFormat( "制空戦力: {0} / 航空威力: {1}\r\n", airsup_str, airbattle ); else - sb.AppendFormat( "制空戦力: {0}\r\n", airsup ); + sb.AppendFormat( "制空戦力: {0}\r\n", airsup_str ); } else if ( airbattle > 0 ) sb.AppendFormat( "航空威力: {0}\r\n", airbattle ); } From 3d3286c15ddb587eb9d95146b855d1c0964ef064 Mon Sep 17 00:00:00 2001 From: Andante Date: Tue, 18 Apr 2017 05:32:18 +0900 Subject: [PATCH 08/16] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Other/Information/apilist.txt | 82 ++++++++++++++++++- .../Other/Information/kcmemo.md | 31 +++++-- 2 files changed, 103 insertions(+), 10 deletions(-) diff --git a/ElectronicObserver/Other/Information/apilist.txt b/ElectronicObserver/Other/Information/apilist.txt index 31918dfb9..0aa8d15c6 100644 --- a/ElectronicObserver/Other/Information/apilist.txt +++ b/ElectronicObserver/Other/Information/apilist.txt @@ -1,6 +1,6 @@ 艦これ APIリスト -2014/08夏イベント~2015/11ごろのAPIの情報を参照 +2014/08夏イベント~のAPIの情報を参照 未記入は不明か使いどころなし 推測・噂で書いてある点も多々ある、信じすぎないこと 基本的に戦闘APIはapi_req_sortie/battleを参照すること。他の戦闘系APIの説明は情報が古い可能性がある、差分だけチェックすること @@ -13,7 +13,79 @@ api_start2 :艦娘・装備固有データその他 api_sortno :図鑑番号 api_name :艦娘名 api_yomi :艦娘名読み - api_stype :艦種 + api_stype :艦種ID + api_ctype :艦型ID 以下図鑑より + 1=綾波型, 深海棲艦 + 2=伊勢型 + 3=加賀型 + 4=球磨型 + 5=暁型 + 6=金剛型 + 7=古鷹型 + 8=高雄型 + 9=最上型 + 10=初春型 + 11=祥鳳型 + 12=吹雪型 + 13=青葉型 + 14=赤城型 + 15=千歳型 + 16=川内型 + 17=蒼龍型 + 18=朝潮型 + 19=長門型 + 20=長良型 + 21=天龍型 + 22=島風型 + 23=白露型 + 24=飛鷹型 + 25=飛龍型 + 26=扶桑型 + 27=鳳翔型 + 28=睦月型 + 29=妙高型 + 30=陽炎型 + 31=利根型 + 32=龍驤型 + 33=翔鶴型 + 34=夕張型 + 35=海大VI型 + 36=巡潜乙型改二 + 37=大和型 + 38=夕雲型 + 39=巡潜乙型 + 40=巡潜3型 + 41=阿賀野型 + 42=(欠番) + 43=大鳳型 + 44=潜特型(伊400型潜水艦) + 45=特種船丙型 + 46=三式潜航輸送艇 + 47=Bismarck級 + 48=Z1型 + 49=工作艦 + 50=大鯨型 + 51=龍鳳型 + 52=大淀型 + 53=雲龍型 + 54=秋月型 + 55=Admiral Hipper級 + 56=香取型 + 57=UボートIXC型/呂号潜水艦 + 58=V.Veneto級 + 59=秋津洲型 + 60=改風早型 + 61=Maestrale級 + 62=瑞穂型 + 63=Graf Zeppelin級 + 64=Zara級 + 65=Iowa級 + 66=神風型 + 67=Queen Elizabeth級 + 68=Aquila級 + 69=Lexington級 + 70=C.Teste級 + 71=巡潜甲型改二 api_afterlv :改装Lv api_aftershipid :改装後ID 文字列 "0"=なし api_taik :耐久 [0]=初期値, [1]=最大値 @@ -74,6 +146,10 @@ api_start2 :艦娘・装備固有データその他 api_mst_equip_exslot:補強スロットに装備可能なカテゴリ + api_mst_equip_exslot_ship :拡張スロットへの特殊装備 + api_slotitem_id :装備ID + api_ship_ids :対象となる艦娘ID [] + api_mst_stype :艦船カテゴリ api_id :カテゴリID(艦船のstypeに対応) api_sortno :並べ替え順 @@ -177,6 +253,7 @@ api_start2 :艦娘・装備固有データその他 40=Jet Fighting Bomber 41=Transport Materials 42=Submarine Equipment + 43=Multi-purpose Seaplane 1=主砲 2=副砲 @@ -217,6 +294,7 @@ api_start2 :艦娘・装備固有データその他 40=噴式戦闘爆撃機 41=輸送機材 42=潜水艦装備 + 43=多用途水上機/水上爆撃機 [2]:カテゴリ (api_mst_slotitem_equiptype を参照) diff --git a/ElectronicObserver/Other/Information/kcmemo.md b/ElectronicObserver/Other/Information/kcmemo.md index 189dc848d..b322d0fa5 100644 --- a/ElectronicObserver/Other/Information/kcmemo.md +++ b/ElectronicObserver/Other/Information/kcmemo.md @@ -5,6 +5,10 @@ 2000≦price<20000 とくに特別なフラグはない。 +また、ダイナミック家具割引が有効になる条件は、 +price≧100000 +値引き後は `int( ( price - 100000 ) * 0.1 )` になる。 + #### ケッコンカッコカリ後の耐久値 ケッコン前の最大耐久値及び「最大耐久値の最大値」にのみ依存する。艦種や艦型、ケッコンのタイミングなどの影響は受けない。 @@ -951,6 +955,7 @@ Bismarck dreiに対する魚雷装備・試製51cm連装砲といったものの |264|「空母機動部隊」西へ!|4-2ボスS勝利1|要(空母or軽母)2/駆逐2 |266|「水上反撃部隊」突入せよ!|2-5ボスS勝利1|要駆逐旗艦、重巡1軽巡1駆逐4 |822|沖ノ島海域迎撃戦|2-4ボスS勝利2|クォータリー(その他扱い) +|854|戦果拡張任務!「Z作戦」前段作戦|2-4・6-1・6-3ボスA勝利各1、6-4ボスS勝利1?|クォータリー |303|「演習」で練度向上!|演習3 |304|「演習」で他提督を圧倒せよ!|演習勝利5 |302|大規模演習|演習勝利20 @@ -1006,6 +1011,8 @@ Bismarck dreiに対する魚雷装備・試製51cm連装砲といったものの * 652: 「特注家具」の調達 * 653: 節分特別任務:節分準備! * 655: 「彩雲」輸送分解 +* 656: 六三一空「晴嵐」隊の編成 +* 659: 精鋭「水戦」隊の新編成 以上の任務には、このような特性が存在する。 @@ -1395,17 +1402,25 @@ Lv. 3 の離島棲鬼には装甲破壊効果はないのではないかと思 両方持っている状態で発動した時、必ずどちらも発動する。(どちらか1つだけ発動することはない)。 大本営曰く併用でより効果が上がるようだが、未検証。 -#### 改装時に必要な開発資材 +#### 改装時に必要な特殊資材 + +##### 開発資材 + +基本的には、改装に必要な鋼材の量に依存する。 -改装に必要な鋼材の量に依存する。 -なお、設計図を1枚以上消費する改装においては常に 0 となる。 +``` +if ( 改装設計図が必要 && 鈴谷改二への改装ではない ) + return 0; +else if ( 鋼材 < 4500 ) return 0; +else if ( 鋼材 < 5500 ) return 10; +else if ( 鋼材 < 6500 ) return 15; +else return 20; +``` -* < 4500 : 0 -* < 5500 : 10 -* < 6500 : 15 -* ≧ 6500 : 20 +##### 高速建造材 -2015/10/21現在、あてはまるのは翔鶴改二(甲)及び瑞鶴改二(甲)のみ。 +ソースコード中に決め打ちされている。 +鈴谷改二, 鈴谷航改二が 20 、 それ以外は 0 。 #### 編成登録・展開の挙動 From 0e11bbd6e9b2f7c6eb84e751f7853950faa77145 Mon Sep 17 00:00:00 2001 From: Andante Date: Fri, 21 Apr 2017 01:10:29 +0900 Subject: [PATCH 09/16] =?UTF-8?q?=E3=83=96=E3=83=A9=E3=82=A6=E3=82=B6?= =?UTF-8?q?=EF=BC=9A=E3=82=AD=E3=83=A3=E3=83=83=E3=82=B7=E3=83=A5=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E3=81=AB=E3=82=BF=E3=82=A4=E3=83=A0=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E6=99=82=E9=96=93=E3=82=92=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * フリーズ対策 --- Browser/FormBrowser.cs | 22 ++++++++++++------- .../Other/Information/kcmemo.md | 5 +++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Browser/FormBrowser.cs b/Browser/FormBrowser.cs index 41491389a..95695d88e 100644 --- a/Browser/FormBrowser.cs +++ b/Browser/FormBrowser.cs @@ -587,7 +587,7 @@ public void SetProxy( string proxy ) { /// /// キャッシュを削除します。 /// - private void ClearCache() { + private bool ClearCache( long timeoutMilliseconds = 5000 ) { const int CACHEGROUP_SEARCH_ALL = 0x0; const int ERROR_NO_MORE_ITEMS = 259; @@ -605,7 +605,7 @@ private void ClearCache() { enumHandle = FindFirstUrlCacheGroup( 0, CACHEGROUP_SEARCH_ALL, IntPtr.Zero, 0, ref groupId, IntPtr.Zero ); if ( enumHandle != IntPtr.Zero && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error() ) - return; + return true; /*/ while ( true ) { @@ -621,13 +621,15 @@ private void ClearCache() { enumHandle = FindFirstUrlCacheEntry( null, IntPtr.Zero, ref cacheEntryInfoBufferSizeInitial ); if ( enumHandle != IntPtr.Zero && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error() ) - return; + return true; cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial; cacheEntryInfoBuffer = Marshal.AllocHGlobal( cacheEntryInfoBufferSize ); enumHandle = FindFirstUrlCacheEntry( null, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial ); - while ( true ) { + + Stopwatch sw = Stopwatch.StartNew(); + while ( sw.ElapsedMilliseconds < timeoutMilliseconds ) { var internetCacheEntry = (INTERNET_CACHE_ENTRY_INFOA)Marshal.PtrToStructure( cacheEntryInfoBuffer, typeof( INTERNET_CACHE_ENTRY_INFOA ) ); cacheEntryInfoBufferSizeInitial = cacheEntryInfoBufferSize; @@ -651,10 +653,11 @@ private void ClearCache() { returnValue = FindNextUrlCacheEntry( enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial ); } } - - + sw.Stop(); Marshal.FreeHGlobal( cacheEntryInfoBuffer ); + + return sw.ElapsedMilliseconds < timeoutMilliseconds; } @@ -897,8 +900,11 @@ private void ToolMenu_Other_ClearCache_Click( object sender, EventArgs e ) { == System.Windows.Forms.DialogResult.OK ) { BeginInvoke( (MethodInvoker)( () => { - ClearCache(); - MessageBox.Show( "キャッシュの削除が完了しました。", "削除完了", MessageBoxButtons.OK, MessageBoxIcon.Information ); + bool succeeded = ClearCache(); + if ( succeeded ) + MessageBox.Show( "キャッシュの削除が完了しました。", "削除完了", MessageBoxButtons.OK, MessageBoxIcon.Information ); + else + MessageBox.Show( "時間がかかりすぎたため、キャッシュの削除を中断しました。\r\n削除しきれていない可能性があります。", "削除中断", MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); } ) ); } diff --git a/ElectronicObserver/Other/Information/kcmemo.md b/ElectronicObserver/Other/Information/kcmemo.md index b322d0fa5..17a8e93a2 100644 --- a/ElectronicObserver/Other/Information/kcmemo.md +++ b/ElectronicObserver/Other/Information/kcmemo.md @@ -46,6 +46,8 @@ value = min + ceil( ( max - min ) * ( 0.4 or 0.8 ) * Lv / 99 ) クリスマス・年末・正月に衣装替えした艦娘のデータは ID 901 以降に保存されており、図鑑からのみ参照できる。 ~~なお、システム内では 501 以降の艦は深海棲艦として扱われるため、一応深海棲艦扱い。~~ 現在は修正済。 +> 2017/04/05 現在、ID: 900-1000 の領域がほぼ枯渇状態にあるため、新しい衣替え艦娘は ID: 900 から降順に追加されていっている。 + 2015/07/17アップデートによって、艦船マスターデータ(`api_mst_ship`)からデータが削除された。 `api_mst_shipgraph` からのみアクセス可能となった。 @@ -53,6 +55,9 @@ value = min + ceil( ( max - min ) * ( 0.4 or 0.8 ) * Lv / 99 ) 理由としては、これらの艦娘には 900 以下のIDが降られており、クライアントに送信するマスターデータのフィルタ処理(ex. ID > 900 の艦娘は送信しない)から抜けてしまったものと考えられる。 (なお、2016/05/03現在、従来の衣替え艦娘領域( 900 < ID < 1000 )はほぼ枯渇状態にある。それがID移動の原因かと考えられる。 ) +2017/04/05 アップデートにより、敵艦IDの先頭が 501 → 1501 に変更された。それに伴ってフィルタ処理が変更されたのか、衣替え艦娘のデータがマスターから消滅した。 +引き続き図鑑や `api_start2` の画像位置設定からは参照可能。 + 以下に 2017/03/01 時点における ID と対応する艦娘及び衣装を示す。なお、ID: 900 以降の名称については(参照できないため)公式のものではない。 |ID|艦名| From 7d875008b546175dc763791639550ab69fa94a07 Mon Sep 17 00:00:00 2001 From: CNA-Bld Date: Fri, 21 Apr 2017 02:14:10 +0800 Subject: [PATCH 10/16] Move setting Text to constructor --- ElectronicObserver/Window/FormMain.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ElectronicObserver/Window/FormMain.cs b/ElectronicObserver/Window/FormMain.cs index 55426b337..c385ab9e9 100644 --- a/ElectronicObserver/Window/FormMain.cs +++ b/ElectronicObserver/Window/FormMain.cs @@ -69,6 +69,8 @@ public partial class FormMain : Form { public FormMain() { InitializeComponent(); + + this.Text = SoftwareInformation.VersionJapanese; } private async void FormMain_Load( object sender, EventArgs e ) { @@ -95,8 +97,6 @@ private async void FormMain_Load( object sender, EventArgs e ) { Utility.Logger.Add( 2, SoftwareInformation.SoftwareNameJapanese + " を起動しています…" ); - this.Text = SoftwareInformation.VersionJapanese; - ResourceManager.Instance.Load(); RecordManager.Instance.Load(); KCDatabase.Instance.Load(); From 5e8d2965215896d7c1befd7b47fd54e3b0026ed3 Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 22 Apr 2017 21:49:04 +0900 Subject: [PATCH 11/16] =?UTF-8?q?=E8=89=A6=E9=9A=8A=E6=A6=82=E8=A6=81?= =?UTF-8?q?=EF=BC=9A=E5=88=B6=E7=A9=BA=E5=80=A4=E3=81=A8=E7=B4=A2=E6=95=B5?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=E3=81=AE=E5=90=88=E8=A8=88=E5=80=A4=E3=81=AE?= =?UTF-8?q?=E3=83=84=E3=83=BC=E3=83=AB=E3=83=81=E3=83=83=E3=83=97=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 艦隊:古い索敵式の値をツールチップから除去 --- ElectronicObserver/Window/FormFleet.cs | 6 +---- .../Window/FormFleetOverview.cs | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index cc9a49afa..d35c53237 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -193,11 +193,7 @@ public void Update( FleetData fleet ) { double probStart = fleet.GetContactProbability(); var probSelect = fleet.GetContactSelectionProbability(); - sb.AppendFormat( "(旧)2-5式: {0}\r\n2-5式(秋): {1}\r\n2-5新秋簡易式: {2}\r\n判定式(33): {3}\r\n新判定式(33):\r\n 分岐点係数1: {4:f2}\r\n 分岐点係数3: {5:f2}\r\n 分岐点係数4: {6:f2}\r\n\r\n触接開始率: \r\n 確保 {7:p1} / 優勢 {8:p1}\r\n", - fleet.GetSearchingAbilityString( 0 ), - fleet.GetSearchingAbilityString( 1 ), - fleet.GetSearchingAbilityString( 2 ), - fleet.GetSearchingAbilityString( 3 ), + sb.AppendFormat( "新判定式(33):\r\n 分岐点係数1: {0:f2}\r\n 分岐点係数3: {1:f2}\r\n 分岐点係数4: {2:f2}\r\n\r\n触接開始率: \r\n 確保 {3:p1} / 優勢 {4:p1}\r\n", Math.Floor( Calculator.GetSearchingAbility_New33( fleet, 1 ) * 100 ) / 100, Math.Floor( Calculator.GetSearchingAbility_New33( fleet, 3 ) * 100 ) / 100, Math.Floor( Calculator.GetSearchingAbility_New33( fleet, 4 ) * 100 ) / 100, diff --git a/ElectronicObserver/Window/FormFleetOverview.cs b/ElectronicObserver/Window/FormFleetOverview.cs index 21a6019fb..5e6c4f74e 100644 --- a/ElectronicObserver/Window/FormFleetOverview.cs +++ b/ElectronicObserver/Window/FormFleetOverview.cs @@ -251,15 +251,23 @@ private void Updated( string apiname, dynamic data ) { if ( KCDatabase.Instance.Fleet.CombinedFlag > 0 ) { CombinedTag.Text = Constants.GetCombinedFleet( KCDatabase.Instance.Fleet.CombinedFlag ); - - int tp = Calculator.GetTPDamage( KCDatabase.Instance.Fleet[1] ) + Calculator.GetTPDamage( KCDatabase.Instance.Fleet[2] ); - - ToolTipInfo.SetToolTip( CombinedTag, string.Format( "ドラム缶搭載: {0}個\r\n大発動艇搭載: {1}個\r\n輸送量(TP): S {2} / A {3}\r\n", - KCDatabase.Instance.Fleet[1].MembersWithoutEscaped.Sum( s => s == null ? 0 : s.AllSlotInstanceMaster.Count( eq => eq != null && eq.CategoryType == 30 ) ) + - KCDatabase.Instance.Fleet[2].MembersWithoutEscaped.Sum( s => s == null ? 0 : s.AllSlotInstanceMaster.Count( eq => eq != null && eq.CategoryType == 30 ) ), - KCDatabase.Instance.Fleet[1].MembersWithoutEscaped.Sum( s => s == null ? 0 : s.AllSlotInstanceMaster.Count( eq => eq != null && eq.CategoryType == 24 ) ) + - KCDatabase.Instance.Fleet[2].MembersWithoutEscaped.Sum( s => s == null ? 0 : s.AllSlotInstanceMaster.Count( eq => eq != null && eq.CategoryType == 24 ) ), - tp, (int)Math.Floor( tp * 0.7 ) + var fleet1 = KCDatabase.Instance.Fleet[1]; + var fleet2 = KCDatabase.Instance.Fleet[2]; + + int tp = Calculator.GetTPDamage( fleet1 ) + Calculator.GetTPDamage( fleet2 ); + + ToolTipInfo.SetToolTip( CombinedTag, string.Format( "ドラム缶搭載: {0}個\r\n大発動艇搭載: {1}個\r\n輸送量(TP): S {2} / A {3}\r\n\r\n制空戦力合計: {4}\r\n索敵能力合計: {5:f2}\r\n新判定式(33):\r\n 分岐点係数1: {6:f2}\r\n 分岐点係数3: {7:f2}\r\n 分岐点係数4: {8:f2}", + fleet1.MembersWithoutEscaped.Sum( s => s == null ? 0 : s.AllSlotInstanceMaster.Count( eq => eq != null && eq.CategoryType == 30 ) ) + + fleet2.MembersWithoutEscaped.Sum( s => s == null ? 0 : s.AllSlotInstanceMaster.Count( eq => eq != null && eq.CategoryType == 30 ) ), + fleet1.MembersWithoutEscaped.Sum( s => s == null ? 0 : s.AllSlotInstanceMaster.Count( eq => eq != null && eq.CategoryType == 24 ) ) + + fleet2.MembersWithoutEscaped.Sum( s => s == null ? 0 : s.AllSlotInstanceMaster.Count( eq => eq != null && eq.CategoryType == 24 ) ), + tp, + (int)Math.Floor( tp * 0.7 ), + Calculator.GetAirSuperiority( fleet1 ) + Calculator.GetAirSuperiority( fleet2 ), + Math.Floor( fleet1.GetSearchingAbility() * 100 ) / 100 + Math.Floor( fleet2.GetSearchingAbility() * 100 ) / 100, + Math.Floor( Calculator.GetSearchingAbility_New33( fleet1, 1 ) * 100 ) / 100 + Math.Floor( Calculator.GetSearchingAbility_New33( fleet2, 1 ) * 100 ) / 100, + Math.Floor( Calculator.GetSearchingAbility_New33( fleet1, 3 ) * 100 ) / 100 + Math.Floor( Calculator.GetSearchingAbility_New33( fleet2, 3 ) * 100 ) / 100, + Math.Floor( Calculator.GetSearchingAbility_New33( fleet1, 4 ) * 100 ) / 100 + Math.Floor( Calculator.GetSearchingAbility_New33( fleet2, 4 ) * 100 ) / 100 ) ); From 78ab30712dba4ff3877859fd70290d9784ce31ee Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 22 Apr 2017 22:35:48 +0900 Subject: [PATCH 12/16] =?UTF-8?q?=E3=81=84=E3=82=89=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=A4=89=E6=95=B0=E3=83=BB=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E3=81=AE=E5=89=8A=E9=99=A4=E3=81=A8=E8=AA=AC=E6=98=8E=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Utility/FleetImageGenerator.cs | 415 +++++++----------- 1 file changed, 147 insertions(+), 268 deletions(-) diff --git a/ElectronicObserver/Utility/FleetImageGenerator.cs b/ElectronicObserver/Utility/FleetImageGenerator.cs index 46e0d4b06..031f578ca 100644 --- a/ElectronicObserver/Utility/FleetImageGenerator.cs +++ b/ElectronicObserver/Utility/FleetImageGenerator.cs @@ -12,13 +12,17 @@ using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Runtime.InteropServices; +using System.Runtime.Serialization; +using ElectronicObserver.Utility.Storage; namespace ElectronicObserver.Utility { public class FleetImageGenerator { + /// 幅・高さともに int.MaxValue の Size protected static readonly Size MaxValueSize = new Size( int.MaxValue, int.MaxValue ); + // 各種画像リソースのサイズ protected static readonly Size ShipBannerSize = new Size( 160, 40 ); protected static readonly Size ShipCardSize = new Size( 218, 300 ); protected static readonly Size ShipCutinSize = new Size( 665, 121 ); @@ -28,6 +32,8 @@ public class FleetImageGenerator { protected static readonly Size EquipmentCardSize = new Size( 260, 260 ); protected static readonly Size EquipmentIconSize = new Size( 16, 16 ); + + // 各種画像リソースの CharacterID protected static readonly int ShipBannerNormalID = 1; protected static readonly int ShipBannerDamagedID = 3; protected static readonly int ShipCardNormalID = 5; @@ -41,220 +47,14 @@ public class FleetImageGenerator { - public static Bitmap GenerateImageTest() { - throw new NotImplementedException(); - } - - - protected static Size RenderShipTest( Bitmap bmp, Graphics g, FleetImageArgument args, Point origin, ShipData ship ) { - - var formatMiddleLeft = GetTextFormat( ContentAlignment.MiddleLeft ); - var formatMiddleCenter = GetTextFormat( ContentAlignment.MiddleCenter ); - var formatMiddleRight = GetTextFormat( ContentAlignment.MiddleRight ); - - Color mainColor = Color.FromArgb( 0xf0, 0xf0, 0xf0 ); - Color parameterNameColor = Color.Teal; - Color aircraftEnableColor = mainColor; - Color aircraftDisableColor = Color.Gray; - - Size shipNameSize = TextRenderer.MeasureText( g, "千代田航改二", args.LargeFont, MaxValueSize, formatMiddleLeft ); - Size equipmentNameSize = TextRenderer.MeasureText( g, "三式戦 飛燕一型丁", args.MediumFont, MaxValueSize, formatMiddleLeft ); - Size parameterSize = TextRenderer.MeasureText( g, "999", args.MediumFont, MaxValueSize, formatMiddleRight ); - Size levelSize = TextRenderer.MeasureText( g, "Lv", args.SmallFont, MaxValueSize, formatMiddleLeft ); - Size parameterNameSize = TextRenderer.MeasureText( g, "耐久", args.SmallFont, MaxValueSize, formatMiddleCenter ); - - Size nameAreaSize = new Size( shipNameSize.Width + levelSize.Width + parameterSize.Width, Max( shipNameSize.Height, levelSize.Height, parameterSize.Height ) ); - Size equipmentAreaUnitSize = new Size( parameterSize.Width + EquipmentIconSize.Width + equipmentNameSize.Width, Max( parameterSize.Height, EquipmentIconSize.Height, equipmentNameSize.Height ) ); - Size equipmentAreaSize = new Size( equipmentAreaUnitSize.Width, equipmentAreaUnitSize.Height * 6 ); - Size parameterAreaUnitSize = new Size( EquipmentIconSize.Width + parameterNameSize.Width + parameterSize.Width, Max( EquipmentIconSize.Height + parameterNameSize.Height + parameterSize.Height ) ); - Size parameterAreaSize = new Size( parameterAreaUnitSize.Width * 2, parameterAreaUnitSize.Height * 6 ); - - Size leftPaneSize = new Size( Max( nameAreaSize.Width, equipmentAreaSize.Width, parameterSize.Width ), nameAreaSize.Height + equipmentAreaSize.Height + parameterSize.Height ); - - Size entireSize = new Size( leftPaneSize.Width + ShipCardSize.Width, Max( leftPaneSize.Height, ShipCardSize.Height ) ); - - - Point ptr = new Point( origin.X, origin.Y ); - TextRenderer.DrawText( g, ship.Name, args.LargeFont, new Rectangle( ptr.X, ptr.Y, shipNameSize.Width, nameAreaSize.Height ), mainColor, formatMiddleLeft ); - ptr.X += leftPaneSize.Width - levelSize.Width - parameterSize.Width; - TextRenderer.DrawText( g, "Lv", args.SmallFont, new Rectangle( ptr.X, ptr.Y, levelSize.Width, nameAreaSize.Height ), parameterNameColor, formatMiddleLeft ); - ptr.X -= levelSize.Width; - TextRenderer.DrawText( g, ship.Level.ToString(), args.SmallFont, new Rectangle( ptr.X, ptr.Y, parameterSize.Width, nameAreaSize.Height ), mainColor, formatMiddleRight ); - - ptr.X = origin.X; - ptr.Y += nameAreaSize.Height; - - - for ( int i = 0; i < 6; i++ ) { - - int aircraftCurrent, aircraftMax; - EquipmentData eq; - bool isInvalid; - - if ( i < 5 ) { - aircraftCurrent = ship.Aircraft[i]; - aircraftMax = ship.MasterShip.Aircraft[i]; - eq = ship.SlotInstance[i]; - isInvalid = i >= ship.SlotSize; - } else { - aircraftCurrent = aircraftMax = 0; - eq = ship.ExpansionSlotInstance; - isInvalid = ship.IsExpansionSlotAvailable; - } - - ptr.X = origin.X; - - // aircraft slot - if ( !isInvalid ) { - if ( aircraftMax > 0 ) { - Color col; - if ( Calculator.IsAircraft( eq == null ? -1 : eq.EquipmentID, true, true ) ) { - col = aircraftEnableColor; - } else { - col = aircraftDisableColor; - } - - TextRenderer.DrawText( g, aircraftMax.ToString(), args.SmallFont, new Rectangle( ptr.X, ptr.Y, parameterSize.Width, equipmentAreaUnitSize.Height ), col, formatMiddleRight ); - } - - ptr.X += parameterSize.Width; - } - - - // icon - { - int index; - - if ( eq == null ) { - if ( isInvalid ) - index = (int)ResourceManager.EquipmentContent.Locked; - else - index = (int)ResourceManager.EquipmentContent.Nothing; - } else if ( (int)ResourceManager.EquipmentContent.Nothing < eq.MasterEquipment.IconType && eq.MasterEquipment.IconType < (int)ResourceManager.EquipmentContent.Locked ) { - index = eq.MasterEquipment.IconType; - } else { - index = (int)ResourceManager.EquipmentContent.Unknown; - } - - g.DrawImage( ResourceManager.Instance.Equipments.Images[index], ptr.X, ptr.Y + equipmentAreaUnitSize.Height / 2 - EquipmentIconSize.Height / 2 ); - - ptr.X += EquipmentIconSize.Width; - } - - // equipment name - { - TextRenderer.DrawText( g, eq.Name, args.MediumFont, new Rectangle( ptr.X, ptr.Y, equipmentNameSize.Width, equipmentAreaUnitSize.Height ), mainColor, formatMiddleRight ); - } - - ptr.Y += parameterAreaUnitSize.Height; - } - - - ptr.X = origin.X; - - - var parameterList = new[] { - new { - image = (int)ResourceManager.IconContent.ParameterHP, - name = "耐久", - value = ship.HPMax.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterFirepower, - name = "火力", - value = ship.FirepowerTotal.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterArmor, - name = "装甲", - value = ship.ArmorTotal.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterTorpedo, - name = "雷装", - value = ship.TorpedoTotal.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterEvasion, - name = "回避", - value = ship.EvasionTotal.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterAA, - name = "対空", - value = ship.AATotal.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterAircraft, - name = "搭載", - value = ship.MasterShip.AircraftTotal.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterASW, - name = "対潜", - value = ship.ASWTotal.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterSpeed, - name = "速力", - value = Constants.GetSpeed( ship.Speed ), - }, - new { - image = (int)ResourceManager.IconContent.ParameterLOS, - name = "索敵", - value = ship.LOSTotal.ToString(), - }, - new { - image = (int)ResourceManager.IconContent.ParameterRange, - name = "射程", - value = Constants.GetRange( ship.Range ), - }, - new { - image = (int)ResourceManager.IconContent.ParameterLuck, - name = "運", - value = ship.LuckTotal.ToString(), - }, - }; - - - for ( int i = 0; i < parameterList.Length; i++ ) { - Point pttr = new Point( ptr.X + parameterAreaUnitSize.Width * ( i % 2 ), ptr.Y + parameterAreaUnitSize.Height * ( i / 2 ) ); - - g.DrawImage( ResourceManager.Instance.Icons.Images[parameterList[i].image], pttr.X, pttr.Y + parameterAreaUnitSize.Height / 2 - EquipmentIconSize.Height / 2 ); - pttr.X += EquipmentIconSize.Width; - - TextRenderer.DrawText( g, parameterList[i].name, args.SmallFont, new Rectangle( pttr.X, pttr.Y, parameterNameSize.Width, parameterAreaUnitSize.Height ), parameterNameColor, formatMiddleCenter ); - pttr.X += parameterNameSize.Width; - - TextRenderer.DrawText( g, parameterList[i].value, args.MediumFont, new Rectangle( pttr.X, pttr.Y, parameterSize.Width, parameterAreaUnitSize.Height ), mainColor, formatMiddleRight ); - } + private FleetImageGenerator() { } - ptr.X = origin.X + leftPaneSize.Width; - ptr.Y = origin.Y; - - try { - string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + ship.MasterShip.ResourceName + ".swf"; - if ( System.IO.File.Exists( shipSwfPath ) ) { - - var shipSwf = new SwfParser(); - shipSwf.Parse( shipSwfPath ); - - var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == ShipCardNormalID ); - using ( var shipImage = imgtag.ExtractImage() ) { - g.DrawImage( shipImage, new Rectangle( ptr.X, ptr.Y, ShipCardSize.Width, ShipCardSize.Height ) ); - } - } - } catch ( Exception ) { - } - - return entireSize; - } - - - - public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { + /// + /// 詳細な情報を表示する、カード式の編成画像を出力します。 + /// + public static Bitmap GenerateCardBitmap( FleetImageArgument args ) { var formatMiddleLeft = GetStringFormat( ContentAlignment.MiddleLeft ); var formatMiddleCenter = GetStringFormat( ContentAlignment.MiddleCenter ); @@ -310,13 +110,9 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { Padding shipNameAreaMargin = new Padding( 0, 0, 0, 2 ); Padding equipmentAreaMargin = new Padding( 0, 0, 0, 2 ); Padding parameterAreaMargin = new Padding( 0, 0, 0, 2 ); - Padding shipValuePaneMargin = new Padding(); - Padding shipImagePaneMargin = new Padding(); Padding shipPaneUnitMargin = new Padding( 2 ); - Padding shipPaneMargin = new Padding(); Padding fleetParameterAreaMargin = new Padding( 8, 0, 0, 4 ); Padding fleetPaneUnitMargin = new Padding( 4 ); - Padding fleetPaneMargin = new Padding(); Padding titleMargin = new Padding( 0, 0, 0, 2 ); Padding commentMargin = new Padding( 2 ); Padding commentPadding = new Padding( 2 ); @@ -331,7 +127,7 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { Size shipValuePaneSize = MaxWidthSumHeight( shipNameAreaSize + shipNameAreaMargin.Size, equipmentAreaSize + equipmentAreaMargin.Size, parameterAreaSize + parameterAreaMargin.Size ); Size shipImagePaneSize = ShipCardSize; - Size shipPaneUnitSize = SumWidthMaxHeight( shipValuePaneSize + shipValuePaneMargin.Size, shipImagePaneSize + shipImagePaneMargin.Size ); + Size shipPaneUnitSize = SumWidthMaxHeight( shipValuePaneSize, shipImagePaneSize ); Size shipPaneSize = new Size( ( shipPaneUnitSize.Width + shipPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalShipCount, 6 ), ( shipPaneUnitSize.Height + shipPaneUnitMargin.Vertical ) * (int)Math.Ceiling( 6.0 / args.HorizontalShipCount ) ); @@ -341,11 +137,11 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { EquipmentIconSize, fleetSearchingAbilityTitleSize, fleetSearchingAbilityValueEstimatedSize ); Size fleetPaneUnitSize; - bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width + shipPaneMargin.Horizontal; + bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width; if ( isFleetNameAndParametersAreSameLine ) { - fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize + shipPaneMargin.Size ); + fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize ); } else { - fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize + shipPaneMargin.Size ); + fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize ); } Size fleetPaneSize = new Size( ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalFleetCount, args.FleetIDs.Length ), @@ -353,7 +149,7 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { Size commentAreaSize = commentSize + commentPadding.Size; - Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize + fleetPaneMargin.Size, commentAreaSize + commentMargin.Size ); + Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize, commentAreaSize + commentMargin.Size ); // anchor shipNameSize.Width = shipValuePaneSize.Width - shipIndexSize.Width - levelSize.Width - mediumDigit3Size.Width; @@ -615,7 +411,9 @@ public static Bitmap GenerateTestBitmap( FleetImageArgument args ) { - + /// + /// カットイン式の編成画像を出力します。 + /// public static Bitmap GenerateCutinBitmap( FleetImageArgument args ) { var formatMiddleLeft = GetStringFormat( ContentAlignment.MiddleLeft ); @@ -669,10 +467,8 @@ public static Bitmap GenerateCutinBitmap( FleetImageArgument args ) { Padding shipNameAreaMargin = new Padding( 0, 0, 0, 2 ); Padding equipmentAreaMargin = new Padding( 0, 0, 0, 2 ); Padding shipPaneUnitMargin = new Padding( 2 ); - Padding shipPaneMargin = new Padding(); Padding fleetParameterAreaMargin = new Padding( 8, 0, 0, 4 ); Padding fleetPaneUnitMargin = new Padding( 4 ); - Padding fleetPaneMargin = new Padding(); Padding titleMargin = new Padding( 0, 0, 0, 2 ); Padding commentMargin = new Padding( 2 ); Padding commentPadding = new Padding( 2 ); @@ -695,11 +491,11 @@ public static Bitmap GenerateCutinBitmap( FleetImageArgument args ) { EquipmentIconSize, fleetSearchingAbilityTitleSize, fleetSearchingAbilityValueEstimatedSize ); Size fleetPaneUnitSize; - bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width + shipPaneMargin.Horizontal; + bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width; if ( isFleetNameAndParametersAreSameLine ) { - fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize + shipPaneMargin.Size ); + fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize ); } else { - fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize + shipPaneMargin.Size ); + fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize ); } Size fleetPaneSize = new Size( ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalFleetCount, args.FleetIDs.Length ), @@ -707,7 +503,7 @@ public static Bitmap GenerateCutinBitmap( FleetImageArgument args ) { Size commentAreaSize = commentSize + commentPadding.Size; - Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize + fleetPaneMargin.Size, commentAreaSize + commentMargin.Size ); + Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize, commentAreaSize + commentMargin.Size ); Size equipmentNameSizeExtended = SumWidthMaxHeight( equipmentNameSize, equipmentLevelSize ); @@ -980,7 +776,9 @@ public static Bitmap GenerateCutinBitmap( FleetImageArgument args ) { - + /// + /// コンパクトにまとめた、バナー式の編成画像を出力します。 + /// public static Bitmap GenerateBannerBitmap( FleetImageArgument args ) { var formatMiddleLeft = GetStringFormat( ContentAlignment.MiddleLeft ); @@ -1033,10 +831,8 @@ public static Bitmap GenerateBannerBitmap( FleetImageArgument args ) { Padding shipNameAreaMargin = new Padding( 0, 0, 0, 2 ); Padding equipmentAreaMargin = new Padding( 0, 0, 0, 2 ); Padding shipPaneUnitMargin = new Padding( 2 ); - Padding shipPaneMargin = new Padding(); Padding fleetParameterAreaMargin = new Padding( 8, 0, 0, 4 ); Padding fleetPaneUnitMargin = new Padding( 4 ); - Padding fleetPaneMargin = new Padding(); Padding titleMargin = new Padding( 0, 0, 0, 2 ); Padding commentMargin = new Padding( 2 ); Padding commentPadding = new Padding( 2 ); @@ -1058,11 +854,11 @@ public static Bitmap GenerateBannerBitmap( FleetImageArgument args ) { EquipmentIconSize, fleetSearchingAbilityTitleSize, fleetSearchingAbilityValueEstimatedSize ); Size fleetPaneUnitSize; - bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width + shipPaneMargin.Horizontal; + bool isFleetNameAndParametersAreSameLine = fleetNameSize.Width + fleetParameterAreaSize.Width + fleetParameterAreaMargin.Horizontal < shipPaneSize.Width; if ( isFleetNameAndParametersAreSameLine ) { - fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize + shipPaneMargin.Size ); + fleetPaneUnitSize = MaxWidthSumHeight( SumWidthMaxHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size ), shipPaneSize ); } else { - fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize + shipPaneMargin.Size ); + fleetPaneUnitSize = MaxWidthSumHeight( fleetNameSize, fleetParameterAreaSize + fleetParameterAreaMargin.Size, shipPaneSize ); } Size fleetPaneSize = new Size( ( fleetPaneUnitSize.Width + fleetPaneUnitMargin.Horizontal ) * Math.Min( args.HorizontalFleetCount, args.FleetIDs.Length ), @@ -1070,7 +866,7 @@ public static Bitmap GenerateBannerBitmap( FleetImageArgument args ) { Size commentAreaSize = commentSize + commentPadding.Size; - Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize + fleetPaneMargin.Size, commentAreaSize + commentMargin.Size ); + Size entireSize = MaxWidthSumHeight( titleSize + titleMargin.Size, fleetPaneSize, commentAreaSize + commentMargin.Size ); Size equipmentNameSizeExtended = SumWidthMaxHeight( equipmentNameSize, equipmentLevelSize ); @@ -1178,7 +974,6 @@ public static Bitmap GenerateBannerBitmap( FleetImageArgument args ) { ( shipPaneUnitSize.Height + shipPaneUnitMargin.Vertical ) * ( shipIndex / args.HorizontalShipCount ) + shipPaneUnitMargin.Top ); Point shipPointer = shipPointerOrigin; - //g.DrawRectangle( Pens.Teal, new Rectangle( shipPointer, shipPaneUnitSize ) ); if ( ship == null ) continue; @@ -1201,7 +996,7 @@ public static Bitmap GenerateBannerBitmap( FleetImageArgument args ) { EquipmentData eq = ship.AllSlotInstance[equipmentIndex]; Point equipmentPointer = equipmentPointerOrigin + new Size( 0, equipmentAreaUnitSize.Height * equipmentIndex ); - + bool isOutOfSlot = equipmentIndex >= ship.SlotSize && !( equipmentIndex == 5 && ship.IsExpansionSlotAvailable ); Size equipmentIconOffset = GetAlignmentOffset( ContentAlignment.MiddleLeft, EquipmentIconSize, equipmentAreaUnitSize ); @@ -1368,6 +1163,17 @@ public ShipParameterData( ResourceManager.IconContent iconIndex, string name, Fu }; + + /// + /// 艦船画像を swf ファイルから読み込んで描画します。 + /// + /// 対象となる Graphics。 + /// 艦船のリソース名(ファイル名)。 + /// 描画する画像の CharacterID 。 + /// 描画先の X 座標。 + /// 描画先の Y 座標。 + /// 描画する画像のサイズ。 + /// 描画に成功したかを返します。ファイルが存在しない場合などには false が返ります。 protected static bool DrawShipSwfImage( Graphics g, string resourceID, int characterID, int x, int y, Size size ) { try { using ( var shipImage = GetShipSwfImage( resourceID, characterID ) ) { @@ -1383,10 +1189,19 @@ protected static bool DrawShipSwfImage( Graphics g, string resourceID, int chara } } + /// + /// 艦船画像を swf ファイルから読み込みます。 + /// + /// 艦船のリソース名(ファイル名)。 + /// 描画する画像の CharacterID 。 + /// 成功した場合は対象の Bitmap オブジェクト、失敗した場合は null を返します。 protected static Bitmap GetShipSwfImage( string resourceID, int characterID ) { try { - string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + resourceID + ".swf"; - if ( System.IO.File.Exists( shipSwfPath ) ) { + + string shipSwfPath = System.IO.Directory.GetFiles( Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\", "*.swf", System.IO.SearchOption.TopDirectoryOnly ) + .Where( path => path.Contains( resourceID ) ).LastOrDefault(); + + if ( shipSwfPath != null ) { var shipSwf = new SwfParser(); shipSwf.Parse( shipSwfPath ); @@ -1401,6 +1216,13 @@ protected static Bitmap GetShipSwfImage( string resourceID, int characterID ) { } } + + /// + /// 矩形範囲にコントロールを配置した際の座標を求めます。 + /// + /// 配置方法。 + /// 配置するコントロールのサイズ。 + /// 配置されるコンテナのサイズ。 protected static Size GetAlignmentOffset( ContentAlignment alignment, Size content, Size container ) { switch ( alignment ) { case ContentAlignment.TopLeft: @@ -1426,36 +1248,9 @@ protected static Size GetAlignmentOffset( ContentAlignment alignment, Size conte } - - protected static TextFormatFlags GetTextFormat( ContentAlignment alignment ) { - - TextFormatFlags textformat = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; - - switch ( alignment ) { - case ContentAlignment.TopLeft: - textformat |= TextFormatFlags.Top | TextFormatFlags.Left; break; - case ContentAlignment.TopCenter: - textformat |= TextFormatFlags.Top | TextFormatFlags.HorizontalCenter; break; - case ContentAlignment.TopRight: - textformat |= TextFormatFlags.Top | TextFormatFlags.Right; break; - case ContentAlignment.MiddleLeft: - textformat |= TextFormatFlags.VerticalCenter | TextFormatFlags.Left; break; - case ContentAlignment.MiddleCenter: - textformat |= TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter; break; - case ContentAlignment.MiddleRight: - textformat |= TextFormatFlags.VerticalCenter | TextFormatFlags.Right; break; - case ContentAlignment.BottomLeft: - textformat |= TextFormatFlags.Bottom | TextFormatFlags.Left; break; - case ContentAlignment.BottomCenter: - textformat |= TextFormatFlags.Bottom | TextFormatFlags.HorizontalCenter; break; - case ContentAlignment.BottomRight: - textformat |= TextFormatFlags.Bottom | TextFormatFlags.Right; break; - } - - return textformat; - - } - + /// + /// 配置に合わせた文字列のフォーマットを返します。 + /// protected static StringFormat GetStringFormat( ContentAlignment alignment ) { var format = new StringFormat( StringFormat.GenericDefault ); @@ -1505,26 +1300,110 @@ protected static StringFormat GetStringFormat( ContentAlignment alignment ) { } } + + /// + /// FleetImageGenerator クラスのメソッドに与えるパラメータ群を保持します。 + /// + [DataContract( Name = "FleetImageArgument" )] public class FleetImageArgument { + /// 対象となる艦隊IDのリスト + [DataMember] public int[] FleetIDs; + + /// 艦隊を横に並べる最大数 + [DataMember] public int HorizontalFleetCount; + + /// 艦船を横に並べる最大数 + [DataMember] public int HorizontalShipCount; + + /// HP に応じて中破グラフィックを適用するか + [DataMember] public bool ReflectDamageGraphic; + + /// Twitter の画像圧縮を回避する情報を埋め込むか + [DataMember] public bool AvoidTwitterDeterioration; + + + /// タイトルのフォント + [IgnoreDataMember] public Font TitleFont; + + /// 大きい文字のフォント(艦隊名など) + [IgnoreDataMember] public Font LargeFont; + + /// 通常の文字のフォント(艦船・装備など) + [IgnoreDataMember] public Font MediumFont; + + /// 小さな文字のフォント() + [IgnoreDataMember] public Font SmallFont; + + /// 通常の英数字フォント(Lvなど) + [IgnoreDataMember] public Font MediumDigitFont; + + /// 小さな英数字フォント(搭載機数など) + [IgnoreDataMember] public Font SmallDigitFont; + + [DataMember] + private SerializableFont SerializedTitleFont { + get { return TitleFont; } + set { TitleFont = value; } + } + [DataMember] + private SerializableFont SerializedLargeFont { + get { return LargeFont; } + set { LargeFont = value; } + } + [DataMember] + private SerializableFont SerializedMediumFont { + get { return MediumFont; } + set { MediumFont = value; } + } + [DataMember] + private SerializableFont SerializedSmallFont { + get { return SmallFont; } + set { SmallFont = value; } + } + [DataMember] + private SerializableFont SerializedMediumDigitFont { + get { return MediumDigitFont; } + set { MediumDigitFont = value; } + } + [DataMember] + private SerializableFont SerializedSmallDigitFont { + get { return SmallDigitFont; } + set { SmallDigitFont = value; } + } + + + /// 背景画像ファイルへのパス(空白の場合描画されません) + [DataMember] public string BackgroundImagePath; + + /// ユーザ指定のタイトル + [DataMember] public string Title; + + /// ユーザ指定のコメント + [DataMember] public string Comment; + + + + public FleetImageArgument() { + } } } From 20c59a1e84427a92bae441e5ca9caf6e4c9c3993 Mon Sep 17 00:00:00 2001 From: Andante Date: Sun, 23 Apr 2017 21:03:46 +0900 Subject: [PATCH 13/16] =?UTF-8?q?=E7=B7=A8=E6=88=90=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E5=87=BA=E5=8A=9B=EF=BC=9AUI=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * たぶん完成… --- ElectronicObserver/ElectronicObserver.csproj | 9 + ElectronicObserver/Utility/Configuration.cs | 29 +- .../Utility/FleetImageGenerator.cs | 110 +- .../DialogFleetImageGenerator.Designer.cs | 946 ++++++++++++++++++ .../Dialog/DialogFleetImageGenerator.cs | 466 +++++++++ .../Dialog/DialogFleetImageGenerator.resx | 141 +++ .../Window/FormFleet.Designer.cs | 16 +- ElectronicObserver/Window/FormFleet.cs | 378 +------ 8 files changed, 1706 insertions(+), 389 deletions(-) create mode 100644 ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.Designer.cs create mode 100644 ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs create mode 100644 ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.resx diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index 4bb3651d6..5db287ab0 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -400,6 +400,12 @@ DialogEquipmentList.cs + + Form + + + DialogFleetImageGenerator.cs + Form @@ -659,6 +665,9 @@ DialogEquipmentList.cs + + DialogFleetImageGenerator.cs + DialogHalloween.cs diff --git a/ElectronicObserver/Utility/Configuration.cs b/ElectronicObserver/Utility/Configuration.cs index 8750663c4..08e76f704 100644 --- a/ElectronicObserver/Utility/Configuration.cs +++ b/ElectronicObserver/Utility/Configuration.cs @@ -647,6 +647,7 @@ public class ConfigFormFleet : ConfigPartBase { /// public int FixedShipNameWidth { get; set; } + public ConfigFormFleet() { ShowAircraft = true; SearchingAbilityMethod = 4; @@ -1135,6 +1136,31 @@ public ConfigBGMPlayer() public ConfigBGMPlayer BGMPlayer { get; private set; } + /// + /// 編成画像出力の設定を扱います。 + /// + public class ConfigFleetImageGenerator : ConfigPartBase { + + public FleetImageArgument Argument { get; set; } + public int ImageType { get; set; } + public int OutputType { get; set; } + public bool OpenImageAfterOutput { get; set; } + public string LastOutputPath { get; set; } + + public ConfigFleetImageGenerator() + : base() { + Argument = FleetImageArgument.GetDefaultInstance(); + ImageType = 0; + OutputType = 0; + OpenImageAfterOutput = false; + LastOutputPath = ""; + } + } + [DataMember] + public ConfigFleetImageGenerator FleetImageGenerator { get; private set; } + + + public class ConfigWhitecap : ConfigPartBase { public bool ShowInTaskbar { get; set; } @@ -1164,7 +1190,7 @@ public ConfigWhitecap() public ConfigWhitecap Whitecap { get; private set; } - + [DataMember] public string Version { get { return SoftwareInformation.VersionEnglish; } @@ -1204,6 +1230,7 @@ public override void Initialize() { NotifierAnchorageRepair = new ConfigNotifierAnchorageRepair(); BGMPlayer = new ConfigBGMPlayer(); + FleetImageGenerator = new ConfigFleetImageGenerator(); Whitecap = new ConfigWhitecap(); VersionUpdateTime = DateTimeHelper.TimeToCSVString( SoftwareInformation.UpdateTime ); diff --git a/ElectronicObserver/Utility/FleetImageGenerator.cs b/ElectronicObserver/Utility/FleetImageGenerator.cs index 031f578ca..10de66543 100644 --- a/ElectronicObserver/Utility/FleetImageGenerator.cs +++ b/ElectronicObserver/Utility/FleetImageGenerator.cs @@ -1072,6 +1072,34 @@ public static Bitmap GenerateBannerBitmap( FleetImageArgument args ) { + public static bool HasShipSwfImage( int[] fleets ) { + + try { + + var swfFiles = System.IO.Directory.GetFiles( Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\", "*.swf", System.IO.SearchOption.TopDirectoryOnly ) + .Select( path => System.IO.Path.GetFileNameWithoutExtension( path ) ) + .Select( path => { + int index = path.IndexOf( '_' ); + if ( index != -1 ) + path = path.Remove( index ); + return path; + } ); + + var resourceIDs = fleets.Select( f => KCDatabase.Instance.Fleet[f] ) + .Where( f => f != null ) + .SelectMany( f => f.MembersInstance ) + .Where( s => s != null ) + .Select( s => s.MasterShip.ResourceName ) + .Distinct(); + + return !resourceIDs.Except( swfFiles ).Any(); + + } catch ( Exception ) { + + return false; + } + } + @@ -1356,36 +1384,36 @@ public class FleetImageArgument { [DataMember] - private SerializableFont SerializedTitleFont { + public SerializableFont SerializedTitleFont { get { return TitleFont; } set { TitleFont = value; } } [DataMember] - private SerializableFont SerializedLargeFont { + public SerializableFont SerializedLargeFont { get { return LargeFont; } set { LargeFont = value; } } [DataMember] - private SerializableFont SerializedMediumFont { + public SerializableFont SerializedMediumFont { get { return MediumFont; } set { MediumFont = value; } } [DataMember] - private SerializableFont SerializedSmallFont { + public SerializableFont SerializedSmallFont { get { return SmallFont; } set { SmallFont = value; } } [DataMember] - private SerializableFont SerializedMediumDigitFont { + public SerializableFont SerializedMediumDigitFont { get { return MediumDigitFont; } set { MediumDigitFont = value; } } [DataMember] - private SerializableFont SerializedSmallDigitFont { + public SerializableFont SerializedSmallDigitFont { get { return SmallDigitFont; } set { SmallDigitFont = value; } } - + /// 背景画像ファイルへのパス(空白の場合描画されません) [DataMember] @@ -1401,9 +1429,73 @@ private SerializableFont SerializedSmallDigitFont { public string Comment; - - public FleetImageArgument() { + + public FleetImageArgument() { + } + + + public static FleetImageArgument GetDefaultInstance() { + var ret = new FleetImageArgument(); + ret.FleetIDs = new int[0]; + ret.HorizontalFleetCount = 2; + ret.HorizontalShipCount = 2; + ret.AvoidTwitterDeterioration = true; + + string baseFont = DefaultFontFamily; + var fonts = ret.Fonts; + for ( int i = 0; i < fonts.Length; i++ ) { + fonts[i] = new Font( baseFont, DefaultFontPixels[i], FontStyle.Regular, GraphicsUnit.Pixel ); + } + ret.Fonts = fonts; + + return ret; + } + + public static readonly string DefaultFontFamily = "Meiryo UI"; + public static readonly float[] DefaultFontPixels = new float[] { 32, 24, 16, 12, 16, 12 }; + + public FleetImageArgument Clone() { + + var clone = (FleetImageArgument)MemberwiseClone(); + + clone.FleetIDs = FleetIDs.ToArray(); + + clone.Fonts = Fonts.Select( f => f != null ? (Font)f.Clone() : null ).ToArray(); + + return clone; } + + + public void DisposeResources() { + foreach ( var font in Fonts ) { + if ( font != null ) + font.Dispose(); + } + } + + + public Font[] Fonts { + get { + return new Font[] { + TitleFont, + LargeFont, + MediumFont, + SmallFont, + MediumDigitFont, + SmallDigitFont, + }; + } + set { + TitleFont = value[0]; + LargeFont = value[1]; + MediumFont = value[2]; + SmallFont = value[3]; + MediumDigitFont = value[4]; + SmallDigitFont = value[5]; + } + + } + } } diff --git a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.Designer.cs b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.Designer.cs new file mode 100644 index 000000000..1d4cadc2a --- /dev/null +++ b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.Designer.cs @@ -0,0 +1,946 @@ +namespace ElectronicObserver.Window.Dialog { + partial class DialogFleetImageGenerator { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose( bool disposing ) { + if ( disposing && ( components != null ) ) { + components.Dispose(); + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.ButtonCancel = new System.Windows.Forms.Button(); + this.ButtonOK = new System.Windows.Forms.Button(); + this.Comment = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.Title = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.TargetFleet4 = new System.Windows.Forms.CheckBox(); + this.TargetFleet3 = new System.Windows.Forms.CheckBox(); + this.TargetFleet2 = new System.Windows.Forms.CheckBox(); + this.TargetFleet1 = new System.Windows.Forms.CheckBox(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.SearchBackgroundImagePath = new System.Windows.Forms.Button(); + this.BackgroundImagePath = new System.Windows.Forms.TextBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.AvoidTwitterDeterioration = new System.Windows.Forms.CheckBox(); + this.ReflectDamageGraphic = new System.Windows.Forms.CheckBox(); + this.label5 = new System.Windows.Forms.Label(); + this.HorizontalShipCount = new System.Windows.Forms.NumericUpDown(); + this.HorizontalFleetCount = new System.Windows.Forms.NumericUpDown(); + this.label4 = new System.Windows.Forms.Label(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.ApplyGeneralFont = new System.Windows.Forms.Button(); + this.label12 = new System.Windows.Forms.Label(); + this.SelectSmallDigitFont = new System.Windows.Forms.Button(); + this.TextSmallDigitFont = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); + this.SelectMediumDigitFont = new System.Windows.Forms.Button(); + this.TextMediumDigitFont = new System.Windows.Forms.TextBox(); + this.label10 = new System.Windows.Forms.Label(); + this.SelectSmallFont = new System.Windows.Forms.Button(); + this.TextSmallFont = new System.Windows.Forms.TextBox(); + this.label9 = new System.Windows.Forms.Label(); + this.SelectMediumFont = new System.Windows.Forms.Button(); + this.TextMediumFont = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.SelectLargeFont = new System.Windows.Forms.Button(); + this.TextLargeFont = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.SelectTitleFont = new System.Windows.Forms.Button(); + this.TextTitleFont = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.SelectGeneralFont = new System.Windows.Forms.Button(); + this.TextGeneralFont = new System.Windows.Forms.TextBox(); + this.fontDialog1 = new System.Windows.Forms.FontDialog(); + this.OpenImageDialog = new System.Windows.Forms.OpenFileDialog(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.ImageTypeBanner = new System.Windows.Forms.RadioButton(); + this.ImageTypeCutin = new System.Windows.Forms.RadioButton(); + this.ImageTypeCard = new System.Windows.Forms.RadioButton(); + this.SaveImageDialog = new System.Windows.Forms.SaveFileDialog(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.OpenImageAfterOutput = new System.Windows.Forms.CheckBox(); + this.OutputTypeClipboard = new System.Windows.Forms.RadioButton(); + this.OutputTypeFile = new System.Windows.Forms.RadioButton(); + this.ClearBackgroundPath = new System.Windows.Forms.Button(); + this.ButtonAlert = new System.Windows.Forms.Button(); + this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); + this.ButtonClearFont = new System.Windows.Forms.Button(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox4.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.HorizontalShipCount)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.HorizontalFleetCount)).BeginInit(); + this.tabPage3.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl1.Location = new System.Drawing.Point(0, 0); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(464, 321); + this.tabControl1.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.ButtonAlert); + this.tabPage1.Controls.Add(this.groupBox3); + this.tabPage1.Controls.Add(this.ButtonCancel); + this.tabPage1.Controls.Add(this.ButtonOK); + this.tabPage1.Controls.Add(this.Comment); + this.tabPage1.Controls.Add(this.label3); + this.tabPage1.Controls.Add(this.Title); + this.tabPage1.Controls.Add(this.label2); + this.tabPage1.Controls.Add(this.groupBox1); + this.tabPage1.Location = new System.Drawing.Point(4, 24); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(456, 293); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "基本"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // ButtonCancel + // + this.ButtonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.ButtonCancel.Location = new System.Drawing.Point(373, 260); + this.ButtonCancel.Name = "ButtonCancel"; + this.ButtonCancel.Size = new System.Drawing.Size(75, 23); + this.ButtonCancel.TabIndex = 0; + this.ButtonCancel.Text = "Cancel"; + this.ButtonCancel.UseVisualStyleBackColor = true; + this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + // + // ButtonOK + // + this.ButtonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ButtonOK.Location = new System.Drawing.Point(292, 260); + this.ButtonOK.Name = "ButtonOK"; + this.ButtonOK.Size = new System.Drawing.Size(75, 23); + this.ButtonOK.TabIndex = 7; + this.ButtonOK.Text = "OK"; + this.ButtonOK.UseVisualStyleBackColor = true; + this.ButtonOK.Click += new System.EventHandler(this.ButtonOK_Click); + // + // Comment + // + this.Comment.AcceptsReturn = true; + this.Comment.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.Comment.Location = new System.Drawing.Point(8, 186); + this.Comment.MaxLength = 0; + this.Comment.Multiline = true; + this.Comment.Name = "Comment"; + this.Comment.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.Comment.Size = new System.Drawing.Size(440, 68); + this.Comment.TabIndex = 6; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(8, 168); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(52, 15); + this.label3.TabIndex = 5; + this.label3.Text = "コメント:"; + // + // Title + // + this.Title.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.Title.Location = new System.Drawing.Point(8, 142); + this.Title.Name = "Title"; + this.Title.Size = new System.Drawing.Size(440, 23); + this.Title.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 124); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(54, 15); + this.label2.TabIndex = 3; + this.label2.Text = "タイトル:"; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.TargetFleet4); + this.groupBox1.Controls.Add(this.TargetFleet3); + this.groupBox1.Controls.Add(this.TargetFleet2); + this.groupBox1.Controls.Add(this.TargetFleet1); + this.groupBox1.Location = new System.Drawing.Point(8, 69); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(440, 52); + this.groupBox1.TabIndex = 2; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "対象艦隊"; + // + // TargetFleet4 + // + this.TargetFleet4.AutoSize = true; + this.TargetFleet4.Location = new System.Drawing.Point(154, 23); + this.TargetFleet4.Name = "TargetFleet4"; + this.TargetFleet4.Size = new System.Drawing.Size(43, 19); + this.TargetFleet4.TabIndex = 2; + this.TargetFleet4.Text = "#4"; + this.TargetFleet4.UseVisualStyleBackColor = true; + this.TargetFleet4.CheckedChanged += new System.EventHandler(this.TargetFleet1_CheckedChanged); + // + // TargetFleet3 + // + this.TargetFleet3.AutoSize = true; + this.TargetFleet3.Location = new System.Drawing.Point(105, 23); + this.TargetFleet3.Name = "TargetFleet3"; + this.TargetFleet3.Size = new System.Drawing.Size(43, 19); + this.TargetFleet3.TabIndex = 2; + this.TargetFleet3.Text = "#3"; + this.TargetFleet3.UseVisualStyleBackColor = true; + this.TargetFleet3.CheckedChanged += new System.EventHandler(this.TargetFleet1_CheckedChanged); + // + // TargetFleet2 + // + this.TargetFleet2.AutoSize = true; + this.TargetFleet2.Location = new System.Drawing.Point(56, 23); + this.TargetFleet2.Name = "TargetFleet2"; + this.TargetFleet2.Size = new System.Drawing.Size(43, 19); + this.TargetFleet2.TabIndex = 1; + this.TargetFleet2.Text = "#2"; + this.TargetFleet2.UseVisualStyleBackColor = true; + this.TargetFleet2.CheckedChanged += new System.EventHandler(this.TargetFleet1_CheckedChanged); + // + // TargetFleet1 + // + this.TargetFleet1.AutoSize = true; + this.TargetFleet1.Location = new System.Drawing.Point(7, 23); + this.TargetFleet1.Name = "TargetFleet1"; + this.TargetFleet1.Size = new System.Drawing.Size(43, 19); + this.TargetFleet1.TabIndex = 0; + this.TargetFleet1.Text = "#1"; + this.TargetFleet1.UseVisualStyleBackColor = true; + this.TargetFleet1.CheckedChanged += new System.EventHandler(this.TargetFleet1_CheckedChanged); + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.groupBox2); + this.tabPage2.Controls.Add(this.groupBox5); + this.tabPage2.Controls.Add(this.groupBox4); + this.tabPage2.Location = new System.Drawing.Point(4, 24); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(456, 293); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "詳細"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // groupBox5 + // + this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox5.Controls.Add(this.ClearBackgroundPath); + this.groupBox5.Controls.Add(this.SearchBackgroundImagePath); + this.groupBox5.Controls.Add(this.BackgroundImagePath); + this.groupBox5.Location = new System.Drawing.Point(8, 150); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(440, 58); + this.groupBox5.TabIndex = 1; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "背景画像"; + // + // SearchBackgroundImagePath + // + this.SearchBackgroundImagePath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SearchBackgroundImagePath.Location = new System.Drawing.Point(348, 21); + this.SearchBackgroundImagePath.Name = "SearchBackgroundImagePath"; + this.SearchBackgroundImagePath.Size = new System.Drawing.Size(40, 23); + this.SearchBackgroundImagePath.TabIndex = 1; + this.SearchBackgroundImagePath.Text = "..."; + this.ToolTipInfo.SetToolTip(this.SearchBackgroundImagePath, "背景画像を検索・指定するダイアログを開きます。"); + this.SearchBackgroundImagePath.UseVisualStyleBackColor = true; + this.SearchBackgroundImagePath.Click += new System.EventHandler(this.SearchBackgroundImagePath_Click); + // + // BackgroundImagePath + // + this.BackgroundImagePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.BackgroundImagePath.Location = new System.Drawing.Point(6, 22); + this.BackgroundImagePath.Name = "BackgroundImagePath"; + this.BackgroundImagePath.Size = new System.Drawing.Size(336, 23); + this.BackgroundImagePath.TabIndex = 0; + this.ToolTipInfo.SetToolTip(this.BackgroundImagePath, "背景画像へのパスを指定します。\r\n空白の場合は背景画像なしで出力されます。"); + // + // groupBox4 + // + this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox4.Controls.Add(this.AvoidTwitterDeterioration); + this.groupBox4.Controls.Add(this.ReflectDamageGraphic); + this.groupBox4.Controls.Add(this.label5); + this.groupBox4.Controls.Add(this.HorizontalShipCount); + this.groupBox4.Controls.Add(this.HorizontalFleetCount); + this.groupBox4.Controls.Add(this.label4); + this.groupBox4.Location = new System.Drawing.Point(8, 6); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(440, 138); + this.groupBox4.TabIndex = 0; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "レイアウト"; + // + // AvoidTwitterDeterioration + // + this.AvoidTwitterDeterioration.AutoSize = true; + this.AvoidTwitterDeterioration.Location = new System.Drawing.Point(9, 105); + this.AvoidTwitterDeterioration.Name = "AvoidTwitterDeterioration"; + this.AvoidTwitterDeterioration.Size = new System.Drawing.Size(182, 19); + this.AvoidTwitterDeterioration.TabIndex = 5; + this.AvoidTwitterDeterioration.Text = "Twitter の画像圧縮を回避する"; + this.ToolTipInfo.SetToolTip(this.AvoidTwitterDeterioration, "Twitter に PNG 形式の画像をアップロードすると、自動的に JPEG 形式に変換され画質が劣化します。\r\nそれを回避するための情報を埋め込むかを指定しま" + + "す。"); + this.AvoidTwitterDeterioration.UseVisualStyleBackColor = true; + // + // ReflectDamageGraphic + // + this.ReflectDamageGraphic.AutoSize = true; + this.ReflectDamageGraphic.Location = new System.Drawing.Point(9, 80); + this.ReflectDamageGraphic.Name = "ReflectDamageGraphic"; + this.ReflectDamageGraphic.Size = new System.Drawing.Size(149, 19); + this.ReflectDamageGraphic.TabIndex = 4; + this.ReflectDamageGraphic.Text = "中破グラフィックを適用する"; + this.ToolTipInfo.SetToolTip(this.ReflectDamageGraphic, "艦娘が中破している場合、出力画像でも中破グラフィックにするかを指定します。"); + this.ReflectDamageGraphic.UseVisualStyleBackColor = true; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(6, 53); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(77, 15); + this.label5.TabIndex = 2; + this.label5.Text = "艦船の横幅:"; + // + // HorizontalShipCount + // + this.HorizontalShipCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.HorizontalShipCount.Location = new System.Drawing.Point(374, 51); + this.HorizontalShipCount.Maximum = new decimal(new int[] { + 6, + 0, + 0, + 0}); + this.HorizontalShipCount.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.HorizontalShipCount.Name = "HorizontalShipCount"; + this.HorizontalShipCount.Size = new System.Drawing.Size(60, 23); + this.HorizontalShipCount.TabIndex = 3; + this.HorizontalShipCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.ToolTipInfo.SetToolTip(this.HorizontalShipCount, "艦船を横に並べる個数を指定します。\r\nこれ以上の数の艦船を出力したとき、改行されます。\r\n"); + this.HorizontalShipCount.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // HorizontalFleetCount + // + this.HorizontalFleetCount.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.HorizontalFleetCount.Location = new System.Drawing.Point(374, 22); + this.HorizontalFleetCount.Maximum = new decimal(new int[] { + 4, + 0, + 0, + 0}); + this.HorizontalFleetCount.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.HorizontalFleetCount.Name = "HorizontalFleetCount"; + this.HorizontalFleetCount.Size = new System.Drawing.Size(60, 23); + this.HorizontalFleetCount.TabIndex = 1; + this.HorizontalFleetCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.ToolTipInfo.SetToolTip(this.HorizontalFleetCount, "艦隊を横に並べる個数を指定します。\r\nこれ以上の数の艦隊を出力したとき、改行されます。\r\n"); + this.HorizontalFleetCount.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 24); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(77, 15); + this.label4.TabIndex = 0; + this.label4.Text = "艦隊の横幅:"; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.groupBox6); + this.tabPage3.Location = new System.Drawing.Point(4, 24); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(456, 293); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "フォント"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // groupBox6 + // + this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox6.Controls.Add(this.ButtonClearFont); + this.groupBox6.Controls.Add(this.ApplyGeneralFont); + this.groupBox6.Controls.Add(this.label12); + this.groupBox6.Controls.Add(this.SelectSmallDigitFont); + this.groupBox6.Controls.Add(this.TextSmallDigitFont); + this.groupBox6.Controls.Add(this.label11); + this.groupBox6.Controls.Add(this.SelectMediumDigitFont); + this.groupBox6.Controls.Add(this.TextMediumDigitFont); + this.groupBox6.Controls.Add(this.label10); + this.groupBox6.Controls.Add(this.SelectSmallFont); + this.groupBox6.Controls.Add(this.TextSmallFont); + this.groupBox6.Controls.Add(this.label9); + this.groupBox6.Controls.Add(this.SelectMediumFont); + this.groupBox6.Controls.Add(this.TextMediumFont); + this.groupBox6.Controls.Add(this.label8); + this.groupBox6.Controls.Add(this.SelectLargeFont); + this.groupBox6.Controls.Add(this.TextLargeFont); + this.groupBox6.Controls.Add(this.label7); + this.groupBox6.Controls.Add(this.SelectTitleFont); + this.groupBox6.Controls.Add(this.TextTitleFont); + this.groupBox6.Controls.Add(this.label6); + this.groupBox6.Controls.Add(this.SelectGeneralFont); + this.groupBox6.Controls.Add(this.TextGeneralFont); + this.groupBox6.Location = new System.Drawing.Point(6, 6); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(442, 277); + this.groupBox6.TabIndex = 0; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "フォント"; + // + // ApplyGeneralFont + // + this.ApplyGeneralFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.ApplyGeneralFont.Location = new System.Drawing.Point(350, 22); + this.ApplyGeneralFont.Name = "ApplyGeneralFont"; + this.ApplyGeneralFont.Size = new System.Drawing.Size(40, 23); + this.ApplyGeneralFont.TabIndex = 2; + this.ApplyGeneralFont.Text = "▼"; + this.ToolTipInfo.SetToolTip(this.ApplyGeneralFont, "左のフォント設定を下の各フォントに適用します。"); + this.ApplyGeneralFont.UseVisualStyleBackColor = true; + this.ApplyGeneralFont.Click += new System.EventHandler(this.ApplyGeneralFont_Click); + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(6, 200); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(65, 15); + this.label12.TabIndex = 19; + this.label12.Text = "小(英数):"; + // + // SelectSmallDigitFont + // + this.SelectSmallDigitFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SelectSmallDigitFont.Location = new System.Drawing.Point(396, 196); + this.SelectSmallDigitFont.Name = "SelectSmallDigitFont"; + this.SelectSmallDigitFont.Size = new System.Drawing.Size(40, 23); + this.SelectSmallDigitFont.TabIndex = 21; + this.SelectSmallDigitFont.Text = "..."; + this.ToolTipInfo.SetToolTip(this.SelectSmallDigitFont, "フォントを指定するダイアログを開きます。"); + this.SelectSmallDigitFont.UseVisualStyleBackColor = true; + // + // TextSmallDigitFont + // + this.TextSmallDigitFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextSmallDigitFont.Location = new System.Drawing.Point(100, 196); + this.TextSmallDigitFont.Name = "TextSmallDigitFont"; + this.TextSmallDigitFont.Size = new System.Drawing.Size(290, 23); + this.TextSmallDigitFont.TabIndex = 20; + this.ToolTipInfo.SetToolTip(this.TextSmallDigitFont, "搭載機数などの補助的な数値の描画に用いられます。"); + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(6, 171); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(65, 15); + this.label11.TabIndex = 16; + this.label11.Text = "中(英数):"; + // + // SelectMediumDigitFont + // + this.SelectMediumDigitFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SelectMediumDigitFont.Location = new System.Drawing.Point(396, 167); + this.SelectMediumDigitFont.Name = "SelectMediumDigitFont"; + this.SelectMediumDigitFont.Size = new System.Drawing.Size(40, 23); + this.SelectMediumDigitFont.TabIndex = 18; + this.SelectMediumDigitFont.Text = "..."; + this.ToolTipInfo.SetToolTip(this.SelectMediumDigitFont, "フォントを指定するダイアログを開きます。"); + this.SelectMediumDigitFont.UseVisualStyleBackColor = true; + // + // TextMediumDigitFont + // + this.TextMediumDigitFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextMediumDigitFont.Location = new System.Drawing.Point(100, 167); + this.TextMediumDigitFont.Name = "TextMediumDigitFont"; + this.TextMediumDigitFont.Size = new System.Drawing.Size(290, 23); + this.TextMediumDigitFont.TabIndex = 17; + this.ToolTipInfo.SetToolTip(this.TextMediumDigitFont, "Lv などの主要な数字の描画に用いられます。"); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(6, 142); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(65, 15); + this.label10.TabIndex = 13; + this.label10.Text = "小(通常):"; + // + // SelectSmallFont + // + this.SelectSmallFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SelectSmallFont.Location = new System.Drawing.Point(396, 138); + this.SelectSmallFont.Name = "SelectSmallFont"; + this.SelectSmallFont.Size = new System.Drawing.Size(40, 23); + this.SelectSmallFont.TabIndex = 15; + this.SelectSmallFont.Text = "..."; + this.ToolTipInfo.SetToolTip(this.SelectSmallFont, "フォントを指定するダイアログを開きます。"); + this.SelectSmallFont.UseVisualStyleBackColor = true; + // + // TextSmallFont + // + this.TextSmallFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextSmallFont.Location = new System.Drawing.Point(100, 138); + this.TextSmallFont.Name = "TextSmallFont"; + this.TextSmallFont.Size = new System.Drawing.Size(290, 23); + this.TextSmallFont.TabIndex = 14; + this.ToolTipInfo.SetToolTip(this.TextSmallFont, "補助的な文字列に利用されます。"); + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(6, 113); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(65, 15); + this.label9.TabIndex = 10; + this.label9.Text = "中(通常):"; + // + // SelectMediumFont + // + this.SelectMediumFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SelectMediumFont.Location = new System.Drawing.Point(396, 109); + this.SelectMediumFont.Name = "SelectMediumFont"; + this.SelectMediumFont.Size = new System.Drawing.Size(40, 23); + this.SelectMediumFont.TabIndex = 12; + this.SelectMediumFont.Text = "..."; + this.ToolTipInfo.SetToolTip(this.SelectMediumFont, "フォントを指定するダイアログを開きます。"); + this.SelectMediumFont.UseVisualStyleBackColor = true; + // + // TextMediumFont + // + this.TextMediumFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextMediumFont.Location = new System.Drawing.Point(100, 109); + this.TextMediumFont.Name = "TextMediumFont"; + this.TextMediumFont.Size = new System.Drawing.Size(290, 23); + this.TextMediumFont.TabIndex = 11; + this.ToolTipInfo.SetToolTip(this.TextMediumFont, "装備名など、通常の文字列に使用されます。"); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(6, 84); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(65, 15); + this.label8.TabIndex = 7; + this.label8.Text = "大(通常):"; + // + // SelectLargeFont + // + this.SelectLargeFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SelectLargeFont.Location = new System.Drawing.Point(396, 80); + this.SelectLargeFont.Name = "SelectLargeFont"; + this.SelectLargeFont.Size = new System.Drawing.Size(40, 23); + this.SelectLargeFont.TabIndex = 9; + this.SelectLargeFont.Text = "..."; + this.ToolTipInfo.SetToolTip(this.SelectLargeFont, "フォントを指定するダイアログを開きます。"); + this.SelectLargeFont.UseVisualStyleBackColor = true; + // + // TextLargeFont + // + this.TextLargeFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextLargeFont.Location = new System.Drawing.Point(100, 80); + this.TextLargeFont.Name = "TextLargeFont"; + this.TextLargeFont.Size = new System.Drawing.Size(290, 23); + this.TextLargeFont.TabIndex = 8; + this.ToolTipInfo.SetToolTip(this.TextLargeFont, "主に艦隊名に使用されるフォントです。"); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(6, 55); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(54, 15); + this.label7.TabIndex = 4; + this.label7.Text = "タイトル:"; + // + // SelectTitleFont + // + this.SelectTitleFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SelectTitleFont.Location = new System.Drawing.Point(396, 51); + this.SelectTitleFont.Name = "SelectTitleFont"; + this.SelectTitleFont.Size = new System.Drawing.Size(40, 23); + this.SelectTitleFont.TabIndex = 6; + this.SelectTitleFont.Text = "..."; + this.ToolTipInfo.SetToolTip(this.SelectTitleFont, "フォントを指定するダイアログを開きます。"); + this.SelectTitleFont.UseVisualStyleBackColor = true; + // + // TextTitleFont + // + this.TextTitleFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextTitleFont.Location = new System.Drawing.Point(100, 51); + this.TextTitleFont.Name = "TextTitleFont"; + this.TextTitleFont.Size = new System.Drawing.Size(290, 23); + this.TextTitleFont.TabIndex = 5; + this.ToolTipInfo.SetToolTip(this.TextTitleFont, "タイトルに利用されるフォントです。"); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(6, 26); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(79, 15); + this.label6.TabIndex = 0; + this.label6.Text = "まとめて変更:"; + // + // SelectGeneralFont + // + this.SelectGeneralFont.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SelectGeneralFont.Location = new System.Drawing.Point(396, 22); + this.SelectGeneralFont.Name = "SelectGeneralFont"; + this.SelectGeneralFont.Size = new System.Drawing.Size(40, 23); + this.SelectGeneralFont.TabIndex = 3; + this.SelectGeneralFont.Text = "..."; + this.ToolTipInfo.SetToolTip(this.SelectGeneralFont, "フォントを指定するダイアログを開きます。"); + this.SelectGeneralFont.UseVisualStyleBackColor = true; + this.SelectGeneralFont.Click += new System.EventHandler(this.SelectGeneralFont_Click); + // + // TextGeneralFont + // + this.TextGeneralFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextGeneralFont.Location = new System.Drawing.Point(100, 22); + this.TextGeneralFont.Name = "TextGeneralFont"; + this.TextGeneralFont.Size = new System.Drawing.Size(244, 23); + this.TextGeneralFont.TabIndex = 1; + this.ToolTipInfo.SetToolTip(this.TextGeneralFont, "下記フォントを自動変更するためのフォントを指定します。\r\n右の ▼ ボタンを押すと適用されます。"); + // + // fontDialog1 + // + this.fontDialog1.AllowVerticalFonts = false; + // + // OpenImageDialog + // + this.OpenImageDialog.Filter = "All Images|*.bmp;*.dib;*.jpg;*.jpeg;*.jpe;*.jfif;*.gif;*.png;*.tif;*.tiff|BMP|*.b" + + "mp;*.dib|JPEG|*.jpg;*.jpeg;*.jpe;*.jfif|GIF|*.gif|PNG|*.png|TIFF|*.tif;*.tiff|Fi" + + "le|*"; + this.OpenImageDialog.Title = "背景画像の参照"; + // + // groupBox3 + // + this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox3.Controls.Add(this.ImageTypeBanner); + this.groupBox3.Controls.Add(this.ImageTypeCutin); + this.groupBox3.Controls.Add(this.ImageTypeCard); + this.groupBox3.Location = new System.Drawing.Point(8, 11); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(440, 52); + this.groupBox3.TabIndex = 0; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "出力モード"; + // + // ImageTypeBanner + // + this.ImageTypeBanner.AutoSize = true; + this.ImageTypeBanner.Location = new System.Drawing.Point(213, 22); + this.ImageTypeBanner.Name = "ImageTypeBanner"; + this.ImageTypeBanner.Size = new System.Drawing.Size(93, 19); + this.ImageTypeBanner.TabIndex = 2; + this.ImageTypeBanner.TabStop = true; + this.ImageTypeBanner.Text = "バナー (小型)"; + this.ImageTypeBanner.UseVisualStyleBackColor = true; + this.ImageTypeBanner.CheckedChanged += new System.EventHandler(this.ImageTypeBanner_CheckedChanged); + // + // ImageTypeCutin + // + this.ImageTypeCutin.AutoSize = true; + this.ImageTypeCutin.Location = new System.Drawing.Point(102, 22); + this.ImageTypeCutin.Name = "ImageTypeCutin"; + this.ImageTypeCutin.Size = new System.Drawing.Size(105, 19); + this.ImageTypeCutin.TabIndex = 1; + this.ImageTypeCutin.TabStop = true; + this.ImageTypeCutin.Text = "カットイン (中型)"; + this.ImageTypeCutin.UseVisualStyleBackColor = true; + this.ImageTypeCutin.CheckedChanged += new System.EventHandler(this.ImageTypeCutin_CheckedChanged); + // + // ImageTypeCard + // + this.ImageTypeCard.AutoSize = true; + this.ImageTypeCard.Location = new System.Drawing.Point(6, 22); + this.ImageTypeCard.Name = "ImageTypeCard"; + this.ImageTypeCard.Size = new System.Drawing.Size(90, 19); + this.ImageTypeCard.TabIndex = 0; + this.ImageTypeCard.TabStop = true; + this.ImageTypeCard.Text = "カード (大型)"; + this.ImageTypeCard.UseVisualStyleBackColor = true; + this.ImageTypeCard.CheckedChanged += new System.EventHandler(this.ImageTypeCard_CheckedChanged); + // + // SaveImageDialog + // + this.SaveImageDialog.Filter = "PNG|*.png|JPEG|*.jpg|File|*"; + this.SaveImageDialog.Title = "編成画像の保存"; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.OpenImageAfterOutput); + this.groupBox2.Controls.Add(this.OutputTypeClipboard); + this.groupBox2.Controls.Add(this.OutputTypeFile); + this.groupBox2.Location = new System.Drawing.Point(8, 214); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(440, 54); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "出力先"; + // + // OpenImageAfterOutput + // + this.OpenImageAfterOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.OpenImageAfterOutput.AutoSize = true; + this.OpenImageAfterOutput.Location = new System.Drawing.Point(345, 23); + this.OpenImageAfterOutput.Name = "OpenImageAfterOutput"; + this.OpenImageAfterOutput.Size = new System.Drawing.Size(89, 19); + this.OpenImageAfterOutput.TabIndex = 2; + this.OpenImageAfterOutput.Text = "保存後に開く"; + this.ToolTipInfo.SetToolTip(this.OpenImageAfterOutput, "出力先が「ファイル」の場合、出力後にその画像をビューアで開くかを指定します。\r\nその画像に紐づけられている既定のビューアが起動します。"); + this.OpenImageAfterOutput.UseVisualStyleBackColor = true; + // + // OutputTypeClipboard + // + this.OutputTypeClipboard.AutoSize = true; + this.OutputTypeClipboard.Location = new System.Drawing.Point(72, 23); + this.OutputTypeClipboard.Name = "OutputTypeClipboard"; + this.OutputTypeClipboard.Size = new System.Drawing.Size(84, 19); + this.OutputTypeClipboard.TabIndex = 1; + this.OutputTypeClipboard.TabStop = true; + this.OutputTypeClipboard.Text = "クリップボード"; + this.OutputTypeClipboard.UseVisualStyleBackColor = true; + // + // OutputTypeFile + // + this.OutputTypeFile.AutoSize = true; + this.OutputTypeFile.Location = new System.Drawing.Point(7, 23); + this.OutputTypeFile.Name = "OutputTypeFile"; + this.OutputTypeFile.Size = new System.Drawing.Size(59, 19); + this.OutputTypeFile.TabIndex = 0; + this.OutputTypeFile.TabStop = true; + this.OutputTypeFile.Text = "ファイル"; + this.OutputTypeFile.UseVisualStyleBackColor = true; + // + // ClearBackgroundPath + // + this.ClearBackgroundPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.ClearBackgroundPath.Location = new System.Drawing.Point(394, 21); + this.ClearBackgroundPath.Name = "ClearBackgroundPath"; + this.ClearBackgroundPath.Size = new System.Drawing.Size(40, 23); + this.ClearBackgroundPath.TabIndex = 2; + this.ClearBackgroundPath.Text = "なし"; + this.ToolTipInfo.SetToolTip(this.ClearBackgroundPath, "背景画像をクリアします。"); + this.ClearBackgroundPath.UseVisualStyleBackColor = true; + this.ClearBackgroundPath.Click += new System.EventHandler(this.ClearBackgroundPath_Click); + // + // ButtonAlert + // + this.ButtonAlert.Font = new System.Drawing.Font("Meiryo UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel); + this.ButtonAlert.ForeColor = System.Drawing.Color.Red; + this.ButtonAlert.Location = new System.Drawing.Point(8, 260); + this.ButtonAlert.Name = "ButtonAlert"; + this.ButtonAlert.Size = new System.Drawing.Size(278, 23); + this.ButtonAlert.TabIndex = 8; + this.ButtonAlert.Text = "Alert"; + this.ButtonAlert.UseVisualStyleBackColor = true; + this.ButtonAlert.Click += new System.EventHandler(this.ButtonAlert_Click); + // + // ToolTipInfo + // + this.ToolTipInfo.AutoPopDelay = 30000; + this.ToolTipInfo.InitialDelay = 500; + this.ToolTipInfo.ReshowDelay = 100; + this.ToolTipInfo.ShowAlways = true; + // + // ButtonClearFont + // + this.ButtonClearFont.Location = new System.Drawing.Point(361, 225); + this.ButtonClearFont.Name = "ButtonClearFont"; + this.ButtonClearFont.Size = new System.Drawing.Size(75, 23); + this.ButtonClearFont.TabIndex = 22; + this.ButtonClearFont.Text = "デフォルト"; + this.ButtonClearFont.UseVisualStyleBackColor = true; + this.ButtonClearFont.Click += new System.EventHandler(this.ButtonClearFont_Click); + // + // DialogFleetImageGenerator + // + this.AcceptButton = this.ButtonOK; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.CancelButton = this.ButtonCancel; + this.ClientSize = new System.Drawing.Size(464, 321); + this.Controls.Add(this.tabControl1); + this.Font = new System.Drawing.Font("Meiryo UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(480, 360); + this.Name = "DialogFleetImageGenerator"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "編成画像出力"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DialogFleetImageGenerator_FormClosing); + this.Load += new System.EventHandler(this.DialogFleetImageGenerator_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.tabPage2.ResumeLayout(false); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.HorizontalShipCount)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.HorizontalFleetCount)).EndInit(); + this.tabPage3.ResumeLayout(false); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.Button ButtonCancel; + private System.Windows.Forms.Button ButtonOK; + private System.Windows.Forms.TextBox Comment; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox Title; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.CheckBox TargetFleet4; + private System.Windows.Forms.CheckBox TargetFleet3; + private System.Windows.Forms.CheckBox TargetFleet2; + private System.Windows.Forms.CheckBox TargetFleet1; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.NumericUpDown HorizontalShipCount; + private System.Windows.Forms.NumericUpDown HorizontalFleetCount; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.Button SearchBackgroundImagePath; + private System.Windows.Forms.TextBox BackgroundImagePath; + private System.Windows.Forms.CheckBox AvoidTwitterDeterioration; + private System.Windows.Forms.CheckBox ReflectDamageGraphic; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.Button ApplyGeneralFont; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Button SelectSmallDigitFont; + private System.Windows.Forms.TextBox TextSmallDigitFont; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Button SelectMediumDigitFont; + private System.Windows.Forms.TextBox TextMediumDigitFont; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Button SelectSmallFont; + private System.Windows.Forms.TextBox TextSmallFont; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Button SelectMediumFont; + private System.Windows.Forms.TextBox TextMediumFont; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button SelectLargeFont; + private System.Windows.Forms.TextBox TextLargeFont; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Button SelectTitleFont; + private System.Windows.Forms.TextBox TextTitleFont; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Button SelectGeneralFont; + private System.Windows.Forms.TextBox TextGeneralFont; + private System.Windows.Forms.FontDialog fontDialog1; + private System.Windows.Forms.OpenFileDialog OpenImageDialog; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.RadioButton ImageTypeBanner; + private System.Windows.Forms.RadioButton ImageTypeCutin; + private System.Windows.Forms.RadioButton ImageTypeCard; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.CheckBox OpenImageAfterOutput; + private System.Windows.Forms.RadioButton OutputTypeClipboard; + private System.Windows.Forms.RadioButton OutputTypeFile; + private System.Windows.Forms.SaveFileDialog SaveImageDialog; + private System.Windows.Forms.Button ClearBackgroundPath; + private System.Windows.Forms.Button ButtonAlert; + private System.Windows.Forms.ToolTip ToolTipInfo; + private System.Windows.Forms.Button ButtonClearFont; + } +} \ No newline at end of file diff --git a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs new file mode 100644 index 000000000..8decb1336 --- /dev/null +++ b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs @@ -0,0 +1,466 @@ +using ElectronicObserver.Utility; +using ElectronicObserver.Utility.Storage; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ElectronicObserver.Window.Dialog { + public partial class DialogFleetImageGenerator : Form { + + private FleetImageArgument CurrentArgument; + private Font GeneralFont; + + private readonly TextBox[] TextFontList; + private Regex LFtoCRLF = new Regex( @"\n|\r\n", RegexOptions.Multiline | RegexOptions.Compiled ); + + + public DialogFleetImageGenerator() { + InitializeComponent(); + + TextFontList = new TextBox[]{ + TextTitleFont, + TextLargeFont, + TextMediumFont, + TextSmallFont, + TextMediumDigitFont, + TextSmallDigitFont, + }; + + for ( int i = 0; i < TextFontList.Length; i++ ) { + int x = i; + this.Controls.Find( "Select" + TextFontList[i].Name.Remove( 0, 4 ), true ).First().Click += ( sender, e ) => SelectFont_Click( sender, e, x ); + } + + LoadConfiguration(); + + } + + public DialogFleetImageGenerator( int fleetID ) + : this() { + + CurrentArgument.FleetIDs = new int[] { fleetID }; + } + + + + private void DialogFleetImageGenerator_Load( object sender, EventArgs e ) { + + ApplyToUI( CurrentArgument ); + + UpdateButtonAlert(); + } + + + + private void LoadConfiguration() { + var config = Utility.Configuration.Config.FleetImageGenerator; + + CurrentArgument = config.Argument.Clone(); + + + switch ( config.ImageType ) { + case 0: + default: + ImageTypeCard.Checked = true; + break; + case 1: + ImageTypeCutin.Checked = true; + break; + case 2: + ImageTypeBanner.Checked = true; + break; + } + + switch ( config.OutputType ) { + case 0: + default: + OutputTypeFile.Checked = true; + break; + case 1: + OutputTypeClipboard.Checked = true; + break; + } + + OpenImageAfterOutput.Checked = config.OpenImageAfterOutput; + + SaveImageDialog.FileName = config.LastOutputPath; + } + + private void SaveConfiguration() { + var config = Utility.Configuration.Config.FleetImageGenerator; + + if ( config.Argument != null ) + config.Argument.DisposeResources(); + + config.Argument = CurrentArgument.Clone(); + + if ( ImageTypeCard.Checked ) + config.ImageType = 0; + else if ( ImageTypeCutin.Checked ) + config.ImageType = 1; + else if ( ImageTypeBanner.Checked ) + config.ImageType = 2; + + if ( OutputTypeFile.Checked ) + config.OutputType = 0; + else if ( OutputTypeClipboard.Checked ) + config.OutputType = 1; + + config.OpenImageAfterOutput = OpenImageAfterOutput.Checked; + + config.LastOutputPath = SaveImageDialog.FileName; + } + + + + private void ApplyToUI( FleetImageArgument args ) { + + // undone: プリセットはなしで + + int[] fleetIDs = args.FleetIDs ?? new int[0]; + + TargetFleet1.Checked = fleetIDs.Contains( 1 ); + TargetFleet2.Checked = fleetIDs.Contains( 2 ); + TargetFleet3.Checked = fleetIDs.Contains( 3 ); + TargetFleet4.Checked = fleetIDs.Contains( 4 ); + + Title.Text = args.Title; + Comment.Text = LFtoCRLF.Replace( args.Comment, "\r\n" ); // 保存データからのロード時に \n に変換されてしまっているため + + + HorizontalFleetCount.Value = args.HorizontalFleetCount; + HorizontalShipCount.Value = args.HorizontalShipCount; + + ReflectDamageGraphic.Checked = args.ReflectDamageGraphic; + AvoidTwitterDeterioration.Checked = args.AvoidTwitterDeterioration; + + BackgroundImagePath.Text = args.BackgroundImagePath; + + for ( int i = 0; i < TextFontList.Length; i++ ) { + TextFontList[i].Text = SerializableFont.FontToString( args.Fonts[i], true ); + } + } + + private FleetImageArgument ApplyToArgument( FleetImageArgument defaultValue = null ) { + + var ret = defaultValue == null ? new FleetImageArgument() : defaultValue.Clone(); + + ret.FleetIDs = new[]{ + TargetFleet1.Checked ? 1 : 0, + TargetFleet2.Checked ? 2 : 0, + TargetFleet3.Checked ? 3 : 0, + TargetFleet4.Checked ? 4 : 0 + }.Where( i => i > 0 ).ToArray(); + + ret.HorizontalFleetCount = (int)HorizontalFleetCount.Value; + ret.HorizontalShipCount = (int)HorizontalShipCount.Value; + + ret.ReflectDamageGraphic = ReflectDamageGraphic.Checked; + ret.AvoidTwitterDeterioration = AvoidTwitterDeterioration.Checked; + + var fonts = ret.Fonts; + for ( int i = 0; i < fonts.Length; i++ ) { + if ( fonts[i] != null ) + fonts[i].Dispose(); + fonts[i] = SerializableFont.StringToFont( TextFontList[i].Text, true ); + } + ret.Fonts = fonts; + + ret.BackgroundImagePath = BackgroundImagePath.Text; + + ret.Title = Title.Text; + ret.Comment = Comment.Text; + + return ret; + } + + private int[] ToFleetIDs() { + return new[]{ + TargetFleet1.Checked ? 1 : 0, + TargetFleet2.Checked ? 2 : 0, + TargetFleet3.Checked ? 3 : 0, + TargetFleet4.Checked ? 4 : 0 + }.Where( i => i > 0 ).ToArray(); + } + + + private void ApplyGeneralFont_Click( object sender, EventArgs e ) { + + if ( GeneralFont != null ) { + GeneralFont.Dispose(); + } + GeneralFont = SerializableFont.StringToFont( TextGeneralFont.Text, true ); + + if ( GeneralFont == null ) { + MessageBox.Show( "フォント名が正しくありません。", "フォント変換失敗", MessageBoxButtons.OK, MessageBoxIcon.Error ); + TextGeneralFont.Text = ""; + return; + } + + + for ( int i = 0; i < TextFontList.Length; i++ ) { + float size = FleetImageArgument.DefaultFontPixels[i]; + var unit = GraphicsUnit.Pixel; + var style = FontStyle.Regular; + + var font = SerializableFont.StringToFont( TextFontList[i].Text, true ); + if ( font != null ) { + size = font.Size; + unit = font.Unit; + style = font.Style; + font.Dispose(); + } + + font = new Font( GeneralFont.FontFamily, size, style, unit ); + TextFontList[i].Text = SerializableFont.FontToString( font ); + font.Dispose(); + } + + } + + + private void SelectGeneralFont_Click( object sender, EventArgs e ) { + fontDialog1.Font = GeneralFont; + if ( fontDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK ) { + GeneralFont = fontDialog1.Font; + TextGeneralFont.Text = SerializableFont.FontToString( GeneralFont, true ); + } + } + + 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 ) { + TextFontList[index].Text = SerializableFont.FontToString( fontDialog1.Font, true ); + } + } + + + private void SearchBackgroundImagePath_Click( object sender, EventArgs e ) { + OpenImageDialog.FileName = BackgroundImagePath.Text; + if ( OpenImageDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK ) { + BackgroundImagePath.Text = OpenImageDialog.FileName; + } + } + + private void ClearBackgroundPath_Click( object sender, EventArgs e ) { + BackgroundImagePath.Text = ""; + } + + + + + private void ButtonOK_Click( object sender, EventArgs e ) { + + var args = ApplyToArgument(); + + // validation + if ( args.FleetIDs == null || args.FleetIDs.Length == 0 ) { + MessageBox.Show( "出力する艦隊が指定されていません。", "入力値エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); + args.DisposeResources(); + return; + } + + if ( args.HorizontalFleetCount <= 0 || args.HorizontalShipCount <= 0 ) { + MessageBox.Show( "艦隊・艦船の横幅は 1 以上にしてください。", "入力値エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); + args.DisposeResources(); + return; + } + + if ( args.Fonts.Any( f => f == null ) ) { + MessageBox.Show( "未入力・不正なフォントが存在します。", "入力値エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); + args.DisposeResources(); + return; + } + + + int mode; + if ( ImageTypeCard.Checked ) + mode = 0; + else if ( ImageTypeCutin.Checked ) + mode = 1; + else if ( ImageTypeBanner.Checked ) + mode = 2; + else + mode = 0; + + + try { + + if ( OutputTypeFile.Checked ) { + + if ( SaveImageDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK ) { + + using ( var image = GenerateFleetImage( args, mode ) ) { + + + switch ( SaveImageDialog.FilterIndex ) { + case 1: + default: + image.Save( SaveImageDialog.FileName, System.Drawing.Imaging.ImageFormat.Png ); + break; + case 2: + image.Save( SaveImageDialog.FileName, System.Drawing.Imaging.ImageFormat.Jpeg ); + break; + } + + if ( OpenImageAfterOutput.Checked ) + System.Diagnostics.Process.Start( SaveImageDialog.FileName ); + + + } + + } else return; + + } else if ( OutputTypeClipboard.Checked ) { + + using ( var image = GenerateFleetImage( args, mode ) ) { + + Clipboard.SetImage( image ); + } + } + + + + if ( CurrentArgument != null ) + CurrentArgument.DisposeResources(); + CurrentArgument = args; + SaveConfiguration(); + + } catch ( Exception ex ) { + + MessageBox.Show( "画像の出力に失敗しました。\r\n" + ex.GetType().Name + "\r\n" + ex.Message, "編成画像出力失敗", MessageBoxButtons.OK, MessageBoxIcon.Error ); + + } finally { + args.DisposeResources(); + } + + + Close(); + + } + + private Bitmap GenerateFleetImage( FleetImageArgument args, int mode ) { + switch ( mode ) { + case 0: + default: + return FleetImageGenerator.GenerateCardBitmap( args ); + case 1: + return FleetImageGenerator.GenerateCutinBitmap( args ); + case 2: + return FleetImageGenerator.GenerateBannerBitmap( args ); + } + } + + + private void ButtonCancel_Click( object sender, EventArgs e ) { + Close(); + } + + + private void ImageTypeCard_CheckedChanged( object sender, EventArgs e ) { + if ( ImageTypeCard.Checked ) + HorizontalShipCount.Value = 2; + } + + private void ImageTypeCutin_CheckedChanged( object sender, EventArgs e ) { + if ( ImageTypeCutin.Checked ) + HorizontalShipCount.Value = 1; + } + + private void ImageTypeBanner_CheckedChanged( object sender, EventArgs e ) { + if ( ImageTypeBanner.Checked ) + HorizontalShipCount.Value = 2; + } + + + + private void UpdateButtonAlert() { + + bool visibility = false; + + if ( !Utility.Configuration.Config.Connection.SaveSWF ) { + + visibility = true; + ButtonAlert.Text = "艦船画像保存設定が無効です(詳細表示...)"; + + } + + if ( !FleetImageGenerator.HasShipSwfImage( ToFleetIDs() ) ) { + + visibility = true; + ButtonAlert.Text = "艦船画像が足りません(詳細表示...)"; + + } + + ButtonAlert.Visible = visibility; + + } + + + private void ButtonAlert_Click( object sender, EventArgs e ) { + + if ( !Utility.Configuration.Config.Connection.SaveSWF ) { + + if ( MessageBox.Show( "編成画像を出力するためには、艦船画像を保存する設定を有効にする必要があります。\r\n有効にしますか?", + "艦船画像保存設定が無効です", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2 ) + == System.Windows.Forms.DialogResult.Yes ) { + + Utility.Configuration.Config.Connection.SaveSWF = true; + + UpdateButtonAlert(); + } + + } + + if ( !FleetImageGenerator.HasShipSwfImage( ToFleetIDs() ) ) { + + MessageBox.Show( "現在の艦隊を出力するための艦船画像データが不足しています。\r\n\r\nキャッシュを削除したのち再読み込みを行い、\r\n艦これ本体側で出力したい艦隊の編成ページを開くと\r\n艦船画像データが保存されます。", + "艦船画像データ不足", MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); + + UpdateButtonAlert(); + } + + } + + + + private void TargetFleet1_CheckedChanged( object sender, EventArgs e ) { + UpdateButtonAlert(); + } + + + private void ButtonClearFont_Click( object sender, EventArgs e ) { + + if ( MessageBox.Show( "フォントをデフォルト設定に戻します。\r\nよろしいですか?", "クリア確認", + MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2 ) + == System.Windows.Forms.DialogResult.Yes ) { + + if ( GeneralFont != null ) + GeneralFont.Dispose(); + GeneralFont = null; + TextGeneralFont.Text = ""; + + for ( int i = 0; i < TextFontList.Length; i++ ) { + using ( var font = new Font( FleetImageArgument.DefaultFontFamily, FleetImageArgument.DefaultFontPixels[i], FontStyle.Regular, GraphicsUnit.Pixel ) ) { + TextFontList[i].Text = SerializableFont.FontToString( font ); + } + } + } + } + + + + private void DialogFleetImageGenerator_FormClosing( object sender, FormClosingEventArgs e ) { + CurrentArgument.DisposeResources(); + } + + + } +} diff --git a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.resx b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.resx new file mode 100644 index 000000000..3c8c8e519 --- /dev/null +++ b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 454, 17 + + + 454, 17 + + + 17, 17 + + + 138, 17 + + + 297, 17 + + + 454, 17 + + + 454, 17 + + \ No newline at end of file diff --git a/ElectronicObserver/Window/FormFleet.Designer.cs b/ElectronicObserver/Window/FormFleet.Designer.cs index 26b4de2f8..a373155b9 100644 --- a/ElectronicObserver/Window/FormFleet.Designer.cs +++ b/ElectronicObserver/Window/FormFleet.Designer.cs @@ -33,8 +33,8 @@ private void InitializeComponent() { this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.ContextMenuFleet_AntiAirDetails = new System.Windows.Forms.ToolStripMenuItem(); this.ContextMenuFleet_Capture = new System.Windows.Forms.ToolStripMenuItem(); - this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); this.ContextMenuFleet_OutputFleetImage = new System.Windows.Forms.ToolStripMenuItem(); + this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); this.ContextMenuFleet.SuspendLayout(); this.SuspendLayout(); // @@ -130,6 +130,13 @@ private void InitializeComponent() { this.ContextMenuFleet_Capture.Text = "この画面をキャプチャ(&S)"; this.ContextMenuFleet_Capture.Click += new System.EventHandler(this.ContextMenuFleet_Capture_Click); // + // ContextMenuFleet_OutputFleetImage + // + this.ContextMenuFleet_OutputFleetImage.Name = "ContextMenuFleet_OutputFleetImage"; + this.ContextMenuFleet_OutputFleetImage.Size = new System.Drawing.Size(227, 22); + this.ContextMenuFleet_OutputFleetImage.Text = "編成画像を出力(&I)"; + this.ContextMenuFleet_OutputFleetImage.Click += new System.EventHandler(this.ContextMenuFleet_OutputFleetImage_Click); + // // ToolTipInfo // this.ToolTipInfo.AutoPopDelay = 30000; @@ -137,13 +144,6 @@ private void InitializeComponent() { this.ToolTipInfo.ReshowDelay = 100; this.ToolTipInfo.ShowAlways = true; // - // ContextMenuFleet_OutputFleetImage - // - this.ContextMenuFleet_OutputFleetImage.Name = "ContextMenuFleet_OutputFleetImage"; - this.ContextMenuFleet_OutputFleetImage.Size = new System.Drawing.Size(227, 22); - this.ContextMenuFleet_OutputFleetImage.Text = "編成画像を出力(仮)"; - this.ContextMenuFleet_OutputFleetImage.Click += new System.EventHandler(this.ContextMenuFleet_OutputFleetImage_Click); - // // FormFleet // this.AutoHidePortion = 150D; diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index f5eccd474..00cd9148f 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -1029,6 +1029,13 @@ private void ContextMenuFleet_Capture_Click( object sender, EventArgs e ) { } + private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e ) { + + using ( var dialog = new DialogFleetImageGenerator( FleetID ) ) { + dialog.ShowDialog( this ); + } + } + void ConfigurationChanged() { @@ -1100,377 +1107,6 @@ protected override string GetPersistString() { } - - private void ContextMenuFleet_OutputFleetImage_Click( object sender, EventArgs e ) { - - bool reflectDamage = true; - - - - - var args = new Utility.FleetImageArgument(); - args.FleetIDs = new int[] { 1, 2 }; - args.HorizontalFleetCount = 2; - args.HorizontalShipCount = 2; - args.ReflectDamageGraphic = true; - args.AvoidTwitterDeterioration = true; - args.TitleFont = new Font( "Meiryo UI", 32, FontStyle.Bold, GraphicsUnit.Pixel ); - args.LargeFont = new Font( "Meiryo UI", 24, FontStyle.Regular, GraphicsUnit.Pixel ); - args.MediumFont = new Font( "Meiryo UI", 16, FontStyle.Regular, GraphicsUnit.Pixel ); - args.SmallFont = new Font( "Meiryo UI", 12, FontStyle.Regular, GraphicsUnit.Pixel ); - args.MediumDigitFont = new Font( "Meiryo UI", 16, FontStyle.Regular, GraphicsUnit.Pixel ); - args.SmallDigitFont = new Font( "Meiryo UI", 12, FontStyle.Regular, GraphicsUnit.Pixel ); - args.BackgroundImagePath = @""; - args.Title = "適当にタイトルを入力"; - args.Comment = "コメント部分です。\r\nここに適当な文字列を入力することができます。ねこです \r\nよろしくおねがいします"; - - using ( var image = Utility.FleetImageGenerator.GenerateBannerBitmap( args ) ) { - string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; - image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); - System.Diagnostics.Process.Start( savePath ); - } - - args.TitleFont.Dispose(); - args.LargeFont.Dispose(); - args.MediumFont.Dispose(); - args.SmallFont.Dispose(); - args.MediumDigitFont.Dispose(); - args.SmallDigitFont.Dispose(); - return; - - - // layout testing - switch ( 3 ) { - case 1: // card - - using ( var image = new Bitmap( 900, 900 ) ) { - using ( var g = Graphics.FromImage( image ) ) { - - var font = Font; - var characterBrush = Brushes.Black; - int lineHeight = 16; - int shipWidth = 450; - - g.Clear( Color.White ); - - - var members = KCDatabase.Instance.Fleet[FleetID].MembersInstance; - - for ( int shipIndex = 0; shipIndex < members.Count; shipIndex++ ) { - - var ship = members[shipIndex]; - Point shipOffset = new Point( shipIndex % 2 * shipWidth, shipIndex / 2 * 300 ); - - - if ( ship == null ) - continue; - - - try { - string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + ship.MasterShip.ResourceName + ".swf"; - if ( System.IO.File.Exists( shipSwfPath ) ) { - - var shipSwf = new SwfParser(); - shipSwf.Parse( shipSwfPath ); - - var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == ( reflectDamage && ship.HPRate <= 0.5 ? 7 : 5 ) ); - using ( var shipImage = imgtag.ExtractImage() ) { - g.DrawImage( shipImage, new Rectangle( shipOffset.X + shipWidth - 218, shipOffset.Y, 218, 300 ) ); - } - } - } catch ( Exception ) { - } - - g.DrawString( ship.NameWithLevel, font, characterBrush, shipOffset.X + 0, shipOffset.Y + 0 ); - shipOffset.Y += lineHeight * 2; - - for ( int slotIndex = 0; slotIndex < ship.AllSlot.Count; slotIndex++ ) { - int icon; - string name; - var eq = ship.AllSlotInstance[slotIndex]; - int aircraft = slotIndex < ship.MasterShip.Aircraft.Count ? ship.MasterShip.Aircraft[slotIndex] : 0; - - Point slotOffset = new Point( shipOffset.X + 0, shipOffset.Y + slotIndex * lineHeight ); - - if ( eq == null ) { - if ( slotIndex < ship.SlotSize ) { - icon = (int)ResourceManager.EquipmentContent.Nothing; - name = "(なし)"; - } else { - icon = (int)ResourceManager.EquipmentContent.Locked; - name = ""; - } - } else { - if ( eq.MasterEquipment.IconType <= 0 || (int)ResourceManager.EquipmentContent.Locked <= eq.MasterEquipment.IconType ) { - icon = (int)ResourceManager.EquipmentContent.Unknown; - name = eq.NameWithLevel; - } else { - icon = eq.MasterEquipment.IconType; - name = eq.NameWithLevel; - } - } - - if ( aircraft > 0 && eq != null && Calculator.IsAircraft( eq.EquipmentID, true, true ) ) - g.DrawString( aircraft.ToString(), font, characterBrush, slotOffset.X, slotOffset.Y ); - g.DrawImage( ResourceManager.Instance.Equipments.Images[icon], slotOffset.X + 16, slotOffset.Y, 16, 16 ); - g.DrawString( name, font, characterBrush, slotOffset.X + 32, slotOffset.Y ); - } - - shipOffset.Y += lineHeight * 7; - - { - Point paramOffset = new Point( shipOffset.X, shipOffset.Y ); - - var list = new[] { - new { image = ResourceManager.IconContent.ParameterHP, param = ship.HPMax.ToString() }, - new { image = ResourceManager.IconContent.ParameterFirepower, param = ship.FirepowerTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterArmor, param = ship.ArmorTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterTorpedo, param = ship.TorpedoTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterEvasion, param = ship.EvasionTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterAA, param = ship.AATotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterAircraft, param = ship.AircraftTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterASW, param = ship.ASWTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterSpeed, param = Constants.GetSpeed( ship.Speed ) }, - new { image = ResourceManager.IconContent.ParameterLOS, param = ship.LOSTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterRange, param = Constants.GetRange( ship.Range ) }, - new { image = ResourceManager.IconContent.ParameterLuck, param = ship.LuckTotal.ToString() }, - }; - - var icons = Resource.ResourceManager.Instance.Icons; - - for ( int i = 0; i < list.Length; i++ ) { - g.DrawImage( icons.Images[(int)list[i].image], paramOffset.X + i % 2 * 100, paramOffset.Y + i / 2 * lineHeight, 16, 16 ); - g.DrawString( list[i].param, font, characterBrush, paramOffset.X + i % 2 * 100 + 16, paramOffset.Y + i / 2 * lineHeight ); - } - } - } - - - image.SetPixel( 0, 0, Color.FromArgb( 252, image.GetPixel( 0, 0 ) ) ); - string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; - image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); - System.Diagnostics.Process.Start( savePath ); - } - } - - break; - - case 2: // cutin - using ( var image = new Bitmap( 665, 121 * 6 ) ) { - using ( var g = Graphics.FromImage( image ) ) { - - var font = Font; - var characterBrush = Brushes.Black; - int lineHeight = 16; - int shipWidth = 450; - Color backColor = Color.White; - - g.Clear( backColor ); - - - var members = KCDatabase.Instance.Fleet[FleetID].MembersInstance; - - for ( int shipIndex = 0; shipIndex < members.Count; shipIndex++ ) { - - var ship = members[shipIndex]; - Point shipOffset = new Point( 0, shipIndex * 121 ); - - - if ( ship == null ) - continue; - - - try { - string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + ship.MasterShip.ResourceName + ".swf"; - if ( System.IO.File.Exists( shipSwfPath ) ) { - - var shipSwf = new SwfParser(); - shipSwf.Parse( shipSwfPath ); - - var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == ( reflectDamage && ship.HPRate <= 0.5 ? 23 : 21 ) ); - using ( var shipImage = imgtag.ExtractImage() ) { - g.DrawImage( shipImage, new Rectangle( shipOffset.X, shipOffset.Y, 665, 121 ) ); - } - } - } catch ( Exception ) { - } - - - shipOffset.X += 332; - using ( var brush = new System.Drawing.Drawing2D.LinearGradientBrush( new Rectangle( shipOffset.X, shipOffset.Y, 111, 121 ), Color.Transparent, backColor, System.Drawing.Drawing2D.LinearGradientMode.Horizontal ) ) { - brush.GammaCorrection = true; - g.FillRectangle( brush, new Rectangle( shipOffset.X, shipOffset.Y, 111, 121 ) ); - } - g.FillRectangle( Brushes.White, new Rectangle( shipOffset.X + 111, shipOffset.Y, 333 - 111, 121 ) ); - - shipOffset.X += 100; - - g.DrawString( ship.NameWithLevel, font, characterBrush, shipOffset.X, shipOffset.Y ); - shipOffset.Y += lineHeight; - - - for ( int slotIndex = 0; slotIndex < ship.AllSlot.Count; slotIndex++ ) { - int icon; - string name; - var eq = ship.AllSlotInstance[slotIndex]; - int aircraft = slotIndex < ship.MasterShip.Aircraft.Count ? ship.MasterShip.Aircraft[slotIndex] : 0; - - Point slotOffset = new Point( shipOffset.X + 0, shipOffset.Y + slotIndex * lineHeight ); - - if ( eq == null ) { - if ( slotIndex < ship.SlotSize ) { - icon = (int)ResourceManager.EquipmentContent.Nothing; - name = "(なし)"; - } else { - icon = (int)ResourceManager.EquipmentContent.Locked; - name = ""; - } - } else { - if ( eq.MasterEquipment.IconType <= 0 || (int)ResourceManager.EquipmentContent.Locked <= eq.MasterEquipment.IconType ) { - icon = (int)ResourceManager.EquipmentContent.Unknown; - name = eq.NameWithLevel; - } else { - icon = eq.MasterEquipment.IconType; - name = eq.NameWithLevel; - } - } - - if ( aircraft > 0 && eq != null && Calculator.IsAircraft( eq.EquipmentID, true, true ) ) - g.DrawString( aircraft.ToString(), font, characterBrush, slotOffset.X, slotOffset.Y ); - g.DrawImage( ResourceManager.Instance.Equipments.Images[icon], slotOffset.X + 16, slotOffset.Y, 16, 16 ); - g.DrawString( name, font, characterBrush, slotOffset.X + 32, slotOffset.Y ); - } - - } - - - image.SetPixel( 0, 0, Color.FromArgb( 252, image.GetPixel( 0, 0 ) ) ); - string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; - image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); - System.Diagnostics.Process.Start( savePath ); - } - } - break; - - case 3: // banner - using ( var image = new Bitmap( 800, 480 ) ) { - using ( var g = Graphics.FromImage( image ) ) { - - var font = Font; - var characterBrush = Brushes.Black; - int lineHeight = 16; - int shipWidth = 400; - int shipHeight = 160; - Color backColor = Color.White; - var icons = ResourceManager.Instance.Icons; - - g.Clear( backColor ); - - - var members = KCDatabase.Instance.Fleet[FleetID].MembersInstance; - - for ( int shipIndex = 0; shipIndex < members.Count; shipIndex++ ) { - - var ship = members[shipIndex]; - Point shipOffset = new Point( shipIndex % 2 * shipWidth, shipIndex / 2 * shipHeight ); - - - if ( ship == null ) - continue; - - - try { - string shipSwfPath = Utility.Configuration.Config.Connection.SaveDataPath + @"\resources\swf\ships\" + ship.MasterShip.ResourceName + ".swf"; - if ( System.IO.File.Exists( shipSwfPath ) ) { - - var shipSwf = new SwfParser(); - shipSwf.Parse( shipSwfPath ); - - var imgtag = shipSwf.FindTags().FirstOrDefault( t => t.CharacterID == ( reflectDamage && ship.HPRate <= 0.5 ? 3 : 1 ) ); - using ( var shipImage = imgtag.ExtractImage() ) { - g.DrawImage( shipImage, new Rectangle( shipOffset.X + 400 - 160, shipOffset.Y, 160, 40 ) ); - } - } - } catch ( Exception ) { - } - - - g.DrawString( ship.Name, font, characterBrush, shipOffset.X, shipOffset.Y + lineHeight * 0 ); - g.DrawString( string.Format( "Lv. {0} / next. {1}", ship.Level, ship.ExpNext ), font, characterBrush, shipOffset.X, shipOffset.Y + lineHeight * 1 ); - - g.DrawImage( icons.Images[(int)ResourceManager.IconContent.ParameterHP], shipOffset.X, shipOffset.Y + lineHeight * 2, 16, 16 ); - g.DrawString( string.Format( "HP: {0} / {1}", ship.HPCurrent, ship.HPMax ), font, characterBrush, shipOffset.X + 16, shipOffset.Y + lineHeight * 2 ); - - { - Point paramOffset = new Point( shipOffset.X, shipOffset.Y + lineHeight * 4 ); - - var list = new[] { - new { image = ResourceManager.IconContent.ParameterFirepower, param = ship.FirepowerTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterTorpedo, param = ship.TorpedoTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterAA, param = ship.AATotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterArmor, param = ship.ArmorTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterSpeed, param = Constants.GetSpeed( ship.Speed ) }, - new { image = ResourceManager.IconContent.ParameterASW, param = ship.ASWTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterEvasion, param = ship.EvasionTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterLOS, param = ship.LOSTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterLuck, param = ship.LuckTotal.ToString() }, - new { image = ResourceManager.IconContent.ParameterRange, param = Constants.GetRange( ship.Range ) }, - }; - - for ( int i = 0; i < list.Length; i++ ) { - g.DrawImage( icons.Images[(int)list[i].image], paramOffset.X + i / 5 * 80, paramOffset.Y + i % 5 * lineHeight, 16, 16 ); - g.DrawString( list[i].param, font, characterBrush, paramOffset.X + i / 5 * 80 + 16, paramOffset.Y + i % 5 * lineHeight ); - } - } - - - for ( int slotIndex = 0; slotIndex < ship.AllSlot.Count; slotIndex++ ) { - int icon; - string name; - var eq = ship.AllSlotInstance[slotIndex]; - int aircraft = slotIndex < ship.MasterShip.Aircraft.Count ? ship.MasterShip.Aircraft[slotIndex] : 0; - - Point slotOffset = new Point( shipOffset.X + 160, shipOffset.Y + 48 + slotIndex * lineHeight ); - - if ( eq == null ) { - if ( slotIndex < ship.SlotSize ) { - icon = (int)ResourceManager.EquipmentContent.Nothing; - name = "(なし)"; - } else { - icon = (int)ResourceManager.EquipmentContent.Locked; - name = ""; - } - } else { - if ( eq.MasterEquipment.IconType <= 0 || (int)ResourceManager.EquipmentContent.Locked <= eq.MasterEquipment.IconType ) { - icon = (int)ResourceManager.EquipmentContent.Unknown; - name = eq.NameWithLevel; - } else { - icon = eq.MasterEquipment.IconType; - name = eq.NameWithLevel; - } - } - - if ( aircraft > 0 && eq != null && Calculator.IsAircraft( eq.EquipmentID, true, true ) ) - g.DrawString( aircraft.ToString(), font, characterBrush, slotOffset.X, slotOffset.Y ); - g.DrawImage( ResourceManager.Instance.Equipments.Images[icon], slotOffset.X + 16, slotOffset.Y, 16, 16 ); - g.DrawString( name, font, characterBrush, slotOffset.X + 32, slotOffset.Y ); - } - - - } - - - image.SetPixel( 0, 0, Color.FromArgb( 252, image.GetPixel( 0, 0 ) ) ); - string savePath = System.Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + @"\test.png"; - image.Save( savePath, System.Drawing.Imaging.ImageFormat.Png ); - System.Diagnostics.Process.Start( savePath ); - } - } - break; - } - } - - } } From 5d3a2e40d105823184e5361c57b5a2b536167428 Mon Sep 17 00:00:00 2001 From: Andante Date: Sun, 23 Apr 2017 22:38:15 +0900 Subject: [PATCH 14/16] =?UTF-8?q?=E7=B7=A8=E6=88=90=E7=94=BB=E5=83=8F?= =?UTF-8?q?=EF=BC=9A=E4=BF=9D=E5=AD=98=E5=85=88=E3=83=95=E3=82=A9=E3=83=AB?= =?UTF-8?q?=E3=83=80=E3=82=92=E5=BE=A9=E5=85=83=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ライセンスファイルの追加 --- .../Dialog/DialogFleetImageGenerator.cs | 3 ++- Licenses/SwfExtractor.txt | 21 +++++++++++++++++++ README.md | 11 +++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 Licenses/SwfExtractor.txt diff --git a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs index 8decb1336..b24b86755 100644 --- a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs +++ b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs @@ -90,7 +90,8 @@ private void LoadConfiguration() { OpenImageAfterOutput.Checked = config.OpenImageAfterOutput; - SaveImageDialog.FileName = config.LastOutputPath; + SaveImageDialog.FileName = System.IO.Path.GetFileName( config.LastOutputPath ); + SaveImageDialog.InitialDirectory = System.IO.Path.GetDirectoryName( config.LastOutputPath ); } private void SaveConfiguration() { diff --git a/Licenses/SwfExtractor.txt b/Licenses/SwfExtractor.txt new file mode 100644 index 000000000..591ae88c8 --- /dev/null +++ b/Licenses/SwfExtractor.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Andante + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 9f688c69c..49f139aab 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,14 @@ [Other/Information/](https://github.com/andanteyk/ElectronicObserver/tree/develop/ElectronicObserver/Other/Information) に艦これのAPIや仕様についての情報を掲載しています。 ご自由にお持ちください。但し内容は保証しません。 -また、実行する際は実行フォルダに気を付けてください。 -Assets.zip をプログラムと同じ場所にコピーするか、実行フォルダの設定を変更してください。 - [ライセンスは MIT License です。](https://github.com/andanteyk/ElectronicObserver/blob/master/LICENSE) +#### 実行方法 + +1. `git clone` +2. `git submodule init` +3. `git submodule update` + ### 使用しているライブラリ --- @@ -60,6 +63,8 @@ Assets.zip をプログラムと同じ場所にコピーするか、実行フォ * [Nekoxy](https://github.com/veigr/Nekoxy) (通信キャプチャ) - [MIT License](https://github.com/andanteyk/ElectronicObserver/blob/master/Licenses/Nekoxy.txt) * [TrotiNet](http://trotinet.sourceforge.net/) - [GNU Lesser General Public License v3.0](https://github.com/andanteyk/ElectronicObserver/blob/master/Licenses/LGPL.txt) * [log4net](https://logging.apache.org/log4net/) - [Apache License version 2.0](https://github.com/andanteyk/ElectronicObserver/blob/master/Licenses/Apache.txt) +* [SwfExtractor](https://github.com/andanteyk/SwfExtractor) (swf からファイル抽出) - [MIT License](https://github.com/andanteyk/ElectronicObserver/blob/master/Licenses/SwfExtractor.txt) + * [LZMA SDK (Software Development Kit)](http://www.7-zip.org/sdk.html) - Public Domain ### 連絡先など --- From d57159a09953026289a94369d1c64ebb8ca89792 Mon Sep 17 00:00:00 2001 From: Andante Date: Sun, 23 Apr 2017 23:06:16 +0900 Subject: [PATCH 15/16] =?UTF-8?q?=E7=B7=A8=E6=88=90=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E5=87=BA=E5=8A=9B=EF=BC=9A=E5=88=9D=E5=9B=9E=E5=AE=9F=E8=A1=8C?= =?UTF-8?q?=E6=99=82=E3=81=AB=E8=90=BD=E3=81=A1=E3=82=8B=E4=B8=8D=E5=85=B7?= =?UTF-8?q?=E5=90=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ElectronicObserver/Utility/FleetImageGenerator.cs | 3 +++ ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ElectronicObserver/Utility/FleetImageGenerator.cs b/ElectronicObserver/Utility/FleetImageGenerator.cs index 10de66543..c78d82393 100644 --- a/ElectronicObserver/Utility/FleetImageGenerator.cs +++ b/ElectronicObserver/Utility/FleetImageGenerator.cs @@ -1431,6 +1431,9 @@ public SerializableFont SerializedSmallDigitFont { public FleetImageArgument() { + BackgroundImagePath = ""; + Title = ""; + Comment = ""; } diff --git a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs index b24b86755..f6c0274ea 100644 --- a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs +++ b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs @@ -91,7 +91,7 @@ private void LoadConfiguration() { OpenImageAfterOutput.Checked = config.OpenImageAfterOutput; SaveImageDialog.FileName = System.IO.Path.GetFileName( config.LastOutputPath ); - SaveImageDialog.InitialDirectory = System.IO.Path.GetDirectoryName( config.LastOutputPath ); + SaveImageDialog.InitialDirectory = string.IsNullOrWhiteSpace( config.LastOutputPath ) ? "" : System.IO.Path.GetDirectoryName( config.LastOutputPath ); } private void SaveConfiguration() { From b94695685f326404284e161d29a83b9820b6f3ea Mon Sep 17 00:00:00 2001 From: Andante Date: Mon, 24 Apr 2017 00:10:12 +0900 Subject: [PATCH 16/16] Version 2.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 編成画像出力:comment を一応 null 対策 --- ElectronicObserver/Utility/SoftwareInformation.cs | 6 +++--- .../Window/Dialog/DialogFleetImageGenerator.cs | 2 +- README.md | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ElectronicObserver/Utility/SoftwareInformation.cs b/ElectronicObserver/Utility/SoftwareInformation.cs index f1e90a672..0840a85ae 100644 --- a/ElectronicObserver/Utility/SoftwareInformation.cs +++ b/ElectronicObserver/Utility/SoftwareInformation.cs @@ -35,7 +35,7 @@ public static string SoftwareNameEnglish { /// public static string VersionJapanese { get { - return SoftwareNameJapanese + "二五型改六"; + return SoftwareNameJapanese + "二六型"; } } @@ -44,7 +44,7 @@ public static string VersionJapanese { /// public static string VersionEnglish { get { - return "2.5.6"; + return "2.6.0"; } } @@ -54,7 +54,7 @@ public static string VersionEnglish { /// public static DateTime UpdateTime { get { - return DateTimeHelper.CSVStringToTime( "2017/04/06 08:00:00" ); + return DateTimeHelper.CSVStringToTime( "2017/04/23 23:00:00" ); } } diff --git a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs index f6c0274ea..62d6cff1e 100644 --- a/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs +++ b/ElectronicObserver/Window/Dialog/DialogFleetImageGenerator.cs @@ -133,7 +133,7 @@ private void ApplyToUI( FleetImageArgument args ) { TargetFleet4.Checked = fleetIDs.Contains( 4 ); Title.Text = args.Title; - Comment.Text = LFtoCRLF.Replace( args.Comment, "\r\n" ); // 保存データからのロード時に \n に変換されてしまっているため + Comment.Text = string.IsNullOrWhiteSpace( args.Comment ) ? "" : LFtoCRLF.Replace( args.Comment, "\r\n" ); // 保存データからのロード時に \n に変換されてしまっているため HorizontalFleetCount.Value = args.HorizontalFleetCount; diff --git a/README.md b/README.md index 49f139aab..d7f15bea0 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ *このリンクの更新は遅れる可能性があります。最新版は[こちら](http://electronicobserver.blog.fc2.com/)で確認してください。* -[ver. 2.5.6 (2017/04/06)](http://bit.ly/2oDyYU0) +[ver. 2.6.0 (2017/04/23)](http://bit.ly/2pTlkfz) [更新内容・履歴はこちらで確認できます。](https://github.com/andanteyk/ElectronicObserver/wiki/ChangeLog) @@ -49,11 +49,12 @@ [ライセンスは MIT License です。](https://github.com/andanteyk/ElectronicObserver/blob/master/LICENSE) -#### 実行方法 +#### ビルド・実行方法 -1. `git clone` +1. `git clone` (もしくはその他の方法でソースコードを入手) 2. `git submodule init` 3. `git submodule update` +4. 「全てリビルド」して実行 ### 使用しているライブラリ ---