From a9cf201b598de3cfc428b4768dbc27142d201e77 Mon Sep 17 00:00:00 2001 From: Andante Date: Sun, 29 May 2016 22:59:52 +0900 Subject: [PATCH 01/20] =?UTF-8?q?=E5=9F=BA=E5=9C=B0=E8=88=AA=E7=A9=BA?= =?UTF-8?q?=E9=9A=8A=E9=96=A2=E9=80=A3=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 基地航空隊ウィンドウを仮実装 * 白波:設定を誤って読んでいたのを修正 --- ElectronicObserver/Data/BaseAirCorpsData.cs | 171 ++++++++++++++++++ .../Data/BaseAirCorpsSquadron.cs | 119 ++++++++++++ ElectronicObserver/Data/Constants.cs | 21 +++ ElectronicObserver/Data/EquipmentData.cs | 12 ++ ElectronicObserver/Data/KCDatabase.cs | 8 +- ElectronicObserver/ElectronicObserver.csproj | 17 ++ ElectronicObserver/Observer/APIObserver.cs | 7 +- .../kcsapi/api_get_member/base_air_corps.cs | 36 ++++ .../Observer/kcsapi/api_port/port.cs | 23 +++ .../kcsapi/api_req_air_corps/change_name.cs | 29 +++ .../kcsapi/api_req_air_corps/set_action.cs | 28 +++ .../kcsapi/api_req_air_corps/set_plane.cs | 38 ++++ .../kcsapi/api_req_air_corps/supply.cs | 38 ++++ .../Window/Dialog/DialogWhitecap.cs | 2 +- .../Window/FormBaseAirCorps.Designer.cs | 60 ++++++ ElectronicObserver/Window/FormBaseAirCorps.cs | 93 ++++++++++ .../Window/FormBaseAirCorps.resx | 120 ++++++++++++ .../Window/FormMain.Designer.cs | 10 + ElectronicObserver/Window/FormMain.cs | 11 +- 19 files changed, 839 insertions(+), 4 deletions(-) create mode 100644 ElectronicObserver/Data/BaseAirCorpsData.cs create mode 100644 ElectronicObserver/Data/BaseAirCorpsSquadron.cs create mode 100644 ElectronicObserver/Observer/kcsapi/api_get_member/base_air_corps.cs create mode 100644 ElectronicObserver/Observer/kcsapi/api_req_air_corps/change_name.cs create mode 100644 ElectronicObserver/Observer/kcsapi/api_req_air_corps/set_action.cs create mode 100644 ElectronicObserver/Observer/kcsapi/api_req_air_corps/set_plane.cs create mode 100644 ElectronicObserver/Observer/kcsapi/api_req_air_corps/supply.cs create mode 100644 ElectronicObserver/Window/FormBaseAirCorps.Designer.cs create mode 100644 ElectronicObserver/Window/FormBaseAirCorps.cs create mode 100644 ElectronicObserver/Window/FormBaseAirCorps.resx diff --git a/ElectronicObserver/Data/BaseAirCorpsData.cs b/ElectronicObserver/Data/BaseAirCorpsData.cs new file mode 100644 index 000000000..0862ae5de --- /dev/null +++ b/ElectronicObserver/Data/BaseAirCorpsData.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data { + + /// + /// 基地航空隊のデータを扱います。 + /// + [DebuggerDisplay( "[{AirCorpsID}] {Name}" )] + public class BaseAirCorpsData : APIWrapper, IIdentifiable { + + + + /// + /// 航空隊ID + /// + public int AirCorpsID { + get { + return (int)RawData.api_rid; + } + } + + /// + /// 航空隊名 + /// + public string Name { + get { + return RawData.api_name; + } + private set { + RawData.api_name = value; + } + } + + /// + /// 戦闘行動半径 + /// + public int Distance { + get { + return (int)RawData.api_distance; + } + private set { + RawData.api_distance = value; + } + } + + /// + /// 行動指示 + /// 0=待機, 1=出撃, 2=防空, 3=退避, 4=休息 + /// + public int ActionKind { + get { + return (int)RawData.api_action_kind; + } + private set { + RawData.api_action_kind = value; + } + } + + + /// + /// 航空中隊情報 + /// + public IDDictionary Squadrons { get; private set; } + + + + /// + /// 配置転換中の装備固有IDリスト + /// + public static HashSet RelocatedEquipments { get; private set; } + + + static BaseAirCorpsData() { + RelocatedEquipments = new HashSet(); + } + + + public BaseAirCorpsData() { + Squadrons = new IDDictionary(); + } + + + public override void LoadFromRequest( string apiname, Dictionary data ) { + base.LoadFromRequest( apiname, data ); + + switch ( apiname ) { + case "api_req_air_corps/change_name": + Name = data["api_name"]; + break; + + case "api_req_air_corps/set_action": { + + int[] ids = data["api_base_id"].Split( ",".ToCharArray() ).Select( s => int.Parse( s ) ).ToArray(); + int[] actions = data["api_action_kind"].Split( ",".ToCharArray() ).Select( s => int.Parse( s ) ).ToArray(); + + int index = Array.IndexOf( ids, AirCorpsID ); + + if ( index >= 0 ) { + ActionKind = actions[index]; + } + + } break; + } + } + + public override void LoadFromResponse( string apiname, dynamic data ) { + + switch ( apiname ) { + case "api_get_member/base_air_corps": + default: + base.LoadFromResponse( apiname, (object)data ); + + SetSquadrons( apiname, data.api_plane_info ); + break; + + case "api_req_air_corps/set_plane": { + var prev = Squadrons.Values.Select( sq => sq != null ? sq.EquipmentID : 0 ).ToArray(); + SetSquadrons( apiname, data.api_plane_info ); + + foreach ( var deleted in prev.Except( Squadrons.Values.Select( sq => sq != null && sq.State == 1 ? sq.EquipmentID : 0 ) ) ) { + var eq = KCDatabase.Instance.Equipments[deleted]; + + if ( eq != null ) { + eq.RelocatedTime = DateTime.Now; + BaseAirCorpsData.RelocatedEquipments.Add( deleted ); + } + } + + Distance = (int)data.api_distance; + } break; + + case "api_req_air_corps/supply": + SetSquadrons( apiname, data.api_plane_info ); + break; + } + } + + private void SetSquadrons( string apiname, dynamic data ) { + + foreach ( var elem in data ) { + + int id = (int)elem.api_squadron_id; + + if ( !Squadrons.ContainsKey( id ) ) { + var a = new BaseAirCorpsSquadron(); + a.LoadFromResponse( apiname, elem ); + Squadrons.Add( a ); + + } else { + Squadrons[id].LoadFromResponse( apiname, elem ); + } + } + } + + + public static void SetRelocatedEquipments( IEnumerable values ) { + if ( values != null ) + RelocatedEquipments = new HashSet( values ); + } + + public int ID { + get { return AirCorpsID; } + } + } +} diff --git a/ElectronicObserver/Data/BaseAirCorpsSquadron.cs b/ElectronicObserver/Data/BaseAirCorpsSquadron.cs new file mode 100644 index 000000000..dcc53bee5 --- /dev/null +++ b/ElectronicObserver/Data/BaseAirCorpsSquadron.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data { + + /// + /// 基地航空隊の航空中隊データを扱います。 + /// + [DebuggerDisplay( "{EquipmentInstance} {AircraftCurrent}/{AircraftMax}" )] + public class BaseAirCorpsSquadron : APIWrapper, IIdentifiable { + + /// + /// 中隊ID + /// + public int SquadronID { + get { + return (int)RawData.api_squadron_id; + } + } + + /// + /// 状態 + /// 0=未配属, 1=配属済み, 2=配置転換中 + /// + public int State { + get { + return RawData.api_state() ? (int)RawData.api_state : 0; + } + } + + /// + /// 装備固有ID + /// + public int EquipmentID { + get { + return (int)RawData.api_slotid; + } + } + + /// + /// 装備データ + /// + public EquipmentData EquipmentInstance { + get { + return KCDatabase.Instance.Equipments[EquipmentID]; + } + } + + /// + /// マスター装備データ + /// + public EquipmentDataMaster EquipmentInstanceMaster { + get { + var eq = EquipmentInstance; + return eq != null ? eq.MasterEquipment : null; + } + } + + /// + /// 現在の稼働機数 + /// + public int AircraftCurrent { + get { + return RawData.api_count() ? (int)RawData.api_count : 0; + } + } + + /// + /// 最大機数 + /// + public int AircraftMax { + get { + return RawData.api_max_count() ? (int)RawData.api_max_count : 0; + } + } + + /// + /// コンディション + /// 1=通常、2=橙疲労、3=赤疲労 + /// + public int Condition { + get { + return RawData.api_cond() ? (int)RawData.api_cond : 1; + } + } + + + /// + /// 配置転換を開始した時刻 + /// + public DateTime RelocatedTime { get; private set; } + + + public override void LoadFromResponse( string apiname, dynamic data ) { + + int prevState = RawData != null ? State : 0; + + base.LoadFromResponse( apiname, (object)data ); + + // 配置転換中になったとき + if ( prevState == 1 && State == 2 ) { + RelocatedTime = DateTime.Now; + } + + if ( State != 2 ) { + RelocatedTime = DateTime.MinValue; + } + } + + + public int ID { + get { return SquadronID; } + } + } +} diff --git a/ElectronicObserver/Data/Constants.cs b/ElectronicObserver/Data/Constants.cs index cf8dd0eb4..f8cd68f7e 100644 --- a/ElectronicObserver/Data/Constants.cs +++ b/ElectronicObserver/Data/Constants.cs @@ -174,6 +174,27 @@ public static string GetDamageState( double hprate, bool isPractice = false, boo } + + /// + /// 基地航空隊の行動指示を表す文字列を取得します。 + /// + public static string GetBaseAirCorpsActionKind( int value ) { + switch ( value ) { + case 0: + return "待機"; + case 1: + return "出撃"; + case 2: + return "防空"; + case 3: + return "退避"; + case 4: + return "休息"; + default: + return "不明"; + } + } + #endregion diff --git a/ElectronicObserver/Data/EquipmentData.cs b/ElectronicObserver/Data/EquipmentData.cs index 159ef96f1..6c79a0c52 100644 --- a/ElectronicObserver/Data/EquipmentData.cs +++ b/ElectronicObserver/Data/EquipmentData.cs @@ -86,6 +86,18 @@ public string NameWithLevel { } + /// + /// 配置転換された時刻 + /// されていなければ DateTime.MinValue + /// + public DateTime RelocatedTime { get; internal set; } + + /// + /// 配置転換中かどうか + /// + public bool IsRelocated { get { return RelocatedTime != DateTime.MinValue; } } + + public int ID { get { return MasterID; } diff --git a/ElectronicObserver/Data/KCDatabase.cs b/ElectronicObserver/Data/KCDatabase.cs index 75564d4c2..ac24a6678 100644 --- a/ElectronicObserver/Data/KCDatabase.cs +++ b/ElectronicObserver/Data/KCDatabase.cs @@ -134,6 +134,12 @@ public static KCDatabase Instance { public ShipGroupManager ShipGroup { get; private set; } + /// + /// 基地航空隊データ + /// + public IDDictionary BaseAirCorps { get; private set; } + + private KCDatabase() { @@ -156,7 +162,7 @@ private KCDatabase() { MapInfo = new IDDictionary(); Mission = new IDDictionary(); ShipGroup = new ShipGroupManager(); - + BaseAirCorps = new IDDictionary(); } diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index 5b50b63d2..3f91c5684 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -96,6 +96,8 @@ + + @@ -174,11 +176,16 @@ + + + + + @@ -457,6 +464,12 @@ FormArsenal.cs + + Form + + + FormBaseAirCorps.cs + Form @@ -654,6 +667,9 @@ FormArsenal.cs + + FormBaseAirCorps.cs + FormBattle.cs @@ -764,6 +780,7 @@ WinFormsUI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/ElectronicObserver/Window/FormMain.Designer.cs b/ElectronicObserver/Window/FormMain.Designer.cs index 697c92bf2..6172c96ef 100644 --- a/ElectronicObserver/Window/FormMain.Designer.cs +++ b/ElectronicObserver/Window/FormMain.Designer.cs @@ -93,6 +93,7 @@ private void InitializeComponent() { this.StripStatus_Clock = new System.Windows.Forms.ToolStripStatusLabel(); this.UIUpdateTimer = new System.Windows.Forms.Timer(this.components); this.MainDockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); + this.StripMenu_View_BaseAirCorps = new System.Windows.Forms.ToolStripMenuItem(); this.StripMenu.SuspendLayout(); this.StripStatus.SuspendLayout(); this.SuspendLayout(); @@ -234,6 +235,7 @@ private void InitializeComponent() { this.toolStripSeparator1, this.StripMenu_View_Dock, this.StripMenu_View_Arsenal, + this.StripMenu_View_BaseAirCorps, this.toolStripSeparator2, this.StripMenu_View_Headquarters, this.StripMenu_View_Quest, @@ -633,6 +635,13 @@ private void InitializeComponent() { this.MainDockPanel.Size = new System.Drawing.Size(640, 434); this.MainDockPanel.TabIndex = 0; // + // StripMenu_View_BaseAirCorps + // + this.StripMenu_View_BaseAirCorps.Name = "StripMenu_View_BaseAirCorps"; + this.StripMenu_View_BaseAirCorps.Size = new System.Drawing.Size(182, 22); + this.StripMenu_View_BaseAirCorps.Text = "基地航空隊(&S)"; + this.StripMenu_View_BaseAirCorps.Click += new System.EventHandler(this.StripMenu_View_BaseAirCorps_Click); + // // FormMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -729,5 +738,6 @@ private void InitializeComponent() { private System.Windows.Forms.ToolStripMenuItem StripMenu_File_Layout_Change; private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; private System.Windows.Forms.ToolStripMenuItem StripMenu_File_Layout_LockLayout; + private System.Windows.Forms.ToolStripMenuItem StripMenu_View_BaseAirCorps; } } diff --git a/ElectronicObserver/Window/FormMain.cs b/ElectronicObserver/Window/FormMain.cs index 97b707b40..ff1ed976c 100644 --- a/ElectronicObserver/Window/FormMain.cs +++ b/ElectronicObserver/Window/FormMain.cs @@ -57,6 +57,7 @@ public partial class FormMain : Form { public FormShipGroup fShipGroup; public FormBrowserHost fBrowser; public FormWindowCapture fWindowCapture; + public FormBaseAirCorps fBaseAirCorps; #endregion @@ -157,7 +158,7 @@ private async void FormMain_Load( object sender, EventArgs e ) { SubForms.Add( fShipGroup = new FormShipGroup( this ) ); SubForms.Add( fBrowser = new FormBrowserHost( this ) ); SubForms.Add( fWindowCapture = new FormWindowCapture( this ) ); - + SubForms.Add( fBaseAirCorps = new FormBaseAirCorps( this ) ); ConfigurationChanged(); //設定から初期化 @@ -432,6 +433,8 @@ private IDockContent GetDockContentFromPersistString( string persistString ) { return fBrowser; case "WindowCapture": return fWindowCapture; + case "BaseAirCorps": + return fBaseAirCorps; default: if ( persistString.StartsWith( "ShipGroup" ) ) { fShipGroup.ConfigureFromPersistString( persistString ); @@ -1244,8 +1247,14 @@ private void StripMenu_WindowCapture_SubWindow_Click( object sender, EventArgs e ShowForm( fWindowCapture ); } + private void StripMenu_View_BaseAirCorps_Click( object sender, EventArgs e ) { + ShowForm( fBaseAirCorps ); + } + #endregion + + From 15529d06e56ea27b8736ee95bf3232c2571cd657 Mon Sep 17 00:00:00 2001 From: Andante Date: Tue, 31 May 2016 01:13:30 +0900 Subject: [PATCH 02/20] =?UTF-8?q?=E5=B1=80=E5=9C=B0=E6=88=A6=E9=97=98?= =?UTF-8?q?=E6=A9=9F=E3=81=AE=E5=88=B6=E7=A9=BA=E5=80=A4=E3=83=9C=E3=83=BC?= =?UTF-8?q?=E3=83=8A=E3=82=B9=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/Data/FleetData.cs | 9 +- .../Other/Information/kcmemo.md | 2 +- ElectronicObserver/Utility/Data/Calculator.cs | 191 +++++++++--------- ElectronicObserver/Window/FormBaseAirCorps.cs | 3 +- ElectronicObserver/Window/FormFleet.cs | 16 +- 5 files changed, 123 insertions(+), 98 deletions(-) diff --git a/ElectronicObserver/Data/FleetData.cs b/ElectronicObserver/Data/FleetData.cs index df1b5a1d4..2a26bac73 100644 --- a/ElectronicObserver/Data/FleetData.cs +++ b/ElectronicObserver/Data/FleetData.cs @@ -449,8 +449,13 @@ public void Escape( int index ) { /// /// 制空戦力。 public int GetAirSuperiority() { - - return Calculator.GetAirSuperiority( this ); + switch ( Utility.Configuration.Config.FormFleet.AirSuperiorityMethod ) { + case 0: + default: + return Calculator.GetAirSuperiorityIgnoreLevel( this ); + case 1: + return Calculator.GetAirSuperiority( this ); + } } diff --git a/ElectronicObserver/Other/Information/kcmemo.md b/ElectronicObserver/Other/Information/kcmemo.md index 5368399f4..a59599b22 100644 --- a/ElectronicObserver/Other/Information/kcmemo.md +++ b/ElectronicObserver/Other/Information/kcmemo.md @@ -1210,7 +1210,7 @@ Lv. 3 の離島棲鬼には装甲破壊効果はないのではないかと思 * 熟練度(少なくとも制空値ボーナス)は有効 * 敵偵察機も航空戦に参加する * そのため、敵の偵察機搭載数を測定できるかもしれない -* 局地戦闘機は「命中」が「対爆」と表示される +* 局地戦闘機は「命中」が「対爆」、「回避」が「迎撃」と表示される * 補給しなくとも配置転換すれば全機補充される * 但し配置コストがかかるので利用は難しい * クライアント上の航空隊戦闘行動半径は Max(中隊〃) だが、APIの値は Min(中隊〃) diff --git a/ElectronicObserver/Utility/Data/Calculator.cs b/ElectronicObserver/Utility/Data/Calculator.cs index 70e4dfc94..0aa12d13e 100644 --- a/ElectronicObserver/Utility/Data/Calculator.cs +++ b/ElectronicObserver/Utility/Data/Calculator.cs @@ -26,35 +26,57 @@ public static int GetParameterFromLevel( int min, int max, int lv ) { - /// - /// 制空戦力を求めます。 + /// 各装備カテゴリにおける制空値の熟練度ボーナス /// - /// 装備スロット。 - /// 艦載機搭載量の配列。 - public static int GetAirSuperiority( int[] slot, int[] aircraft ) { + private static readonly Dictionary AircraftLevelBonus = new Dictionary() { + { 6, new int[] { 0, 0, 2, 5, 9, 14, 14, 22, 22 } }, //艦上戦闘機 + { 7, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //艦上爆撃機 + { 8, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //艦上攻撃機 + { 11, new int[] { 0, 1, 1, 1, 1, 3, 3, 6, 6 } }, //水上爆撃機 + { 45, new int[] { 0, 0, 2, 5, 9, 14, 14, 22, 22 } }, //水上戦闘機 + { 47, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //陸上攻撃機 + { 48, new int[] { 0, 0, 2, 5, 9, 14, 14, 22, 22 } }, //局地戦闘機 + }; - int air = 0; - int length = Math.Min( slot.Length, aircraft.Length ); + /// + /// 艦載機熟練度の内部値テーブル(仮) + /// + private static readonly List AircraftExpTable = new List() { + 0, 10, 25, 40, 55, 70, 85, 100, 120 + }; - for ( int s = 0; s < length; s++ ) { - EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[slot[s]]; + /// + /// 制空戦力を求めます。 + /// + /// 装備ID。 + /// 搭載機数。 + /// 艦載機熟練度。既定値は 0 です。 + public static int GetAirSuperiority( int slot, int aircraft, int level = 0 ) { + var eq = KCDatabase.Instance.MasterEquipments[slot]; + if ( eq == null || aircraft == 0 ) + return 0; + + int category = eq.CategoryType; + if ( AircraftLevelBonus.ContainsKey( category ) ) { + return (int)( ( eq.AA + ( category == 48 ? ( eq.Evasion * 1.5 ) : 0 ) ) + * Math.Sqrt( aircraft ) + + Math.Sqrt( AircraftExpTable[level] / 10.0 ) + + AircraftLevelBonus[category][level] ); + } - if ( eq == null ) continue; + return 0; + } - switch ( eq.EquipmentType[2] ) { - case 6: // 艦上戦闘機 - case 7: // 艦上爆撃機 - case 8: // 艦上攻撃機 - case 11: // 水上爆撃機 - case 45: // 水上戦闘機 - air += (int)( eq.AA * Math.Sqrt( aircraft[s] ) ); - break; - } - } + /// + /// 制空戦力を求めます。 + /// + /// 装備スロット。 + /// 搭載機数の配列。 + public static int GetAirSuperiority( int[] slot, int[] aircraft ) { - return air; + return slot.Select( ( eq, i ) => GetAirSuperiority( eq, aircraft[i] ) ).Sum(); } /// @@ -63,16 +85,7 @@ public static int GetAirSuperiority( int[] slot, int[] aircraft ) { /// 艦船IDの配列。 public static int GetAirSuperiority( int[] fleet ) { - int air = 0; - - for ( int i = 0; i < fleet.Length; i++ ) { - ShipDataMaster ship = KCDatabase.Instance.MasterShips[fleet[i]]; - if ( ship == null ) continue; - - air += GetAirSuperiority( ship ); - } - - return air; + return fleet.Select( id => KCDatabase.Instance.MasterShips[id] ).Sum( ship => GetAirSuperiority( ship ) ); } /// @@ -96,24 +109,18 @@ public static int GetAirSuperiority( int[] fleet, int[][] slot ) { return air; } - /// - /// 各装備カテゴリにおける制空値の熟練度ボーナス + /// 制空戦力を求めます。 /// - private static readonly Dictionary AircraftLevelBonus = new Dictionary() { - { 6, new int[] { 0, 0, 2, 5, 9, 14, 14, 22, 22 } }, //艦上戦闘機 - { 7, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //艦上爆撃機 - { 8, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, //艦上攻撃機 - { 11, new int[] { 0, 1, 1, 1, 1, 3, 3, 6, 6 } }, //水上爆撃機 - { 45, new int[] { 0, 0, 2, 5, 9, 14, 14, 22, 22 } }, //水上戦闘機 - }; + /// 各スロットの装備IDリスト。 + /// 艦載機搭載量。 + /// 各スロットの艦載機熟練度。 + /// + public static int GetAirSuperiority( int[] slot, int[] aircraft, int[] level ) { + + return slot.Select( ( eq, i ) => GetAirSuperiority( eq, aircraft[i], level[i] ) ).Sum(); + } - /// - /// 艦載機熟練度の内部値テーブル(仮) - /// - private static readonly List AircraftExpTable = new List() { - 0, 10, 25, 40, 55, 70, 85, 100, 120 - }; /// @@ -124,53 +131,55 @@ public static int GetAirSuperiority( ShipData ship ) { if ( ship == null ) return 0; - if ( Utility.Configuration.Config.FormFleet.AirSuperiorityMethod == 0 ) { - return GetAirSuperiority( ship.SlotMaster.ToArray(), ship.Aircraft.ToArray() ); - } + return ship.SlotInstance.Select( ( eq, i ) => eq == null ? 0 : GetAirSuperiority( eq.EquipmentID, ship.Aircraft[i], eq.AircraftLevel ) ).Sum(); + } - int air = 0; - var eqs = ship.SlotInstance; - var aircrafts = ship.Aircraft; + /// + /// 制空戦力を求めます。 + /// + /// 対象の艦船。 + public static int GetAirSuperiority( ShipDataMaster ship ) { + if ( ship == null || ship.DefaultSlot == null ) return 0; + return GetAirSuperiority( ship.DefaultSlot.ToArray(), ship.Aircraft.ToArray() ); - for ( int i = 0; i < eqs.Count; i++ ) { - var eq = eqs[i]; - if ( eq != null && aircrafts[i] > 0 ) { + } - int category = eq.MasterEquipment.CategoryType; + /// + /// 制空戦力を求めます。 + /// + /// 対象の艦隊。 + public static int GetAirSuperiority( FleetData fleet ) { + if ( fleet == null ) + return 0; + return fleet.MembersWithoutEscaped.Select( ship => GetAirSuperiority( ship ) ).Sum(); + } - if ( AircraftLevelBonus.ContainsKey( category ) ) { - air += (int)( eq.MasterEquipment.AA * Math.Sqrt( aircrafts[i] ) + Math.Sqrt( AircraftExpTable[eq.AircraftLevel] / 10.0 ) + AircraftLevelBonus[category][eq.AircraftLevel] ); - } - } - } + /// + /// 基地航空隊の制空戦力を求めます。 + /// + /// 対象の基地航空隊。 + public static int GetAirSuperiority( BaseAirCorpsData aircorps ) { + if ( aircorps == null ) + return 0; - return air; + return aircorps.Squadrons.Values.Sum( sq => GetAirSuperiority( sq ) ); } - /// - /// 制空戦力を求めます。 + /// 基地航空中隊の制空戦力を求めます。 /// - /// 各スロットの装備IDリスト。 - /// 艦載機搭載量。 - /// 各スロットの艦載機熟練度。 - /// - public static int GetAirSuperiority( int[] slot, int[] aircraft, int[] level ) { - int air = 0; - - for ( int i = 0; i < aircraft.Length; i++ ) { - var eq = KCDatabase.Instance.MasterEquipments[slot[i]]; - if ( eq == null || aircraft[i] == 0 ) continue; + /// 対象の基地航空中隊。 + public static int GetAirSuperiority( BaseAirCorpsSquadron squadron ) { + if ( squadron == null || squadron.State != 1 ) + return 0; - int category = eq.CategoryType; - if ( AircraftLevelBonus.ContainsKey( category ) ) { - air += (int)( eq.AA * Math.Sqrt( aircraft[i] ) + Math.Sqrt( AircraftExpTable[level[i]] / 10.0 ) + AircraftLevelBonus[category][level[i]] ); - } - } + var eq = squadron.EquipmentInstance; + if ( eq == null ) + return 0; - return air; + return GetAirSuperiority( eq.EquipmentID, squadron.AircraftCurrent, eq.AircraftLevel ); } @@ -185,27 +194,29 @@ public static int GetAirSuperiorityAtMaxLevel( int[] fleet, int[][] slot ) { .Select( ( ship, i ) => ship == null ? 0 : GetAirSuperiority( slot[i], ship.Aircraft.ToArray(), new int[] { 8, 8, 8, 8, 8 } ) ).Sum(); } + /// - /// 制空戦力を求めます。 + /// 艦載機熟練度を無視した制空戦力を求めます。 /// /// 対象の艦船。 - public static int GetAirSuperiority( ShipDataMaster ship ) { - - if ( ship.DefaultSlot == null ) return 0; - return GetAirSuperiority( ship.DefaultSlot.ToArray(), ship.Aircraft.ToArray() ); - + public static int GetAirSuperiorityIgnoreLevel( ShipData ship ) { + if ( ship == null ) + return 0; + return GetAirSuperiority( ship.SlotMaster.ToArray(), ship.Aircraft.ToArray() ); } /// - /// 制空戦力を求めます。 + /// 艦載機熟練度を無視した制空戦力を求めます。 /// /// 対象の艦隊。 - public static int GetAirSuperiority( FleetData fleet ) { - - return fleet.MembersWithoutEscaped.Select( ship => GetAirSuperiority( ship ) ).Sum(); + public static int GetAirSuperiorityIgnoreLevel( FleetData fleet ) { + if ( fleet == null ) + return 0; + return fleet.MembersWithoutEscaped.Select( ship => GetAirSuperiorityIgnoreLevel( ship ) ).Sum(); } + /// /// 索敵能力を求めます。「2-5式」です。 /// diff --git a/ElectronicObserver/Window/FormBaseAirCorps.cs b/ElectronicObserver/Window/FormBaseAirCorps.cs index 418137927..d96093a95 100644 --- a/ElectronicObserver/Window/FormBaseAirCorps.cs +++ b/ElectronicObserver/Window/FormBaseAirCorps.cs @@ -1,4 +1,5 @@ using ElectronicObserver.Data; +using ElectronicObserver.Utility.Data; using ElectronicObserver.Utility.Mathematics; using System; using System.Collections.Generic; @@ -48,7 +49,7 @@ void Updated( string apiname, dynamic data ) { var aircorps = KCDatabase.Instance.BaseAirCorps.Values; foreach ( var corp in aircorps ) { - sb.AppendFormat( "{0} [{1}]\r\n", corp.Name, Constants.GetBaseAirCorpsActionKind( corp.ActionKind ) ); + sb.AppendFormat( "{0} [{1}] 制空: {2}\r\n", corp.Name, Constants.GetBaseAirCorpsActionKind( corp.ActionKind ), Calculator.GetAirSuperiority( corp ) ); foreach ( var sq in corp.Squadrons.Values ) { var eq = sq.EquipmentInstance; diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index 6fd9977a0..13a115aaf 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -152,13 +152,16 @@ public void Update( FleetData fleet ) { //制空戦力計算 { int airSuperiority = fleet.GetAirSuperiority(); + bool includeLevel = Utility.Configuration.Config.FormFleet.AirSuperiorityMethod == 1; AirSuperiority.Text = airSuperiority.ToString(); ToolTipInfo.SetToolTip( AirSuperiority, - string.Format( "確保: {0}\r\n優勢: {1}\r\n均衡: {2}\r\n劣勢: {3}\r\n", + string.Format( "確保: {0}\r\n優勢: {1}\r\n均衡: {2}\r\n劣勢: {3}\r\n({4}: {5})\r\n", (int)( airSuperiority / 3.0 ), (int)( airSuperiority / 1.5 ), - (int)( airSuperiority * 1.5 - 1 ), - (int)( airSuperiority * 3.0 - 1 ) ) ); + Math.Max( (int)( airSuperiority * 1.5 - 1 ), 0 ), + Math.Max( (int)( airSuperiority * 3.0 - 1 ), 0 ), + includeLevel ? "熟練度なし" : "熟練度あり", + includeLevel ? Calculator.GetAirSuperiorityIgnoreLevel( fleet ) : Calculator.GetAirSuperiority( fleet ) ) ); } @@ -555,7 +558,12 @@ private string GetEquipmentString( ShipData ship ) { } } { - int airsup = Calculator.GetAirSuperiority( ship ); + int airsup; + if ( Utility.Configuration.Config.FormFleet.AirSuperiorityMethod == 1 ) + airsup = Calculator.GetAirSuperiority( ship ); + else + airsup = Calculator.GetAirSuperiorityIgnoreLevel( ship ); + int airbattle = ship.AirBattlePower; if ( airsup > 0 ) { if ( airbattle > 0 ) From 555488b175fe50b60073523048d081c5a1a11ff7 Mon Sep 17 00:00:00 2001 From: Andante Date: Mon, 8 Aug 2016 00:14:00 +0900 Subject: [PATCH 03/20] =?UTF-8?q?JSON=20=E3=82=A6=E3=82=A3=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=82=A6=E3=82=92=E4=BB=AE=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/Observer/APIObserver.cs | 18 +- .../Other/Information/apilist.txt | 1 + ElectronicObserver/Utility/Configuration.cs | 33 ++ .../Window/FormJson.Designer.cs | 276 +++++++++++ ElectronicObserver/Window/FormJson.cs | 455 ++++++++++++++++++ ElectronicObserver/Window/FormJson.resx | 126 +++++ .../Window/FormMain.Designer.cs | 24 +- ElectronicObserver/Window/FormMain.cs | 11 +- 9 files changed, 940 insertions(+), 13 deletions(-) create mode 100644 ElectronicObserver/Window/FormJson.Designer.cs create mode 100644 ElectronicObserver/Window/FormJson.cs create mode 100644 ElectronicObserver/Window/FormJson.resx diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index f2cb6e035..dcfa0a696 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -467,6 +467,12 @@ FormCompass.cs + + Form + + + FormJson.cs + Form @@ -652,6 +658,9 @@ FormCompass.cs + + FormJson.cs + FormWindowCapture.cs diff --git a/ElectronicObserver/Observer/APIObserver.cs b/ElectronicObserver/Observer/APIObserver.cs index 2b5adb02b..69a4c1375 100644 --- a/ElectronicObserver/Observer/APIObserver.cs +++ b/ElectronicObserver/Observer/APIObserver.cs @@ -42,6 +42,9 @@ public static APIObserver Instance { private Control UIControl; private APIKancolleDB DBSender; + public event APIReceivedEventHandler RequestReceived = delegate { }; + public event APIReceivedEventHandler ResponseReceived = delegate { }; + private APIObserver() { @@ -347,7 +350,7 @@ public void LoadRequest( string path, string data ) { APIList.OnRequestReceived( shortpath, parsedData ); - + RequestReceived( shortpath, parsedData ); } catch ( Exception ex ) { @@ -382,13 +385,18 @@ public void LoadResponse( string path, string data ) { } - if ( shortpath == "api_get_member/ship2" ) + if ( shortpath == "api_get_member/ship2" ) { APIList.OnResponseReceived( shortpath, json ); - else if ( json.IsDefined( "api_data" ) ) + ResponseReceived( shortpath, json ); + + } else if ( json.IsDefined( "api_data" ) ) { APIList.OnResponseReceived( shortpath, json.api_data ); - else - APIList.OnResponseReceived( shortpath, null ); + ResponseReceived( shortpath, json.api_data ); + } else { + APIList.OnResponseReceived( shortpath, null ); + ResponseReceived( shortpath, null ); + } } catch ( Exception ex ) { diff --git a/ElectronicObserver/Other/Information/apilist.txt b/ElectronicObserver/Other/Information/apilist.txt index 9e365aae9..1fdb6d067 100644 --- a/ElectronicObserver/Other/Information/apilist.txt +++ b/ElectronicObserver/Other/Information/apilist.txt @@ -1172,6 +1172,7 @@ api_get_member/mapcell :マップデータ Request.api_req_map/start :出撃 api_deck_id :出撃艦隊ID api_formation_id : + api_serial_cid : api_maparea_id :海域カテゴリID api_mapinfo_no :海域カテゴリ内番号 diff --git a/ElectronicObserver/Utility/Configuration.cs b/ElectronicObserver/Utility/Configuration.cs index 4aafe8d8f..a93165d16 100644 --- a/ElectronicObserver/Utility/Configuration.cs +++ b/ElectronicObserver/Utility/Configuration.cs @@ -841,6 +841,38 @@ public ConfigFormCompass() { public ConfigFormCompass FormCompass { get; private set; } + /// + /// [JSON]ウィンドウの設定を扱います。 + /// + public class ConfigFormJson : ConfigPartBase { + + /// + /// 自動更新するか + /// + public bool AutoUpdate { get; set; } + + /// + /// TreeView を更新するか + /// + public bool UpdatesTree { get; set; } + + /// + /// 自動更新時のフィルタ + /// + public string AutoUpdateFilter { get; set; } + + + public ConfigFormJson() { + AutoUpdate = false; + UpdatesTree = true; + AutoUpdateFilter = ""; + } + } + /// [JSON]ウィンドウ + [DataMember] + public ConfigFormJson FormJson { get; private set; } + + /// /// 各[通知]ウィンドウの設定を扱います。 /// @@ -1061,6 +1093,7 @@ public override void Initialize() { FormShipGroup = new ConfigFormShipGroup(); FormBrowser = new ConfigFormBrowser(); FormCompass = new ConfigFormCompass(); + FormJson = new ConfigFormJson(); NotifierExpedition = new ConfigNotifierBase(); NotifierConstruction = new ConfigNotifierBase(); diff --git a/ElectronicObserver/Window/FormJson.Designer.cs b/ElectronicObserver/Window/FormJson.Designer.cs new file mode 100644 index 000000000..0a8c5a373 --- /dev/null +++ b/ElectronicObserver/Window/FormJson.Designer.cs @@ -0,0 +1,276 @@ +namespace ElectronicObserver.Window { + partial class FormJson { + /// + /// 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.JsonTreeView = new System.Windows.Forms.TreeView(); + this.TreeContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.TreeContextMenu_Expand = new System.Windows.Forms.ToolStripMenuItem(); + this.TreeContextMenu_Shrink = new System.Windows.Forms.ToolStripMenuItem(); + this.TreeContextMenu_ShrinkParent = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.TreeContextMenu_OutputCSV = new System.Windows.Forms.ToolStripMenuItem(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.JsonRawData = new System.Windows.Forms.TextBox(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.label2 = new System.Windows.Forms.Label(); + this.UpdatesTree = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.AutoUpdateFilter = new System.Windows.Forms.TextBox(); + this.AutoUpdate = new System.Windows.Forms.CheckBox(); + this.CSVSaver = new System.Windows.Forms.SaveFileDialog(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.TreeContextMenu.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.AllowDrop = true; + 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(300, 200); + this.tabControl1.TabIndex = 0; + this.tabControl1.DragDrop += new System.Windows.Forms.DragEventHandler(this.tabControl1_DragDrop); + this.tabControl1.DragEnter += new System.Windows.Forms.DragEventHandler(this.tabControl1_DragEnter); + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.JsonTreeView); + 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(292, 172); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Tree"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // JsonTreeView + // + this.JsonTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.JsonTreeView.ContextMenuStrip = this.TreeContextMenu; + this.JsonTreeView.Dock = System.Windows.Forms.DockStyle.Fill; + this.JsonTreeView.Location = new System.Drawing.Point(3, 3); + this.JsonTreeView.Margin = new System.Windows.Forms.Padding(0); + this.JsonTreeView.Name = "JsonTreeView"; + this.JsonTreeView.PathSeparator = "."; + this.JsonTreeView.ShowNodeToolTips = true; + this.JsonTreeView.Size = new System.Drawing.Size(286, 166); + this.JsonTreeView.TabIndex = 0; + this.JsonTreeView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.JsonTreeView_MouseClick); + // + // TreeContextMenu + // + this.TreeContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.TreeContextMenu_Expand, + this.TreeContextMenu_Shrink, + this.TreeContextMenu_ShrinkParent, + this.toolStripSeparator1, + this.TreeContextMenu_OutputCSV}); + this.TreeContextMenu.Name = "TreeContextMenu"; + this.TreeContextMenu.Size = new System.Drawing.Size(197, 98); + this.TreeContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.TreeContextMenu_Opening); + // + // TreeContextMenu_Expand + // + this.TreeContextMenu_Expand.Name = "TreeContextMenu_Expand"; + this.TreeContextMenu_Expand.Size = new System.Drawing.Size(196, 22); + this.TreeContextMenu_Expand.Text = "全て展開"; + this.TreeContextMenu_Expand.Click += new System.EventHandler(this.TreeContextMenu_Expand_Click); + // + // TreeContextMenu_Shrink + // + this.TreeContextMenu_Shrink.Name = "TreeContextMenu_Shrink"; + this.TreeContextMenu_Shrink.Size = new System.Drawing.Size(196, 22); + this.TreeContextMenu_Shrink.Text = "全て格納"; + this.TreeContextMenu_Shrink.Click += new System.EventHandler(this.TreeContextMenu_Shrink_Click); + // + // TreeContextMenu_ShrinkParent + // + this.TreeContextMenu_ShrinkParent.Name = "TreeContextMenu_ShrinkParent"; + this.TreeContextMenu_ShrinkParent.Size = new System.Drawing.Size(196, 22); + this.TreeContextMenu_ShrinkParent.Text = "親ノードを格納"; + this.TreeContextMenu_ShrinkParent.Click += new System.EventHandler(this.TreeContextMenu_ShrinkParent_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(193, 6); + // + // TreeContextMenu_OutputCSV + // + this.TreeContextMenu_OutputCSV.Name = "TreeContextMenu_OutputCSV"; + this.TreeContextMenu_OutputCSV.Size = new System.Drawing.Size(196, 22); + this.TreeContextMenu_OutputCSV.Text = "このノードをCSVに出力..."; + this.TreeContextMenu_OutputCSV.Click += new System.EventHandler(this.TreeContextMenu_OutputCSV_Click); + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.JsonRawData); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(292, 174); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Raw"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // JsonRawData + // + this.JsonRawData.Dock = System.Windows.Forms.DockStyle.Fill; + this.JsonRawData.Location = new System.Drawing.Point(3, 3); + this.JsonRawData.MaxLength = 0; + this.JsonRawData.Multiline = true; + this.JsonRawData.Name = "JsonRawData"; + this.JsonRawData.ReadOnly = true; + this.JsonRawData.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.JsonRawData.Size = new System.Drawing.Size(286, 168); + this.JsonRawData.TabIndex = 0; + this.JsonRawData.WordWrap = false; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.label2); + this.tabPage3.Controls.Add(this.UpdatesTree); + this.tabPage3.Controls.Add(this.label1); + this.tabPage3.Controls.Add(this.AutoUpdateFilter); + this.tabPage3.Controls.Add(this.AutoUpdate); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(292, 174); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Config"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label2.Location = new System.Drawing.Point(140, 7); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(144, 44); + this.label2.TabIndex = 4; + this.label2.Text = "※更新を有効にすると、\r\n 重くなる可能性があります"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // UpdatesTree + // + this.UpdatesTree.AutoSize = true; + this.UpdatesTree.Location = new System.Drawing.Point(9, 32); + this.UpdatesTree.Name = "UpdatesTree"; + this.UpdatesTree.Size = new System.Drawing.Size(85, 19); + this.UpdatesTree.TabIndex = 3; + this.UpdatesTree.Text = "Treeを更新"; + this.UpdatesTree.UseVisualStyleBackColor = true; + this.UpdatesTree.CheckedChanged += new System.EventHandler(this.UpdatesTree_CheckedChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(8, 60); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(52, 15); + this.label1.TabIndex = 2; + this.label1.Text = "フィルタ:"; + // + // AutoUpdateFilter + // + this.AutoUpdateFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.AutoUpdateFilter.Location = new System.Drawing.Point(66, 57); + this.AutoUpdateFilter.Name = "AutoUpdateFilter"; + this.AutoUpdateFilter.Size = new System.Drawing.Size(218, 23); + this.AutoUpdateFilter.TabIndex = 1; + this.AutoUpdateFilter.Validated += new System.EventHandler(this.AutoUpdateFilter_Validated); + // + // AutoUpdate + // + this.AutoUpdate.AutoSize = true; + this.AutoUpdate.Location = new System.Drawing.Point(9, 7); + this.AutoUpdate.Name = "AutoUpdate"; + this.AutoUpdate.Size = new System.Drawing.Size(93, 19); + this.AutoUpdate.TabIndex = 0; + this.AutoUpdate.Text = "自動更新する"; + this.AutoUpdate.UseVisualStyleBackColor = true; + this.AutoUpdate.CheckedChanged += new System.EventHandler(this.AutoUpdate_CheckedChanged); + // + // CSVSaver + // + this.CSVSaver.Filter = "CSV|*.csv|File|*"; + this.CSVSaver.Title = "ノードを CSV に出力"; + // + // FormJson + // + this.AutoHidePortion = 150D; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.ClientSize = new System.Drawing.Size(300, 200); + this.Controls.Add(this.tabControl1); + this.Font = new System.Drawing.Font("Meiryo UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.HideOnClose = true; + this.Name = "FormJson"; + this.Text = "JSON"; + this.Load += new System.EventHandler(this.FormJson_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.TreeContextMenu.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); + this.tabPage3.ResumeLayout(false); + this.tabPage3.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TreeView JsonTreeView; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TextBox JsonRawData; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox AutoUpdateFilter; + private System.Windows.Forms.CheckBox AutoUpdate; + private System.Windows.Forms.CheckBox UpdatesTree; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ContextMenuStrip TreeContextMenu; + private System.Windows.Forms.ToolStripMenuItem TreeContextMenu_Expand; + private System.Windows.Forms.ToolStripMenuItem TreeContextMenu_Shrink; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem TreeContextMenu_OutputCSV; + private System.Windows.Forms.SaveFileDialog CSVSaver; + private System.Windows.Forms.ToolStripMenuItem TreeContextMenu_ShrinkParent; + } +} \ No newline at end of file diff --git a/ElectronicObserver/Window/FormJson.cs b/ElectronicObserver/Window/FormJson.cs new file mode 100644 index 000000000..5904fe5ad --- /dev/null +++ b/ElectronicObserver/Window/FormJson.cs @@ -0,0 +1,455 @@ +using ElectronicObserver.Observer; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; +using WeifenLuo.WinFormsUI.Docking; + +namespace ElectronicObserver.Window { + public partial class FormJson : DockContent { + + + // yyyyMMdd_hhmmssff[S|Q]@api_path.json + private static readonly Regex _filenamePattern = new Regex( @"\d{8}_\d{8}([SQ])@(.*)\.json$", RegexOptions.Compiled ); + + private Regex _apiPattern; + + private string _currentAPIPath; + private dynamic _currentData; + + + public FormJson( FormMain parent ) { + InitializeComponent(); + + + ConfigurationChanged(); + } + + private void FormJson_Load( object sender, EventArgs e ) { + + var o = APIObserver.Instance; + + o.RequestReceived += RequestReceived; + o.ResponseReceived += ResponseReceived; + + Utility.Configuration.Instance.ConfigurationChanged += ConfigurationChanged; + } + + + void RequestReceived( string apiname, dynamic data ) { + + if ( !AutoUpdate.Checked ) + return; + + if ( _apiPattern != null && !_apiPattern.Match( apiname ).Success ) + return; + + + LoadRequest( apiname, data ); + } + + void ResponseReceived( string apiname, dynamic data ) { + + if ( !AutoUpdate.Checked ) + return; + + if ( _apiPattern != null && !_apiPattern.Match( apiname ).Success ) + return; + + + LoadResponse( apiname, data ); + } + + + + private void LoadRequest( string apiname, Dictionary data ) { + + JsonRawData.Text = apiname + " : Request\r\n" + string.Join( "\r\n", data.Select( p => p.Key + "=" + p.Value ) ); + + + if ( !UpdatesTree.Checked ) + return; + + + JsonTreeView.BeginUpdate(); + + + JsonTreeView.Nodes.Clear(); + JsonTreeView.Nodes.Add( apiname ); + + TreeNode root = new TreeNode( " : {" + data.Count + "}" ); + root.Name = ""; + root.Nodes.AddRange( data.Select( e => new TreeNode( e.Key + " : " + e.Value ) ).ToArray() ); + + JsonTreeView.Nodes.Add( root ); + + + JsonTreeView.EndUpdate(); + _currentAPIPath = apiname; + } + + private void LoadResponse( string apiname, dynamic data ) { + + + JsonRawData.Text = ( _currentAPIPath == apiname ? JsonRawData.Text + "\r\n\r\n" : "" ) + apiname + " : Response\r\n" + ( data == null ? "" : data.ToString() ); + _currentData = data; + + if ( !UpdatesTree.Checked ) + return; + + + JsonTreeView.BeginUpdate(); + + + if ( JsonTreeView.Nodes.Count == 0 || JsonTreeView.Nodes[0].Text != apiname ) { + JsonTreeView.Nodes.Clear(); + JsonTreeView.Nodes.Add( apiname ); + } + + TreeNode root = new TreeNode( "" ); + AddNode( root, "", -1, data ); + + JsonTreeView.Nodes.Add( root.FirstNode ); + + + JsonTreeView.EndUpdate(); + _currentAPIPath = apiname; + } + + + + + + private void LoadFromFile( string path ) { + + + var match = _filenamePattern.Match( path ); + + if ( match.Success ) { + + try { + + using ( var sr = new StreamReader( path ) ) { + + string data = sr.ReadToEnd(); + + + if ( match.Groups[1].Value == "Q" ) { + // request + + var parsedData = new Dictionary(); + data = System.Web.HttpUtility.UrlDecode( data ); + + foreach ( string unit in data.Split( "&".ToCharArray() ) ) { + string[] pair = unit.Split( "=".ToCharArray() ); + parsedData.Add( pair[0], pair[1] ); + } + + LoadRequest( match.Groups[2].Value.Replace( '@', '/' ), parsedData ); + + + } else if ( match.Groups[1].Value == "S" ) { + //response + + int head = data.IndexOfAny( "[{".ToCharArray() ); + if ( head == -1 ) + throw new ArgumentException( "JSON の開始文字を検出できませんでした。" ); + data = data.Substring( head ); + + LoadResponse( match.Groups[2].Value.Replace( '@', '/' ), Codeplex.Data.DynamicJson.Parse( data ) ); + + } + + } + + } catch ( Exception ex ) { + + Utility.ErrorReporter.SendErrorReport( ex, "JSON データの読み込みに失敗しました。" ); + } + + + } + } + + + + /// + /// JSON データから、TreeNodeを構成します。 + /// + /// 親になるノード。 + /// 生成するノード名。 + /// 生成するノードが配列の要素だった場合、そのインデックス。そうでなければ -1 + /// もととなる JSON データ。 + private TreeNode AddNode( TreeNode root, string name, int index, dynamic data ) { + + TreeNode self = root.Nodes.Add( string.IsNullOrEmpty( name ) ? "" : ( name + " : " ) ); + self.Name = name + ( index >= 0 ? "[" + index + "]" : "" ); + + if ( data == null ) { + self.Text += "null"; + + } else if ( data is string ) { + self.Text += "\"" + data + "\""; + + } else if ( data is bool || data is double ) { + self.Text += data.ToString(); + + } else if ( data.IsArray ) { + int count = 0; + foreach ( var elem in data ) { + AddNode( self, null, count, elem ); + count++; + } + self.Text += "[" + count + "]"; + self.Tag = 1; + + } else if ( data.IsObject ) { + int count = 0; + foreach ( KeyValuePair elem in data ) { + AddNode( self, elem.Key, -1, elem.Value ); + count++; + } + self.Text += "{" + count + "}"; + self.Tag = 2; + + } else { + throw new NotImplementedException(); + } + + return root; + } + + + + + void ConfigurationChanged() { + + var c = Utility.Configuration.Config; + + Font = tabControl1.Font = c.UI.MainFont; + + AutoUpdate.Checked = c.FormJson.AutoUpdate; + UpdatesTree.Checked = c.FormJson.UpdatesTree; + AutoUpdateFilter.Text = c.FormJson.AutoUpdateFilter; + + try { + _apiPattern = new Regex( c.FormJson.AutoUpdateFilter ); + + } catch ( Exception ) { + Utility.Logger.Add( 3, "JSON ウィンドウ:フィルタが不正です。" ); + _apiPattern = null; + } + } + + + private void tabControl1_DragEnter( object sender, DragEventArgs e ) { + + if ( e.Data.GetDataPresent( DataFormats.FileDrop ) ) + e.Effect = DragDropEffects.Copy; + else + e.Effect = DragDropEffects.None; + + } + + private void tabControl1_DragDrop( object sender, DragEventArgs e ) { + + foreach ( string path in ( (string[])e.Data.GetData( DataFormats.FileDrop ) ).OrderBy( s => s ) ) + LoadFromFile( path ); + + } + + + private void UpdatesTree_CheckedChanged( object sender, EventArgs e ) { + + JsonTreeView.Nodes.Clear(); + + if ( !UpdatesTree.Checked ) { + JsonTreeView.Nodes.Add( "<更新が無効になっています。Configから有効化してください。>" ); + + } + + Utility.Configuration.Config.FormJson.UpdatesTree = UpdatesTree.Checked; + + } + + private void AutoUpdate_CheckedChanged( object sender, EventArgs e ) { + Utility.Configuration.Config.FormJson.AutoUpdate = AutoUpdate.Checked; + } + + private void AutoUpdateFilter_Validated( object sender, EventArgs e ) { + var c = Utility.Configuration.Config.FormJson; + c.AutoUpdateFilter = AutoUpdateFilter.Text; + + try { + _apiPattern = new Regex( c.AutoUpdateFilter ); + + } catch ( Exception ) { + Utility.Logger.Add( 3, "JSON ウィンドウ:フィルタが不正です。フィルタはクリアされます。" ); + c.AutoUpdateFilter = AutoUpdateFilter.Text = ""; + _apiPattern = null; + } + } + + + private void TreeContextMenu_Expand_Click( object sender, EventArgs e ) { + JsonTreeView.SelectedNode.ExpandAll(); + } + private void TreeContextMenu_Shrink_Click( object sender, EventArgs e ) { + JsonTreeView.SelectedNode.Collapse(); + } + private void TreeContextMenu_ShrinkParent_Click( object sender, EventArgs e ) { + var node = JsonTreeView.SelectedNode.Parent; + if ( node != null ) + node.Collapse(); + } + + + private void TreeContextMenu_Opening( object sender, CancelEventArgs e ) { + + var root = JsonTreeView.SelectedNode; + + // root is array, children > 0, root[0](=child) is object or array + if ( ( root.Tag as int? ?? 0 ) == 1 && root.Nodes.Count > 0 && ( root.FirstNode.Tag as int? ?? 0 ) != 0 ) { + TreeContextMenu_OutputCSV.Enabled = true; + + } else { + TreeContextMenu_OutputCSV.Enabled = false; + } + } + + private void TreeContextMenu_OutputCSV_Click( object sender, EventArgs e ) { + + if ( CSVSaver.ShowDialog() == System.Windows.Forms.DialogResult.OK ) { + + try { + + using ( var sw = new StreamWriter( CSVSaver.FileName, false, Utility.Configuration.Config.Log.FileEncoding ) ) { + + var root = JsonTreeView.SelectedNode; + var data = _currentData; + + + // root にあたる実データの取得 + List revpath = new List(); + var ptr = root; + + while ( ptr.Parent != null ) { + revpath.Add( ptr.Name ); + ptr = ptr.Parent; + } + + foreach ( var path in revpath.Reverse() ) { + int index = path.IndexOf( '[' ); + if ( index != -1 ) { + int indexer = int.Parse( path.Substring( index + 1, path.Length - index - 2 ) ); + data = data[path.Substring( 0, index - 1 )][indexer]; + + } else { + data = data[path]; + } + } + + + // ヘッダーの取得 + var content = new StringBuilder(); + BuildCSVHeader( content, "", data[0] ); + content.Remove( content.Length - 1, 1 ); + + sw.WriteLine( content.ToString() ); + + + foreach ( dynamic elem in data ) { + content.Clear(); + BuildCSVContent( content, elem ); + content.Remove( content.Length - 1, 1 ); + + sw.WriteLine( content.ToString() ); + } + } + + + } catch ( Exception ex ) { + Utility.ErrorReporter.SendErrorReport( ex, "JSON: CSV 出力に失敗しました。" ); + MessageBox.Show( "CSV 出力に失敗しました。\r\n" + ex.Message, "出力エラー", MessageBoxButtons.OK, MessageBoxIcon.Error ); + } + + + } + + } + + private void BuildCSVHeader( StringBuilder sb, string currentPath, dynamic data ) { + + if ( data is Codeplex.Data.DynamicJson ) { + + if ( data.IsObject ) { + foreach ( string p in data.GetDynamicMemberNames() ) { + BuildCSVHeader( sb, currentPath + "." + p, data[p] ); + } + return; + + } else if ( data.IsArray ) { + int index = 0; + foreach ( dynamic elem in data ) { + BuildCSVHeader( sb, currentPath + "[" + index + "]", elem ); + index++; + } + return; + + } + } + + sb.Append( currentPath ).Append( "," ); + } + + private void BuildCSVContent( StringBuilder sb, dynamic data ) { + + if ( data is Codeplex.Data.DynamicJson ) { + + if ( data.IsObject ) { + foreach ( string p in data.GetDynamicMemberNames() ) { + BuildCSVContent( sb, data[p] ); + } + return; + + } else if ( data.IsArray ) { + foreach ( dynamic elem in data ) { + BuildCSVContent( sb, elem ); + } + return; + + } + } + + sb.Append( data ).Append( "," ); + } + + + // 右クリックでも選択するように + private void JsonTreeView_MouseClick( object sender, MouseEventArgs e ) { + var node = JsonTreeView.GetNodeAt( e.Location ); + if ( node != null ) { + JsonTreeView.SelectedNode = node; + } + } + + + + + + protected override string GetPersistString() { + return "Json"; + } + + + + + } +} diff --git a/ElectronicObserver/Window/FormJson.resx b/ElectronicObserver/Window/FormJson.resx new file mode 100644 index 000000000..ca3c13462 --- /dev/null +++ b/ElectronicObserver/Window/FormJson.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 17, 17 + + + 175, 17 + + \ No newline at end of file diff --git a/ElectronicObserver/Window/FormMain.Designer.cs b/ElectronicObserver/Window/FormMain.Designer.cs index 496f3b0cf..480226e8a 100644 --- a/ElectronicObserver/Window/FormMain.Designer.cs +++ b/ElectronicObserver/Window/FormMain.Designer.cs @@ -95,6 +95,7 @@ private void InitializeComponent() { this.StripStatus_Clock = new System.Windows.Forms.ToolStripStatusLabel(); this.UIUpdateTimer = new System.Windows.Forms.Timer(this.components); this.MainDockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); + this.StripMenu_View_Json = new System.Windows.Forms.ToolStripMenuItem(); this.StripMenu.SuspendLayout(); this.StripStatus.SuspendLayout(); this.SuspendLayout(); @@ -132,7 +133,7 @@ private void InitializeComponent() { this.StripMenu_File_Record_Save, this.StripMenu_File_Record_Load}); this.StripMenu_File_Record.Name = "StripMenu_File_Record"; - this.StripMenu_File_Record.Size = new System.Drawing.Size(152, 22); + this.StripMenu_File_Record.Size = new System.Drawing.Size(135, 22); this.StripMenu_File_Record.Text = "レコード(&R)"; // // StripMenu_File_Record_Save @@ -161,7 +162,7 @@ private void InitializeComponent() { this.toolStripSeparator10, this.StripMenu_File_Layout_TopMost}); this.StripMenu_File_Layout.Name = "StripMenu_File_Layout"; - this.StripMenu_File_Layout.Size = new System.Drawing.Size(152, 22); + this.StripMenu_File_Layout.Size = new System.Drawing.Size(135, 22); this.StripMenu_File_Layout.Text = "レイアウト(&L)"; // // StripMenu_File_Layout_Load @@ -221,24 +222,24 @@ private void InitializeComponent() { // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator6.Size = new System.Drawing.Size(132, 6); // // StripMenu_File_Configuration // this.StripMenu_File_Configuration.Name = "StripMenu_File_Configuration"; - this.StripMenu_File_Configuration.Size = new System.Drawing.Size(152, 22); + this.StripMenu_File_Configuration.Size = new System.Drawing.Size(135, 22); this.StripMenu_File_Configuration.Text = "設定(&C)..."; this.StripMenu_File_Configuration.Click += new System.EventHandler(this.StripMenu_File_Configuration_Click); // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator5.Size = new System.Drawing.Size(132, 6); // // StripMenu_File_Close // this.StripMenu_File_Close.Name = "StripMenu_File_Close"; - this.StripMenu_File_Close.Size = new System.Drawing.Size(152, 22); + this.StripMenu_File_Close.Size = new System.Drawing.Size(135, 22); this.StripMenu_File_Close.Text = "終了(&X)"; this.StripMenu_File_Close.Click += new System.EventHandler(this.StripMenu_File_Close_Click); // @@ -261,7 +262,8 @@ private void InitializeComponent() { this.toolStripSeparator4, this.StripMenu_View_Browser, this.StripMenu_View_Log, - this.StripMenu_WindowCapture}); + this.StripMenu_WindowCapture, + this.StripMenu_View_Json}); this.StripMenu_View.Name = "StripMenu_View"; this.StripMenu_View.Size = new System.Drawing.Size(61, 20); this.StripMenu_View.Text = "表示(&V)"; @@ -650,6 +652,13 @@ private void InitializeComponent() { this.MainDockPanel.Size = new System.Drawing.Size(640, 434); this.MainDockPanel.TabIndex = 0; // + // StripMenu_View_Json + // + this.StripMenu_View_Json.Name = "StripMenu_View_Json"; + this.StripMenu_View_Json.Size = new System.Drawing.Size(182, 22); + this.StripMenu_View_Json.Text = "JSON(&J)"; + this.StripMenu_View_Json.Click += new System.EventHandler(this.StripMenu_View_Json_Click); + // // FormMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -748,5 +757,6 @@ private void InitializeComponent() { private System.Windows.Forms.ToolStripMenuItem StripMenu_File_Layout_LockLayout; private System.Windows.Forms.ToolStripSeparator toolStripSeparator10; private System.Windows.Forms.ToolStripMenuItem StripMenu_File_Layout_TopMost; + private System.Windows.Forms.ToolStripMenuItem StripMenu_View_Json; } } diff --git a/ElectronicObserver/Window/FormMain.cs b/ElectronicObserver/Window/FormMain.cs index 5f1ef6f1d..c7e9b8966 100644 --- a/ElectronicObserver/Window/FormMain.cs +++ b/ElectronicObserver/Window/FormMain.cs @@ -57,6 +57,7 @@ public partial class FormMain : Form { public FormShipGroup fShipGroup; public FormBrowserHost fBrowser; public FormWindowCapture fWindowCapture; + public FormJson fJson; #endregion @@ -157,7 +158,7 @@ private async void FormMain_Load( object sender, EventArgs e ) { SubForms.Add( fShipGroup = new FormShipGroup( this ) ); SubForms.Add( fBrowser = new FormBrowserHost( this ) ); SubForms.Add( fWindowCapture = new FormWindowCapture( this ) ); - + SubForms.Add( fJson = new FormJson( this ) ); ConfigurationChanged(); //設定から初期化 @@ -434,6 +435,8 @@ private IDockContent GetDockContentFromPersistString( string persistString ) { return fBrowser; case "WindowCapture": return fWindowCapture; + case "Json": + return fJson; default: if ( persistString.StartsWith( "ShipGroup" ) ) { fShipGroup.ConfigureFromPersistString( persistString ); @@ -1252,8 +1255,14 @@ private void StripMenu_WindowCapture_SubWindow_Click( object sender, EventArgs e ShowForm( fWindowCapture ); } + private void StripMenu_View_Json_Click( object sender, EventArgs e ) { + ShowForm( fJson ); + } + #endregion + + From edc9829eee2389e6bd119e794d1ce357a620e81e Mon Sep 17 00:00:00 2001 From: Andante Date: Fri, 19 Aug 2016 21:57:36 +0900 Subject: [PATCH 04/20] =?UTF-8?q?=E8=89=A6=E9=9A=8A=EF=BC=9ATP=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=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/Window/FormFleet.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index ab1bb9d9e..84c2e959b 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -139,8 +139,10 @@ public void Update( FleetData fleet ) { var landattacker = slots.Where( e => e.EquipmentID == 167 ); double expeditionBonus = Math.Min( daihatsu.Count() * 0.05 + daihatsu_tank.Count() * 0.02 + landattacker.Count() * 0.01, 0.20 ); + int tp = Calculator.GetTPDamage( fleet ); + ToolTipInfo.SetToolTip( Name, string.Format( - "Lv合計: {0} / 平均: {1:0.00}\r\n{2}艦隊\r\nドラム缶搭載: {3}個 ({4}艦)\r\n大発動艇搭載: {5}個 ({6}艦, +{7:p1})\r\n総積載: 燃 {8} / 弾 {9}\r\n(1戦当たり 燃 {10} / 弾 {11})", + "Lv合計: {0} / 平均: {1:0.00}\r\n{2}艦隊\r\nドラム缶搭載: {3}個 ({4}艦)\r\n大発動艇搭載: {5}個 ({6}艦, +{7:p1})\r\n輸送量(TP): S {8} / A {9}\r\n総積載: 燃 {10} / 弾 {11}\r\n(1戦当たり 燃 {12} / 弾 {13})", levelSum, (double)levelSum / Math.Max( fleet.Members.Count( id => id != -1 ), 1 ), Constants.GetSpeed( speed ), @@ -149,6 +151,8 @@ public void Update( FleetData fleet ) { daihatsu.Count() + daihatsu_tank.Count() + landattacker.Count(), fleet.MembersInstance.Count( s => s == null ? false : s.SlotInstanceMaster.Any( q => q == null ? false : q.CategoryType == 24 || q.CategoryType == 46 ) ), expeditionBonus + 0.01 * expeditionBonus * ( daihatsu.Sum( e => e.Level ) + daihatsu_tank.Sum( e => e.Level ) + landattacker.Sum( e => e.Level ) ) / Math.Max( daihatsu.Count() + daihatsu_tank.Count() + landattacker.Count(), 1 ), + tp, + (int)( tp * 0.7 ), fueltotal, ammototal, fuelunit, From 2fb937e8879c5375fc2d8e5ee00597630d883921 Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 20 Aug 2016 17:07:41 +0900 Subject: [PATCH 05/20] =?UTF-8?q?JSON=EF=BC=9A=E6=9C=AC=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * アイコンリソースの追加・実装 * 設定:JSONウィンドウの設定を実装 * JSON:ノード展開処理を軽量化 * JSON:自動更新無効時の警告表示を実装 * JSON:フィルタエラー発生時の処理を変更 --- ElectronicObserver/Assets.zip | Bin 173911 -> 174324 bytes ElectronicObserver/Assets/Form/Json.png | Bin 0 -> 274 bytes .../Resource/ResourceManager.cs | 4 +- .../Dialog/DialogConfiguration.Designer.cs | 237 +++++++++++++----- .../Window/Dialog/DialogConfiguration.cs | 10 + .../Window/Dialog/DialogConfiguration.resx | 6 +- .../Window/FormJson.Designer.cs | 31 ++- ElectronicObserver/Window/FormJson.cs | 179 ++++++------- ElectronicObserver/Window/FormMain.cs | 8 +- 9 files changed, 312 insertions(+), 163 deletions(-) create mode 100644 ElectronicObserver/Assets/Form/Json.png diff --git a/ElectronicObserver/Assets.zip b/ElectronicObserver/Assets.zip index 4dd7e4c03d455612a13057fffff5d99f3a8d2e7b..6681e26827744fc2d2d000c728592c7c5355527c 100644 GIT binary patch delta 1411 zcmZWodr(wm6ualxaT|Hxp%t- zGd+Tq1;eta_%A=61H3(-gImJR*vsX&Ut*!I#4Tb!*%r@AkD%i`;sY!Bv z&`bR7t%2#SwvC+!nnG*lTEBLF)^|HENNu$~)$vf~_?^0EM~wxGKh3P2syy>qYtfbb zd9Mu#CH)ry?sxR1KNy{KoZYQn;k(gyp!~v7-N@LJ(bjHHy)_ed&8h9;^$me$6RLR} z6VRS8p=uY|(3a5z6uBhP?Jh}>CF2Hz>LcK1D-(Ruf7aAPzpyi!5Dec9cI^{KAj)FJ z|K^4f#o)4$j4NwhPFA{rl954D6irE}qMN;!*-F34J72Nk3L2yoQ-58ud<_>&aY?GsN{EI2DGnzxBqQF);TsIZ z(})$vK*Xqx78rDld~af!^PN5hJ3;b{#mpNsR%l;Ee95z%FTV<6;F~$lcXrkqr&yoU z-<&V9n$#~d;kjx^gmx3YhNO4lKaA1jfNCUhTb>gv!fAvks9fZ5!f}G{E}`K#WSBJr zjT)M^N1qx9Gn+S~@gdL>)DZ@kEbwU!saIf)J8K~gx&_!#3!%%%E^fn$YH)npR!G12 z>mt)qviGNY|962Fl#|ku;U1c|7_J2|*;>rdf-`Iq;^$ge@2>FYW4?Fe?K=x%SL41O znqM;ZuePE{&LGJ#+m=k@x+K~io3$WZ-cs~R^#C3Cf<}tDI@k-Bq}Zn;r>k8BSSSN$ z+*L=;b80m<*Admu9dKa{IHLCnqMCbP!3mP%tWn-TG7fBJ6(wBU!bUitR1bS#DflI^LcN|`XH+P!tT;*bcJKq9^eaG!U+T%L z;Uok>&URkT3WL{C*hq@kM7&fiur3@d`Dj%miM|qrhEt^Pr)=N?M`YDeV2(+rh!C-p z^(vt)nzb_AdYas`FqTiTi2(uraGHdr#_@`06KU(`T|Ch@k)0JL@Wk#6_%1h42I`=K LqB3>^xrBcK-^w^$ delta 1141 zcmYk4eN0nl6vpp;F3ei6!B|;gRXPEknZz-TiCIKt_%*Tyr3K2!q(uhPG0|=&Ci`+t zBrQ-rF6F4K75PwOi~~%@{xDhCjMErNn~9(}hEtYJryGjf7`pA;d(rIv^S;05ob#Ob zeeaow=m-1tT~poC`#sy`T|=hR@jZ1W*>WlB^ytM^Yov}7Uy~(PT#N~CZ+5IWBab&# zHka6IbKzY}6c=rvbDv@b6;>lonyBAI=|0Sr7xx%?U-n?#Gi31~iVR-F(p@hM6!0RB zVtlaUhl}L$VH>*p>AVl6m=~5SBS~bfh80Z_3RUB6M14myYfyoP%e1)`@#L@J;5Qn` zORmf!v6cl~QKIi4ZIHgIMG^7`X`Y{}PY%idUQMJnKj-9JliP<=X}F#bl3a&Oc&<}f z9b1o#$myf0G*!n*jibDuOU3mlfcZyx=gsGp0xMSClIzFJw4s6b-;NPAz=gn1G`k6N z$k52*Srv@5yAioC{;WidG~5UW_Wq)RJbF8ZUa#QhPMMpZyRE5dzv`$@W`prNicl_Q zQJhlhZ{icQ-&3?XG}XjDDZi^A`^IO{o&Z-Ak89DZ0od@xeGM|3`C)H7(BNb<^6=tA z4W1?B0*UAqaUQPQtxTNd|i_vQ|2p{3;&B%NT z(e(MNm_fO1obyqZCZB1;R-9k|6m*o)&OhC}NmEX>vqfjN2B{q=#7e6Id*I4Z)+91@ z!Y=u@fc81Kzqb=s>Fg7F&Xq%3eA7%Q$K26^%G?1rKBIO=KzLZv=(jvNij9qFR e)0r8^Q6LQzPE*fuEH`usT|!*8Afy+8|IU9;X`ICX diff --git a/ElectronicObserver/Assets/Form/Json.png b/ElectronicObserver/Assets/Form/Json.png new file mode 100644 index 0000000000000000000000000000000000000000..29c5ec24695e81e786b4d1f6cafa802c61339c10 GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE|wDUzDf*NqW0@fHt+OV_qn@ 17, 17 + + 17, 17 + True @@ -132,9 +135,6 @@ True - - 17, 17 - 137, 17 diff --git a/ElectronicObserver/Window/FormJson.Designer.cs b/ElectronicObserver/Window/FormJson.Designer.cs index 0a8c5a373..dff31c2cb 100644 --- a/ElectronicObserver/Window/FormJson.Designer.cs +++ b/ElectronicObserver/Window/FormJson.Designer.cs @@ -42,6 +42,7 @@ private void InitializeComponent() { this.AutoUpdateFilter = new System.Windows.Forms.TextBox(); this.AutoUpdate = new System.Windows.Forms.CheckBox(); this.CSVSaver = new System.Windows.Forms.SaveFileDialog(); + this.label3 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.TreeContextMenu.SuspendLayout(); @@ -87,6 +88,7 @@ private void InitializeComponent() { this.JsonTreeView.ShowNodeToolTips = true; this.JsonTreeView.Size = new System.Drawing.Size(286, 166); this.JsonTreeView.TabIndex = 0; + this.JsonTreeView.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.JsonTreeView_BeforeExpand); this.JsonTreeView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.JsonTreeView_MouseClick); // // TreeContextMenu @@ -137,10 +139,10 @@ private void InitializeComponent() { // tabPage2 // this.tabPage2.Controls.Add(this.JsonRawData); - this.tabPage2.Location = new System.Drawing.Point(4, 22); + 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(292, 174); + this.tabPage2.Size = new System.Drawing.Size(292, 172); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Raw"; this.tabPage2.UseVisualStyleBackColor = true; @@ -154,21 +156,22 @@ private void InitializeComponent() { this.JsonRawData.Name = "JsonRawData"; this.JsonRawData.ReadOnly = true; this.JsonRawData.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.JsonRawData.Size = new System.Drawing.Size(286, 168); + this.JsonRawData.Size = new System.Drawing.Size(286, 166); this.JsonRawData.TabIndex = 0; this.JsonRawData.WordWrap = false; // // tabPage3 // + this.tabPage3.Controls.Add(this.label3); this.tabPage3.Controls.Add(this.label2); this.tabPage3.Controls.Add(this.UpdatesTree); this.tabPage3.Controls.Add(this.label1); this.tabPage3.Controls.Add(this.AutoUpdateFilter); this.tabPage3.Controls.Add(this.AutoUpdate); - this.tabPage3.Location = new System.Drawing.Point(4, 22); + 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(292, 174); + this.tabPage3.Size = new System.Drawing.Size(292, 172); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Config"; this.tabPage3.UseVisualStyleBackColor = true; @@ -180,7 +183,7 @@ private void InitializeComponent() { this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(144, 44); this.label2.TabIndex = 4; - this.label2.Text = "※更新を有効にすると、\r\n 重くなる可能性があります"; + this.label2.Text = "※自動更新を有効にすると、\r\n 重くなる可能性があります"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // UpdatesTree @@ -188,9 +191,9 @@ private void InitializeComponent() { this.UpdatesTree.AutoSize = true; this.UpdatesTree.Location = new System.Drawing.Point(9, 32); this.UpdatesTree.Name = "UpdatesTree"; - this.UpdatesTree.Size = new System.Drawing.Size(85, 19); + this.UpdatesTree.Size = new System.Drawing.Size(104, 19); this.UpdatesTree.TabIndex = 3; - this.UpdatesTree.Text = "Treeを更新"; + this.UpdatesTree.Text = "Treeも更新する"; this.UpdatesTree.UseVisualStyleBackColor = true; this.UpdatesTree.CheckedChanged += new System.EventHandler(this.UpdatesTree_CheckedChanged); // @@ -229,6 +232,17 @@ private void InitializeComponent() { this.CSVSaver.Filter = "CSV|*.csv|File|*"; this.CSVSaver.Title = "ノードを CSV に出力"; // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 152); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(249, 15); + this.label3.TabIndex = 5; + this.label3.Text = "◆ D&D で保存した json ファイル を読み込めます"; + this.label3.UseMnemonic = false; + // // FormJson // this.AutoHidePortion = 150D; @@ -272,5 +286,6 @@ private void InitializeComponent() { private System.Windows.Forms.ToolStripMenuItem TreeContextMenu_OutputCSV; private System.Windows.Forms.SaveFileDialog CSVSaver; private System.Windows.Forms.ToolStripMenuItem TreeContextMenu_ShrinkParent; + private System.Windows.Forms.Label label3; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/FormJson.cs b/ElectronicObserver/Window/FormJson.cs index 5904fe5ad..52ae03a31 100644 --- a/ElectronicObserver/Window/FormJson.cs +++ b/ElectronicObserver/Window/FormJson.cs @@ -1,4 +1,5 @@ using ElectronicObserver.Observer; +using ElectronicObserver.Resource; using System; using System.Collections.Generic; using System.ComponentModel; @@ -17,12 +18,12 @@ public partial class FormJson : DockContent { // yyyyMMdd_hhmmssff[S|Q]@api_path.json - private static readonly Regex _filenamePattern = new Regex( @"\d{8}_\d{8}([SQ])@(.*)\.json$", RegexOptions.Compiled ); + private static readonly Regex FileNamePattern = new Regex( @"\d{8}_\d{8}([SQ])@(.*)\.json$", RegexOptions.Compiled ); + private const string AutoUpdateDisabledMessage = "<自動更新が無効になっています。Configから有効化してください。>"; private Regex _apiPattern; private string _currentAPIPath; - private dynamic _currentData; public FormJson( FormMain parent ) { @@ -30,6 +31,8 @@ public FormJson( FormMain parent ) { ConfigurationChanged(); + + Icon = ResourceManager.ImageToIcon( ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormJson] ); } private void FormJson_Load( object sender, EventArgs e ) { @@ -99,7 +102,6 @@ private void LoadResponse( string apiname, dynamic data ) { JsonRawData.Text = ( _currentAPIPath == apiname ? JsonRawData.Text + "\r\n\r\n" : "" ) + apiname + " : Response\r\n" + ( data == null ? "" : data.ToString() ); - _currentData = data; if ( !UpdatesTree.Checked ) return; @@ -113,10 +115,9 @@ private void LoadResponse( string apiname, dynamic data ) { JsonTreeView.Nodes.Add( apiname ); } - TreeNode root = new TreeNode( "" ); - AddNode( root, "", -1, data ); - - JsonTreeView.Nodes.Add( root.FirstNode ); + var node = CreateNode( "", data ); + CreateChildNode( node ); + JsonTreeView.Nodes.Add( node ); JsonTreeView.EndUpdate(); @@ -130,7 +131,7 @@ private void LoadResponse( string apiname, dynamic data ) { private void LoadFromFile( string path ) { - var match = _filenamePattern.Match( path ); + var match = FileNamePattern.Match( path ); if ( match.Success ) { @@ -179,54 +180,75 @@ private void LoadFromFile( string path ) { } + private void CreateChildNode( TreeNode root ) { + dynamic json = root.Tag; - /// - /// JSON データから、TreeNodeを構成します。 - /// - /// 親になるノード。 - /// 生成するノード名。 - /// 生成するノードが配列の要素だった場合、そのインデックス。そうでなければ -1 - /// もととなる JSON データ。 - private TreeNode AddNode( TreeNode root, string name, int index, dynamic data ) { + if ( json == null || !( json is Codeplex.Data.DynamicJson ) ) { + return; - TreeNode self = root.Nodes.Add( string.IsNullOrEmpty( name ) ? "" : ( name + " : " ) ); - self.Name = name + ( index >= 0 ? "[" + index + "]" : "" ); + } else if ( json.IsArray ) { + foreach ( var elem in json ) { + root.Nodes.Add( CreateNode( "", elem ) ); + } + + } else if ( json.IsObject ) { + foreach ( KeyValuePair elem in json ) { + root.Nodes.Add( CreateNode( elem.Key, elem.Value ) ); + } + } + } + + private TreeNode CreateNode( string name, dynamic data ) { + TreeNode node = new TreeNode(); + node.Tag = data; + node.Name = name; + node.Text = string.IsNullOrEmpty( name ) ? "" : ( name + " : " ); if ( data == null ) { - self.Text += "null"; + node.Text += "null"; } else if ( data is string ) { - self.Text += "\"" + data + "\""; + node.Text += "\"" + data + "\""; } else if ( data is bool || data is double ) { - self.Text += data.ToString(); + node.Text += data.ToString(); } else if ( data.IsArray ) { int count = 0; - foreach ( var elem in data ) { - AddNode( self, null, count, elem ); + foreach ( var elem in data ) count++; - } - self.Text += "[" + count + "]"; - self.Tag = 1; + node.Text += "[" + count + "]"; } else if ( data.IsObject ) { int count = 0; - foreach ( KeyValuePair elem in data ) { - AddNode( self, elem.Key, -1, elem.Value ); + foreach ( var elem in data ) count++; - } - self.Text += "{" + count + "}"; - self.Tag = 2; + node.Text += "{" + count + "}"; } else { throw new NotImplementedException(); + } - return root; + return node; } + // ノードが展開されたときに、孫ノードを生成する(子ノードは生成済みという前提) + // 子ノードまでだと [+] [-] が表示されないため孫まで生成しておく + private void JsonTreeView_BeforeExpand( object sender, TreeViewCancelEventArgs e ) { + + // Checked は展開済みフラグ :( + if ( e.Node.Checked ) + return; + + foreach ( TreeNode child in e.Node.Nodes ) { + CreateChildNode( child ); + } + + e.Node.Checked = true; + } + void ConfigurationChanged() { @@ -239,11 +261,19 @@ void ConfigurationChanged() { UpdatesTree.Checked = c.FormJson.UpdatesTree; AutoUpdateFilter.Text = c.FormJson.AutoUpdateFilter; + + JsonTreeView.Nodes.Clear(); + + if ( !AutoUpdate.Checked || !UpdatesTree.Checked ) + JsonTreeView.Nodes.Add( AutoUpdateDisabledMessage ); + + try { _apiPattern = new Regex( c.FormJson.AutoUpdateFilter ); + AutoUpdateFilter.BackColor = SystemColors.Window; } catch ( Exception ) { - Utility.Logger.Add( 3, "JSON ウィンドウ:フィルタが不正です。" ); + AutoUpdateFilter.BackColor = Color.MistyRose; _apiPattern = null; } } @@ -270,29 +300,35 @@ private void UpdatesTree_CheckedChanged( object sender, EventArgs e ) { JsonTreeView.Nodes.Clear(); - if ( !UpdatesTree.Checked ) { - JsonTreeView.Nodes.Add( "<更新が無効になっています。Configから有効化してください。>" ); + if ( !AutoUpdate.Checked || !UpdatesTree.Checked ) + JsonTreeView.Nodes.Add( AutoUpdateDisabledMessage ); - } Utility.Configuration.Config.FormJson.UpdatesTree = UpdatesTree.Checked; - } private void AutoUpdate_CheckedChanged( object sender, EventArgs e ) { + + JsonTreeView.Nodes.Clear(); + + if ( !AutoUpdate.Checked || !UpdatesTree.Checked ) + JsonTreeView.Nodes.Add( AutoUpdateDisabledMessage ); + + Utility.Configuration.Config.FormJson.AutoUpdate = AutoUpdate.Checked; } + private void AutoUpdateFilter_Validated( object sender, EventArgs e ) { var c = Utility.Configuration.Config.FormJson; c.AutoUpdateFilter = AutoUpdateFilter.Text; try { _apiPattern = new Regex( c.AutoUpdateFilter ); + AutoUpdateFilter.BackColor = SystemColors.Window; } catch ( Exception ) { - Utility.Logger.Add( 3, "JSON ウィンドウ:フィルタが不正です。フィルタはクリアされます。" ); - c.AutoUpdateFilter = AutoUpdateFilter.Text = ""; + AutoUpdateFilter.BackColor = Color.MistyRose; _apiPattern = null; } } @@ -314,14 +350,19 @@ private void TreeContextMenu_ShrinkParent_Click( object sender, EventArgs e ) { private void TreeContextMenu_Opening( object sender, CancelEventArgs e ) { var root = JsonTreeView.SelectedNode; + dynamic json = root.Tag; // root is array, children > 0, root[0](=child) is object or array - if ( ( root.Tag as int? ?? 0 ) == 1 && root.Nodes.Count > 0 && ( root.FirstNode.Tag as int? ?? 0 ) != 0 ) { + if ( + root.GetNodeCount( false ) > 0 && + json != null && json is Codeplex.Data.DynamicJson && json.IsArray && + root.FirstNode.Tag != null && root.FirstNode.Tag is Codeplex.Data.DynamicJson && ( ( (dynamic)root.FirstNode.Tag ).IsArray || ( (dynamic)root.FirstNode.Tag ).IsObject ) ) { TreeContextMenu_OutputCSV.Enabled = true; } else { TreeContextMenu_OutputCSV.Enabled = false; } + } private void TreeContextMenu_OutputCSV_Click( object sender, EventArgs e ) { @@ -333,44 +374,11 @@ private void TreeContextMenu_OutputCSV_Click( object sender, EventArgs e ) { using ( var sw = new StreamWriter( CSVSaver.FileName, false, Utility.Configuration.Config.Log.FileEncoding ) ) { var root = JsonTreeView.SelectedNode; - var data = _currentData; - - - // root にあたる実データの取得 - List revpath = new List(); - var ptr = root; - while ( ptr.Parent != null ) { - revpath.Add( ptr.Name ); - ptr = ptr.Parent; - } - - foreach ( var path in revpath.Reverse() ) { - int index = path.IndexOf( '[' ); - if ( index != -1 ) { - int indexer = int.Parse( path.Substring( index + 1, path.Length - index - 2 ) ); - data = data[path.Substring( 0, index - 1 )][indexer]; + sw.WriteLine( BuildCSVHeader( new StringBuilder(), "", ( (dynamic)root.Tag )[0] ).ToString() ); - } else { - data = data[path]; - } - } - - - // ヘッダーの取得 - var content = new StringBuilder(); - BuildCSVHeader( content, "", data[0] ); - content.Remove( content.Length - 1, 1 ); - - sw.WriteLine( content.ToString() ); - - - foreach ( dynamic elem in data ) { - content.Clear(); - BuildCSVContent( content, elem ); - content.Remove( content.Length - 1, 1 ); - - sw.WriteLine( content.ToString() ); + foreach ( dynamic elem in (dynamic)root.Tag ) { + sw.WriteLine( BuildCSVContent( new StringBuilder(), elem ).ToString() ); } } @@ -385,7 +393,8 @@ private void TreeContextMenu_OutputCSV_Click( object sender, EventArgs e ) { } - private void BuildCSVHeader( StringBuilder sb, string currentPath, dynamic data ) { + + private StringBuilder BuildCSVHeader( StringBuilder sb, string currentPath, dynamic data ) { if ( data is Codeplex.Data.DynamicJson ) { @@ -393,7 +402,7 @@ private void BuildCSVHeader( StringBuilder sb, string currentPath, dynamic data foreach ( string p in data.GetDynamicMemberNames() ) { BuildCSVHeader( sb, currentPath + "." + p, data[p] ); } - return; + return sb; } else if ( data.IsArray ) { int index = 0; @@ -401,15 +410,16 @@ private void BuildCSVHeader( StringBuilder sb, string currentPath, dynamic data BuildCSVHeader( sb, currentPath + "[" + index + "]", elem ); index++; } - return; + return sb; } } sb.Append( currentPath ).Append( "," ); + return sb; } - private void BuildCSVContent( StringBuilder sb, dynamic data ) { + private StringBuilder BuildCSVContent( StringBuilder sb, dynamic data ) { if ( data is Codeplex.Data.DynamicJson ) { @@ -417,18 +427,19 @@ private void BuildCSVContent( StringBuilder sb, dynamic data ) { foreach ( string p in data.GetDynamicMemberNames() ) { BuildCSVContent( sb, data[p] ); } - return; + return sb; } else if ( data.IsArray ) { foreach ( dynamic elem in data ) { BuildCSVContent( sb, elem ); } - return; + return sb; } } sb.Append( data ).Append( "," ); + return sb; } @@ -447,9 +458,5 @@ private void JsonTreeView_MouseClick( object sender, MouseEventArgs e ) { protected override string GetPersistString() { return "Json"; } - - - - } } diff --git a/ElectronicObserver/Window/FormMain.cs b/ElectronicObserver/Window/FormMain.cs index c7e9b8966..ed6ffa440 100644 --- a/ElectronicObserver/Window/FormMain.cs +++ b/ElectronicObserver/Window/FormMain.cs @@ -118,6 +118,7 @@ private async void FormMain_Load( object sender, EventArgs e ) { StripMenu_View_Browser.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormBrowser]; StripMenu_View_Log.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormLog]; StripMenu_WindowCapture.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormWindowCapture]; + StripMenu_View_Json.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormJson]; StripMenu_Tool_EquipmentList.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormEquipmentList]; StripMenu_Tool_DropRecord.Image = ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormDropRecord]; @@ -212,7 +213,10 @@ private void ConfigurationChanged() { var c = Utility.Configuration.Config; - StripMenu_Debug.Enabled = StripMenu_Debug.Visible = c.Debug.EnableDebugMenu; + StripMenu_Debug.Enabled = StripMenu_Debug.Visible = + StripMenu_View_Json.Enabled = StripMenu_View_Json.Visible = + c.Debug.EnableDebugMenu; + StripStatus.Visible = c.Life.ShowStatusBar; // Load で TopMost を変更するとバグるため(前述) @@ -1261,7 +1265,7 @@ private void StripMenu_View_Json_Click( object sender, EventArgs e ) { #endregion - + From 47e6f4ef23df42b4733341ad129e8271fe98f35b Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 20 Aug 2016 17:51:14 +0900 Subject: [PATCH 06/20] =?UTF-8?q?=E5=BE=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 戦闘:装甲破壊システムのAPI名称変更に対応 * 設定:初回起動時にブラウザバージョンを書き込むように * 起動時にタスクバーに表示されなくなることがある問題に対応 --- .../Data/Battle/Phase/PhaseInitial.cs | 2 +- .../Other/Information/apilist.txt | 3 +- ElectronicObserver/Utility/Configuration.cs | 24 ++ .../Dialog/DialogConfiguration.Designer.cs | 236 +++++++++--------- .../Window/Dialog/DialogConfiguration.cs | 12 +- ElectronicObserver/Window/FormMain.cs | 2 +- 6 files changed, 153 insertions(+), 126 deletions(-) diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseInitial.cs b/ElectronicObserver/Data/Battle/Phase/PhaseInitial.cs index 6393cad42..5e369b3db 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseInitial.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseInitial.cs @@ -127,7 +127,7 @@ public int[][] EnemyParameters { /// public bool IsBossDamaged { get { - return RawData.api_boss_damaged() && (int)RawData.api_boss_damaged > 0; + return RawData.api_xal01() && (int)RawData.api_xal01 > 0; } } diff --git a/ElectronicObserver/Other/Information/apilist.txt b/ElectronicObserver/Other/Information/apilist.txt index d38d3823a..3c4a60107 100644 --- a/ElectronicObserver/Other/Information/apilist.txt +++ b/ElectronicObserver/Other/Information/apilist.txt @@ -1709,7 +1709,7 @@ api_req_combined_battle/battle :連合艦隊-機動部隊or輸送部隊 戦闘 api_fParam :味方艦船基礎ステータス api_eParam :敵艦船基礎ステータス api_fParam_combined :味方随伴護衛艦隊基礎ステータス - api_boss_damaged :1=装甲破壊状態 そうでなければ存在しない + api_xal01 :1=装甲破壊状態 そうでなければ存在しない api_escape_idx :機動部隊本隊退避艦座標(1-6) api_escape_idx_combined :随伴護衛艦隊退避艦座標(1-6) api_combat_ration :本隊戦闘糧食補給 発動時のみ存在 艦船IDの数値配列 @@ -1718,6 +1718,7 @@ api_req_combined_battle/battle :連合艦隊-機動部隊or輸送部隊 戦闘 api_formation :陣形/交戦形態? [0]=味方, [1]=敵, [2]=交戦形態 [0|1]:1=単縦陣 2=複縦陣, 3=輪形陣, 4=梯形陣?, 5=単横陣?, "11"-"14"=第n警戒航行序列 [2]:2=反航戦? + api_air_base_attack :基地航空隊攻撃 通常戦闘を参照 api_stage_flag :航空戦フラグ? api_kouku :航空戦情報 api_plane_from :艦載機を飛ばせる艦 [0]=味方, [1]=敵 いなければ{-1} diff --git a/ElectronicObserver/Utility/Configuration.cs b/ElectronicObserver/Utility/Configuration.cs index a93165d16..11d25fba8 100644 --- a/ElectronicObserver/Utility/Configuration.cs +++ b/ElectronicObserver/Utility/Configuration.cs @@ -1138,6 +1138,30 @@ public void Load( Form mainForm ) { } else { MessageBox.Show( SoftwareInformation.SoftwareNameJapanese + " をご利用いただきありがとうございます。\r\n設定や使用方法については「ヘルプ」→「オンラインヘルプ」を参照してください。\r\nご使用の前に必ずご一読ください。", "初回起動メッセージ", MessageBoxButtons.OK, MessageBoxIcon.Information ); + + + // そのままだと正常に動作しなくなった(らしい)ので、ブラウザバージョンの書き込み + Microsoft.Win32.RegistryKey reg = null; + try { + + reg = Microsoft.Win32.Registry.CurrentUser.CreateSubKey( DialogConfiguration.RegistryPathMaster + DialogConfiguration.RegistryPathBrowserVersion ); + reg.SetValue( Window.FormBrowserHost.BrowserExeName, DialogConfiguration.DefaultBrowserVersion, Microsoft.Win32.RegistryValueKind.DWord ); + reg.Close(); + + reg = Microsoft.Win32.Registry.CurrentUser.CreateSubKey( DialogConfiguration.RegistryPathMaster + DialogConfiguration.RegistryPathGPURendering ); + reg.SetValue( Window.FormBrowserHost.BrowserExeName, DialogConfiguration.DefaultGPURendering ? 1 : 0, Microsoft.Win32.RegistryValueKind.DWord ); + + Utility.Logger.Add( 2, "ブラウザバージョンをレジストリに書き込みました。削除したい場合は「設定→サブウィンドウ→ブラウザ2→削除」を押してください。" ); + + + } catch ( Exception ex ) { + Utility.ErrorReporter.SendErrorReport( ex, "ブラウザバージョンをレジストリに書き込めませんでした。" ); + + } finally { + if ( reg != null ) + reg.Close(); + } + } } diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs b/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs index 94a8e05aa..37f784b30 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.Designer.cs @@ -168,6 +168,14 @@ private void InitializeComponent() { this.FormBrowser_GPURendering = new System.Windows.Forms.CheckBox(); this.FormBrowser_ApplyRegistry = new System.Windows.Forms.Button(); this.label19 = new System.Windows.Forms.Label(); + this.SubWindow_Json = new System.Windows.Forms.TabPage(); + this.SubWindow_Json_SealingPanel = new System.Windows.Forms.Panel(); + this.FormJson_AutoUpdate = new System.Windows.Forms.CheckBox(); + this.label32 = new System.Windows.Forms.Label(); + this.FormJson_UpdatesTree = new System.Windows.Forms.CheckBox(); + this.FormJson_AutoUpdateFilter = new System.Windows.Forms.TextBox(); + this.label31 = new System.Windows.Forms.Label(); + this.label33 = new System.Windows.Forms.Label(); this.tabPage11 = new System.Windows.Forms.TabPage(); this.Notification_AnchorageRepair = new System.Windows.Forms.Button(); this.label10 = new System.Windows.Forms.Label(); @@ -200,14 +208,6 @@ private void InitializeComponent() { this.FontSelector = new System.Windows.Forms.FontDialog(); this.LayoutFileBrowser = new System.Windows.Forms.OpenFileDialog(); this.APIListBrowser = new System.Windows.Forms.OpenFileDialog(); - this.SubWindow_Json = new System.Windows.Forms.TabPage(); - this.FormJson_AutoUpdate = new System.Windows.Forms.CheckBox(); - this.FormJson_UpdatesTree = new System.Windows.Forms.CheckBox(); - this.label31 = new System.Windows.Forms.Label(); - this.FormJson_AutoUpdateFilter = new System.Windows.Forms.TextBox(); - this.label32 = new System.Windows.Forms.Label(); - this.SubWindow_Json_SealingPanel = new System.Windows.Forms.Panel(); - this.label33 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Connection_UpstreamProxyPort)).BeginInit(); @@ -238,14 +238,14 @@ private void InitializeComponent() { this.tabPage14.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox3.SuspendLayout(); + this.SubWindow_Json.SuspendLayout(); + this.SubWindow_Json_SealingPanel.SuspendLayout(); this.tabPage11.SuspendLayout(); this.tabPage15.SuspendLayout(); this.groupBox5.SuspendLayout(); this.tabPage17.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.BGMPlayer_VolumeAll)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.BGMPlayer_ControlGrid)).BeginInit(); - this.SubWindow_Json.SuspendLayout(); - this.SubWindow_Json_SealingPanel.SuspendLayout(); this.SuspendLayout(); // // tabControl1 @@ -878,7 +878,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, 233); + this.Debug_SealingPanel.Size = new System.Drawing.Size(576, 231); this.Debug_SealingPanel.TabIndex = 1; // // Debug_APIListPath @@ -1264,10 +1264,10 @@ private void InitializeComponent() { // 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; @@ -1298,7 +1298,7 @@ private void InitializeComponent() { 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(442, 201); + this.tabPage19.Size = new System.Drawing.Size(562, 260); this.tabPage19.TabIndex = 8; this.tabPage19.Text = "入渠"; this.tabPage19.UseVisualStyleBackColor = true; @@ -1321,7 +1321,7 @@ private void InitializeComponent() { 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(442, 201); + this.tabPage16.Size = new System.Drawing.Size(562, 260); this.tabPage16.TabIndex = 6; this.tabPage16.Text = "司令部"; this.tabPage16.UseVisualStyleBackColor = true; @@ -1344,7 +1344,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, 149); + this.FormHeadquarters_Visibility.Size = new System.Drawing.Size(150, 208); this.FormHeadquarters_Visibility.TabIndex = 1; // // FormHeadquarters_BlinkAtMaximum @@ -1364,7 +1364,7 @@ private void InitializeComponent() { 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(442, 201); + this.tabPage18.Size = new System.Drawing.Size(562, 260); this.tabPage18.TabIndex = 7; this.tabPage18.Text = "羅針盤"; this.tabPage18.UseVisualStyleBackColor = true; @@ -1411,7 +1411,7 @@ private void InitializeComponent() { this.tabPage10.Location = new System.Drawing.Point(4, 22); this.tabPage10.Name = "tabPage10"; this.tabPage10.Padding = new System.Windows.Forms.Padding(3); - this.tabPage10.Size = new System.Drawing.Size(442, 201); + this.tabPage10.Size = new System.Drawing.Size(562, 260); this.tabPage10.TabIndex = 2; this.tabPage10.Text = "任務"; this.tabPage10.UseVisualStyleBackColor = true; @@ -1531,7 +1531,7 @@ private void InitializeComponent() { this.tabPage13.Location = new System.Drawing.Point(4, 22); this.tabPage13.Name = "tabPage13"; this.tabPage13.Padding = new System.Windows.Forms.Padding(3); - this.tabPage13.Size = new System.Drawing.Size(442, 201); + this.tabPage13.Size = new System.Drawing.Size(562, 260); this.tabPage13.TabIndex = 4; this.tabPage13.Text = "グループ"; this.tabPage13.UseVisualStyleBackColor = true; @@ -1593,10 +1593,10 @@ private void InitializeComponent() { this.tabPage12.Controls.Add(this.FormBrowser_LogInPageURL); this.tabPage12.Controls.Add(this.FormBrowser_ZoomRate); this.tabPage12.Controls.Add(this.label15); - this.tabPage12.Location = new System.Drawing.Point(4, 24); + this.tabPage12.Location = new System.Drawing.Point(4, 22); this.tabPage12.Name = "tabPage12"; this.tabPage12.Padding = new System.Windows.Forms.Padding(3); - this.tabPage12.Size = new System.Drawing.Size(562, 258); + this.tabPage12.Size = new System.Drawing.Size(562, 260); this.tabPage12.TabIndex = 3; this.tabPage12.Text = "ブラウザ"; this.tabPage12.UseVisualStyleBackColor = true; @@ -1866,6 +1866,8 @@ private void InitializeComponent() { // // 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.FormBrowser_BrowserVersion); this.groupBox3.Controls.Add(this.FormBrowser_DeleteRegistry); this.groupBox3.Controls.Add(this.FormBrowser_GPURendering); @@ -1873,7 +1875,7 @@ private void InitializeComponent() { this.groupBox3.Controls.Add(this.label19); this.groupBox3.Location = new System.Drawing.Point(6, 6); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(430, 46); + this.groupBox3.Size = new System.Drawing.Size(550, 46); this.groupBox3.TabIndex = 0; this.groupBox3.TabStop = false; this.groupBox3.Text = "レジストリ"; @@ -1902,7 +1904,7 @@ private void InitializeComponent() { // FormBrowser_DeleteRegistry // this.FormBrowser_DeleteRegistry.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.FormBrowser_DeleteRegistry.Location = new System.Drawing.Point(374, 15); + this.FormBrowser_DeleteRegistry.Location = new System.Drawing.Point(494, 15); this.FormBrowser_DeleteRegistry.Name = "FormBrowser_DeleteRegistry"; this.FormBrowser_DeleteRegistry.Size = new System.Drawing.Size(50, 23); this.FormBrowser_DeleteRegistry.TabIndex = 4; @@ -1925,7 +1927,7 @@ private void InitializeComponent() { // FormBrowser_ApplyRegistry // this.FormBrowser_ApplyRegistry.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.FormBrowser_ApplyRegistry.Location = new System.Drawing.Point(318, 15); + this.FormBrowser_ApplyRegistry.Location = new System.Drawing.Point(438, 15); this.FormBrowser_ApplyRegistry.Name = "FormBrowser_ApplyRegistry"; this.FormBrowser_ApplyRegistry.Size = new System.Drawing.Size(50, 23); this.FormBrowser_ApplyRegistry.TabIndex = 3; @@ -1943,6 +1945,93 @@ private void InitializeComponent() { this.label19.TabIndex = 0; this.label19.Text = "ブラウザバージョン:"; // + // SubWindow_Json + // + this.SubWindow_Json.Controls.Add(this.SubWindow_Json_SealingPanel); + this.SubWindow_Json.Controls.Add(this.label33); + this.SubWindow_Json.Location = new System.Drawing.Point(4, 24); + this.SubWindow_Json.Name = "SubWindow_Json"; + this.SubWindow_Json.Padding = new System.Windows.Forms.Padding(3); + this.SubWindow_Json.Size = new System.Drawing.Size(562, 258); + this.SubWindow_Json.TabIndex = 9; + this.SubWindow_Json.Text = "JSON"; + this.SubWindow_Json.UseVisualStyleBackColor = true; + // + // SubWindow_Json_SealingPanel + // + this.SubWindow_Json_SealingPanel.BackColor = System.Drawing.SystemColors.Window; + this.SubWindow_Json_SealingPanel.Controls.Add(this.FormJson_AutoUpdate); + this.SubWindow_Json_SealingPanel.Controls.Add(this.label32); + this.SubWindow_Json_SealingPanel.Controls.Add(this.FormJson_UpdatesTree); + this.SubWindow_Json_SealingPanel.Controls.Add(this.FormJson_AutoUpdateFilter); + this.SubWindow_Json_SealingPanel.Controls.Add(this.label31); + this.SubWindow_Json_SealingPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.SubWindow_Json_SealingPanel.Location = new System.Drawing.Point(3, 3); + this.SubWindow_Json_SealingPanel.Margin = new System.Windows.Forms.Padding(0); + this.SubWindow_Json_SealingPanel.Name = "SubWindow_Json_SealingPanel"; + this.SubWindow_Json_SealingPanel.Size = new System.Drawing.Size(556, 252); + this.SubWindow_Json_SealingPanel.TabIndex = 6; + // + // FormJson_AutoUpdate + // + this.FormJson_AutoUpdate.AutoSize = true; + this.FormJson_AutoUpdate.Location = new System.Drawing.Point(3, 3); + this.FormJson_AutoUpdate.Name = "FormJson_AutoUpdate"; + this.FormJson_AutoUpdate.Size = new System.Drawing.Size(93, 19); + this.FormJson_AutoUpdate.TabIndex = 0; + this.FormJson_AutoUpdate.Text = "自動更新する"; + this.ToolTipInfo.SetToolTip(this.FormJson_AutoUpdate, "API の送受信時に、自動で表示を更新するかを指定します。\r\n多少重くなる可能性があります。\r\n"); + this.FormJson_AutoUpdate.UseVisualStyleBackColor = true; + // + // label32 + // + this.label32.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label32.Location = new System.Drawing.Point(765, 3); + this.label32.Name = "label32"; + this.label32.Size = new System.Drawing.Size(144, 44); + this.label32.TabIndex = 5; + this.label32.Text = "※自動更新を有効にすると、\r\n 重くなる可能性があります"; + this.label32.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // FormJson_UpdatesTree + // + this.FormJson_UpdatesTree.AutoSize = true; + this.FormJson_UpdatesTree.Location = new System.Drawing.Point(3, 28); + this.FormJson_UpdatesTree.Name = "FormJson_UpdatesTree"; + this.FormJson_UpdatesTree.Size = new System.Drawing.Size(104, 19); + this.FormJson_UpdatesTree.TabIndex = 1; + this.FormJson_UpdatesTree.Text = "Treeも更新する"; + this.ToolTipInfo.SetToolTip(this.FormJson_UpdatesTree, "API の送受信時に、自動で Tree 表示を更新するかを指定します。\r\n上の「自動更新する」が有効の時のみ更新されます。\r\n多少重くなる可能性があります。"); + this.FormJson_UpdatesTree.UseVisualStyleBackColor = true; + // + // FormJson_AutoUpdateFilter + // + this.FormJson_AutoUpdateFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.FormJson_AutoUpdateFilter.Location = new System.Drawing.Point(109, 53); + this.FormJson_AutoUpdateFilter.Name = "FormJson_AutoUpdateFilter"; + this.FormJson_AutoUpdateFilter.Size = new System.Drawing.Size(444, 23); + this.FormJson_AutoUpdateFilter.TabIndex = 3; + this.ToolTipInfo.SetToolTip(this.FormJson_AutoUpdateFilter, "自動更新時に読み込む API を選択するフィルタです。\r\n正規表現も利用可能です。"); + // + // label31 + // + this.label31.AutoSize = true; + this.label31.Location = new System.Drawing.Point(3, 56); + this.label31.Name = "label31"; + this.label31.Size = new System.Drawing.Size(100, 15); + this.label31.TabIndex = 2; + this.label31.Text = "自動更新フィルタ:"; + // + // label33 + // + this.label33.AutoSize = true; + this.label33.Location = new System.Drawing.Point(24, 24); + this.label33.Name = "label33"; + this.label33.Size = new System.Drawing.Size(253, 15); + this.label33.TabIndex = 0; + this.label33.Text = "(非表示です。デバッグメニューを有効にしてください。)"; + // // tabPage11 // this.tabPage11.Controls.Add(this.Notification_AnchorageRepair); @@ -1974,7 +2063,7 @@ private void InitializeComponent() { // this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(3, 274); + this.label10.Location = new System.Drawing.Point(3, 272); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(238, 15); this.label10.TabIndex = 5; @@ -2194,7 +2283,7 @@ private void InitializeComponent() { 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, 251); + this.BGMPlayer_ControlGrid.Size = new System.Drawing.Size(564, 249); 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); @@ -2276,93 +2365,6 @@ private void InitializeComponent() { this.APIListBrowser.Filter = "Text File|*.txt|File|*"; this.APIListBrowser.Title = "API リストを開く"; // - // SubWindow_Json - // - this.SubWindow_Json.Controls.Add(this.SubWindow_Json_SealingPanel); - this.SubWindow_Json.Controls.Add(this.label33); - this.SubWindow_Json.Location = new System.Drawing.Point(4, 24); - this.SubWindow_Json.Name = "SubWindow_Json"; - this.SubWindow_Json.Padding = new System.Windows.Forms.Padding(3); - this.SubWindow_Json.Size = new System.Drawing.Size(562, 258); - this.SubWindow_Json.TabIndex = 9; - this.SubWindow_Json.Text = "JSON"; - this.SubWindow_Json.UseVisualStyleBackColor = true; - // - // FormJson_AutoUpdate - // - this.FormJson_AutoUpdate.AutoSize = true; - this.FormJson_AutoUpdate.Location = new System.Drawing.Point(3, 3); - this.FormJson_AutoUpdate.Name = "FormJson_AutoUpdate"; - this.FormJson_AutoUpdate.Size = new System.Drawing.Size(93, 19); - this.FormJson_AutoUpdate.TabIndex = 0; - this.FormJson_AutoUpdate.Text = "自動更新する"; - this.ToolTipInfo.SetToolTip(this.FormJson_AutoUpdate, "API の送受信時に、自動で表示を更新するかを指定します。\r\n多少重くなる可能性があります。\r\n"); - this.FormJson_AutoUpdate.UseVisualStyleBackColor = true; - // - // FormJson_UpdatesTree - // - this.FormJson_UpdatesTree.AutoSize = true; - this.FormJson_UpdatesTree.Location = new System.Drawing.Point(3, 28); - this.FormJson_UpdatesTree.Name = "FormJson_UpdatesTree"; - this.FormJson_UpdatesTree.Size = new System.Drawing.Size(104, 19); - this.FormJson_UpdatesTree.TabIndex = 1; - this.FormJson_UpdatesTree.Text = "Treeも更新する"; - this.ToolTipInfo.SetToolTip(this.FormJson_UpdatesTree, "API の送受信時に、自動で Tree 表示を更新するかを指定します。\r\n上の「自動更新する」が有効の時のみ更新されます。\r\n多少重くなる可能性があります。"); - this.FormJson_UpdatesTree.UseVisualStyleBackColor = true; - // - // label31 - // - this.label31.AutoSize = true; - this.label31.Location = new System.Drawing.Point(3, 56); - this.label31.Name = "label31"; - this.label31.Size = new System.Drawing.Size(100, 15); - this.label31.TabIndex = 2; - this.label31.Text = "自動更新フィルタ:"; - // - // FormJson_AutoUpdateFilter - // - this.FormJson_AutoUpdateFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.FormJson_AutoUpdateFilter.Location = new System.Drawing.Point(109, 53); - this.FormJson_AutoUpdateFilter.Name = "FormJson_AutoUpdateFilter"; - this.FormJson_AutoUpdateFilter.Size = new System.Drawing.Size(444, 23); - this.FormJson_AutoUpdateFilter.TabIndex = 3; - this.ToolTipInfo.SetToolTip(this.FormJson_AutoUpdateFilter, "自動更新時に読み込む API を選択するフィルタです。\r\n正規表現も利用可能です。"); - // - // label32 - // - this.label32.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.label32.Location = new System.Drawing.Point(765, 3); - this.label32.Name = "label32"; - this.label32.Size = new System.Drawing.Size(144, 44); - this.label32.TabIndex = 5; - this.label32.Text = "※自動更新を有効にすると、\r\n 重くなる可能性があります"; - this.label32.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // SubWindow_Json_SealingPanel - // - this.SubWindow_Json_SealingPanel.BackColor = System.Drawing.SystemColors.Window; - this.SubWindow_Json_SealingPanel.Controls.Add(this.FormJson_AutoUpdate); - this.SubWindow_Json_SealingPanel.Controls.Add(this.label32); - this.SubWindow_Json_SealingPanel.Controls.Add(this.FormJson_UpdatesTree); - this.SubWindow_Json_SealingPanel.Controls.Add(this.FormJson_AutoUpdateFilter); - this.SubWindow_Json_SealingPanel.Controls.Add(this.label31); - this.SubWindow_Json_SealingPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.SubWindow_Json_SealingPanel.Location = new System.Drawing.Point(3, 3); - this.SubWindow_Json_SealingPanel.Margin = new System.Windows.Forms.Padding(0); - this.SubWindow_Json_SealingPanel.Name = "SubWindow_Json_SealingPanel"; - this.SubWindow_Json_SealingPanel.Size = new System.Drawing.Size(556, 252); - this.SubWindow_Json_SealingPanel.TabIndex = 6; - // - // label33 - // - this.label33.AutoSize = true; - this.label33.Location = new System.Drawing.Point(24, 24); - this.label33.Name = "label33"; - this.label33.Size = new System.Drawing.Size(253, 15); - this.label33.TabIndex = 0; - this.label33.Text = "(非表示です。デバッグメニューを有効にしてください。)"; - // // DialogConfiguration // this.AcceptButton = this.ButtonOK; @@ -2432,6 +2434,10 @@ private void InitializeComponent() { this.groupBox4.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); + this.SubWindow_Json.ResumeLayout(false); + this.SubWindow_Json.PerformLayout(); + this.SubWindow_Json_SealingPanel.ResumeLayout(false); + this.SubWindow_Json_SealingPanel.PerformLayout(); this.tabPage11.ResumeLayout(false); this.tabPage11.PerformLayout(); this.tabPage15.ResumeLayout(false); @@ -2441,10 +2447,6 @@ private void InitializeComponent() { this.tabPage17.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.BGMPlayer_VolumeAll)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.BGMPlayer_ControlGrid)).EndInit(); - this.SubWindow_Json.ResumeLayout(false); - this.SubWindow_Json.PerformLayout(); - this.SubWindow_Json_SealingPanel.ResumeLayout(false); - this.SubWindow_Json_SealingPanel.PerformLayout(); this.ResumeLayout(false); } diff --git a/ElectronicObserver/Window/Dialog/DialogConfiguration.cs b/ElectronicObserver/Window/Dialog/DialogConfiguration.cs index 6ae4135b7..c835a50be 100644 --- a/ElectronicObserver/Window/Dialog/DialogConfiguration.cs +++ b/ElectronicObserver/Window/Dialog/DialogConfiguration.cs @@ -17,12 +17,12 @@ namespace ElectronicObserver.Window.Dialog { public partial class DialogConfiguration : Form { - private static readonly string RegistryPathMaster = @"Software\Microsoft\Internet Explorer\Main\FeatureControl\"; - private static readonly string RegistryPathBrowserVersion = @"FEATURE_BROWSER_EMULATION\"; - private static readonly string RegistryPathGPURendering = @"FEATURE_GPU_RENDERING\"; + public const string RegistryPathMaster = @"Software\Microsoft\Internet Explorer\Main\FeatureControl\"; + public const string RegistryPathBrowserVersion = @"FEATURE_BROWSER_EMULATION\"; + public const string RegistryPathGPURendering = @"FEATURE_GPU_RENDERING\"; - private static readonly int DefaultBrowserVersion = 7000; - private static readonly bool DefaultGPURendering = false; + public const int DefaultBrowserVersion = 11001; + public const bool DefaultGPURendering = false; private System.Windows.Forms.Control _UIControl; @@ -256,7 +256,7 @@ private void Debug_EnableDebugMenu_CheckedChanged( object sender, EventArgs e ) Connection_UpstreamProxyAddress.Visible = Connection_DownstreamProxy.Visible = Connection_DownstreamProxyLabel.Visible = - SubWindow_Json_SealingPanel.Visible = + SubWindow_Json_SealingPanel.Visible = Debug_EnableDebugMenu.Checked; } diff --git a/ElectronicObserver/Window/FormMain.cs b/ElectronicObserver/Window/FormMain.cs index ed6ffa440..5a52588fb 100644 --- a/ElectronicObserver/Window/FormMain.cs +++ b/ElectronicObserver/Window/FormMain.cs @@ -204,7 +204,7 @@ private void FormMain_Shown( object sender, EventArgs e ) { TopMost = Utility.Configuration.Config.Life.TopMost; // HACK: タスクバーに表示されなくなる不具合への応急処置 効くかは知らない - Show(); + ShowInTaskbar = true; } From a4b13bd2c1f30ff6603fe404aab147b20aeaf717 Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 20 Aug 2016 21:21:35 +0900 Subject: [PATCH 07/20] =?UTF-8?q?=E6=83=85=E5=A0=B1=EF=BC=9A=E3=82=AE?= =?UTF-8?q?=E3=83=9F=E3=83=83=E3=82=AF=E8=A7=A3=E9=99=A4=E3=83=A1=E3=83=83?= =?UTF-8?q?=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=AE=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ElectronicObserver/Window/FormInformation.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ElectronicObserver/Window/FormInformation.cs b/ElectronicObserver/Window/FormInformation.cs index 0d9e40cd4..9959bf306 100644 --- a/ElectronicObserver/Window/FormInformation.cs +++ b/ElectronicObserver/Window/FormInformation.cs @@ -73,6 +73,12 @@ void Updated( string apiname, dynamic data ) { TextInformation.Text = GetConsumptionResource( data ); } _inSortie = null; + + // '16 summer event + if ( data.api_event_object() && data.api_event_object.api_m_flag2() && (int)data.api_event_object.api_m_flag2 > 0 ) { + TextInformation.Text += "*ギミック解除*\r\n"; + Utility.Logger.Add( 2, "敵勢力の弱体化を確認しました!" ); + } break; case "api_req_member/get_practice_enemyinfo": From 844e869d122c9c68e47cdb5b6ec65a865af3dc8d Mon Sep 17 00:00:00 2001 From: Andante Date: Sun, 21 Aug 2016 09:38:52 +0900 Subject: [PATCH 08/20] =?UTF-8?q?=E6=88=A6=E9=97=98=EF=BC=9A=E5=9F=BA?= =?UTF-8?q?=E5=9C=B0=E8=88=AA=E7=A9=BA=E9=9A=8A=E6=88=A6=E6=B3=81=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=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/Window/FormBattle.cs | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index 58953056b..ce5868898 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -64,6 +64,7 @@ public FormBattle( FormMain parent ) { TableBottom.ResumeLayout(); + Searching.ImageList = SearchingFriend.ImageList = SearchingEnemy.ImageList = AACutin.ImageList = @@ -138,6 +139,7 @@ private void Updated( string apiname, dynamic data ) { SetFormation( bm.BattleDay ); SetSearchingResult( bm.BattleDay ); + SetBaseAirAttack( bm.BattleDay.BaseAirAttack ); SetAerialWarfare( bm.BattleDay.AirBattle ); SetHPNormal( bm.BattleDay ); SetDamageRateNormal( bm.BattleDay, bm.BattleDay.Initial.InitialHPs ); @@ -158,6 +160,7 @@ private void Updated( string apiname, dynamic data ) { case "api_req_battle_midnight/sp_midnight": { SetFormation( bm.BattleNight ); + ClearBaseAirAttack(); ClearAerialWarfare(); ClearSearchingResult(); SetNightBattleEvent( bm.BattleNight.NightBattle ); @@ -171,6 +174,7 @@ private void Updated( string apiname, dynamic data ) { SetFormation( bm.BattleDay ); SetSearchingResult( bm.BattleDay ); + SetBaseAirAttack( bm.BattleDay.BaseAirAttack ); SetAerialWarfareAirBattle( bm.BattleDay.AirBattle, ( (BattleAirBattle)bm.BattleDay ).AirBattle2 ); SetHPNormal( bm.BattleDay ); SetDamageRateNormal( bm.BattleDay, bm.BattleDay.Initial.InitialHPs ); @@ -184,6 +188,7 @@ private void Updated( string apiname, dynamic data ) { SetFormation( bm.BattleDay ); SetSearchingResult( bm.BattleDay ); + SetBaseAirAttack( bm.BattleDay.BaseAirAttack ); SetAerialWarfare( bm.BattleDay.AirBattle ); SetHPCombined( bm.BattleDay ); SetDamageRateCombined( bm.BattleDay, bm.BattleDay.Initial.InitialHPs ); @@ -195,6 +200,7 @@ private void Updated( string apiname, dynamic data ) { SetFormation( bm.BattleDay ); SetSearchingResult( bm.BattleDay ); + SetBaseAirAttack( bm.BattleDay.BaseAirAttack ); SetAerialWarfareAirBattle( bm.BattleDay.AirBattle, ( (BattleCombinedAirBattle)bm.BattleDay ).AirBattle2 ); SetHPCombined( bm.BattleDay ); SetDamageRateCombined( bm.BattleDay, bm.BattleDay.Initial.InitialHPs ); @@ -216,6 +222,7 @@ private void Updated( string apiname, dynamic data ) { SetFormation( bm.BattleNight ); ClearAerialWarfare(); ClearSearchingResult(); + ClearBaseAirAttack(); SetNightBattleEvent( bm.BattleNight.NightBattle ); SetHPCombined( bm.BattleNight ); SetDamageRateCombined( bm.BattleNight, bm.BattleNight.Initial.InitialHPs ); @@ -280,6 +287,60 @@ private void ClearSearchingResult() { } + /// + /// 基地航空隊フェーズの結果を設定します。 + /// + private void SetBaseAirAttack( PhaseBaseAirAttack pd ) { + + if ( pd.IsAvailable ) { + + Searching.Text = "基地航空隊"; + Searching.ImageAlign = ContentAlignment.MiddleLeft; + Searching.ImageIndex = (int)ResourceManager.EquipmentContent.LandAttacker; + + var sb = new StringBuilder(); + int index = 1; + + foreach ( var phase in pd.AirAttackUnits ) { + + sb.AppendFormat( "{0} 回目 - #{1} :\r\n", + index, phase.AirUnitID ); + + if ( phase.IsStage1Available ) { + sb.AppendFormat( " St1: 自軍 -{0}/{1} | 敵軍 -{2}/{3} | {4}\r\n", + phase.AircraftLostStage1Friend, phase.AircraftTotalStage1Friend, + phase.AircraftLostStage1Enemy, phase.AircraftTotalStage1Enemy, + Constants.GetAirSuperiority( phase.AirSuperiority ) ); + } + if ( phase.IsStage2Available ) { + sb.AppendFormat( " St2: 自軍 -{0}/{1} | 敵軍 -{2}/{3}\r\n", + phase.AircraftLostStage2Friend, phase.AircraftTotalStage2Friend, + phase.AircraftLostStage2Enemy, phase.AircraftTotalStage2Enemy ); + } + + index++; + } + + ToolTipInfo.SetToolTip( Searching, sb.ToString() ); + + + } else { + ClearBaseAirAttack(); + } + + } + + /// + /// 基地航空隊フェーズの結果をクリアします。 + /// + private void ClearBaseAirAttack() { + Searching.Text = "索敵"; + Searching.ImageAlign = ContentAlignment.MiddleCenter; + Searching.ImageIndex = -1; + ToolTipInfo.SetToolTip( Searching, null ); + } + + /// /// 航空戦情報を設定します。 /// From 33a048658af1d8e39213ce196be6ea2b08426fca Mon Sep 17 00:00:00 2001 From: xzk Date: Sun, 21 Aug 2016 17:47:46 +0800 Subject: [PATCH 09/20] Add battle detail information of normal fleet in friend side Todo: Combined fleet --- .../Data/Battle/BattleDetail.cs | 176 ++++++++++++++++++ .../Data/Battle/Phase/PhaseBase.cs | 2 + .../Data/Battle/Phase/PhaseNightBattle.cs | 14 +- .../Data/Battle/Phase/PhaseShelling.cs | 8 +- .../Data/Battle/Phase/PhaseTorpedo.cs | 25 +++ ElectronicObserver/ElectronicObserver.csproj | 3 +- ElectronicObserver/Window/FormBattle.cs | 143 ++++++++++++-- 7 files changed, 348 insertions(+), 23 deletions(-) create mode 100644 ElectronicObserver/Data/Battle/BattleDetail.cs diff --git a/ElectronicObserver/Data/Battle/BattleDetail.cs b/ElectronicObserver/Data/Battle/BattleDetail.cs new file mode 100644 index 000000000..d6f53f8f3 --- /dev/null +++ b/ElectronicObserver/Data/Battle/BattleDetail.cs @@ -0,0 +1,176 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Battle +{ + /// + /// Save the battle detail information + /// + public abstract class BattleDetail + { + // Save id rather than ship name here + protected int attacker; + protected int defender; + public int[] damage; + public CriticalType[] critical; + + /// + /// The first id in battle data's id list is always -1 + /// Skip it automatically + /// so return attacker - 1 + /// The same as defender + /// + public int Attacker { get { return attacker - 1; } } + + /// + /// Though there mutiple defenders in API, but they are the same so it + /// uses one defender + /// + public int Defender { get { return defender - 1; } } + public enum CriticalType + { + Miss = 0, + Hit = 1, + Critical = 2, + Unknown = -1 + } + + public BattleDetail(int attackerId, int defenderId, int[] d, int[] c) + { + attacker = attackerId; + defender = defenderId; + damage = d; + List ct = new List(); + foreach (int i in c) + { + ct.Add((CriticalType)i); + } + critical = ct.ToArray(); + } + + /// + /// Because BattleDetail doesn't save ship's name + /// It can't return the final string of the description + /// So name it BattleDescription rether than ToString() + /// + /// Description with parameters + public virtual string BattleDescription() + { + return "Unsupported"; + } + } + + /// + /// Cutin types are different in day battle and night battle + /// + public class BattleDayDetail : BattleDetail + { + public enum DayCutinType + { + Normal = 0, + Laser = 1, + Double = 2, + Cutin_Main_Sub = 3, + Cutin_Main_Radar = 4, + Cutin_Main_Bomb = 5, + Cutin_Main_Main = 6, + + Torpedo = 10 + } + public DayCutinType dayCutin; + + public BattleDayDetail(int attackerId, int defenderId, int[] d, int[] c, int cutin) + : base(attackerId, defenderId, d, c) + { + dayCutin = (DayCutinType)cutin; + } + + public override string BattleDescription() + { + StringBuilder builder = new StringBuilder(); + builder.AppendLine("{0} → {1}"); + builder.Append("Attack Type : "); + switch (dayCutin) + { + case DayCutinType.Normal: builder.AppendLine("通常"); break; + case DayCutinType.Laser: builder.AppendLine("レーザー"); break; + case DayCutinType.Double: builder.AppendLine("連撃"); break; + case DayCutinType.Cutin_Main_Sub: builder.AppendLine("カットイン(主砲/副砲)"); break; + case DayCutinType.Cutin_Main_Radar: builder.AppendLine("カットイン(主砲/電探)"); break; + case DayCutinType.Cutin_Main_Bomb: builder.AppendLine("カットイン(主砲/徹甲)"); break; + case DayCutinType.Cutin_Main_Main: builder.AppendLine("カットイン(主砲/主砲)"); break; + case DayCutinType.Torpedo: builder.AppendLine("雷撃"); break; + } + builder.Append("Damage: "); + for (int i = 0; i < damage.Length; i++) + { + if (i > 0) builder.AppendLine("").Append(" "); + builder.Append(damage[i]); + builder.Append(" "); + switch (critical[i]) + { + case CriticalType.Miss: builder.Append("Miss"); break; + case CriticalType.Hit: builder.Append("Hit"); break; + case CriticalType.Critical: builder.Append("Critical"); break; + } + } + return builder.ToString(); + + } + } + + public class BattleNightDetail : BattleDetail + { + public enum NightCutin + { + Normal = 0, + Double = 1, + Cutin_Main_Tor = 2, + Cutin_Tor = 3, + Cutin_Main_Sub = 4, + Cutin_Main_Main = 5 + } + + public NightCutin nightCutin; + + public BattleNightDetail(int attackerId, int defenderId, int[] d, int[] c, int cutin) + : base(attackerId, defenderId, d, c) + { + nightCutin = (NightCutin)cutin; + } + + public override string BattleDescription() + { + StringBuilder builder = new StringBuilder(); + builder.AppendLine("{0} → {1}"); + builder.Append("Attack Type : "); + switch (nightCutin) + { + case NightCutin.Normal: builder.AppendLine("通常"); break; + case NightCutin.Double: builder.AppendLine("連撃"); break; + case NightCutin.Cutin_Main_Tor: builder.AppendLine("カットイン(主砲/魚雷)"); break; + case NightCutin.Cutin_Tor: builder.AppendLine("カットイン(魚雷/魚雷)"); break; + case NightCutin.Cutin_Main_Sub: builder.AppendLine("カットイン(主砲/副砲)"); break; + case NightCutin.Cutin_Main_Main: builder.AppendLine("カットイン(主砲/主砲)"); break; + } + builder.Append("Damage: "); + for (int i = 0; i < damage.Length; i++) + { + if (i > 0) builder.AppendLine("").Append(" "); + builder.Append(damage[i]); + builder.Append(" "); + switch (critical[i]) + { + case CriticalType.Miss: builder.Append("Miss"); break; + case CriticalType.Hit: builder.Append("Hit"); break; + case CriticalType.Critical: builder.Append("Critical"); break; + } + } + return builder.ToString(); + + } + } +} diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs b/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs index a902873ea..96ae70ac7 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs @@ -17,9 +17,11 @@ public abstract class PhaseBase { public PhaseBase( BattleData data ) { _battleData = data; + battleDetails = new List(); } + public List battleDetails; protected dynamic RawData { get { return _battleData.RawData; } } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs b/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs index b1d0b08ac..0c59e1b42 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs @@ -37,14 +37,22 @@ public override void EmulateBattle( int[] hps, int[] damages ) { int[] defenders = (int[])( ShellingData.api_df_list[i] ); int[] unitDamages = (int[])( ShellingData.api_damage[i] ); + int tempDefender = -1; for ( int j = 0; j < defenders.Length; j++ ) { - if ( defenders[j] != -1 ) - tempDamages[GetIndex( defenders[j] )] += Math.Max( unitDamages[j], 0 ); + if (defenders[j] != -1) + { + tempDamages[GetIndex(defenders[j])] += Math.Max(unitDamages[j], 0); + if (tempDefender != defenders[j]) tempDefender = defenders[j]; + } } for ( int j = 0; j < tempDamages.Length; j++ ) - AddDamage( hps, j, tempDamages[j] ); + AddDamage( hps, j, tempDamages[j] ); + + + BattleNightDetail detail = new BattleNightDetail(attackers[i], tempDefender, unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_sp_list[i]); + battleDetails.Add(detail); damages[GetIndex( attackers[i] )] += tempDamages.Sum(); } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs b/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs index 401ab1216..afd5cf676 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs @@ -46,15 +46,21 @@ public override void EmulateBattle( int[] hps, int[] damages ) { int[] defenders = (int[])( ShellingData.api_df_list[i] ); int[] unitDamages = (int[])( ShellingData.api_damage[i] ); + int tempDefender = -1; for ( int j = 0; j < defenders.Length; j++ ) { - if ( defenders[j] != -1 ) + if ( defenders[j] != -1 ) { tempDamages[GetIndex( defenders[j] )] += Math.Max( unitDamages[j], 0 ); + if(tempDefender != defenders[j]) tempDefender = defenders[j]; + } } for ( int j = 0; j < tempDamages.Length; j++ ) AddDamage( hps, j, tempDamages[j] ); + BattleDayDetail detail = new BattleDayDetail(attackers[i], tempDefender, unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_at_type[i]); + battleDetails.Add(detail); + damages[GetIndex( attackers[i] )] += tempDamages.Sum(); } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs b/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs index 23e5bf872..ff1f0a20e 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs @@ -34,6 +34,7 @@ public override bool IsAvailable { } } + public dynamic ShellingData { get { return phaseID ==0 ? RawData.api_opening_atack : RawData.api_raigeki; } } public override void EmulateBattle( int[] hps, int[] damages ) { if ( !IsAvailable ) return; @@ -49,6 +50,30 @@ public override void EmulateBattle( int[] hps, int[] damages ) { damages[i] += dmg[i]; } } + { + int[] friendTargets = (int[])ShellingData.api_frai; + int[] enemyTargets = (int[])ShellingData.api_erai; + int[] friendTargetDams = (int[])ShellingData.api_fydam; + int[] enemyTargetDam = (int[])ShellingData.api_eydam; + int[] friendCritical = (int[])ShellingData.api_fcl; + int[] enemyCritical = (int[])ShellingData.api_ecl; + for (int i = 1; i < friendTargets.Length; i++) + { //skip header(-1) + if (friendTargets[i] > 0) + { + BattleDayDetail detail = new BattleDayDetail(i, friendTargets[i] + 6, new int[] { friendTargetDams[i] }, new int[] { friendCritical[i] }, (int) BattleDayDetail.DayCutinType.Torpedo); + battleDetails.Add(detail); + } + } + for (int i = 1; i < enemyTargets.Length; i++) + { + if (enemyTargets[i] > 0) + { + BattleDayDetail detail = new BattleDayDetail(i + 6, enemyTargets[i], new int[] { enemyTargetDam[i] }, new int[] { enemyCritical[i] }, (int)BattleDayDetail.DayCutinType.Torpedo); + battleDetails.Add(detail); + } + } + } } diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index dcfa0a696..a76128ae0 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -102,6 +102,7 @@ + @@ -735,7 +736,7 @@ False - Microsoft .NET Framework 4.5 %28x86 および x64%29 + Microsoft .NET Framework 4.5 %28x86 和 x64%29 true diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index ce5868898..328f82192 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -748,24 +748,83 @@ private void SetHPNormal( BattleData bd ) { } - for ( int i = 0; i < 6; i++ ) { - if ( initialHPs[i] != -1 ) { - ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; - - ToolTipInfo.SetToolTip( HPBars[i], - string.Format( "{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max( HPBars[i].PrevValue, 0 ), - Math.Max( HPBars[i].Value, 0 ), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState( (double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase ), - attackDamages[i] - ) - ); - } + for ( int i = 0; i < 6; i++ ) { + if (initialHPs[i] != -1) + { + ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; + if (bd is BattleDay) + { + List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i); + List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i); + List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); + List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); + List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipOpeningASWDetail.Count > 0) + { + builder.AppendLine("開幕対潜"); + builder.AppendLine(FriendShipBattleDetail(bd, shipOpeningASWDetail)); + } + if (shipOpeningTorpedoDetail.Count > 0) + { + builder.AppendLine("開幕雷撃"); + builder.AppendLine(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); + } + if (shipShelling1Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.AppendLine(FriendShipBattleDetail(bd, shipShelling1Detail)); + if (shipShelling2Detail.Count > 0) + { + builder.AppendLine(FriendShipBattleDetail(bd, shipShelling2Detail)); + } + } + if (shipTorpedoDetail.Count > 0) + { + builder.AppendLine("雷撃"); + builder.AppendLine(FriendShipBattleDetail(bd, shipTorpedoDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + + if (bd is BattleNight) + { + List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipNightBattleDetail.Count > 0) + { + builder.AppendLine("夜戦"); + builder.AppendLine(FriendShipBattleDetail(bd, shipNightBattleDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + } } for ( int i = 0; i < 6; i++ ) { @@ -1227,6 +1286,54 @@ protected override string GetPersistString() { return "Battle"; } + private string FriendShipBattleDetail(BattleData bd, IEnumerable details) + { + + StringBuilder builder = new StringBuilder(); + foreach (BattleDetail detail in details) + { + if (detail != null) + { + builder.AppendLine(string.Format(detail.BattleDescription(), GetShipName(bd, detail.Attacker), GetShipName(bd, detail.Defender))); + } + } + return builder.ToString(); + + } + + private string GetShipName(BattleData bd, int i) + { + int index = i; + if (index > -1 && index < 6) + { + return bd.Initial.FriendFleet.MembersInstance[index].Name; + } + else if (index >= 6 && index < 12) + { + index -= 6; + return bd.Initial.EnemyMembersInstance[index].NameWithClass; + } + else if (index >= 12 && index < 18) + { + index -= 12; + KCDatabase db = KCDatabase.Instance; + return db.Fleet[2].MembersInstance[index].Name; + } + return ""; + } + + private List SelectBattleDetail(List details, int index) + { + List results = new List(); + foreach (BattleDetail detail in details) + { + if (detail.Attacker.Equals(index) || detail.Defender.Equals(index)) + { + results.Add(detail); + } + } + return results; + } } From a2d82a7d53884d2beeb833d42170dc18b7f68cff Mon Sep 17 00:00:00 2001 From: Andante Date: Sun, 21 Aug 2016 19:58:36 +0900 Subject: [PATCH 10/20] =?UTF-8?q?=E3=83=9E=E3=83=BC=E3=82=B8=E3=83=9F?= =?UTF-8?q?=E3=82=B9=E4=BF=AE=E6=AD=A3=E3=81=A8=E5=BE=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 戦闘:演習時にエラーが出る不具合を修正 * 制空周りのコードを調整 --- ElectronicObserver/Utility/Data/Calculator.cs | 100 ++++++++---------- ElectronicObserver/Window/FormBattle.cs | 2 +- 2 files changed, 45 insertions(+), 57 deletions(-) diff --git a/ElectronicObserver/Utility/Data/Calculator.cs b/ElectronicObserver/Utility/Data/Calculator.cs index 30906669f..bb1489172 100644 --- a/ElectronicObserver/Utility/Data/Calculator.cs +++ b/ElectronicObserver/Utility/Data/Calculator.cs @@ -47,29 +47,46 @@ public static int GetParameterFromLevel( int min, int max, int lv ) { 0, 10, 25, 40, 55, 70, 85, 100, 120 }; + /// + /// 各装備カテゴリにおける制空値の改修ボーナス + /// + private static readonly Dictionary LevelBonus = new Dictionary() { + { 6, 0.2 }, // 艦上戦闘機 + { 7, 0.25 }, // 艦上爆撃機 + }; + + /// /// 制空戦力を求めます。 /// - /// 装備ID。 - /// 搭載機数。 - /// 艦載機熟練度。既定値は 0 です。 - public static int GetAirSuperiority( int slot, int aircraft, int level = 0 ) { - var eq = KCDatabase.Instance.MasterEquipments[slot]; - if ( eq == null || aircraft == 0 ) + /// 装備ID。 + /// 搭載機数。 + /// 艦載機熟練度。既定値は 0 です。 + /// 改修レベル。既定値は 0 です。 + /// + public static int GetAirSuperiority( int equipmentID, int count, int aircraftLevel = 0, int level = 0 ) { + + if ( count <= 0 ) + return 0; + + var eq = KCDatabase.Instance.MasterEquipments[equipmentID]; + if ( eq == null ) return 0; int category = eq.CategoryType; - if ( AircraftLevelBonus.ContainsKey( category ) ) { - return (int)( ( eq.AA + ( category == 48 ? ( eq.Evasion * 1.5 ) : 0 ) ) - * Math.Sqrt( aircraft ) - + Math.Sqrt( AircraftExpTable[level] / 10.0 ) - + AircraftLevelBonus[category][level] ); - } + if ( !AircraftLevelBonus.ContainsKey( category ) ) + return 0; - return 0; + double interceptorBonus = category == 48 ? ( eq.Evasion * 1.5 ) : 0; // 局地戦闘機の迎撃補正 + double levelBonus = LevelBonus.ContainsKey( category ) ? LevelBonus[category] : 0; // 改修レベル補正 + + + return (int)( ( eq.AA + levelBonus * level + interceptorBonus ) * Math.Sqrt( count ) + Math.Sqrt( AircraftExpTable[aircraftLevel] / 10.0 ) + AircraftLevelBonus[category][aircraftLevel] ); } + + /// /// 制空戦力を求めます。 /// @@ -80,6 +97,19 @@ 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(); + } + + /// /// 制空戦力を求めます。 /// @@ -110,18 +140,6 @@ public static int GetAirSuperiority( int[] fleet, int[][] slot ) { return air; } - /// - /// 制空戦力を求めます。 - /// - /// 各スロットの装備IDリスト。 - /// 艦載機搭載量。 - /// 各スロットの艦載機熟練度。 - /// - public static int GetAirSuperiority( int[] slot, int[] aircraft, int[] level ) { - - return slot.Select( ( eq, i ) => GetAirSuperiority( eq, aircraft[i], level[i] ) ).Sum(); - } - /// @@ -132,37 +150,7 @@ public static int GetAirSuperiority( ShipData ship ) { if ( ship == null ) return 0; - int air = 0; - var eqs = ship.SlotInstance; - var aircrafts = ship.Aircraft; - - - for ( int i = 0; i < eqs.Count; i++ ) { - var eq = eqs[i]; - if ( eq != null && aircrafts[i] > 0 ) { - - int category = eq.MasterEquipment.CategoryType; - - if ( AircraftLevelBonus.ContainsKey( category ) ) { - - double levelRate; - switch ( category ) { - case 6: // 艦上戦闘機 - levelRate = 0.2; - break; - case 7: // 艦上爆撃機 - levelRate = 0.25; - break; - default: - levelRate = 0; - break; - } - - air += (int)( ( eq.MasterEquipment.AA + levelRate * eq.Level ) * Math.Sqrt( aircrafts[i] ) + Math.Sqrt( AircraftExpTable[eq.AircraftLevel] / 10.0 ) + AircraftLevelBonus[category][eq.AircraftLevel] ); - } - - } - } + return ship.SlotInstance.Select( ( eq, i ) => eq == null ? 0 : GetAirSuperiority( eq.EquipmentID, ship.Aircraft[i], eq.AircraftLevel, eq.Level ) ).Sum(); } /// diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index ce5868898..99190bf8a 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -292,7 +292,7 @@ private void ClearSearchingResult() { /// private void SetBaseAirAttack( PhaseBaseAirAttack pd ) { - if ( pd.IsAvailable ) { + if ( pd != null && pd.IsAvailable ) { Searching.Text = "基地航空隊"; Searching.ImageAlign = ContentAlignment.MiddleLeft; From ce6d0997f6d1a363db67cc0d639a79e57a69c40f Mon Sep 17 00:00:00 2001 From: xzk Date: Sun, 21 Aug 2016 22:22:31 +0800 Subject: [PATCH 11/20] Apply battle detail to combine fleet modify displaying text --- .../Data/Battle/BattleDetail.cs | 5 +- ElectronicObserver/Window/FormBattle.cs | 472 ++++++++++++++---- 2 files changed, 366 insertions(+), 111 deletions(-) diff --git a/ElectronicObserver/Data/Battle/BattleDetail.cs b/ElectronicObserver/Data/Battle/BattleDetail.cs index d6f53f8f3..a8714a1ef 100644 --- a/ElectronicObserver/Data/Battle/BattleDetail.cs +++ b/ElectronicObserver/Data/Battle/BattleDetail.cs @@ -23,13 +23,13 @@ public abstract class BattleDetail /// so return attacker - 1 /// The same as defender /// - public int Attacker { get { return attacker - 1; } } + public int Attacker { get { return attacker - 1; } set { attacker = value + 1; } } /// /// Though there mutiple defenders in API, but they are the same so it /// uses one defender /// - public int Defender { get { return defender - 1; } } + public int Defender { get { return defender - 1; } set { defender = value + 1; } } public enum CriticalType { Miss = 0, @@ -117,6 +117,7 @@ public override string BattleDescription() case CriticalType.Critical: builder.Append("Critical"); break; } } + builder.AppendLine(""); return builder.ToString(); } diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index 328f82192..662198101 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -748,82 +748,102 @@ private void SetHPNormal( BattleData bd ) { } - for ( int i = 0; i < 6; i++ ) { - if (initialHPs[i] != -1) - { - ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; - if (bd is BattleDay) - { - List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i); - List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i); - List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); - List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); - List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipOpeningASWDetail.Count > 0) - { - builder.AppendLine("開幕対潜"); - builder.AppendLine(FriendShipBattleDetail(bd, shipOpeningASWDetail)); - } - if (shipOpeningTorpedoDetail.Count > 0) - { - builder.AppendLine("開幕雷撃"); - builder.AppendLine(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); - } - if (shipShelling1Detail.Count > 0) - { - builder.AppendLine("砲撃戦"); - builder.AppendLine(FriendShipBattleDetail(bd, shipShelling1Detail)); - if (shipShelling2Detail.Count > 0) - { - builder.AppendLine(FriendShipBattleDetail(bd, shipShelling2Detail)); - } - } - if (shipTorpedoDetail.Count > 0) - { - builder.AppendLine("雷撃"); - builder.AppendLine(FriendShipBattleDetail(bd, shipTorpedoDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } - - if (bd is BattleNight) - { - List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipNightBattleDetail.Count > 0) - { - builder.AppendLine("夜戦"); - builder.AppendLine(FriendShipBattleDetail(bd, shipNightBattleDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } + for ( int i = 0; i < 6; i++ ) { + if (initialHPs[i] != -1) + { + ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; + if (bd is BattleDay) + { + List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i); + List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i); + List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); + List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); + List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i); + List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipOpeningASWDetail.Count > 0) + { + builder.AppendLine("開幕対潜"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); + } + if (shipOpeningTorpedoDetail.Count > 0) + { + builder.AppendLine("開幕雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); + } + if (shipShelling1Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); + if (shipShelling2Detail.Count > 0) + { + builder.AppendLine("砲撃戦 Phase2"); + builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); + } + if (shipShelling3Detail.Count > 0) + { + builder.Append(FriendShipBattleDetail(bd, shipShelling3Detail)); + } + } + if (shipTorpedoDetail.Count > 0) + { + builder.AppendLine("雷撃"); + builder.AppendLine(FriendShipBattleDetail(bd, shipTorpedoDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + + else if (bd is BattleNight) + { + List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipNightBattleDetail.Count > 0) + { + builder.AppendLine("夜戦"); + builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + else + { + ToolTipInfo.SetToolTip(HPBars[i], string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + )); + } } } @@ -892,19 +912,100 @@ private void SetHPCombined( BattleData bd ) { if ( initialHPs[i] != -1 ) { ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; bool isEscaped = bd.Initial.FriendFleet.EscapedShipList.Contains( ship.MasterID ); - - ToolTipInfo.SetToolTip( HPBars[i], - string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max( HPBars[i].PrevValue, 0 ), - Math.Max( HPBars[i].Value, 0 ), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState( (double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped ), - attackDamages[i] - ) - ); + if (bd is BattleCombinedWater) + { + List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); + List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipShelling1Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); + if (shipShelling2Detail.Count > 0) + { + builder.AppendLine("砲撃戦 Phase2"); + builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); + } + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + else if (bd is BattleCombinedNormalDay) + { + List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); + List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipShelling2Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); + if (shipShelling3Detail.Count > 0) + { + builder.AppendLine("砲撃戦 Phase2"); + builder.AppendLine(FriendShipBattleDetail(bd, shipShelling3Detail)); + } + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + else if (bd is BattleNight) + { + List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipNightBattleDetail.Count > 0) + { + builder.AppendLine("夜戦"); + builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + else + { + ToolTipInfo.SetToolTip(HPBars[i], string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i] + )); + } if ( isEscaped ) HPBars[i].BackColor = Color.Silver; else HPBars[i].BackColor = SystemColors.Control; @@ -933,19 +1034,172 @@ private void SetHPCombined( BattleData bd ) { if ( initialHPs[i + 12] != -1 ) { ShipData ship = db.Fleet[2].MembersInstance[i]; bool isEscaped = db.Fleet[2].EscapedShipList.Contains( ship.MasterID ); - - ToolTipInfo.SetToolTip( HPBars[i + 12], - string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max( HPBars[i + 12].PrevValue, 0 ), - Math.Max( HPBars[i + 12].Value, 0 ), - HPBars[i + 12].MaximumValue, - HPBars[i + 12].Value - HPBars[i + 12].PrevValue, - Constants.GetDamageState( (double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped ), - attackDamages[i + 12] - ) - ); + if (bd is BattleCombinedNormalDay) + { + //Format the index in api in a friendly form + foreach (BattleDetail detail in ((BattleDay)bd).OpeningASW.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).OpeningTorpedo.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).Shelling1.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).Torpedo.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i + 12); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i + 12].PrevValue, 0), + Math.Max(HPBars[i + 12].Value, 0), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i + 12] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipOpeningASWDetail.Count > 0) + { + builder.AppendLine("開幕対潜"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); + } + if (shipOpeningTorpedoDetail.Count > 0) + { + builder.AppendLine("開幕雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); + } + if (shipShelling1Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); + } + if (shipTorpedoDetail.Count > 0) + { + builder.AppendLine("雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipTorpedoDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); + } + else if (bd is BattleCombinedWater) + { + //Format the index in api in a friendly form + foreach (BattleDetail detail in ((BattleDay)bd).OpeningASW.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).OpeningTorpedo.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).Shelling3.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).Torpedo.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i + 12); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i + 12].PrevValue, 0), + Math.Max(HPBars[i + 12].Value, 0), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i + 12] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipOpeningASWDetail.Count > 0) + { + builder.AppendLine("開幕対潜"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); + } + if (shipOpeningTorpedoDetail.Count > 0) + { + builder.AppendLine("開幕雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); + } + if (shipShelling3Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling3Detail)); + } + if (shipTorpedoDetail.Count > 0) + { + builder.AppendLine("雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipTorpedoDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); + } + else if (bd is BattleNight) + { + + foreach (BattleDetail detail in ((BattleNight)bd).NightBattle.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i + 12); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i + 12].PrevValue, 0), + Math.Max(HPBars[i + 12].Value, 0), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i + 12] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipNightBattleDetail.Count > 0) + { + builder.AppendLine("夜戦"); + builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); + } + else + { + ToolTipInfo.SetToolTip(HPBars[i + 12], string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i + 12].PrevValue, 0), + Math.Max(HPBars[i + 12].Value, 0), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i + 12] + )); + } if ( isEscaped ) HPBars[i + 12].BackColor = Color.Silver; else HPBars[i + 12].BackColor = SystemColors.Control; @@ -1299,8 +1553,8 @@ private string FriendShipBattleDetail(BattleData bd, IEnumerable d } return builder.ToString(); - } - + } + private string GetShipName(BattleData bd, int i) { int index = i; @@ -1309,19 +1563,19 @@ private string GetShipName(BattleData bd, int i) return bd.Initial.FriendFleet.MembersInstance[index].Name; } else if (index >= 6 && index < 12) - { + { index -= 6; - return bd.Initial.EnemyMembersInstance[index].NameWithClass; + return bd.Initial.EnemyMembersInstance[index].NameWithClass + " #" + (index + 1).ToString(); } else if (index >= 12 && index < 18) - { + { index -= 12; KCDatabase db = KCDatabase.Instance; return db.Fleet[2].MembersInstance[index].Name; } return ""; - } - + } + private List SelectBattleDetail(List details, int index) { List results = new List(); From f3ab884388740aa5ee98532331b76565ec018c55 Mon Sep 17 00:00:00 2001 From: xzk Date: Sun, 21 Aug 2016 17:47:46 +0800 Subject: [PATCH 12/20] Add battle detail information of normal fleet in friend side Todo: Combined fleet --- .../Data/Battle/BattleDetail.cs | 176 ++++++++++++++++++ .../Data/Battle/Phase/PhaseBase.cs | 2 + .../Data/Battle/Phase/PhaseNightBattle.cs | 14 +- .../Data/Battle/Phase/PhaseShelling.cs | 8 +- .../Data/Battle/Phase/PhaseTorpedo.cs | 25 +++ ElectronicObserver/ElectronicObserver.csproj | 3 +- ElectronicObserver/Window/FormBattle.cs | 143 ++++++++++++-- 7 files changed, 348 insertions(+), 23 deletions(-) create mode 100644 ElectronicObserver/Data/Battle/BattleDetail.cs diff --git a/ElectronicObserver/Data/Battle/BattleDetail.cs b/ElectronicObserver/Data/Battle/BattleDetail.cs new file mode 100644 index 000000000..d6f53f8f3 --- /dev/null +++ b/ElectronicObserver/Data/Battle/BattleDetail.cs @@ -0,0 +1,176 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Battle +{ + /// + /// Save the battle detail information + /// + public abstract class BattleDetail + { + // Save id rather than ship name here + protected int attacker; + protected int defender; + public int[] damage; + public CriticalType[] critical; + + /// + /// The first id in battle data's id list is always -1 + /// Skip it automatically + /// so return attacker - 1 + /// The same as defender + /// + public int Attacker { get { return attacker - 1; } } + + /// + /// Though there mutiple defenders in API, but they are the same so it + /// uses one defender + /// + public int Defender { get { return defender - 1; } } + public enum CriticalType + { + Miss = 0, + Hit = 1, + Critical = 2, + Unknown = -1 + } + + public BattleDetail(int attackerId, int defenderId, int[] d, int[] c) + { + attacker = attackerId; + defender = defenderId; + damage = d; + List ct = new List(); + foreach (int i in c) + { + ct.Add((CriticalType)i); + } + critical = ct.ToArray(); + } + + /// + /// Because BattleDetail doesn't save ship's name + /// It can't return the final string of the description + /// So name it BattleDescription rether than ToString() + /// + /// Description with parameters + public virtual string BattleDescription() + { + return "Unsupported"; + } + } + + /// + /// Cutin types are different in day battle and night battle + /// + public class BattleDayDetail : BattleDetail + { + public enum DayCutinType + { + Normal = 0, + Laser = 1, + Double = 2, + Cutin_Main_Sub = 3, + Cutin_Main_Radar = 4, + Cutin_Main_Bomb = 5, + Cutin_Main_Main = 6, + + Torpedo = 10 + } + public DayCutinType dayCutin; + + public BattleDayDetail(int attackerId, int defenderId, int[] d, int[] c, int cutin) + : base(attackerId, defenderId, d, c) + { + dayCutin = (DayCutinType)cutin; + } + + public override string BattleDescription() + { + StringBuilder builder = new StringBuilder(); + builder.AppendLine("{0} → {1}"); + builder.Append("Attack Type : "); + switch (dayCutin) + { + case DayCutinType.Normal: builder.AppendLine("通常"); break; + case DayCutinType.Laser: builder.AppendLine("レーザー"); break; + case DayCutinType.Double: builder.AppendLine("連撃"); break; + case DayCutinType.Cutin_Main_Sub: builder.AppendLine("カットイン(主砲/副砲)"); break; + case DayCutinType.Cutin_Main_Radar: builder.AppendLine("カットイン(主砲/電探)"); break; + case DayCutinType.Cutin_Main_Bomb: builder.AppendLine("カットイン(主砲/徹甲)"); break; + case DayCutinType.Cutin_Main_Main: builder.AppendLine("カットイン(主砲/主砲)"); break; + case DayCutinType.Torpedo: builder.AppendLine("雷撃"); break; + } + builder.Append("Damage: "); + for (int i = 0; i < damage.Length; i++) + { + if (i > 0) builder.AppendLine("").Append(" "); + builder.Append(damage[i]); + builder.Append(" "); + switch (critical[i]) + { + case CriticalType.Miss: builder.Append("Miss"); break; + case CriticalType.Hit: builder.Append("Hit"); break; + case CriticalType.Critical: builder.Append("Critical"); break; + } + } + return builder.ToString(); + + } + } + + public class BattleNightDetail : BattleDetail + { + public enum NightCutin + { + Normal = 0, + Double = 1, + Cutin_Main_Tor = 2, + Cutin_Tor = 3, + Cutin_Main_Sub = 4, + Cutin_Main_Main = 5 + } + + public NightCutin nightCutin; + + public BattleNightDetail(int attackerId, int defenderId, int[] d, int[] c, int cutin) + : base(attackerId, defenderId, d, c) + { + nightCutin = (NightCutin)cutin; + } + + public override string BattleDescription() + { + StringBuilder builder = new StringBuilder(); + builder.AppendLine("{0} → {1}"); + builder.Append("Attack Type : "); + switch (nightCutin) + { + case NightCutin.Normal: builder.AppendLine("通常"); break; + case NightCutin.Double: builder.AppendLine("連撃"); break; + case NightCutin.Cutin_Main_Tor: builder.AppendLine("カットイン(主砲/魚雷)"); break; + case NightCutin.Cutin_Tor: builder.AppendLine("カットイン(魚雷/魚雷)"); break; + case NightCutin.Cutin_Main_Sub: builder.AppendLine("カットイン(主砲/副砲)"); break; + case NightCutin.Cutin_Main_Main: builder.AppendLine("カットイン(主砲/主砲)"); break; + } + builder.Append("Damage: "); + for (int i = 0; i < damage.Length; i++) + { + if (i > 0) builder.AppendLine("").Append(" "); + builder.Append(damage[i]); + builder.Append(" "); + switch (critical[i]) + { + case CriticalType.Miss: builder.Append("Miss"); break; + case CriticalType.Hit: builder.Append("Hit"); break; + case CriticalType.Critical: builder.Append("Critical"); break; + } + } + return builder.ToString(); + + } + } +} diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs b/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs index a902873ea..96ae70ac7 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs @@ -17,9 +17,11 @@ public abstract class PhaseBase { public PhaseBase( BattleData data ) { _battleData = data; + battleDetails = new List(); } + public List battleDetails; protected dynamic RawData { get { return _battleData.RawData; } } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs b/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs index b1d0b08ac..0c59e1b42 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs @@ -37,14 +37,22 @@ public override void EmulateBattle( int[] hps, int[] damages ) { int[] defenders = (int[])( ShellingData.api_df_list[i] ); int[] unitDamages = (int[])( ShellingData.api_damage[i] ); + int tempDefender = -1; for ( int j = 0; j < defenders.Length; j++ ) { - if ( defenders[j] != -1 ) - tempDamages[GetIndex( defenders[j] )] += Math.Max( unitDamages[j], 0 ); + if (defenders[j] != -1) + { + tempDamages[GetIndex(defenders[j])] += Math.Max(unitDamages[j], 0); + if (tempDefender != defenders[j]) tempDefender = defenders[j]; + } } for ( int j = 0; j < tempDamages.Length; j++ ) - AddDamage( hps, j, tempDamages[j] ); + AddDamage( hps, j, tempDamages[j] ); + + + BattleNightDetail detail = new BattleNightDetail(attackers[i], tempDefender, unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_sp_list[i]); + battleDetails.Add(detail); damages[GetIndex( attackers[i] )] += tempDamages.Sum(); } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs b/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs index 401ab1216..afd5cf676 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs @@ -46,15 +46,21 @@ public override void EmulateBattle( int[] hps, int[] damages ) { int[] defenders = (int[])( ShellingData.api_df_list[i] ); int[] unitDamages = (int[])( ShellingData.api_damage[i] ); + int tempDefender = -1; for ( int j = 0; j < defenders.Length; j++ ) { - if ( defenders[j] != -1 ) + if ( defenders[j] != -1 ) { tempDamages[GetIndex( defenders[j] )] += Math.Max( unitDamages[j], 0 ); + if(tempDefender != defenders[j]) tempDefender = defenders[j]; + } } for ( int j = 0; j < tempDamages.Length; j++ ) AddDamage( hps, j, tempDamages[j] ); + BattleDayDetail detail = new BattleDayDetail(attackers[i], tempDefender, unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_at_type[i]); + battleDetails.Add(detail); + damages[GetIndex( attackers[i] )] += tempDamages.Sum(); } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs b/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs index 23e5bf872..ff1f0a20e 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs @@ -34,6 +34,7 @@ public override bool IsAvailable { } } + public dynamic ShellingData { get { return phaseID ==0 ? RawData.api_opening_atack : RawData.api_raigeki; } } public override void EmulateBattle( int[] hps, int[] damages ) { if ( !IsAvailable ) return; @@ -49,6 +50,30 @@ public override void EmulateBattle( int[] hps, int[] damages ) { damages[i] += dmg[i]; } } + { + int[] friendTargets = (int[])ShellingData.api_frai; + int[] enemyTargets = (int[])ShellingData.api_erai; + int[] friendTargetDams = (int[])ShellingData.api_fydam; + int[] enemyTargetDam = (int[])ShellingData.api_eydam; + int[] friendCritical = (int[])ShellingData.api_fcl; + int[] enemyCritical = (int[])ShellingData.api_ecl; + for (int i = 1; i < friendTargets.Length; i++) + { //skip header(-1) + if (friendTargets[i] > 0) + { + BattleDayDetail detail = new BattleDayDetail(i, friendTargets[i] + 6, new int[] { friendTargetDams[i] }, new int[] { friendCritical[i] }, (int) BattleDayDetail.DayCutinType.Torpedo); + battleDetails.Add(detail); + } + } + for (int i = 1; i < enemyTargets.Length; i++) + { + if (enemyTargets[i] > 0) + { + BattleDayDetail detail = new BattleDayDetail(i + 6, enemyTargets[i], new int[] { enemyTargetDam[i] }, new int[] { enemyCritical[i] }, (int)BattleDayDetail.DayCutinType.Torpedo); + battleDetails.Add(detail); + } + } + } } diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index dcfa0a696..a76128ae0 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -102,6 +102,7 @@ + @@ -735,7 +736,7 @@ False - Microsoft .NET Framework 4.5 %28x86 および x64%29 + Microsoft .NET Framework 4.5 %28x86 和 x64%29 true diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index 58953056b..f12beef0c 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -687,24 +687,83 @@ private void SetHPNormal( BattleData bd ) { } - for ( int i = 0; i < 6; i++ ) { - if ( initialHPs[i] != -1 ) { - ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; - - ToolTipInfo.SetToolTip( HPBars[i], - string.Format( "{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max( HPBars[i].PrevValue, 0 ), - Math.Max( HPBars[i].Value, 0 ), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState( (double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase ), - attackDamages[i] - ) - ); - } + for ( int i = 0; i < 6; i++ ) { + if (initialHPs[i] != -1) + { + ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; + if (bd is BattleDay) + { + List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i); + List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i); + List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); + List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); + List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipOpeningASWDetail.Count > 0) + { + builder.AppendLine("開幕対潜"); + builder.AppendLine(FriendShipBattleDetail(bd, shipOpeningASWDetail)); + } + if (shipOpeningTorpedoDetail.Count > 0) + { + builder.AppendLine("開幕雷撃"); + builder.AppendLine(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); + } + if (shipShelling1Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.AppendLine(FriendShipBattleDetail(bd, shipShelling1Detail)); + if (shipShelling2Detail.Count > 0) + { + builder.AppendLine(FriendShipBattleDetail(bd, shipShelling2Detail)); + } + } + if (shipTorpedoDetail.Count > 0) + { + builder.AppendLine("雷撃"); + builder.AppendLine(FriendShipBattleDetail(bd, shipTorpedoDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + + if (bd is BattleNight) + { + List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipNightBattleDetail.Count > 0) + { + builder.AppendLine("夜戦"); + builder.AppendLine(FriendShipBattleDetail(bd, shipNightBattleDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + } } for ( int i = 0; i < 6; i++ ) { @@ -1166,6 +1225,54 @@ protected override string GetPersistString() { return "Battle"; } + private string FriendShipBattleDetail(BattleData bd, IEnumerable details) + { + + StringBuilder builder = new StringBuilder(); + foreach (BattleDetail detail in details) + { + if (detail != null) + { + builder.AppendLine(string.Format(detail.BattleDescription(), GetShipName(bd, detail.Attacker), GetShipName(bd, detail.Defender))); + } + } + return builder.ToString(); + + } + + private string GetShipName(BattleData bd, int i) + { + int index = i; + if (index > -1 && index < 6) + { + return bd.Initial.FriendFleet.MembersInstance[index].Name; + } + else if (index >= 6 && index < 12) + { + index -= 6; + return bd.Initial.EnemyMembersInstance[index].NameWithClass; + } + else if (index >= 12 && index < 18) + { + index -= 12; + KCDatabase db = KCDatabase.Instance; + return db.Fleet[2].MembersInstance[index].Name; + } + return ""; + } + + private List SelectBattleDetail(List details, int index) + { + List results = new List(); + foreach (BattleDetail detail in details) + { + if (detail.Attacker.Equals(index) || detail.Defender.Equals(index)) + { + results.Add(detail); + } + } + return results; + } } From ec22fa971a14b7973c982189e01b42ab9a341172 Mon Sep 17 00:00:00 2001 From: xzk Date: Sun, 21 Aug 2016 22:22:31 +0800 Subject: [PATCH 13/20] Apply battle detail to combine fleet modify displaying text --- .../Data/Battle/BattleDetail.cs | 5 +- ElectronicObserver/Window/FormBattle.cs | 472 ++++++++++++++---- 2 files changed, 366 insertions(+), 111 deletions(-) diff --git a/ElectronicObserver/Data/Battle/BattleDetail.cs b/ElectronicObserver/Data/Battle/BattleDetail.cs index d6f53f8f3..a8714a1ef 100644 --- a/ElectronicObserver/Data/Battle/BattleDetail.cs +++ b/ElectronicObserver/Data/Battle/BattleDetail.cs @@ -23,13 +23,13 @@ public abstract class BattleDetail /// so return attacker - 1 /// The same as defender /// - public int Attacker { get { return attacker - 1; } } + public int Attacker { get { return attacker - 1; } set { attacker = value + 1; } } /// /// Though there mutiple defenders in API, but they are the same so it /// uses one defender /// - public int Defender { get { return defender - 1; } } + public int Defender { get { return defender - 1; } set { defender = value + 1; } } public enum CriticalType { Miss = 0, @@ -117,6 +117,7 @@ public override string BattleDescription() case CriticalType.Critical: builder.Append("Critical"); break; } } + builder.AppendLine(""); return builder.ToString(); } diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index f12beef0c..0a2d7b584 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -687,82 +687,102 @@ private void SetHPNormal( BattleData bd ) { } - for ( int i = 0; i < 6; i++ ) { - if (initialHPs[i] != -1) - { - ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; - if (bd is BattleDay) - { - List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i); - List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i); - List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); - List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); - List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipOpeningASWDetail.Count > 0) - { - builder.AppendLine("開幕対潜"); - builder.AppendLine(FriendShipBattleDetail(bd, shipOpeningASWDetail)); - } - if (shipOpeningTorpedoDetail.Count > 0) - { - builder.AppendLine("開幕雷撃"); - builder.AppendLine(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); - } - if (shipShelling1Detail.Count > 0) - { - builder.AppendLine("砲撃戦"); - builder.AppendLine(FriendShipBattleDetail(bd, shipShelling1Detail)); - if (shipShelling2Detail.Count > 0) - { - builder.AppendLine(FriendShipBattleDetail(bd, shipShelling2Detail)); - } - } - if (shipTorpedoDetail.Count > 0) - { - builder.AppendLine("雷撃"); - builder.AppendLine(FriendShipBattleDetail(bd, shipTorpedoDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } - - if (bd is BattleNight) - { - List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipNightBattleDetail.Count > 0) - { - builder.AppendLine("夜戦"); - builder.AppendLine(FriendShipBattleDetail(bd, shipNightBattleDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } + for ( int i = 0; i < 6; i++ ) { + if (initialHPs[i] != -1) + { + ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; + if (bd is BattleDay) + { + List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i); + List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i); + List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); + List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); + List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i); + List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipOpeningASWDetail.Count > 0) + { + builder.AppendLine("開幕対潜"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); + } + if (shipOpeningTorpedoDetail.Count > 0) + { + builder.AppendLine("開幕雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); + } + if (shipShelling1Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); + if (shipShelling2Detail.Count > 0) + { + builder.AppendLine("砲撃戦 Phase2"); + builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); + } + if (shipShelling3Detail.Count > 0) + { + builder.Append(FriendShipBattleDetail(bd, shipShelling3Detail)); + } + } + if (shipTorpedoDetail.Count > 0) + { + builder.AppendLine("雷撃"); + builder.AppendLine(FriendShipBattleDetail(bd, shipTorpedoDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + + else if (bd is BattleNight) + { + List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipNightBattleDetail.Count > 0) + { + builder.AppendLine("夜戦"); + builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + else + { + ToolTipInfo.SetToolTip(HPBars[i], string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), + attackDamages[i] + )); + } } } @@ -831,19 +851,100 @@ private void SetHPCombined( BattleData bd ) { if ( initialHPs[i] != -1 ) { ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; bool isEscaped = bd.Initial.FriendFleet.EscapedShipList.Contains( ship.MasterID ); - - ToolTipInfo.SetToolTip( HPBars[i], - string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max( HPBars[i].PrevValue, 0 ), - Math.Max( HPBars[i].Value, 0 ), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState( (double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped ), - attackDamages[i] - ) - ); + if (bd is BattleCombinedWater) + { + List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); + List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipShelling1Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); + if (shipShelling2Detail.Count > 0) + { + builder.AppendLine("砲撃戦 Phase2"); + builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); + } + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + else if (bd is BattleCombinedNormalDay) + { + List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); + List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipShelling2Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); + if (shipShelling3Detail.Count > 0) + { + builder.AppendLine("砲撃戦 Phase2"); + builder.AppendLine(FriendShipBattleDetail(bd, shipShelling3Detail)); + } + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + else if (bd is BattleNight) + { + List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipNightBattleDetail.Count > 0) + { + builder.AppendLine("夜戦"); + builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); + } + else + { + ToolTipInfo.SetToolTip(HPBars[i], string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i].PrevValue, 0), + Math.Max(HPBars[i].Value, 0), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i] + )); + } if ( isEscaped ) HPBars[i].BackColor = Color.Silver; else HPBars[i].BackColor = SystemColors.Control; @@ -872,19 +973,172 @@ private void SetHPCombined( BattleData bd ) { if ( initialHPs[i + 12] != -1 ) { ShipData ship = db.Fleet[2].MembersInstance[i]; bool isEscaped = db.Fleet[2].EscapedShipList.Contains( ship.MasterID ); - - ToolTipInfo.SetToolTip( HPBars[i + 12], - string.Format( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max( HPBars[i + 12].PrevValue, 0 ), - Math.Max( HPBars[i + 12].Value, 0 ), - HPBars[i + 12].MaximumValue, - HPBars[i + 12].Value - HPBars[i + 12].PrevValue, - Constants.GetDamageState( (double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped ), - attackDamages[i + 12] - ) - ); + if (bd is BattleCombinedNormalDay) + { + //Format the index in api in a friendly form + foreach (BattleDetail detail in ((BattleDay)bd).OpeningASW.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).OpeningTorpedo.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).Shelling1.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).Torpedo.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i + 12); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i + 12].PrevValue, 0), + Math.Max(HPBars[i + 12].Value, 0), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i + 12] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipOpeningASWDetail.Count > 0) + { + builder.AppendLine("開幕対潜"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); + } + if (shipOpeningTorpedoDetail.Count > 0) + { + builder.AppendLine("開幕雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); + } + if (shipShelling1Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); + } + if (shipTorpedoDetail.Count > 0) + { + builder.AppendLine("雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipTorpedoDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); + } + else if (bd is BattleCombinedWater) + { + //Format the index in api in a friendly form + foreach (BattleDetail detail in ((BattleDay)bd).OpeningASW.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).OpeningTorpedo.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).Shelling3.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i + 12); + foreach (BattleDetail detail in ((BattleDay)bd).Torpedo.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i + 12); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i + 12].PrevValue, 0), + Math.Max(HPBars[i + 12].Value, 0), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i + 12] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipOpeningASWDetail.Count > 0) + { + builder.AppendLine("開幕対潜"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); + } + if (shipOpeningTorpedoDetail.Count > 0) + { + builder.AppendLine("開幕雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); + } + if (shipShelling3Detail.Count > 0) + { + builder.AppendLine("砲撃戦"); + builder.Append(FriendShipBattleDetail(bd, shipShelling3Detail)); + } + if (shipTorpedoDetail.Count > 0) + { + builder.AppendLine("雷撃"); + builder.Append(FriendShipBattleDetail(bd, shipTorpedoDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); + } + else if (bd is BattleNight) + { + + foreach (BattleDetail detail in ((BattleNight)bd).NightBattle.battleDetails) + { + if (detail.Attacker < 6) detail.Attacker += 12; + if (detail.Defender < 6) detail.Defender += 12; + } + List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i + 12); + + StringBuilder builder = new StringBuilder(); + string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i + 12].PrevValue, 0), + Math.Max(HPBars[i + 12].Value, 0), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i + 12] + ); + builder.AppendLine(sum).AppendLine(""); + if (shipNightBattleDetail.Count > 0) + { + builder.AppendLine("夜戦"); + builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); + } + ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); + } + else + { + ToolTipInfo.SetToolTip(HPBars[i + 12], string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max(HPBars[i + 12].PrevValue, 0), + Math.Max(HPBars[i + 12].Value, 0), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), + attackDamages[i + 12] + )); + } if ( isEscaped ) HPBars[i + 12].BackColor = Color.Silver; else HPBars[i + 12].BackColor = SystemColors.Control; @@ -1238,8 +1492,8 @@ private string FriendShipBattleDetail(BattleData bd, IEnumerable d } return builder.ToString(); - } - + } + private string GetShipName(BattleData bd, int i) { int index = i; @@ -1248,19 +1502,19 @@ private string GetShipName(BattleData bd, int i) return bd.Initial.FriendFleet.MembersInstance[index].Name; } else if (index >= 6 && index < 12) - { + { index -= 6; - return bd.Initial.EnemyMembersInstance[index].NameWithClass; + return bd.Initial.EnemyMembersInstance[index].NameWithClass + " #" + (index + 1).ToString(); } else if (index >= 12 && index < 18) - { + { index -= 12; KCDatabase db = KCDatabase.Instance; return db.Fleet[2].MembersInstance[index].Name; } return ""; - } - + } + private List SelectBattleDetail(List details, int index) { List results = new List(); From adb15c632dde19ff5eb8c642efc2fc06da591c87 Mon Sep 17 00:00:00 2001 From: Andante Date: Mon, 22 Aug 2016 11:50:32 +0900 Subject: [PATCH 14/20] =?UTF-8?q?=E5=9F=BA=E5=9C=B0=E8=88=AA=E7=A9=BA?= =?UTF-8?q?=E9=9A=8A=EF=BC=9A=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=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 --- ElectronicObserver/Assets.zip | Bin 174324 -> 174742 bytes .../Assets/Form/BaseAirCorps.png | Bin 0 -> 257 bytes .../Resource/ResourceManager.cs | 2 ++ ElectronicObserver/Window/FormBaseAirCorps.cs | 9 +++------ ElectronicObserver/Window/FormMain.cs | 1 + 5 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 ElectronicObserver/Assets/Form/BaseAirCorps.png diff --git a/ElectronicObserver/Assets.zip b/ElectronicObserver/Assets.zip index 6681e26827744fc2d2d000c728592c7c5355527c..eb3382c529399d0efc06f06f6ab01006321b1fdd 100644 GIT binary patch delta 1404 zcmYk5c}x^{6vt=2Bb6eoP?tkkvm6p6#Uf~WnHoVOMG8`2IV@F9(Fg(AYR{yxg19K> z01riOP}(#qkQ5tf2(983thCiYsYY7cdIc+JJ+?^S>@2N+z4v+d{N9`ULv}Tn?2ef` zrIaS;?x&rTvt)CgqfRFXLWt3r`JORwO>TZpU}&l_Gh|Ets@(iMqg)Z`C&z9Zql^N) z&@J_}%#&V?bnfmrw>@MQE8*m2FD|lZJ(2dJO}s@dicb@J;?t1rsWhTfpW&5xD-yKT zb><;)M&2(Er=Vgu%l=)Op5R>w7M$z~7h1E=L91Fn><=(o;L?;d1h*ExCX*##74 z!V={v=pz$6@cnrr6TCJ3?|(J8nr92hP$Zo;VHutqq$v~9vGxL`6(a+>Av#lxOzinV z&KuHG)Lt$={UbH(#TMjVqUZM^2mf5Aw@ctcrTY*izC_U_aFqitJCIny!8yZ%gQx;&5N?uF73Ptql8u2D&{BRSV)5xM z#iOOsN+jX>Z41cPZq1>{9B!T}BUB6`$0}a+;ybp~FLQqKxDvG)NAIddORIPS%{>*& zRa~cR!UA&fJqOxR%_-+6RqseO;^6f_h0q#a-dlgG@MR6+QS(p*S3&}AJW^qo0_&cr zaF@7zpPAOyVgqiQ>5E!Ela*6)>XerJ_Vf3A_>}eeRK1_O4oq9@kJ&EG5k*>efP=3} zbo>C{T7V6C)-g}aR-~5d>o~jHjwb4mDZyT(+jio7G9JVd^;a3%2>0|b2XW?Si^)vS z&Cdw56Fm9g`Q!yRpx@Zh2t9U($5XgSJOP=32S!`Pv-20=)SgWxSJ zwB!qxIz|VPlI=ww_h-v)>Qc{Am6Tc!7j>kM>*0=1(uwM^RO6z3wmA*g^YNbaBuxWS zFyTpg4ZN`n-t=<=wo1bbLH$0MPpOUkOyPdi*~l08nm_59kRoOIgQ6EfPYq4%of}Hy zP5ju)LuqFlr(`v=G0zGYoB4u2U#)r=Z0P7J%%<2Dj=8x;HTSk)BbJ8$2e!1Ll^0(W zp<0f#atX&M6@1&U9&OPI?7(1*BK73f4ukYK4zx3g`x#(_yai@EvR9iVh@7E8n$JR|l49x`Zy_dW0Yx+yLIs EzX78I2mk;8 delta 1277 zcmY+DdrXye7{}lDdw}qCKoB9ovL6T1cb4JA-W|3hu2{`lsEw#X)wmQtMs^**4nx z*OZ$qx8^2ev$tA<_dh|Pqqly~#m}ZJvSwRf*oQb-E$qe9pJD-@*^g*kYh}THyoL5Q z#nA3SClf-kubqh|Y(ZHE2TjO;|F=q3=TbhK0|PU%@e&fxC{1VG*q4n^p2~(ZpUS~T zcy%dTyN#^R5hY5xc{c~CIQ<G^n6h;(n3qVxLfZqS02D7Jof_|4+#GLJU=Rc z8v_c&=~GsCM-F0E0UlAzBldJI6ne@C-zY>p3P$)%p-8^+6Q3+X8cdgz3!}dLutYqt zt4KVs?Po>*i;;fCBFS}(?-wHzJ(oFAEKZ8J!uS$w!;Y)$FF`tHe`Sz@B=lXQg>Ye$ zB9f*xP!h)N=y6a8A>&rB^7(ZGvsIz#x)y%pAmT7{L-Qt1%wzH);q{x)yxoToglecB0`0FKaN&U%^yEL77)0lJBB5Rg~RdDlBS7UqB<+`3I zNs5Vtv_yK$8ZTM%UNp!oa*&sDyb1=tkRUDpYhTRN`*KF)}v zV%Ti`*l`qzSnfyf8f?X-l`N_e?R_Yif7Xc3Js-@WV`4YoJ0?EH&Q&U8>b_VFc80^9 z3AK1#_h8K&d98sx$7&I!i&!@&g&#+}Zgl;BWXrzeB4B%%ReFLUb)w~E8?5BTwmLBk zT@iGy7gwCNT2E#*z>XF5h`@#@)ib9!H3+38`d=j$h8PX*G>C~ziPc~r4vuWxD|YDP j6Jm$X#%c1{2@zw6*C6sFRya0G&CT)29v%n*= zn1O*?7=#%aX3dcR3bL1Y`ns||V3FifGkN>x?*^bypQnpsh{frnle`5FDDb$L&*gGt z5}FXe>ER5d8d|J8`E`wbezI0&=ovKDa!NN${m^x}?6=ZB#<-8xnxf1Mru_Yrs}2b% z?1*W;JjLSuDua!xayF@N9C>42E_q+WcJW%lyxU9LGP8d~GKw=W2&%iR&B%_34t}zj vo7;Y)W$S*1M}<$+j-@Q(Hi Date: Wed, 24 Aug 2016 20:32:05 +0900 Subject: [PATCH 15/20] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0=E3=81=9D=E3=81=AE=E4=BB=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * BattleDetail のシステムを変更 * 艦船データを直接保持するように(攻撃種別の詳細化が可能に) * BattleDescription は重複が多いため基底クラスへ移動、差分を派生クラスで補うように * CutinType 列挙体を廃止(Constants.GetDay/NightAttackKind() を利用するため) * ツールチップフォーマットの変更 * なるべくコンパクトになるように変更 * 攻撃種別を詳細化、表記を統一 * 連合艦隊長距離空襲戦および連合艦隊航空戦において、例外が出る不具合を修正 * 連合艦隊開幕夜戦において、第一艦隊側にも戦況が表示されてしまう不具合を修正 * FormBattle: 冗長な部分を統合 * ついでに攻撃種別判定の強化 * ついでに演習時のエラーを修正 --- .../Data/Battle/BattleDetail.cs | 343 +++++----- .../Data/Battle/Phase/PhaseBase.cs | 4 +- .../Data/Battle/Phase/PhaseNightBattle.cs | 334 +++++----- .../Data/Battle/Phase/PhaseOpeningASW.cs | 2 +- .../Data/Battle/Phase/PhaseShelling.cs | 8 +- .../Data/Battle/Phase/PhaseTorpedo.cs | 229 ++++--- ElectronicObserver/Data/Constants.cs | 8 + ElectronicObserver/Utility/Data/Calculator.cs | 111 +++- ElectronicObserver/Window/FormBattle.cs | 620 ++++++------------ 9 files changed, 757 insertions(+), 902 deletions(-) diff --git a/ElectronicObserver/Data/Battle/BattleDetail.cs b/ElectronicObserver/Data/Battle/BattleDetail.cs index a8714a1ef..f197e3ce1 100644 --- a/ElectronicObserver/Data/Battle/BattleDetail.cs +++ b/ElectronicObserver/Data/Battle/BattleDetail.cs @@ -1,177 +1,178 @@ -using System; +using ElectronicObserver.Utility.Data; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace ElectronicObserver.Data.Battle -{ - /// - /// Save the battle detail information - /// - public abstract class BattleDetail - { - // Save id rather than ship name here - protected int attacker; - protected int defender; - public int[] damage; - public CriticalType[] critical; - - /// - /// The first id in battle data's id list is always -1 - /// Skip it automatically - /// so return attacker - 1 - /// The same as defender - /// - public int Attacker { get { return attacker - 1; } set { attacker = value + 1; } } - - /// - /// Though there mutiple defenders in API, but they are the same so it - /// uses one defender - /// - public int Defender { get { return defender - 1; } set { defender = value + 1; } } - public enum CriticalType - { - Miss = 0, - Hit = 1, - Critical = 2, - Unknown = -1 - } - - public BattleDetail(int attackerId, int defenderId, int[] d, int[] c) - { - attacker = attackerId; - defender = defenderId; - damage = d; - List ct = new List(); - foreach (int i in c) - { - ct.Add((CriticalType)i); - } - critical = ct.ToArray(); - } - - /// - /// Because BattleDetail doesn't save ship's name - /// It can't return the final string of the description - /// So name it BattleDescription rether than ToString() - /// - /// Description with parameters - public virtual string BattleDescription() - { - return "Unsupported"; - } - } - - /// - /// Cutin types are different in day battle and night battle - /// - public class BattleDayDetail : BattleDetail - { - public enum DayCutinType - { - Normal = 0, - Laser = 1, - Double = 2, - Cutin_Main_Sub = 3, - Cutin_Main_Radar = 4, - Cutin_Main_Bomb = 5, - Cutin_Main_Main = 6, - - Torpedo = 10 - } - public DayCutinType dayCutin; - - public BattleDayDetail(int attackerId, int defenderId, int[] d, int[] c, int cutin) - : base(attackerId, defenderId, d, c) - { - dayCutin = (DayCutinType)cutin; - } - - public override string BattleDescription() - { - StringBuilder builder = new StringBuilder(); - builder.AppendLine("{0} → {1}"); - builder.Append("Attack Type : "); - switch (dayCutin) - { - case DayCutinType.Normal: builder.AppendLine("通常"); break; - case DayCutinType.Laser: builder.AppendLine("レーザー"); break; - case DayCutinType.Double: builder.AppendLine("連撃"); break; - case DayCutinType.Cutin_Main_Sub: builder.AppendLine("カットイン(主砲/副砲)"); break; - case DayCutinType.Cutin_Main_Radar: builder.AppendLine("カットイン(主砲/電探)"); break; - case DayCutinType.Cutin_Main_Bomb: builder.AppendLine("カットイン(主砲/徹甲)"); break; - case DayCutinType.Cutin_Main_Main: builder.AppendLine("カットイン(主砲/主砲)"); break; - case DayCutinType.Torpedo: builder.AppendLine("雷撃"); break; - } - builder.Append("Damage: "); - for (int i = 0; i < damage.Length; i++) - { - if (i > 0) builder.AppendLine("").Append(" "); - builder.Append(damage[i]); - builder.Append(" "); - switch (critical[i]) - { - case CriticalType.Miss: builder.Append("Miss"); break; - case CriticalType.Hit: builder.Append("Hit"); break; - case CriticalType.Critical: builder.Append("Critical"); break; - } - } - builder.AppendLine(""); - return builder.ToString(); - - } - } - - public class BattleNightDetail : BattleDetail - { - public enum NightCutin - { - Normal = 0, - Double = 1, - Cutin_Main_Tor = 2, - Cutin_Tor = 3, - Cutin_Main_Sub = 4, - Cutin_Main_Main = 5 - } - - public NightCutin nightCutin; - - public BattleNightDetail(int attackerId, int defenderId, int[] d, int[] c, int cutin) - : base(attackerId, defenderId, d, c) - { - nightCutin = (NightCutin)cutin; - } - - public override string BattleDescription() - { - StringBuilder builder = new StringBuilder(); - builder.AppendLine("{0} → {1}"); - builder.Append("Attack Type : "); - switch (nightCutin) - { - case NightCutin.Normal: builder.AppendLine("通常"); break; - case NightCutin.Double: builder.AppendLine("連撃"); break; - case NightCutin.Cutin_Main_Tor: builder.AppendLine("カットイン(主砲/魚雷)"); break; - case NightCutin.Cutin_Tor: builder.AppendLine("カットイン(魚雷/魚雷)"); break; - case NightCutin.Cutin_Main_Sub: builder.AppendLine("カットイン(主砲/副砲)"); break; - case NightCutin.Cutin_Main_Main: builder.AppendLine("カットイン(主砲/主砲)"); break; - } - builder.Append("Damage: "); - for (int i = 0; i < damage.Length; i++) - { - if (i > 0) builder.AppendLine("").Append(" "); - builder.Append(damage[i]); - builder.Append(" "); - switch (critical[i]) - { - case CriticalType.Miss: builder.Append("Miss"); break; - case CriticalType.Hit: builder.Append("Hit"); break; - case CriticalType.Critical: builder.Append("Critical"); break; - } - } - return builder.ToString(); - - } - } +namespace ElectronicObserver.Data.Battle { + /// + /// 戦闘詳細のデータを保持します。 + /// + public abstract class BattleDetail { + + protected int attackerIndex; + protected int defenderIndex; + public int[] Damages { get; protected set; } + public CriticalType[] CriticalTypes { get; protected set; } + public int AttackType { get; protected set; } + + public ShipDataMaster Attacker { get; protected set; } + public ShipDataMaster Defender { get; protected set; } + + + /// + /// The first id in battle data's id list is always -1 + /// Skip it automatically + /// so return attacker - 1 + /// The same as defender + /// + public int AttackerIndex { get { return attackerIndex - 1; } set { attackerIndex = value + 1; } } + + /// + /// Though there mutiple defenders in API, but they are the same so it + /// uses one defender + /// + public int DefenderIndex { get { return defenderIndex - 1; } set { defenderIndex = value + 1; } } + + + public enum CriticalType { + Miss = 0, + Hit = 1, + Critical = 2, + Unknown = -1 + } + + + /// 戦闘情報。 + /// 攻撃側のインデックス。 1-18 + /// 防御側のインデックス。 1-18 + /// ダメージの配列。 + /// 命中判定の配列。 + /// 攻撃種別。 + public BattleDetail( BattleData bd, int attackerIndex, int defenderIndex, int[] damages, int[] criticalTypes, int attackType ) { + + this.attackerIndex = attackerIndex; + this.defenderIndex = defenderIndex; + Damages = damages; + CriticalTypes = criticalTypes.Select( i => (CriticalType)i ).ToArray(); + AttackType = attackType; + + + int[] slots; + + if ( AttackerIndex < 6 ) { + var atk = bd.Initial.FriendFleet.MembersInstance[AttackerIndex]; + Attacker = atk.MasterShip; + slots = atk.SlotMaster.ToArray(); + + } else if ( AttackerIndex < 12 ) { + Attacker = bd.Initial.EnemyMembersInstance[AttackerIndex - 6]; + slots = bd.Initial.EnemySlots[AttackerIndex - 6]; + + } else { + var atk = KCDatabase.Instance.Fleet[2].MembersInstance[AttackerIndex - 12]; + Attacker = atk.MasterShip; + slots = atk.SlotMaster.ToArray(); + } + + + if ( DefenderIndex < 6 ) + Defender = bd.Initial.FriendFleet.MembersInstance[DefenderIndex].MasterShip; + else if ( DefenderIndex < 12 ) + Defender = bd.Initial.EnemyMembersInstance[DefenderIndex - 6]; + else + Defender = KCDatabase.Instance.Fleet[2].MembersInstance[DefenderIndex - 12].MasterShip; + + + if ( AttackType == 0 ) { + AttackType = CaclulateAttackKind( slots, Attacker.ShipID, Defender.ShipID ); + } + + } + + /// + /// 戦闘詳細の情報を出力します。 + /// + public virtual string BattleDescription() { + + StringBuilder builder = new StringBuilder(); + builder.Append( Attacker.NameWithClass ); + if ( 6 <= AttackerIndex && AttackerIndex < 12 ) + builder.Append( " #" ).Append( AttackerIndex - 6 + 1 ); + + builder.Append( " → " ).Append( Defender.NameWithClass ); + if ( 6 <= DefenderIndex && DefenderIndex < 12 ) + builder.Append( " #" ).Append( DefenderIndex - 6 + 1 ); + + builder.AppendLine(); + + if ( AttackType >= 0 ) + builder.Append( "[" ).Append( GetAttackKind() ).Append( "] " ); + + for ( int i = 0; i < Damages.Length; i++ ) { + if ( i > 0 ) + builder.Append( " , " ); + + switch ( CriticalTypes[i] ) { + case CriticalType.Miss: + builder.Append( "Miss" ); + break; + case CriticalType.Hit: + builder.Append( Damages[i] ).Append( " Dmg" ); + break; + case CriticalType.Critical: + builder.Append( Damages[i] ).Append( " Critical!" ); + break; + } + } + + builder.AppendLine(); + return builder.ToString(); + } + + + protected abstract int CaclulateAttackKind( int[] slots, int attackerShipID, int defenderShipID ); + protected abstract string GetAttackKind(); + + } + + + /// + /// 昼戦の戦闘詳細データを保持します。 + /// + public class BattleDayDetail : BattleDetail { + + public BattleDayDetail( BattleData bd, int attackerId, int defenderId, int[] damages, int[] criticalTypes, int attackType ) + : base( bd, attackerId, defenderId, damages, criticalTypes, attackType ) { + + } + + protected override int CaclulateAttackKind( int[] slots, int attackerShipID, int defenderShipID ) { + return Calculator.GetDayAttackKind( slots, attackerShipID, defenderShipID, false ); + } + + protected override string GetAttackKind() { + return Constants.GetDayAttackKind( AttackType ); + } + } + + /// + /// 夜戦における戦闘詳細データを保持します。 + /// + public class BattleNightDetail : BattleDetail { + + public BattleNightDetail( BattleData bd, int attackerId, int defenderId, int[] damages, int[] criticalTypes, int attackType ) + : base( bd, attackerId, defenderId, damages, criticalTypes, attackType ) { + + } + + protected override int CaclulateAttackKind( int[] slots, int attackerShipID, int defenderShipID ) { + return Calculator.GetNightAttackKind( slots, attackerShipID, defenderShipID, false ); + } + + protected override string GetAttackKind() { + return Constants.GetNightAttackKind( AttackType ); + } + } } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs b/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs index 96ae70ac7..1fba61929 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseBase.cs @@ -13,15 +13,15 @@ namespace ElectronicObserver.Data.Battle.Phase { public abstract class PhaseBase { protected BattleData _battleData; + public List BattleDetails { get; protected set; } public PhaseBase( BattleData data ) { _battleData = data; - battleDetails = new List(); + BattleDetails = new List(); } - public List battleDetails; protected dynamic RawData { get { return _battleData.RawData; } } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs b/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs index 0c59e1b42..118f1ffda 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs @@ -1,172 +1,168 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ElectronicObserver.Data.Battle.Phase { - - /// - /// 夜戦フェーズの処理を行います。 - /// - public class PhaseNightBattle : PhaseBase { - - private readonly bool isEscort; - - public PhaseNightBattle( BattleData data, bool isEscort ) - : base( data ) { - - this.isEscort = isEscort; - } - - public override bool IsAvailable { - get { return true; } - } - - public dynamic ShellingData { get { return RawData.api_hougeki; } } - - public override void EmulateBattle( int[] hps, int[] damages ) { - - if ( !IsAvailable ) return; - - int[] attackers = (int[])ShellingData.api_at_list; - - for ( int i = 1; i < attackers.Length; i++ ) { //skip header(-1) - - int[] tempDamages = Enumerable.Repeat( 0, hps.Length ).ToArray(); - - int[] defenders = (int[])( ShellingData.api_df_list[i] ); - int[] unitDamages = (int[])( ShellingData.api_damage[i] ); - int tempDefender = -1; - - for ( int j = 0; j < defenders.Length; j++ ) { - if (defenders[j] != -1) - { - tempDamages[GetIndex(defenders[j])] += Math.Max(unitDamages[j], 0); - if (tempDefender != defenders[j]) tempDefender = defenders[j]; - } - } - - for ( int j = 0; j < tempDamages.Length; j++ ) +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Battle.Phase { + + /// + /// 夜戦フェーズの処理を行います。 + /// + public class PhaseNightBattle : PhaseBase { + + private readonly bool isEscort; + + public PhaseNightBattle( BattleData data, bool isEscort ) + : base( data ) { + + this.isEscort = isEscort; + } + + public override bool IsAvailable { + get { return true; } + } + + public dynamic ShellingData { get { return RawData.api_hougeki; } } + + public override void EmulateBattle( int[] hps, int[] damages ) { + + if ( !IsAvailable ) return; + + int[] attackers = (int[])ShellingData.api_at_list; + + for ( int i = 1; i < attackers.Length; i++ ) { //skip header(-1) + + int[] tempDamages = Enumerable.Repeat( 0, hps.Length ).ToArray(); + + int[] defenders = (int[])( ShellingData.api_df_list[i] ); + int[] unitDamages = (int[])( ShellingData.api_damage[i] ); + + for ( int j = 0; j < defenders.Length; j++ ) { + if ( defenders[j] != -1 ) { + tempDamages[GetIndex( defenders[j] )] += Math.Max( unitDamages[j], 0 ); + } + } + + for ( int j = 0; j < tempDamages.Length; j++ ) AddDamage( hps, j, tempDamages[j] ); - BattleNightDetail detail = new BattleNightDetail(attackers[i], tempDefender, unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_sp_list[i]); - battleDetails.Add(detail); - - damages[GetIndex( attackers[i] )] += tempDamages.Sum(); - } - - } - - - /// - /// 自軍艦隊 - /// - public FleetData FriendFleet { get { return KCDatabase.Instance.Fleet[isEscort ? 2 : _battleData.Initial.FriendFleetID]; } } - - - /// - /// 自軍触接機ID - /// - public int TouchAircraftFriend { get { return (int)RawData.api_touch_plane[0]; } } - - /// - /// 敵軍触接機ID - /// - public int TouchAircraftEnemy { get { return (int)RawData.api_touch_plane[1]; } } - - /// - /// 自軍照明弾投射艦番号 - /// - public int FlareIndexFriend { - get { - int index = (int)RawData.api_flare_pos[0]; - return index != -1 ? index - 1 : -1; - } - } - - /// - /// 敵軍照明弾投射艦番号(0-5, -1=発動せず) - /// - public int FlareIndexEnemy { - get { - int index = (int)RawData.api_flare_pos[1]; - return index != -1 ? index - 1 : -1; - } - } - - /// - /// 敵軍照明弾投射艦 - /// - public ShipDataMaster FlareEnemyInstance { - get { - int index = FlareIndexEnemy; - return index == -1 ? null : _battleData.Initial.EnemyMembersInstance[index]; - } - } - - /// - /// 自軍探照灯照射艦番号 - /// - public int SearchlightIndexFriend { - get { - var ships = KCDatabase.Instance.Fleet[isEscort ? 2 : _battleData.Initial.FriendFleetID].MembersWithoutEscaped; - int index = -1; - - for ( int i = 0; i < ships.Count; i++ ) { - - var ship = ships[i]; - if ( ship != null && _battleData.Initial.InitialHPs[( isEscort ? 12 : 0 ) + i] > 1 ) { - - if ( ship.SlotInstanceMaster.Count( e => e != null && e.CategoryType == 42 ) > 0 ) //大型探照灯 - return i; - else if ( ship.SlotInstanceMaster.Count( e => e != null && e.CategoryType == 29 ) > 0 && index == -1 ) //探照灯 - index = i; - } - } - - return index; - } - } - - /// - /// 敵軍探照灯照射艦番号(0-5) - /// - public int SearchlightIndexEnemy { - get { - var ships = _battleData.Initial.EnemyMembersInstance; - var eqs = _battleData.Initial.EnemySlotsInstance; - int index = -1; - - for ( int i = 0; i < ships.Length; i++ ) { - - if ( ships[i] != null && _battleData.Initial.InitialHPs[6 + i] > 1 ) { - - if ( eqs[i].Count( e => e != null && e.CategoryType == 42 ) > 0 ) //大型探照灯 - return i; - else if ( eqs[i].Count( e => e != null && e.CategoryType == 29 ) > 0 && index == -1 ) //探照灯 - index = i; - - } - } - - return index; - } - } - - public ShipDataMaster SearchlightEnemyInstance { - get { - int index = SearchlightIndexEnemy; - return index == -1 ? null : _battleData.Initial.EnemyMembersInstance[index]; - } - } - - - private int GetIndex( int index ) { - if ( isEscort && index <= 6 ) - return 12 + index - 1; - return index - 1; - } - } -} + BattleDetails.Add( new BattleNightDetail( _battleData, attackers[i] + ( isEscort && attackers[i] <= 6 ? 12 : 0 ), defenders.LastOrDefault() + ( isEscort && defenders.LastOrDefault() <= 6 ? 12 : 0 ), unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_sp_list[i] ) ); + + damages[GetIndex( attackers[i] )] += tempDamages.Sum(); + } + + } + + + /// + /// 自軍艦隊 + /// + public FleetData FriendFleet { get { return KCDatabase.Instance.Fleet[isEscort ? 2 : _battleData.Initial.FriendFleetID]; } } + + + /// + /// 自軍触接機ID + /// + public int TouchAircraftFriend { get { return (int)RawData.api_touch_plane[0]; } } + + /// + /// 敵軍触接機ID + /// + public int TouchAircraftEnemy { get { return (int)RawData.api_touch_plane[1]; } } + + /// + /// 自軍照明弾投射艦番号 + /// + public int FlareIndexFriend { + get { + int index = (int)RawData.api_flare_pos[0]; + return index != -1 ? index - 1 : -1; + } + } + + /// + /// 敵軍照明弾投射艦番号(0-5, -1=発動せず) + /// + public int FlareIndexEnemy { + get { + int index = (int)RawData.api_flare_pos[1]; + return index != -1 ? index - 1 : -1; + } + } + + /// + /// 敵軍照明弾投射艦 + /// + public ShipDataMaster FlareEnemyInstance { + get { + int index = FlareIndexEnemy; + return index == -1 ? null : _battleData.Initial.EnemyMembersInstance[index]; + } + } + + /// + /// 自軍探照灯照射艦番号 + /// + public int SearchlightIndexFriend { + get { + var ships = KCDatabase.Instance.Fleet[isEscort ? 2 : _battleData.Initial.FriendFleetID].MembersWithoutEscaped; + int index = -1; + + for ( int i = 0; i < ships.Count; i++ ) { + + var ship = ships[i]; + if ( ship != null && _battleData.Initial.InitialHPs[( isEscort ? 12 : 0 ) + i] > 1 ) { + + if ( ship.SlotInstanceMaster.Count( e => e != null && e.CategoryType == 42 ) > 0 ) //大型探照灯 + return i; + else if ( ship.SlotInstanceMaster.Count( e => e != null && e.CategoryType == 29 ) > 0 && index == -1 ) //探照灯 + index = i; + } + } + + return index; + } + } + + /// + /// 敵軍探照灯照射艦番号(0-5) + /// + public int SearchlightIndexEnemy { + get { + var ships = _battleData.Initial.EnemyMembersInstance; + var eqs = _battleData.Initial.EnemySlotsInstance; + int index = -1; + + for ( int i = 0; i < ships.Length; i++ ) { + + if ( ships[i] != null && _battleData.Initial.InitialHPs[6 + i] > 1 ) { + + if ( eqs[i].Count( e => e != null && e.CategoryType == 42 ) > 0 ) //大型探照灯 + return i; + else if ( eqs[i].Count( e => e != null && e.CategoryType == 29 ) > 0 && index == -1 ) //探照灯 + index = i; + + } + } + + return index; + } + } + + public ShipDataMaster SearchlightEnemyInstance { + get { + int index = SearchlightIndexEnemy; + return index == -1 ? null : _battleData.Initial.EnemyMembersInstance[index]; + } + } + + + private int GetIndex( int index ) { + if ( isEscort && index <= 6 ) + return 12 + index - 1; + return index - 1; + } + } +} diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseOpeningASW.cs b/ElectronicObserver/Data/Battle/Phase/PhaseOpeningASW.cs index 789986c2d..33c0d5884 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseOpeningASW.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseOpeningASW.cs @@ -13,7 +13,7 @@ public class PhaseOpeningASW : PhaseShelling { // 砲撃戦とフォーマットが同じなので流用 - public PhaseOpeningASW( BattleData data, bool isEscort ) + public PhaseOpeningASW( BattleData data, bool isEscort ) : base( data, 0, "", isEscort ) { } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs b/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs index afd5cf676..e54ceaf14 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs @@ -46,20 +46,18 @@ public override void EmulateBattle( int[] hps, int[] damages ) { int[] defenders = (int[])( ShellingData.api_df_list[i] ); int[] unitDamages = (int[])( ShellingData.api_damage[i] ); - int tempDefender = -1; for ( int j = 0; j < defenders.Length; j++ ) { if ( defenders[j] != -1 ) { tempDamages[GetIndex( defenders[j] )] += Math.Max( unitDamages[j], 0 ); - if(tempDefender != defenders[j]) tempDefender = defenders[j]; - } + } } for ( int j = 0; j < tempDamages.Length; j++ ) AddDamage( hps, j, tempDamages[j] ); - BattleDayDetail detail = new BattleDayDetail(attackers[i], tempDefender, unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_at_type[i]); - battleDetails.Add(detail); + + BattleDetails.Add( new BattleDayDetail( _battleData, attackers[i] + ( isEscort && attackers[i] <= 6 ? 12 : 0 ), defenders.LastOrDefault() + ( isEscort && defenders.LastOrDefault() <= 6 ? 12 : 0 ), unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_at_type[i] ) ); damages[GetIndex( attackers[i] )] += tempDamages.Sum(); } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs b/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs index ff1f0a20e..6f271a127 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseTorpedo.cs @@ -1,116 +1,113 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ElectronicObserver.Data.Battle.Phase { - - /// - /// 雷撃戦フェーズの処理を行います。 - /// - public class PhaseTorpedo : PhaseBase { - - /// - /// フェーズID 0=開幕雷撃, 1-4=雷撃戦 - /// - private readonly int phaseID; - - public PhaseTorpedo( BattleData data, int phaseID ) - : base( data ) { - - this.phaseID = phaseID; - } - - public override bool IsAvailable { - get { - - if ( phaseID == 0 ) { - return RawData.api_opening_flag() ? (int)RawData.api_opening_flag != 0 : false; - - } else { - return (int)RawData.api_hourai_flag[phaseID - 1] != 0; - } - } - } - - public dynamic ShellingData { get { return phaseID ==0 ? RawData.api_opening_atack : RawData.api_raigeki; } } - public override void EmulateBattle( int[] hps, int[] damages ) { - - if ( !IsAvailable ) return; - { - int[] dmg = Damages; - for ( int i = 0; i < hps.Length; i++ ) { - AddDamage( hps, i, dmg[i] ); - } - } - { - int[] dmg = AttackDamages; - for ( int i = 0; i < damages.Length; i++ ) { - damages[i] += dmg[i]; - } - } - { - int[] friendTargets = (int[])ShellingData.api_frai; - int[] enemyTargets = (int[])ShellingData.api_erai; - int[] friendTargetDams = (int[])ShellingData.api_fydam; - int[] enemyTargetDam = (int[])ShellingData.api_eydam; - int[] friendCritical = (int[])ShellingData.api_fcl; - int[] enemyCritical = (int[])ShellingData.api_ecl; - for (int i = 1; i < friendTargets.Length; i++) - { //skip header(-1) - if (friendTargets[i] > 0) - { - BattleDayDetail detail = new BattleDayDetail(i, friendTargets[i] + 6, new int[] { friendTargetDams[i] }, new int[] { friendCritical[i] }, (int) BattleDayDetail.DayCutinType.Torpedo); - battleDetails.Add(detail); - } - } - for (int i = 1; i < enemyTargets.Length; i++) - { - if (enemyTargets[i] > 0) - { - BattleDayDetail detail = new BattleDayDetail(i + 6, enemyTargets[i], new int[] { enemyTargetDam[i] }, new int[] { enemyCritical[i] }, (int)BattleDayDetail.DayCutinType.Torpedo); - battleDetails.Add(detail); - } - } - } - } - - - public dynamic TorpedoData { - get { return phaseID == 0 ? RawData.api_opening_atack : RawData.api_raigeki; } - } - - /// - /// 各艦の被ダメージ - /// - public int[] Damages { - get { - if ( IsCombined ) { - return Enumerable.Repeat( 0, 6 ) - .Concat( ( (int[])TorpedoData.api_edam ).Skip( 1 ) ) - .Concat( ( (int[])TorpedoData.api_fdam ).Skip( 1 ) ).ToArray(); - } else { - return ( (int[])TorpedoData.api_fdam ).Skip( 1 ) - .Concat( ( (int[])TorpedoData.api_edam ).Skip( 1 ) ).ToArray(); - } - } - } - - /// - /// 各艦の与ダメージ - /// - public int[] AttackDamages { - get { - if ( IsCombined ) { - return Enumerable.Repeat( 0, 6 ) - .Concat( ( (int[])TorpedoData.api_eydam ).Skip( 1 ) ) - .Concat( ( (int[])TorpedoData.api_fydam ).Skip( 1 ) ).ToArray(); - } else { - return ( (int[])TorpedoData.api_fydam ).Skip( 1 ) - .Concat( ( (int[])TorpedoData.api_eydam ).Skip( 1 ) ).ToArray(); - } - } - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ElectronicObserver.Data.Battle.Phase { + + /// + /// 雷撃戦フェーズの処理を行います。 + /// + public class PhaseTorpedo : PhaseBase { + + /// + /// フェーズID 0=開幕雷撃, 1-4=雷撃戦 + /// + private readonly int phaseID; + + public PhaseTorpedo( BattleData data, int phaseID ) + : base( data ) { + + this.phaseID = phaseID; + } + + public override bool IsAvailable { + get { + + if ( phaseID == 0 ) { + return RawData.api_opening_flag() ? (int)RawData.api_opening_flag != 0 : false; + + } else { + return (int)RawData.api_hourai_flag[phaseID - 1] != 0; + } + } + } + + + public override void EmulateBattle( int[] hps, int[] damages ) { + + if ( !IsAvailable ) return; + { + int[] dmg = Damages; + for ( int i = 0; i < hps.Length; i++ ) { + AddDamage( hps, i, dmg[i] ); + } + } + { + int[] dmg = AttackDamages; + for ( int i = 0; i < damages.Length; i++ ) { + damages[i] += dmg[i]; + } + } + { + int[] friendTargets = (int[])TorpedoData.api_frai; + int[] enemyTargets = (int[])TorpedoData.api_erai; + int[] friendTargetDamages = (int[])TorpedoData.api_fydam; + int[] enemyTargetDamages = (int[])TorpedoData.api_eydam; + int[] friendCritical = (int[])TorpedoData.api_fcl; + int[] enemyCritical = (int[])TorpedoData.api_ecl; + + bool isEscort = ( _battleData.BattleType & BattleData.BattleTypeFlag.Combined ) > 0; + + for ( int i = 1; i < friendTargets.Length; i++ ) { //skip header(-1) + if ( friendTargets[i] > 0 ) { + BattleDetails.Add( new BattleDayDetail( _battleData, i + ( isEscort ? 12 : 0 ), friendTargets[i] + 6, new int[] { friendTargetDamages[i] }, new int[] { friendCritical[i] }, -1 ) ); + } + } + for ( int i = 1; i < enemyTargets.Length; i++ ) { + if ( enemyTargets[i] > 0 ) { + BattleDetails.Add( new BattleDayDetail( _battleData, i + 6, enemyTargets[i] + ( isEscort ? 12 : 0 ), new int[] { enemyTargetDamages[i] }, new int[] { enemyCritical[i] }, -1 ) ); + } + } + } + } + + + public dynamic TorpedoData { + get { return phaseID == 0 ? RawData.api_opening_atack : RawData.api_raigeki; } + } + + /// + /// 各艦の被ダメージ + /// + public int[] Damages { + get { + if ( IsCombined ) { + return Enumerable.Repeat( 0, 6 ) + .Concat( ( (int[])TorpedoData.api_edam ).Skip( 1 ) ) + .Concat( ( (int[])TorpedoData.api_fdam ).Skip( 1 ) ).ToArray(); + } else { + return ( (int[])TorpedoData.api_fdam ).Skip( 1 ) + .Concat( ( (int[])TorpedoData.api_edam ).Skip( 1 ) ).ToArray(); + } + } + } + + /// + /// 各艦の与ダメージ + /// + public int[] AttackDamages { + get { + if ( IsCombined ) { + return Enumerable.Repeat( 0, 6 ) + .Concat( ( (int[])TorpedoData.api_eydam ).Skip( 1 ) ) + .Concat( ( (int[])TorpedoData.api_fydam ).Skip( 1 ) ).ToArray(); + } else { + return ( (int[])TorpedoData.api_fydam ).Skip( 1 ) + .Concat( ( (int[])TorpedoData.api_eydam ).Skip( 1 ) ).ToArray(); + } + } + } + } +} diff --git a/ElectronicObserver/Data/Constants.cs b/ElectronicObserver/Data/Constants.cs index 47ece5f04..c0578f4e3 100644 --- a/ElectronicObserver/Data/Constants.cs +++ b/ElectronicObserver/Data/Constants.cs @@ -499,6 +499,10 @@ public static string GetDayAttackKind( int id ) { return "雷撃"; case 10: return "ロケット砲撃"; + case 11: + return "揚陸攻撃(大発動艇)"; + case 12: + return "揚陸攻撃(内火艇)"; default: return "不明"; } @@ -532,6 +536,10 @@ public static string GetNightAttackKind( int id ) { return "雷撃"; case 10: return "ロケット砲撃"; + case 11: + return "揚陸攻撃(大発動艇)"; + case 12: + return "揚陸攻撃(内火艇)"; default: return "不明"; } diff --git a/ElectronicObserver/Utility/Data/Calculator.cs b/ElectronicObserver/Utility/Data/Calculator.cs index 54ab61208..89203481a 100644 --- a/ElectronicObserver/Utility/Data/Calculator.cs +++ b/ElectronicObserver/Utility/Data/Calculator.cs @@ -583,6 +583,17 @@ public static int GetTPDamage( FleetData fleet ) { } + /// + /// ハードスキン型陸上基地の名前リスト + /// IDではなく名前なのは本家の処理に倣ったため + /// + private static readonly HashSet HardInstallationNames = new HashSet() { + "離島棲姫", + "砲台小鬼", + "集積地棲姫", + "集積地棲姫-壊", + }; + /// /// 昼戦における攻撃種別を取得します。 /// @@ -598,6 +609,8 @@ public static int GetDayAttackKind( int[] slot, int attackerShipID, int defenerS int apshellcnt = 0; int radarcnt = 0; int rocketcnt = 0; + int landingcnt = 0; + int uchibicnt = 0; if ( slot == null ) return -1; @@ -609,28 +622,35 @@ public static int GetDayAttackKind( int[] slot, int attackerShipID, int defenerS int eqtype = eq.CategoryType; switch ( eqtype ) { - case 1: - case 2: - case 3: + case 1: // 小口径主砲 + case 2: // 中口径主砲 + case 3: // 大口径主砲 mainguncnt++; break; - case 4: + case 4: // 副砲 subguncnt++; break; - case 10: - case 11: + case 10: // 水上偵察機 + case 11: // 水上爆撃機 reconcnt++; break; - case 12: - case 13: + case 12: // 小型電探 + case 13: // 大型電探 radarcnt++; break; - case 19: + case 19: // 対艦強化弾 apshellcnt++; break; - case 37: + case 24: // 上陸用舟艇 + if ( eq.EquipmentID == 166 ) // 陸戦隊 + landingcnt++; + break; + case 37: // 対地装備 rocketcnt++; break; + case 46: // 特型内火艇 + uchibicnt++; + break; } } @@ -653,10 +673,20 @@ public static int GetDayAttackKind( int[] slot, int attackerShipID, int defenerS if ( atkship != null ) { - if ( defship != null && defship.IsLandBase && rocketcnt > 0 ) - return 10; //ロケット砲撃 + if ( defship != null ) { + + if ( uchibicnt > 0 && ( ( ( atkship.ShipType == 13 || atkship.ShipType == 14 ) && defship.IsLandBase ) || HardInstallationNames.Contains( defship.Name ) ) ) + return 12; // 揚陸攻撃(内火艇) + + if ( landingcnt > 0 && HardInstallationNames.Contains( defship.Name ) ) + return 11; // 揚陸攻撃(大発動艇) + + if ( rocketcnt > 0 && defship.IsLandBase ) + return 10; //ロケット砲撃 + } - else if ( attackerShipID == 352 ) { //速吸改 + + if ( attackerShipID == 352 ) { //速吸改 if ( defship != null && ( defship.ShipType == 13 || defship.ShipType == 14 ) ) { if ( slot.Select( id => KCDatabase.Instance.MasterEquipments[id] ) @@ -686,7 +716,7 @@ public static int GetDayAttackKind( int[] slot, int attackerShipID, int defenerS } - return 0; + return 0; //砲撃 } @@ -696,12 +726,15 @@ public static int GetDayAttackKind( int[] slot, int attackerShipID, int defenerS /// 攻撃艦のスロット(マスターID)。 /// 攻撃艦の艦船ID。 /// 防御艦の艦船ID。なければ-1 - public static int GetNightAttackKind( int[] slot, int attackerShipID, int defenerShipID ) { + /// カットイン/連撃の判定を含むか。falseなら除外して計算 + public static int GetNightAttackKind( int[] slot, int attackerShipID, int defenerShipID, bool includeSpecialAttack = true ) { int mainguncnt = 0; int subguncnt = 0; int torpcnt = 0; int rocketcnt = 0; + int landingcnt = 0; + int uchibicnt = 0; if ( slot == null ) return -1; @@ -731,18 +764,22 @@ public static int GetNightAttackKind( int[] slot, int attackerShipID, int defene } - if ( torpcnt >= 2 ) - return 3; //カットイン(魚雷/魚雷) - else if ( mainguncnt >= 3 ) - return 5; //カットイン(主砲x3) - else if ( mainguncnt == 2 && subguncnt > 0 ) - return 4; //カットイン(主砲x2/副砲) - else if ( ( mainguncnt == 2 && subguncnt == 0 && torpcnt == 1 ) || ( mainguncnt == 1 && torpcnt == 1 ) ) - return 2; //カットイン(主砲/魚雷) - else if ( ( mainguncnt == 2 && subguncnt == 0 & torpcnt == 0 ) || - ( mainguncnt == 1 && subguncnt > 0 ) || - ( subguncnt >= 2 && torpcnt <= 1 ) ) { - return 1; //連撃 + if ( includeSpecialAttack ) { + + if ( torpcnt >= 2 ) + return 3; //カットイン(魚雷/魚雷) + else if ( mainguncnt >= 3 ) + return 5; //カットイン(主砲x3) + else if ( mainguncnt == 2 && subguncnt > 0 ) + return 4; //カットイン(主砲x2/副砲) + else if ( ( mainguncnt == 2 && subguncnt == 0 && torpcnt == 1 ) || ( mainguncnt == 1 && torpcnt == 1 ) ) + return 2; //カットイン(主砲/魚雷) + else if ( ( mainguncnt == 2 && subguncnt == 0 & torpcnt == 0 ) || + ( mainguncnt == 1 && subguncnt > 0 ) || + ( subguncnt >= 2 && torpcnt <= 1 ) ) { + return 1; //連撃 + } + } @@ -751,13 +788,25 @@ public static int GetNightAttackKind( int[] slot, int attackerShipID, int defene if ( atkship != null ) { - if ( defship != null && defship.IsLandBase && rocketcnt > 0 ) - return 10; //ロケット砲撃 + if ( defship != null ) { - else if ( atkship.ShipType == 7 || atkship.ShipType == 11 || atkship.ShipType == 18 ) { //軽空母/正規空母/装甲空母 + if ( uchibicnt > 0 && ( ( ( atkship.ShipType == 13 || atkship.ShipType == 14 ) && defship.IsLandBase ) || HardInstallationNames.Contains( defship.Name ) ) ) + return 12; // 揚陸攻撃(内火艇) + + if ( landingcnt > 0 && HardInstallationNames.Contains( defship.Name ) ) + return 11; // 揚陸攻撃(大発動艇) + + if ( rocketcnt > 0 && defship.IsLandBase ) + return 10; //ロケット砲撃 + } + + + if ( atkship.ShipType == 7 || atkship.ShipType == 11 || atkship.ShipType == 18 ) { //軽空母/正規空母/装甲空母 if ( attackerShipID == 432 || attackerShipID == 353 ) //Graf Zeppelin(改) return 0; //砲撃 + else if ( atkship.Name == "リコリス棲姫" ) + return 0; //砲撃 else return 7; //空撃 @@ -773,7 +822,7 @@ public static int GetNightAttackKind( int[] slot, int attackerShipID, int defene else if ( slot.Length > 0 ) { EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[slot[0]]; - if ( eq != null && eq.EquipmentType[2] == 5 ) { //最初のスロット==魚雷 (本来の判定とは微妙に異なるが無問題) + if ( eq != null && ( eq.CategoryType == 5 || eq.CategoryType == 32 ) ) { //最初のスロット==魚雷 (本来の判定とは微妙に異なるが無問題) return 9; //雷撃 } } diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index 662198101..5ab7ce3dc 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -64,7 +64,7 @@ public FormBattle( FormMain parent ) { TableBottom.ResumeLayout(); - Searching.ImageList = + Searching.ImageList = SearchingFriend.ImageList = SearchingEnemy.ImageList = AACutin.ImageList = @@ -292,7 +292,7 @@ private void ClearSearchingResult() { /// private void SetBaseAirAttack( PhaseBaseAirAttack pd ) { - if ( pd.IsAvailable ) { + if ( pd != null && pd.IsAvailable ) { Searching.Text = "基地航空隊"; Searching.ImageAlign = ContentAlignment.MiddleLeft; @@ -749,102 +749,72 @@ private void SetHPNormal( BattleData bd ) { for ( int i = 0; i < 6; i++ ) { - if (initialHPs[i] != -1) - { - ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; - if (bd is BattleDay) - { - List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i); - List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i); - List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); - List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); - List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i); - List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipOpeningASWDetail.Count > 0) - { - builder.AppendLine("開幕対潜"); - builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); - } - if (shipOpeningTorpedoDetail.Count > 0) - { - builder.AppendLine("開幕雷撃"); - builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); - } - if (shipShelling1Detail.Count > 0) - { - builder.AppendLine("砲撃戦"); - builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); - if (shipShelling2Detail.Count > 0) - { - builder.AppendLine("砲撃戦 Phase2"); - builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); - } - if (shipShelling3Detail.Count > 0) - { - builder.Append(FriendShipBattleDetail(bd, shipShelling3Detail)); - } - } - if (shipTorpedoDetail.Count > 0) - { - builder.AppendLine("雷撃"); - builder.AppendLine(FriendShipBattleDetail(bd, shipTorpedoDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } - - else if (bd is BattleNight) - { - List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipNightBattleDetail.Count > 0) - { - builder.AppendLine("夜戦"); - builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } - else - { - ToolTipInfo.SetToolTip(HPBars[i], string.Format("{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}", - ship.MasterShip.ShipTypeName, - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase), - attackDamages[i] - )); - } - } + if ( initialHPs[i] != -1 ) { + ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; + + + StringBuilder builder = new StringBuilder(); + builder.AppendFormat( + "{0} {1} Lv. {2}\r\nHP: ({3} → {4})/{5} ({6}) [{7}]\r\n与ダメージ: {8}\r\n\r\n", + ship.MasterShip.ShipTypeName, + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max( HPBars[i].PrevValue, 0 ), + Math.Max( HPBars[i].Value, 0 ), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState( (double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase ), + attackDamages[i] + ); + + + if ( bd is BattleNormalDay || bd is BattlePracticeDay ) { + var shipOpeningASWDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningASW.BattleDetails, i ); + var shipOpeningTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningTorpedo.BattleDetails, i ); + var shipShelling1Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling1.BattleDetails, i ); + var shipShelling2Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling2.BattleDetails, i ); + var shipShelling3Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling3.BattleDetails, i ); + var shipTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).Torpedo.BattleDetails, i ); + + if ( shipOpeningASWDetail.Any() ) { + builder.AppendLine( "《開幕対潜》" ); + builder.Append( FriendShipBattleDetail( bd, shipOpeningASWDetail ) ); + } + if ( shipOpeningTorpedoDetail.Any() ) { + builder.AppendLine( "《開幕雷撃》" ); + builder.Append( FriendShipBattleDetail( bd, shipOpeningTorpedoDetail ) ); + } + if ( shipShelling1Detail.Any() ) { + builder.AppendLine( "《第一砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling1Detail ) ); + if ( shipShelling2Detail.Any() ) { + builder.AppendLine( "《第二砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling2Detail ) ); + } + if ( shipShelling3Detail.Any() ) { + builder.AppendLine( "《第三砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling3Detail ) ); + } + } + if ( shipTorpedoDetail.Any() ) { + builder.AppendLine( "《雷撃戦》" ); + builder.AppendLine( FriendShipBattleDetail( bd, shipTorpedoDetail ) ); + } + + + } else if ( bd is BattleNight ) { + var shipNightBattleDetail = SelectBattleDetail( ( (BattleNight)bd ).NightBattle.BattleDetails, i ); + + if ( shipNightBattleDetail.Any() ) { + builder.AppendLine( "《夜戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipNightBattleDetail ) ); + } + + + } + + ToolTipInfo.SetToolTip( HPBars[i], builder.ToString() ); + } } for ( int i = 0; i < 6; i++ ) { @@ -912,106 +882,62 @@ private void SetHPCombined( BattleData bd ) { if ( initialHPs[i] != -1 ) { ShipData ship = bd.Initial.FriendFleet.MembersInstance[i]; bool isEscaped = bd.Initial.FriendFleet.EscapedShipList.Contains( ship.MasterID ); - if (bd is BattleCombinedWater) - { - List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i); - List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipShelling1Detail.Count > 0) - { - builder.AppendLine("砲撃戦"); - builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); - if (shipShelling2Detail.Count > 0) - { - builder.AppendLine("砲撃戦 Phase2"); - builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); - } - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } - else if (bd is BattleCombinedNormalDay) - { - List shipShelling2Detail = SelectBattleDetail(((BattleDay)bd).Shelling2.battleDetails, i); - List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipShelling2Detail.Count > 0) - { - builder.AppendLine("砲撃戦"); - builder.Append(FriendShipBattleDetail(bd, shipShelling2Detail)); - if (shipShelling3Detail.Count > 0) - { - builder.AppendLine("砲撃戦 Phase2"); - builder.AppendLine(FriendShipBattleDetail(bd, shipShelling3Detail)); - } - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } - else if (bd is BattleNight) - { - List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), - attackDamages[i] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipNightBattleDetail.Count > 0) - { - builder.AppendLine("夜戦"); - builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i], builder.ToString()); - } - else - { - ToolTipInfo.SetToolTip(HPBars[i], string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i].PrevValue, 0), - Math.Max(HPBars[i].Value, 0), - HPBars[i].MaximumValue, - HPBars[i].Value - HPBars[i].PrevValue, - Constants.GetDamageState((double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), - attackDamages[i] - )); - } + + + StringBuilder builder = new StringBuilder(); + builder.AppendFormat( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}\r\n\r\n", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max( HPBars[i].PrevValue, 0 ), + Math.Max( HPBars[i].Value, 0 ), + HPBars[i].MaximumValue, + HPBars[i].Value - HPBars[i].PrevValue, + Constants.GetDamageState( (double)HPBars[i].Value / HPBars[i].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped ), + attackDamages[i] + ); + + + if ( bd is BattleCombinedWater ) { + var shipShelling1Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling1.BattleDetails, i ); + var shipShelling2Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling2.BattleDetails, i ); + + if ( shipShelling1Detail.Any() ) { + builder.AppendLine( "《第一砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling1Detail ) ); + + if ( shipShelling2Detail.Any() ) { + builder.AppendLine( "《第二砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling2Detail ) ); + } + } + + + } else if ( bd is BattleCombinedNormalDay ) { + var shipShelling2Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling2.BattleDetails, i ); + var shipShelling3Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling3.BattleDetails, i ); + + if ( shipShelling2Detail.Any() ) { + builder.AppendLine( "《第二砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling2Detail ) ); + + if ( shipShelling3Detail.Any() ) { + builder.AppendLine( "《第三砲撃戦》" ); + builder.AppendLine( FriendShipBattleDetail( bd, shipShelling3Detail ) ); + } + } + + + } + + + ToolTipInfo.SetToolTip( HPBars[i], builder.ToString() ); if ( isEscaped ) HPBars[i].BackColor = Color.Silver; else HPBars[i].BackColor = SystemColors.Control; } } + for ( int i = 0; i < 6; i++ ) { if ( initialHPs[i + 6] != -1 ) { ShipDataMaster ship = bd.Initial.EnemyMembersInstance[i]; @@ -1030,176 +956,88 @@ private void SetHPCombined( BattleData bd ) { } } + for ( int i = 0; i < 6; i++ ) { if ( initialHPs[i + 12] != -1 ) { ShipData ship = db.Fleet[2].MembersInstance[i]; bool isEscaped = db.Fleet[2].EscapedShipList.Contains( ship.MasterID ); - if (bd is BattleCombinedNormalDay) - { - //Format the index in api in a friendly form - foreach (BattleDetail detail in ((BattleDay)bd).OpeningASW.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i + 12); - foreach (BattleDetail detail in ((BattleDay)bd).OpeningTorpedo.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i + 12); - foreach (BattleDetail detail in ((BattleDay)bd).Shelling1.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipShelling1Detail = SelectBattleDetail(((BattleDay)bd).Shelling1.battleDetails, i + 12); - foreach (BattleDetail detail in ((BattleDay)bd).Torpedo.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i + 12); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i + 12].PrevValue, 0), - Math.Max(HPBars[i + 12].Value, 0), - HPBars[i + 12].MaximumValue, - HPBars[i + 12].Value - HPBars[i + 12].PrevValue, - Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), - attackDamages[i + 12] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipOpeningASWDetail.Count > 0) - { - builder.AppendLine("開幕対潜"); - builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); - } - if (shipOpeningTorpedoDetail.Count > 0) - { - builder.AppendLine("開幕雷撃"); - builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); - } - if (shipShelling1Detail.Count > 0) - { - builder.AppendLine("砲撃戦"); - builder.Append(FriendShipBattleDetail(bd, shipShelling1Detail)); - } - if (shipTorpedoDetail.Count > 0) - { - builder.AppendLine("雷撃"); - builder.Append(FriendShipBattleDetail(bd, shipTorpedoDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); - } - else if (bd is BattleCombinedWater) - { - //Format the index in api in a friendly form - foreach (BattleDetail detail in ((BattleDay)bd).OpeningASW.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipOpeningASWDetail = SelectBattleDetail(((BattleDay)bd).OpeningASW.battleDetails, i + 12); - foreach (BattleDetail detail in ((BattleDay)bd).OpeningTorpedo.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipOpeningTorpedoDetail = SelectBattleDetail(((BattleDay)bd).OpeningTorpedo.battleDetails, i + 12); - foreach (BattleDetail detail in ((BattleDay)bd).Shelling3.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipShelling3Detail = SelectBattleDetail(((BattleDay)bd).Shelling3.battleDetails, i + 12); - foreach (BattleDetail detail in ((BattleDay)bd).Torpedo.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipTorpedoDetail = SelectBattleDetail(((BattleDay)bd).Torpedo.battleDetails, i + 12); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i + 12].PrevValue, 0), - Math.Max(HPBars[i + 12].Value, 0), - HPBars[i + 12].MaximumValue, - HPBars[i + 12].Value - HPBars[i + 12].PrevValue, - Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), - attackDamages[i + 12] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipOpeningASWDetail.Count > 0) - { - builder.AppendLine("開幕対潜"); - builder.Append(FriendShipBattleDetail(bd, shipOpeningASWDetail)); - } - if (shipOpeningTorpedoDetail.Count > 0) - { - builder.AppendLine("開幕雷撃"); - builder.Append(FriendShipBattleDetail(bd, shipOpeningTorpedoDetail)); - } - if (shipShelling3Detail.Count > 0) - { - builder.AppendLine("砲撃戦"); - builder.Append(FriendShipBattleDetail(bd, shipShelling3Detail)); - } - if (shipTorpedoDetail.Count > 0) - { - builder.AppendLine("雷撃"); - builder.Append(FriendShipBattleDetail(bd, shipTorpedoDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); - } - else if (bd is BattleNight) - { - - foreach (BattleDetail detail in ((BattleNight)bd).NightBattle.battleDetails) - { - if (detail.Attacker < 6) detail.Attacker += 12; - if (detail.Defender < 6) detail.Defender += 12; - } - List shipNightBattleDetail = SelectBattleDetail(((BattleNight)bd).NightBattle.battleDetails, i + 12); - - StringBuilder builder = new StringBuilder(); - string sum = string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i + 12].PrevValue, 0), - Math.Max(HPBars[i + 12].Value, 0), - HPBars[i + 12].MaximumValue, - HPBars[i + 12].Value - HPBars[i + 12].PrevValue, - Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), - attackDamages[i + 12] - ); - builder.AppendLine(sum).AppendLine(""); - if (shipNightBattleDetail.Count > 0) - { - builder.AppendLine("夜戦"); - builder.Append(FriendShipBattleDetail(bd, shipNightBattleDetail)); - } - ToolTipInfo.SetToolTip(HPBars[i + 12], builder.ToString()); - } - else - { - ToolTipInfo.SetToolTip(HPBars[i + 12], string.Format("{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}", - ship.MasterShip.NameWithClass, - ship.Level, - Math.Max(HPBars[i + 12].PrevValue, 0), - Math.Max(HPBars[i + 12].Value, 0), - HPBars[i + 12].MaximumValue, - HPBars[i + 12].Value - HPBars[i + 12].PrevValue, - Constants.GetDamageState((double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped), - attackDamages[i + 12] - )); - } + + + StringBuilder builder = new StringBuilder(); + builder.AppendFormat( "{0} Lv. {1}\r\nHP: ({2} → {3})/{4} ({5}) [{6}]\r\n与ダメージ: {7}\r\n\r\n", + ship.MasterShip.NameWithClass, + ship.Level, + Math.Max( HPBars[i + 12].PrevValue, 0 ), + Math.Max( HPBars[i + 12].Value, 0 ), + HPBars[i + 12].MaximumValue, + HPBars[i + 12].Value - HPBars[i + 12].PrevValue, + Constants.GetDamageState( (double)HPBars[i + 12].Value / HPBars[i + 12].MaximumValue, isPractice, ship.MasterShip.IsLandBase, isEscaped ), + attackDamages[i + 12] + ); + + + if ( bd is BattleCombinedNormalDay ) { + var shipOpeningASWDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningASW.BattleDetails, i + 12 ); + var shipOpeningTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningTorpedo.BattleDetails, i + 12 ); + var shipShelling1Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling1.BattleDetails, i + 12 ); + var shipTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).Torpedo.BattleDetails, i + 12 ); + + + if ( shipOpeningASWDetail.Any() ) { + builder.AppendLine( "《開幕対潜》" ); + builder.Append( FriendShipBattleDetail( bd, shipOpeningASWDetail ) ); + } + if ( shipOpeningTorpedoDetail.Any() ) { + builder.AppendLine( "《開幕雷撃》" ); + builder.Append( FriendShipBattleDetail( bd, shipOpeningTorpedoDetail ) ); + } + if ( shipShelling1Detail.Any() ) { + builder.AppendLine( "《第一砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling1Detail ) ); + } + if ( shipTorpedoDetail.Any() ) { + builder.AppendLine( "《雷撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipTorpedoDetail ) ); + } + + + } else if ( bd is BattleCombinedWater ) { + var shipOpeningASWDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningASW.BattleDetails, i + 12 ); + var shipOpeningTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningTorpedo.BattleDetails, i + 12 ); + var shipShelling3Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling3.BattleDetails, i + 12 ); + var shipTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).Torpedo.BattleDetails, i + 12 ); + + + if ( shipOpeningASWDetail.Any() ) { + builder.AppendLine( "《開幕対潜》" ); + builder.Append( FriendShipBattleDetail( bd, shipOpeningASWDetail ) ); + } + if ( shipOpeningTorpedoDetail.Any() ) { + builder.AppendLine( "《開幕雷撃》" ); + builder.Append( FriendShipBattleDetail( bd, shipOpeningTorpedoDetail ) ); + } + if ( shipShelling3Detail.Any() ) { + builder.AppendLine( "《第三砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling3Detail ) ); + } + if ( shipTorpedoDetail.Any() ) { + builder.AppendLine( "《雷撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipTorpedoDetail ) ); + } + + + } else if ( bd is BattleNight ) { + var shipNightBattleDetail = SelectBattleDetail( ( (BattleNight)bd ).NightBattle.BattleDetails, i + 12 ); + + + if ( shipNightBattleDetail.Any() ) { + builder.AppendLine( "《夜戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipNightBattleDetail ) ); + } + } + + + ToolTipInfo.SetToolTip( HPBars[i + 12], builder.ToString() ); if ( isEscaped ) HPBars[i + 12].BackColor = Color.Silver; else HPBars[i + 12].BackColor = SystemColors.Control; @@ -1507,6 +1345,23 @@ private void SetNightBattleEvent( PhaseNightBattle pd ) { } + private string FriendShipBattleDetail( BattleData bd, IEnumerable details ) { + + StringBuilder builder = new StringBuilder(); + foreach ( BattleDetail detail in details ) { + if ( detail != null ) { + builder.AppendLine( detail.BattleDescription() ); + } + } + return builder.ToString(); + + } + + + private IEnumerable SelectBattleDetail( List details, int index ) { + return details.Where( d => d.AttackerIndex == index || d.DefenderIndex == index ); + } + void ConfigurationChanged() { @@ -1540,55 +1395,6 @@ protected override string GetPersistString() { return "Battle"; } - private string FriendShipBattleDetail(BattleData bd, IEnumerable details) - { - - StringBuilder builder = new StringBuilder(); - foreach (BattleDetail detail in details) - { - if (detail != null) - { - builder.AppendLine(string.Format(detail.BattleDescription(), GetShipName(bd, detail.Attacker), GetShipName(bd, detail.Defender))); - } - } - return builder.ToString(); - - } - - private string GetShipName(BattleData bd, int i) - { - int index = i; - if (index > -1 && index < 6) - { - return bd.Initial.FriendFleet.MembersInstance[index].Name; - } - else if (index >= 6 && index < 12) - { - index -= 6; - return bd.Initial.EnemyMembersInstance[index].NameWithClass + " #" + (index + 1).ToString(); - } - else if (index >= 12 && index < 18) - { - index -= 12; - KCDatabase db = KCDatabase.Instance; - return db.Fleet[2].MembersInstance[index].Name; - } - return ""; - } - - private List SelectBattleDetail(List details, int index) - { - List results = new List(); - foreach (BattleDetail detail in details) - { - if (detail.Attacker.Equals(index) || detail.Defender.Equals(index)) - { - results.Add(detail); - } - } - return results; - } - } } From 32f80ab73c681365bf0012cb5070fee18879c810 Mon Sep 17 00:00:00 2001 From: xzk Date: Thu, 25 Aug 2016 09:28:10 +0800 Subject: [PATCH 16/20] Add battle description of air battle phase --- .../Data/Battle/BattleDetail.cs | 46 +++++++++++++++---- .../Data/Battle/Phase/PhaseAirBattle.cs | 46 +++++++++++++++++++ ElectronicObserver/Window/FormBattle.cs | 27 +++++++++++ 3 files changed, 110 insertions(+), 9 deletions(-) diff --git a/ElectronicObserver/Data/Battle/BattleDetail.cs b/ElectronicObserver/Data/Battle/BattleDetail.cs index f197e3ce1..00fb58b70 100644 --- a/ElectronicObserver/Data/Battle/BattleDetail.cs +++ b/ElectronicObserver/Data/Battle/BattleDetail.cs @@ -11,6 +11,8 @@ namespace ElectronicObserver.Data.Battle { /// public abstract class BattleDetail { + public static readonly int AIR_ATTACKER = -999; + protected int attackerIndex; protected int defenderIndex; public int[] Damages { get; protected set; } @@ -61,7 +63,11 @@ public BattleDetail( BattleData bd, int attackerIndex, int defenderIndex, int[] int[] slots; - if ( AttackerIndex < 6 ) { + if (attackerIndex.Equals(AIR_ATTACKER)) { + Attacker = null; + slots = null; + + } else if ( AttackerIndex < 6 ) { var atk = bd.Initial.FriendFleet.MembersInstance[AttackerIndex]; Attacker = atk.MasterShip; slots = atk.SlotMaster.ToArray(); @@ -94,18 +100,23 @@ public BattleDetail( BattleData bd, int attackerIndex, int defenderIndex, int[] /// /// 戦闘詳細の情報を出力します。 /// - public virtual string BattleDescription() { + public string BattleDescription() { StringBuilder builder = new StringBuilder(); - builder.Append( Attacker.NameWithClass ); - if ( 6 <= AttackerIndex && AttackerIndex < 12 ) - builder.Append( " #" ).Append( AttackerIndex - 6 + 1 ); + if (Attacker == null) { + //TODO please translate it to Japanese + builder.Append("Damage from air battle").AppendLine(); + } else { + builder.Append(Attacker.NameWithClass); + if (6 <= AttackerIndex && AttackerIndex < 12) + builder.Append(" #").Append(AttackerIndex - 6 + 1); - builder.Append( " → " ).Append( Defender.NameWithClass ); - if ( 6 <= DefenderIndex && DefenderIndex < 12 ) - builder.Append( " #" ).Append( DefenderIndex - 6 + 1 ); + builder.Append(" → ").Append(Defender.NameWithClass); + if (6 <= DefenderIndex && DefenderIndex < 12) + builder.Append(" #").Append(DefenderIndex - 6 + 1); - builder.AppendLine(); + builder.AppendLine(); + } if ( AttackType >= 0 ) builder.Append( "[" ).Append( GetAttackKind() ).Append( "] " ); @@ -175,4 +186,21 @@ protected override string GetAttackKind() { return Constants.GetNightAttackKind( AttackType ); } } + + public class BattleAirDetail : BattleDayDetail { + + public BattleAirDetail( BattleData bd, int defenderId, int[] damages, int[] criticalTypes ) + : base(bd, AIR_ATTACKER, defenderId, damages, criticalTypes, -1) { + + } + + protected override int CaclulateAttackKind(int[] slots, int attackerShipID, int defenderShipID) { + return -1; + } + + protected override string GetAttackKind() { + return null; + } + + } } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseAirBattle.cs b/ElectronicObserver/Data/Battle/Phase/PhaseAirBattle.cs index 41065f2c0..cde4647e8 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseAirBattle.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseAirBattle.cs @@ -43,6 +43,20 @@ public override void EmulateBattle( int[] hps, int[] damages ) { } } + { + + for (int i = 0; i < Damages.Length; i++) { + if (Damages[i] > 0) { + if (i < 6) { + // 0 in criticals stands both hit and miss, 1 stands for critical + BattleDetails.Add(new BattleAirDetail(_battleData, i + 1, new int[] { Damages[i] }, new int[] { Criticals[i] + 1 })); + } else if (i >= 12) { + BattleDetails.Add(new BattleAirDetail(_battleData, i + 1, new int[] { Damages[i] }, new int[] { Criticals[i] + 1 })); + } + } + } + } + CalculateAttackDamage( damages ); } @@ -249,6 +263,38 @@ public int[] Damages { } } } + public int[] Criticals { + get { + if (AirBattleData.api_stage3_combined()) { + int[] ret = new int[18]; + + int[] friend = (int[])AirBattleData.api_stage3.api_fcl_flag; + int[] enemy = (int[])AirBattleData.api_stage3.api_ecl_flag; + int[] escort = (int[])AirBattleData.api_stage3_combined.api_fcl_flag; + + for (int i = 0; i < 6; i++) { + ret[i] = Math.Max(friend[i + 1], 0); + ret[i + 6] = Math.Max(enemy[i + 1], 0); + ret[i + 12] = Math.Max(escort[i + 1], 0); + } + + return ret; + + } else { + int[] ret = new int[12]; + + int[] friend = (int[])AirBattleData.api_stage3.api_fcl_flag; + int[] enemy = (int[])AirBattleData.api_stage3.api_ecl_flag; + + for (int i = 0; i < 6; i++) { + ret[i] = Math.Max(friend[i + 1], 0); + ret[i + 6] = Math.Max(enemy[i + 1], 0); + } + + return ret; + } + } + } } } diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index 5ab7ce3dc..74116c125 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -769,6 +769,7 @@ private void SetHPNormal( BattleData bd ) { if ( bd is BattleNormalDay || bd is BattlePracticeDay ) { + var shipAirBattleDetail = SelectBattleDetail( ( (BattleDay)bd ).AirBattle.BattleDetails, i ); var shipOpeningASWDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningASW.BattleDetails, i ); var shipOpeningTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningTorpedo.BattleDetails, i ); var shipShelling1Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling1.BattleDetails, i ); @@ -776,6 +777,12 @@ private void SetHPNormal( BattleData bd ) { var shipShelling3Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling3.BattleDetails, i ); var shipTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).Torpedo.BattleDetails, i ); + if (shipAirBattleDetail.Any()) { + //TODO please translate it to Japanese + builder.AppendLine("《Air Battle》"); + builder.Append(FriendShipBattleDetail(bd, shipAirBattleDetail)); + } + if ( shipOpeningASWDetail.Any() ) { builder.AppendLine( "《開幕対潜》" ); builder.Append( FriendShipBattleDetail( bd, shipOpeningASWDetail ) ); @@ -896,6 +903,16 @@ private void SetHPCombined( BattleData bd ) { attackDamages[i] ); + if ( bd is BattleCombinedAirRaid ) { + var shipAirBattleDetail = SelectBattleDetail(((BattleDay)bd).AirBattle.BattleDetails, i); + + if (shipAirBattleDetail.Any()) { + //TODO please translate it to Japanese + builder.AppendLine("《Air Battle》"); + builder.Append(FriendShipBattleDetail(bd, shipAirBattleDetail)); + } + + } if ( bd is BattleCombinedWater ) { var shipShelling1Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling1.BattleDetails, i ); @@ -975,6 +992,16 @@ private void SetHPCombined( BattleData bd ) { attackDamages[i + 12] ); + if (bd is BattleCombinedAirRaid) { + var shipAirBattleDetail = SelectBattleDetail(((BattleDay)bd).AirBattle.BattleDetails, i); + + if (shipAirBattleDetail.Any()) { + //TODO please translate it to Japanese + builder.AppendLine("《Air Battle》"); + builder.Append(FriendShipBattleDetail(bd, shipAirBattleDetail)); + } + + } if ( bd is BattleCombinedNormalDay ) { var shipOpeningASWDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningASW.BattleDetails, i + 12 ); From 0f1be346ed2b07ba3f9f2c4d3589cce9e575f8ec Mon Sep 17 00:00:00 2001 From: Andante Date: Fri, 26 Aug 2016 01:25:31 +0900 Subject: [PATCH 17/20] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0zwei?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * PhaseAirBattle: 被雷撃・被爆撃フラグを追加、重複部分を統合 * PhaseShelling, PhaseNightBattle: 単発系カットインでエラーが発生する不具合を修正(defenderに -1 を含むため) * メッセージの日本語訳 * BattleDetail: 夜戦単発系カットインで空の要素が表示される不具合を修正 * BattleDetail: AttackType を受け取るように変更(雷撃/爆撃表示を行う) * FormBattle: "第n砲撃戦"→"第n次砲撃戦" * FormBattle: 通常艦隊航空戦・通常艦隊長距離空襲戦に対応 * FormBattle: 第一次砲撃戦で被弾しなかったとき、第二次砲撃戦で被弾しても表示されない不具合を修正 * FormBattle: 連合艦隊航空戦では2つの航空戦を表示するように変更 --- .../Data/Battle/BattleDetail.cs | 75 +++++---- .../Data/Battle/Phase/PhaseAirBattle.cs | 137 ++++++++--------- .../Data/Battle/Phase/PhaseNightBattle.cs | 2 +- .../Data/Battle/Phase/PhaseShelling.cs | 2 +- ElectronicObserver/Window/FormBattle.cs | 144 ++++++++++++------ 5 files changed, 206 insertions(+), 154 deletions(-) diff --git a/ElectronicObserver/Data/Battle/BattleDetail.cs b/ElectronicObserver/Data/Battle/BattleDetail.cs index 00fb58b70..c92064022 100644 --- a/ElectronicObserver/Data/Battle/BattleDetail.cs +++ b/ElectronicObserver/Data/Battle/BattleDetail.cs @@ -11,7 +11,7 @@ namespace ElectronicObserver.Data.Battle { /// public abstract class BattleDetail { - public static readonly int AIR_ATTACKER = -999; + public static readonly int AIR_ATTACKER = -999; protected int attackerIndex; protected int defenderIndex; @@ -42,7 +42,7 @@ public enum CriticalType { Miss = 0, Hit = 1, Critical = 2, - Unknown = -1 + Invalid = -1 } @@ -63,11 +63,11 @@ public BattleDetail( BattleData bd, int attackerIndex, int defenderIndex, int[] int[] slots; - if (attackerIndex.Equals(AIR_ATTACKER)) { - Attacker = null; - slots = null; + if ( attackerIndex.Equals( AIR_ATTACKER ) ) { + Attacker = null; + slots = null; - } else if ( AttackerIndex < 6 ) { + } else if ( AttackerIndex < 6 ) { var atk = bd.Initial.FriendFleet.MembersInstance[AttackerIndex]; Attacker = atk.MasterShip; slots = atk.SlotMaster.ToArray(); @@ -103,25 +103,30 @@ public BattleDetail( BattleData bd, int attackerIndex, int defenderIndex, int[] public string BattleDescription() { StringBuilder builder = new StringBuilder(); - if (Attacker == null) { - //TODO please translate it to Japanese - builder.Append("Damage from air battle").AppendLine(); - } else { - builder.Append(Attacker.NameWithClass); - if (6 <= AttackerIndex && AttackerIndex < 12) - builder.Append(" #").Append(AttackerIndex - 6 + 1); + if ( Attacker == null ) { + builder.Append( "敵航空隊 → " ).Append( Defender.NameWithClass ); + if ( 6 <= DefenderIndex && DefenderIndex < 12 ) + builder.Append( " #" ).Append( DefenderIndex - 6 + 1 ); - builder.Append(" → ").Append(Defender.NameWithClass); - if (6 <= DefenderIndex && DefenderIndex < 12) - builder.Append(" #").Append(DefenderIndex - 6 + 1); + } else { + builder.Append( Attacker.NameWithClass ); + if ( 6 <= AttackerIndex && AttackerIndex < 12 ) + builder.Append( " #" ).Append( AttackerIndex - 6 + 1 ); + + builder.Append( " → " ).Append( Defender.NameWithClass ); + if ( 6 <= DefenderIndex && DefenderIndex < 12 ) + builder.Append( " #" ).Append( DefenderIndex - 6 + 1 ); - builder.AppendLine(); - } + } + builder.AppendLine(); if ( AttackType >= 0 ) builder.Append( "[" ).Append( GetAttackKind() ).Append( "] " ); for ( int i = 0; i < Damages.Length; i++ ) { + if ( CriticalTypes[i] == CriticalType.Invalid ) // カットイン(主砲/主砲)、カットイン(主砲/副砲)時に発生する + continue; + if ( i > 0 ) builder.Append( " , " ); @@ -187,20 +192,32 @@ protected override string GetAttackKind() { } } - public class BattleAirDetail : BattleDayDetail { + /// + /// 航空戦における戦闘詳細データを保持します。 + /// + public class BattleAirDetail : BattleDayDetail { - public BattleAirDetail( BattleData bd, int defenderId, int[] damages, int[] criticalTypes ) - : base(bd, AIR_ATTACKER, defenderId, damages, criticalTypes, -1) { + public BattleAirDetail( BattleData bd, int defenderId, int[] damages, int[] criticalTypes, int attackType ) + : base( bd, AIR_ATTACKER, defenderId, damages, criticalTypes, attackType ) { - } + } - protected override int CaclulateAttackKind(int[] slots, int attackerShipID, int defenderShipID) { - return -1; - } + protected override int CaclulateAttackKind( int[] slots, int attackerShipID, int defenderShipID ) { + return -1; + } - protected override string GetAttackKind() { - return null; - } + protected override string GetAttackKind() { + switch ( AttackType ) { + case 1: + return "雷撃"; + case 2: + return "爆撃"; + case 3: + return "雷撃+爆撃"; + default: + return "不明"; + } + } - } + } } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseAirBattle.cs b/ElectronicObserver/Data/Battle/Phase/PhaseAirBattle.cs index cde4647e8..194ff3f36 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseAirBattle.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseAirBattle.cs @@ -35,27 +35,30 @@ public override void EmulateBattle( int[] hps, int[] damages ) { if ( !IsAvailable || !IsStage3Available ) return; - { - int[] dmg = Damages; - for ( int i = 0; i < hps.Length; i++ ) { - AddDamage( hps, i, dmg[i] ); - } + // キャッシュ + int[] torp = TorpedoFlags; + int[] bomb = BomberFlags; + int[] crit = Criticals; + int[] dmg = Damages; + + for ( int i = 0; i < hps.Length; i++ ) { + AddDamage( hps, i, dmg[i] ); } - { - for (int i = 0; i < Damages.Length; i++) { - if (Damages[i] > 0) { - if (i < 6) { - // 0 in criticals stands both hit and miss, 1 stands for critical - BattleDetails.Add(new BattleAirDetail(_battleData, i + 1, new int[] { Damages[i] }, new int[] { Criticals[i] + 1 })); - } else if (i >= 12) { - BattleDetails.Add(new BattleAirDetail(_battleData, i + 1, new int[] { Damages[i] }, new int[] { Criticals[i] + 1 })); - } - } - } - } + for ( int i = 0; i < dmg.Length; i++ ) { + if ( torp[i] > 0 || bomb[i] > 0 ) { + if ( i < 6 ) { + // 0 in criticals stands both hit and miss, 1 stands for critical + BattleDetails.Add( new BattleAirDetail( _battleData, i + 1, new int[] { dmg[i] }, new int[] { crit[i] + 1 }, ( torp[i] > 0 ? 1 : 0 ) | ( bomb[i] > 0 ? 2 : 0 ) ) ); + + } else if ( i >= 12 ) { + BattleDetails.Add( new BattleAirDetail( _battleData, i + 1, new int[] { dmg[i] }, new int[] { crit[i] + 1 }, ( torp[i] > 0 ? 1 : 0 ) | ( bomb[i] > 0 ? 2 : 0 ) ) ); + } + } + } + CalculateAttackDamage( damages ); @@ -228,73 +231,59 @@ public ShipData AACutInShip { /// public bool IsStage3Available { get { return StageFlag != null && StageFlag[2] != 0 && AirBattleData.api_stage3() && AirBattleData.api_stage3 != null; } } - /// - /// 各艦の被ダメージ - /// - public int[] Damages { - get { - if ( AirBattleData.api_stage3_combined() ) { - int[] ret = new int[18]; - int[] friend = (int[])AirBattleData.api_stage3.api_fdam; - int[] enemy = (int[])AirBattleData.api_stage3.api_edam; - int[] escort = (int[])AirBattleData.api_stage3_combined.api_fdam; - for ( int i = 0; i < 6; i++ ) { - ret[i] = Math.Max( friend[i + 1], 0 ); - ret[i + 6] = Math.Max( enemy[i + 1], 0 ); - ret[i + 12] = Math.Max( escort[i + 1], 0 ); - } + private int[] ConcatStage3Array( string friendName, string enemyName ) { + if ( AirBattleData.api_stage3_combined() ) { + int[] ret = new int[18]; - return ret; + int[] friend = (int[])AirBattleData.api_stage3[friendName]; + int[] enemy = (int[])AirBattleData.api_stage3[enemyName]; + int[] escort = (int[])AirBattleData.api_stage3_combined[friendName]; - } else { - int[] ret = new int[12]; + for ( int i = 0; i < 6; i++ ) { + ret[i] = Math.Max( friend[i + 1], 0 ); + ret[i + 6] = Math.Max( enemy[i + 1], 0 ); + ret[i + 12] = Math.Max( escort[i + 1], 0 ); + } - int[] friend = (int[])AirBattleData.api_stage3.api_fdam; - int[] enemy = (int[])AirBattleData.api_stage3.api_edam; + return ret; - for ( int i = 0; i < 6; i++ ) { - ret[i] = Math.Max( friend[i + 1], 0 ); - ret[i + 6] = Math.Max( enemy[i + 1], 0 ); - } + } else { + int[] ret = new int[12]; + + int[] friend = (int[])AirBattleData.api_stage3[friendName]; + int[] enemy = (int[])AirBattleData.api_stage3[enemyName]; - return ret; + for ( int i = 0; i < 6; i++ ) { + ret[i] = Math.Max( friend[i + 1], 0 ); + ret[i + 6] = Math.Max( enemy[i + 1], 0 ); } + + return ret; } } - public int[] Criticals { - get { - if (AirBattleData.api_stage3_combined()) { - int[] ret = new int[18]; - - int[] friend = (int[])AirBattleData.api_stage3.api_fcl_flag; - int[] enemy = (int[])AirBattleData.api_stage3.api_ecl_flag; - int[] escort = (int[])AirBattleData.api_stage3_combined.api_fcl_flag; - - for (int i = 0; i < 6; i++) { - ret[i] = Math.Max(friend[i + 1], 0); - ret[i + 6] = Math.Max(enemy[i + 1], 0); - ret[i + 12] = Math.Max(escort[i + 1], 0); - } - - return ret; - - } else { - int[] ret = new int[12]; - - int[] friend = (int[])AirBattleData.api_stage3.api_fcl_flag; - int[] enemy = (int[])AirBattleData.api_stage3.api_ecl_flag; - - for (int i = 0; i < 6; i++) { - ret[i] = Math.Max(friend[i + 1], 0); - ret[i + 6] = Math.Max(enemy[i + 1], 0); - } - - return ret; - } - } - } + + + /// + /// 被雷撃フラグ + /// + public int[] TorpedoFlags { get { return ConcatStage3Array( "api_frai_flag", "api_erai_flag" ); } } + + /// + /// 被爆撃フラグ + /// + public int[] BomberFlags { get { return ConcatStage3Array( "api_fbak_flag", "api_ebak_flag" ); } } + + /// + /// 各艦のクリティカルフラグ + /// + public int[] Criticals { get { return ConcatStage3Array( "api_fcl_flag", "api_ecl_flag" ); } } + + /// + /// 各艦の被ダメージ + /// + public int[] Damages { get { return ConcatStage3Array( "api_fdam", "api_edam" ); } } } } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs b/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs index 118f1ffda..75e1d844c 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseNightBattle.cs @@ -48,7 +48,7 @@ public override void EmulateBattle( int[] hps, int[] damages ) { AddDamage( hps, j, tempDamages[j] ); - BattleDetails.Add( new BattleNightDetail( _battleData, attackers[i] + ( isEscort && attackers[i] <= 6 ? 12 : 0 ), defenders.LastOrDefault() + ( isEscort && defenders.LastOrDefault() <= 6 ? 12 : 0 ), unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_sp_list[i] ) ); + BattleDetails.Add( new BattleNightDetail( _battleData, attackers[i] + ( isEscort && attackers[i] <= 6 ? 12 : 0 ), defenders.LastOrDefault( x => x != -1 ) + ( isEscort && defenders.LastOrDefault( x => x != -1 ) <= 6 ? 12 : 0 ), unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_sp_list[i] ) ); damages[GetIndex( attackers[i] )] += tempDamages.Sum(); } diff --git a/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs b/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs index e54ceaf14..644dd9d28 100644 --- a/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs +++ b/ElectronicObserver/Data/Battle/Phase/PhaseShelling.cs @@ -57,7 +57,7 @@ public override void EmulateBattle( int[] hps, int[] damages ) { AddDamage( hps, j, tempDamages[j] ); - BattleDetails.Add( new BattleDayDetail( _battleData, attackers[i] + ( isEscort && attackers[i] <= 6 ? 12 : 0 ), defenders.LastOrDefault() + ( isEscort && defenders.LastOrDefault() <= 6 ? 12 : 0 ), unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_at_type[i] ) ); + BattleDetails.Add( new BattleDayDetail( _battleData, attackers[i] + ( isEscort && attackers[i] <= 6 ? 12 : 0 ), defenders.LastOrDefault( x => x != -1 ) + ( isEscort && defenders.LastOrDefault( x => x != -1 ) <= 6 ? 12 : 0 ), unitDamages, (int[])ShellingData.api_cl_list[i], (int)ShellingData.api_at_type[i] ) ); damages[GetIndex( attackers[i] )] += tempDamages.Sum(); } diff --git a/ElectronicObserver/Window/FormBattle.cs b/ElectronicObserver/Window/FormBattle.cs index 74116c125..fc4574e44 100644 --- a/ElectronicObserver/Window/FormBattle.cs +++ b/ElectronicObserver/Window/FormBattle.cs @@ -769,7 +769,7 @@ private void SetHPNormal( BattleData bd ) { if ( bd is BattleNormalDay || bd is BattlePracticeDay ) { - var shipAirBattleDetail = SelectBattleDetail( ( (BattleDay)bd ).AirBattle.BattleDetails, i ); + var shipAirBattleDetail = SelectBattleDetail( ( (BattleDay)bd ).AirBattle.BattleDetails, i ); var shipOpeningASWDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningASW.BattleDetails, i ); var shipOpeningTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningTorpedo.BattleDetails, i ); var shipShelling1Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling1.BattleDetails, i ); @@ -777,12 +777,10 @@ private void SetHPNormal( BattleData bd ) { var shipShelling3Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling3.BattleDetails, i ); var shipTorpedoDetail = SelectBattleDetail( ( (BattleDay)bd ).Torpedo.BattleDetails, i ); - if (shipAirBattleDetail.Any()) { - //TODO please translate it to Japanese - builder.AppendLine("《Air Battle》"); - builder.Append(FriendShipBattleDetail(bd, shipAirBattleDetail)); - } - + if ( shipAirBattleDetail.Any() ) { + builder.AppendLine( "《航空戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattleDetail ) ); + } if ( shipOpeningASWDetail.Any() ) { builder.AppendLine( "《開幕対潜》" ); builder.Append( FriendShipBattleDetail( bd, shipOpeningASWDetail ) ); @@ -792,16 +790,16 @@ private void SetHPNormal( BattleData bd ) { builder.Append( FriendShipBattleDetail( bd, shipOpeningTorpedoDetail ) ); } if ( shipShelling1Detail.Any() ) { - builder.AppendLine( "《第一砲撃戦》" ); + builder.AppendLine( "《第一次砲撃戦》" ); builder.Append( FriendShipBattleDetail( bd, shipShelling1Detail ) ); - if ( shipShelling2Detail.Any() ) { - builder.AppendLine( "《第二砲撃戦》" ); - builder.Append( FriendShipBattleDetail( bd, shipShelling2Detail ) ); - } - if ( shipShelling3Detail.Any() ) { - builder.AppendLine( "《第三砲撃戦》" ); - builder.Append( FriendShipBattleDetail( bd, shipShelling3Detail ) ); - } + } + if ( shipShelling2Detail.Any() ) { + builder.AppendLine( "《第二次砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling2Detail ) ); + } + if ( shipShelling3Detail.Any() ) { + builder.AppendLine( "《第三次砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling3Detail ) ); } if ( shipTorpedoDetail.Any() ) { builder.AppendLine( "《雷撃戦》" ); @@ -818,6 +816,29 @@ private void SetHPNormal( BattleData bd ) { } + } else if ( bd is BattleAirBattle ) { + var shipAirBattle1Detail = SelectBattleDetail( ( (BattleCombinedAirBattle)bd ).AirBattle.BattleDetails, i ); + var shipAirBattle2Detail = SelectBattleDetail( ( (BattleCombinedAirBattle)bd ).AirBattle2.BattleDetails, i ); + + if ( shipAirBattle1Detail.Any() ) { + builder.AppendLine( "《第一次航空戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattle1Detail ) ); + } + if ( shipAirBattle2Detail.Any() ) { + builder.AppendLine( "《第二次航空戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattle2Detail ) ); + } + + + } else if ( bd is BattleAirRaid ) { + var shipAirBattleDetail = SelectBattleDetail( ( (BattleDay)bd ).AirBattle.BattleDetails, i ); + + if ( shipAirBattleDetail.Any() ) { + builder.AppendLine( "《空襲戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattleDetail ) ); + } + + } ToolTipInfo.SetToolTip( HPBars[i], builder.ToString() ); @@ -903,29 +924,18 @@ private void SetHPCombined( BattleData bd ) { attackDamages[i] ); - if ( bd is BattleCombinedAirRaid ) { - var shipAirBattleDetail = SelectBattleDetail(((BattleDay)bd).AirBattle.BattleDetails, i); - - if (shipAirBattleDetail.Any()) { - //TODO please translate it to Japanese - builder.AppendLine("《Air Battle》"); - builder.Append(FriendShipBattleDetail(bd, shipAirBattleDetail)); - } - - } if ( bd is BattleCombinedWater ) { var shipShelling1Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling1.BattleDetails, i ); var shipShelling2Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling2.BattleDetails, i ); if ( shipShelling1Detail.Any() ) { - builder.AppendLine( "《第一砲撃戦》" ); + builder.AppendLine( "《第一次砲撃戦》" ); builder.Append( FriendShipBattleDetail( bd, shipShelling1Detail ) ); - - if ( shipShelling2Detail.Any() ) { - builder.AppendLine( "《第二砲撃戦》" ); - builder.Append( FriendShipBattleDetail( bd, shipShelling2Detail ) ); - } + } + if ( shipShelling2Detail.Any() ) { + builder.AppendLine( "《第二次砲撃戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipShelling2Detail ) ); } @@ -934,16 +944,37 @@ private void SetHPCombined( BattleData bd ) { var shipShelling3Detail = SelectBattleDetail( ( (BattleDay)bd ).Shelling3.BattleDetails, i ); if ( shipShelling2Detail.Any() ) { - builder.AppendLine( "《第二砲撃戦》" ); + builder.AppendLine( "《第二次砲撃戦》" ); builder.Append( FriendShipBattleDetail( bd, shipShelling2Detail ) ); + } + if ( shipShelling3Detail.Any() ) { + builder.AppendLine( "《第三次砲撃戦》" ); + builder.AppendLine( FriendShipBattleDetail( bd, shipShelling3Detail ) ); + } - if ( shipShelling3Detail.Any() ) { - builder.AppendLine( "《第三砲撃戦》" ); - builder.AppendLine( FriendShipBattleDetail( bd, shipShelling3Detail ) ); - } + + } else if ( bd is BattleCombinedAirBattle ) { + var shipAirBattle1Detail = SelectBattleDetail( ( (BattleCombinedAirBattle)bd ).AirBattle.BattleDetails, i ); + var shipAirBattle2Detail = SelectBattleDetail( ( (BattleCombinedAirBattle)bd ).AirBattle2.BattleDetails, i ); + + if ( shipAirBattle1Detail.Any() ) { + builder.AppendLine( "《第一次航空戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattle1Detail ) ); + } + if ( shipAirBattle2Detail.Any() ) { + builder.AppendLine( "《第二次航空戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattle2Detail ) ); } + } else if ( bd is BattleCombinedAirRaid ) { + var shipAirBattleDetail = SelectBattleDetail( ( (BattleDay)bd ).AirBattle.BattleDetails, i ); + + if ( shipAirBattleDetail.Any() ) { + builder.AppendLine( "《空襲戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattleDetail ) ); + } + } @@ -992,16 +1023,6 @@ private void SetHPCombined( BattleData bd ) { attackDamages[i + 12] ); - if (bd is BattleCombinedAirRaid) { - var shipAirBattleDetail = SelectBattleDetail(((BattleDay)bd).AirBattle.BattleDetails, i); - - if (shipAirBattleDetail.Any()) { - //TODO please translate it to Japanese - builder.AppendLine("《Air Battle》"); - builder.Append(FriendShipBattleDetail(bd, shipAirBattleDetail)); - } - - } if ( bd is BattleCombinedNormalDay ) { var shipOpeningASWDetail = SelectBattleDetail( ( (BattleDay)bd ).OpeningASW.BattleDetails, i + 12 ); @@ -1019,7 +1040,7 @@ private void SetHPCombined( BattleData bd ) { builder.Append( FriendShipBattleDetail( bd, shipOpeningTorpedoDetail ) ); } if ( shipShelling1Detail.Any() ) { - builder.AppendLine( "《第一砲撃戦》" ); + builder.AppendLine( "《第一次砲撃戦》" ); builder.Append( FriendShipBattleDetail( bd, shipShelling1Detail ) ); } if ( shipTorpedoDetail.Any() ) { @@ -1044,7 +1065,7 @@ private void SetHPCombined( BattleData bd ) { builder.Append( FriendShipBattleDetail( bd, shipOpeningTorpedoDetail ) ); } if ( shipShelling3Detail.Any() ) { - builder.AppendLine( "《第三砲撃戦》" ); + builder.AppendLine( "《第三次砲撃戦》" ); builder.Append( FriendShipBattleDetail( bd, shipShelling3Detail ) ); } if ( shipTorpedoDetail.Any() ) { @@ -1061,9 +1082,34 @@ private void SetHPCombined( BattleData bd ) { builder.AppendLine( "《夜戦》" ); builder.Append( FriendShipBattleDetail( bd, shipNightBattleDetail ) ); } + + + } else if ( bd is BattleCombinedAirBattle ) { + var shipAirBattle1Detail = SelectBattleDetail( ( (BattleCombinedAirBattle)bd ).AirBattle.BattleDetails, i + 12 ); + var shipAirBattle2Detail = SelectBattleDetail( ( (BattleCombinedAirBattle)bd ).AirBattle2.BattleDetails, i + 12 ); + + if ( shipAirBattle1Detail.Any() ) { + builder.AppendLine( "《第一次航空戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattle1Detail ) ); + } + if ( shipAirBattle2Detail.Any() ) { + builder.AppendLine( "《第二次航空戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattle2Detail ) ); + } + + + } else if ( bd is BattleCombinedAirRaid ) { + var shipAirBattleDetail = SelectBattleDetail( ( (BattleDay)bd ).AirBattle.BattleDetails, i + 12 ); + + if ( shipAirBattleDetail.Any() ) { + builder.AppendLine( "《空襲戦》" ); + builder.Append( FriendShipBattleDetail( bd, shipAirBattleDetail ) ); + } + } + ToolTipInfo.SetToolTip( HPBars[i + 12], builder.ToString() ); if ( isEscaped ) HPBars[i + 12].BackColor = Color.Silver; From d4ac46b9ece8070a140670f3e69d734bb405af03 Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 27 Aug 2016 01:20:10 +0900 Subject: [PATCH 18/20] =?UTF-8?q?=E5=9F=BA=E5=9C=B0=E8=88=AA=E7=A9=BA?= =?UTF-8?q?=E9=9A=8A=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/Assets.zip | Bin 174742 -> 175956 bytes .../Assets/Parameter/AircraftCost.png | Bin 0 -> 563 bytes .../Assets/Parameter/AircraftDistance.png | Bin 0 -> 292 bytes ElectronicObserver/Data/BaseAirCorpsData.cs | 10 +- .../Data/BaseAirCorpsSquadron.cs | 18 +- .../Other/Information/apilist.txt | 1 + .../Resource/ResourceManager.cs | 4 + ElectronicObserver/Utility/Data/Calculator.cs | 2 + .../Window/Control/ShipStatusEquipment.cs | 43 ++ .../DialogAlbumMasterEquipment.Designer.cs | 399 +++++++++++------- .../Dialog/DialogAlbumMasterEquipment.cs | 30 ++ .../Window/FormBaseAirCorps.Designer.cs | 40 +- ElectronicObserver/Window/FormBaseAirCorps.cs | 305 +++++++++++-- .../Window/FormBaseAirCorps.resx | 3 + 14 files changed, 645 insertions(+), 210 deletions(-) create mode 100644 ElectronicObserver/Assets/Parameter/AircraftCost.png create mode 100644 ElectronicObserver/Assets/Parameter/AircraftDistance.png diff --git a/ElectronicObserver/Assets.zip b/ElectronicObserver/Assets.zip index eb3382c529399d0efc06f06f6ab01006321b1fdd..46f8c35b4906a8d245df4385a23e65bc7227b02f 100644 GIT binary patch delta 1478 zcmZWpX;4#V6n*c$AUh$FVn9JGiz48LRm8EBRS*%ZNM#XOsu=B{11QzDAX{~eRmvk= z0znoPQL&1Frcenk7`0L=SZ%S3NWsymD7e%#2)o?4B)~V)>q;xz8al~Wpv->UAoJXqDB}#6ZGW)MFseau$&P1goIls~y3ZN! zKt4xQI7j2>)$S75GB?+{xzGJVw`u=Tx3s$8_pG@}zpbM!R-#_h^RXQZeeP_#V{^7u z-7I?`E(&(NynS@EHX(S?&#LFc74u!r2>fq|E*KxoKAjVF>nl+;wSy~iK2eaT_RNmq;R(~6d49hd?8&lw+UZ^2)bS2yNl31P!*2J^1vQt(2kv!}boeevxcyUZ zW%eRX@4TIx6xB^Z8!H&8EOPoazG&uhDlJqk9uViad~saSS2r|4mU(VqZKX(5oYfY7 zB2#%&`E_<-PlBvxl95;HWM(K?vrnb?#adXFmNm97{$aneU7hutJjSEGDSuvjO!>?d zyMZ)GP`6*c<@-T+~GMq+9*OZ&TuC)01Ud{tkb z&!F6Akd~Kd&4hpF!F&ssO(TX8nl4%&m5@_rWl>Hpghy~N-+=M5X0P!7b<#L|?2YEqYfuAP_r{+F*u z+*S&9md=!uu94CS>KlBa7QGi5O`AlE^1R;`siaZJM*@&lx_@}n$ zpw<@o7+y+-ZWz&bHkZN&aQe9(I7EMvle#>wTdjwxek+(i<&#lfL+SP!QRF-A%-WsK*fM5Z*Qk!wT?Frb3yc3RMQ z)r7XjV_I~BOQx97Hu%1X$>S4mFSpe*|J-4Oxa8ghMru z0s%pI^#Iso<^i($XTe&K&a^H8JR1Q5j6Vo#7{jm^$bK;xVedg$$;5`gpdt=I9Mix2 zUu1wChe*T6kveKBhSrkxs-tws9$RY3r~iHx@(z<%WTLgv7PISM9F`x36%ZZs8e>^U zm~UfWG10(Ztp`u)h!H-D*MrU&u)t$EV1~Izzz?ph(bK(0NDn_z4y$L-#HnqFxfY5br1T-ms9|D=IYrYsr)EfKgfA78!9EBgItVl_ zdUC$acjs$5Xas>@!jRIG3Iah0f*OXUR;EksfA3a)I?wMp=Q;m#x$jm3+ujF0@l5lj z_HgI^^p>CCsZk1k^GdQ=p%hv(bUwQO zLonHIA)2ZQ+K@=ML2hbV;(XQBLnz`XyAsj`8dA3-g48zTqiCIO+fae2Z-RCsjMi-^ zfMP?^<_?(9yeaAV4w&(3OVq;Rwm)6$gaO*0LgSp_AJv7>l60CWIl>;^DdRSk-M~NJ#riUUt*cU-X-+PdY zxdShl>fK|IiPjx1#mgcxd_4r3vKndXr@7==lU2 scw8uvhTge*gdg diff --git a/ElectronicObserver/Assets/Parameter/AircraftCost.png b/ElectronicObserver/Assets/Parameter/AircraftCost.png new file mode 100644 index 0000000000000000000000000000000000000000..dfea1f5711bdb9d45b92ef4d18dac1fef1d5a88e GIT binary patch literal 563 zcmV-30?hr1P)WFU8GbZ8()Nlj2>E@cM*00EatL_t(I%e|AmOB_KM z#((p%vomX9vjpV~dhU4#R!?H0DupRC9jlXWW*6gj@j9nTfl(v@fRp15klMrjD8*U&N{5M z%ryi`NrE6CiY(4KqR0|OjwG4PK{;UI*MgsaJ^$b~hi|^2wMJ{51Dvx|D$^8;FHrz; zOZt`Nm4POWt-j)@@E5ap!sTV3i;I+gzfZ4s#@fcVklA3f*&GNsZXW~iWB-r%zS|aQ znsR>rk6!QO#>D!5-M3mTthIzT#9Es#XC38onMTqWXt)IEbUIY4RSFXYZu=U?F-eke zdUiT22IvgX?RKfvYD`T|<)&$^Y5#6xjN#EB4U&*OXJ|tz<;v3~TvG)ePaMaTlF~Cs z00_T?{=WN}oP(udOOclZDR002ovPDHLkV1lf+ B@iYJc literal 0 HcmV?d00001 diff --git a/ElectronicObserver/Assets/Parameter/AircraftDistance.png b/ElectronicObserver/Assets/Parameter/AircraftDistance.png new file mode 100644 index 0000000000000000000000000000000000000000..ac9d769f0b555b47899ea890ad86fbd2b978918c GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)1(cP|;!?2T+8wz$3Dl zfq`2Xgc%uT&5-~KvX^-Jy0YKnmSs?5lm6$w7bql~84^+AoS&PUnpXnkGB7w7r6!i7 zrYMwWmSiZnd-?{X=%um)#XCG*978NlZw=bb*WkdR{mhQnJl+1%&9ilrH%t3TIqkTU zxkZ?B%Tv}rtf8i%TP4aTzrAs`?{1PzwztZ+4rT^VMuv}_xv>lkk4^5gOnTH>%j>CW zy8QIPM3WVL7piBvzfF_4 c7x%z;PV4*9&%gK;mVzAX>FVdQ&MBb@01e(_ApigX literal 0 HcmV?d00001 diff --git a/ElectronicObserver/Data/BaseAirCorpsData.cs b/ElectronicObserver/Data/BaseAirCorpsData.cs index 0862ae5de..62f781cd0 100644 --- a/ElectronicObserver/Data/BaseAirCorpsData.cs +++ b/ElectronicObserver/Data/BaseAirCorpsData.cs @@ -68,7 +68,11 @@ private set { /// public IDDictionary Squadrons { get; private set; } - + public BaseAirCorpsSquadron this[int i] { + get { + return Squadrons[i]; + } + } /// /// 配置転換中の装備固有IDリスト @@ -120,10 +124,10 @@ public override void LoadFromResponse( string apiname, dynamic data ) { break; case "api_req_air_corps/set_plane": { - var prev = Squadrons.Values.Select( sq => sq != null ? sq.EquipmentID : 0 ).ToArray(); + var prev = Squadrons.Values.Select( sq => sq != null ? sq.EquipmentMasterID : 0 ).ToArray(); SetSquadrons( apiname, data.api_plane_info ); - foreach ( var deleted in prev.Except( Squadrons.Values.Select( sq => sq != null && sq.State == 1 ? sq.EquipmentID : 0 ) ) ) { + foreach ( var deleted in prev.Except( Squadrons.Values.Select( sq => sq != null && sq.State == 1 ? sq.EquipmentMasterID : 0 ) ) ) { var eq = KCDatabase.Instance.Equipments[deleted]; if ( eq != null ) { diff --git a/ElectronicObserver/Data/BaseAirCorpsSquadron.cs b/ElectronicObserver/Data/BaseAirCorpsSquadron.cs index dcc53bee5..a95e3ed7e 100644 --- a/ElectronicObserver/Data/BaseAirCorpsSquadron.cs +++ b/ElectronicObserver/Data/BaseAirCorpsSquadron.cs @@ -35,7 +35,7 @@ public int State { /// /// 装備固有ID /// - public int EquipmentID { + public int EquipmentMasterID { get { return (int)RawData.api_slotid; } @@ -46,7 +46,17 @@ public int EquipmentID { /// public EquipmentData EquipmentInstance { get { - return KCDatabase.Instance.Equipments[EquipmentID]; + return KCDatabase.Instance.Equipments[EquipmentMasterID]; + } + } + + /// + /// 装備ID + /// + public int EquipmentID { + get { + var eq = EquipmentInstance; + return eq != null ? eq.EquipmentID : -1; } } @@ -56,7 +66,7 @@ public EquipmentData EquipmentInstance { public EquipmentDataMaster EquipmentInstanceMaster { get { var eq = EquipmentInstance; - return eq != null ? eq.MasterEquipment : null; + return eq != null ? eq.MasterEquipment : null; } } @@ -98,7 +108,7 @@ public int Condition { public override void LoadFromResponse( string apiname, dynamic data ) { int prevState = RawData != null ? State : 0; - + base.LoadFromResponse( apiname, (object)data ); // 配置転換中になったとき diff --git a/ElectronicObserver/Other/Information/apilist.txt b/ElectronicObserver/Other/Information/apilist.txt index 3c4a60107..51cd7c4d2 100644 --- a/ElectronicObserver/Other/Information/apilist.txt +++ b/ElectronicObserver/Other/Information/apilist.txt @@ -566,6 +566,7 @@ api_port/port :母港情報 api_base_convert_slot :配置転換中の装備固有ID 1つ以上あるときのみ存在 api_event_object :('16 夏イベ版データ) api_m_flag : + api_base_conver_slot:配置転換中の装備固有ID 1つ以上あるときのみ存在 api_m_flag2 :0=なし 1=ギミック解除SE再生 api_parallel_quest_count :最大受領可能任務数 diff --git a/ElectronicObserver/Resource/ResourceManager.cs b/ElectronicObserver/Resource/ResourceManager.cs index a55c0773e..4ae937fc9 100644 --- a/ElectronicObserver/Resource/ResourceManager.cs +++ b/ElectronicObserver/Resource/ResourceManager.cs @@ -131,6 +131,8 @@ public enum IconContent { ParameterAircraft, ParameterSpeed, ParameterRange, + ParameterAircraftCost, + ParameterAircraftDistance, BattleFormationEnemyLineAhead, BattleFormationEnemyDoubleLine, BattleFormationEnemyDiamond, @@ -328,6 +330,8 @@ private void LoadFromArchive( string path ) { LoadImageFromArchive( Icons, archive, mstpath + @"Parameter/Aircraft.png", "Parameter_Aircraft" ); LoadImageFromArchive( Icons, archive, mstpath + @"Parameter/Speed.png", "Parameter_Speed" ); LoadImageFromArchive( Icons, archive, mstpath + @"Parameter/Range.png", "Parameter_Range" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Parameter/AircraftCost.png", "Parameter_AircraftCost" ); + LoadImageFromArchive( Icons, archive, mstpath + @"Parameter/AircraftDistance.png", "Parameter_AircraftDistance" ); LoadImageFromArchive( Icons, archive, mstpath + @"Battle/FormationEnemy01.png", "Battle_FormationEnemy_LineAhead" ); LoadImageFromArchive( Icons, archive, mstpath + @"Battle/FormationEnemy02.png", "Battle_FormationEnemy_DoubleLine" ); diff --git a/ElectronicObserver/Utility/Data/Calculator.cs b/ElectronicObserver/Utility/Data/Calculator.cs index bb1489172..dbcc7f339 100644 --- a/ElectronicObserver/Utility/Data/Calculator.cs +++ b/ElectronicObserver/Utility/Data/Calculator.cs @@ -957,6 +957,8 @@ public static bool IsAircraft( int equipmentID, bool containsRecon, bool contain case 25: //オートジャイロ case 26: //対潜哨戒機 case 45: //水上戦闘機 + case 47: //陸上攻撃機 + case 48: //局地戦闘機 return true; case 9: //艦上偵察機 diff --git a/ElectronicObserver/Window/Control/ShipStatusEquipment.cs b/ElectronicObserver/Window/Control/ShipStatusEquipment.cs index 3d5b8ed5d..6a5adfa72 100644 --- a/ElectronicObserver/Window/Control/ShipStatusEquipment.cs +++ b/ElectronicObserver/Window/Control/ShipStatusEquipment.cs @@ -473,6 +473,49 @@ public void SetSlotList( int shipID, int[] slot ) { PropertyChanged(); } + public void SetSlotList( BaseAirCorpsData corps ) { + + int slotLength = corps != null ? corps.Squadrons.Count() : 0; + + if ( SlotList.Length != slotLength ) { + SlotList = new SlotItem[slotLength]; + for ( int i = 0; i < SlotList.Length; i++ ) { + SlotList[i] = new SlotItem(); + } + } + + for ( int i = 0; i < SlotList.Length; i++ ) { + var squadron = corps[i + 1]; + var eq = squadron.EquipmentInstance; + + switch ( squadron.State ) { + case 0: // 未配属 + case 2: // 配置転換中 + default: + SlotList[i].EquipmentID = -1; + SlotList[i].AircraftCurrent = + SlotList[i].AircraftMax = + SlotList[i].Level = + SlotList[i].AircraftLevel = 0; + break; + case 1: // 配属済み + if ( eq == null ) + goto case 0; + SlotList[i].EquipmentID = eq.EquipmentID; + SlotList[i].AircraftCurrent = squadron.AircraftCurrent; + SlotList[i].AircraftMax = squadron.AircraftMax; + SlotList[i].Level = eq.Level; + SlotList[i].AircraftLevel = eq.AircraftLevel; + break; + } + + } + + SlotSize = slotLength; + + PropertyChanged(); + } + private void PropertyChanged() { diff --git a/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.Designer.cs b/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.Designer.cs index 22edd5f36..df7a9288a 100644 --- a/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.Designer.cs +++ b/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.Designer.cs @@ -38,16 +38,26 @@ private void InitializeComponent() { this.EquipmentView_Type = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.EquipmentView_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.BasePanelEquipment = new System.Windows.Forms.Panel(); + this.DefaultSlots = new System.Windows.Forms.ListBox(); + this.TableEquipmentName = new System.Windows.Forms.FlowLayoutPanel(); + this.TableParameterSub = new System.Windows.Forms.TableLayoutPanel(); + this.TableArsenal = new System.Windows.Forms.TableLayoutPanel(); + this.TableParameterMain = new System.Windows.Forms.TableLayoutPanel(); + this.EquipmentImage = new System.Windows.Forms.PictureBox(); + this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); + this.SaveCSVDialog = new System.Windows.Forms.SaveFileDialog(); + this.TableAircraft = new System.Windows.Forms.TableLayoutPanel(); + this.TitleAircraftDistance = new ElectronicObserver.Window.Control.ImageLabel(); + this.AircraftDistance = new ElectronicObserver.Window.Control.ImageLabel(); + this.AircraftCost = new ElectronicObserver.Window.Control.ImageLabel(); + this.TitleAircraftCost = new ElectronicObserver.Window.Control.ImageLabel(); this.AlbumNo = new ElectronicObserver.Window.Control.ImageLabel(); this.imageLabel1 = new ElectronicObserver.Window.Control.ImageLabel(); this.imageLabel2 = new ElectronicObserver.Window.Control.ImageLabel(); - this.DefaultSlots = new System.Windows.Forms.ListBox(); this.Description = new ElectronicObserver.Window.Control.ImageLabel(); - this.TableEquipmentName = new System.Windows.Forms.FlowLayoutPanel(); this.EquipmentType = new ElectronicObserver.Window.Control.ImageLabel(); this.EquipmentName = new ElectronicObserver.Window.Control.ImageLabel(); this.EquipmentID = new ElectronicObserver.Window.Control.ImageLabel(); - this.TableParameterSub = new System.Windows.Forms.TableLayoutPanel(); this.imageLabel76 = new ElectronicObserver.Window.Control.ImageLabel(); this.Rarity = new ElectronicObserver.Window.Control.ImageLabel(); this.Range = new ElectronicObserver.Window.Control.ImageLabel(); @@ -56,14 +66,12 @@ private void InitializeComponent() { this.imageLabel71 = new ElectronicObserver.Window.Control.ImageLabel(); this.TitleRange = new ElectronicObserver.Window.Control.ImageLabel(); this.TitleSpeed = new ElectronicObserver.Window.Control.ImageLabel(); - this.TableArsenal = new System.Windows.Forms.TableLayoutPanel(); this.MaterialBauxite = new ElectronicObserver.Window.Control.ImageLabel(); this.MaterialFuel = new ElectronicObserver.Window.Control.ImageLabel(); this.MaterialSteel = new ElectronicObserver.Window.Control.ImageLabel(); this.MaterialAmmo = new ElectronicObserver.Window.Control.ImageLabel(); this.imageLabel59 = new ElectronicObserver.Window.Control.ImageLabel(); this.imageLabel45 = new ElectronicObserver.Window.Control.ImageLabel(); - this.TableParameterMain = new System.Windows.Forms.TableLayoutPanel(); this.Bomber = new ElectronicObserver.Window.Control.ImageLabel(); this.TitleBomber = new ElectronicObserver.Window.Control.ImageLabel(); this.LOS = new ElectronicObserver.Window.Control.ImageLabel(); @@ -83,9 +91,6 @@ private void InitializeComponent() { this.Evasion = new ElectronicObserver.Window.Control.ImageLabel(); this.TitleAccuracy = new ElectronicObserver.Window.Control.ImageLabel(); this.Accuracy = new ElectronicObserver.Window.Control.ImageLabel(); - this.EquipmentImage = new System.Windows.Forms.PictureBox(); - this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); - this.SaveCSVDialog = new System.Windows.Forms.SaveFileDialog(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -98,6 +103,7 @@ private void InitializeComponent() { this.TableArsenal.SuspendLayout(); this.TableParameterMain.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.EquipmentImage)).BeginInit(); + this.TableAircraft.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -232,6 +238,7 @@ private void InitializeComponent() { // // BasePanelEquipment // + this.BasePanelEquipment.Controls.Add(this.TableAircraft); this.BasePanelEquipment.Controls.Add(this.AlbumNo); this.BasePanelEquipment.Controls.Add(this.imageLabel1); this.BasePanelEquipment.Controls.Add(this.imageLabel2); @@ -250,6 +257,219 @@ private void InitializeComponent() { this.BasePanelEquipment.Size = new System.Drawing.Size(546, 456); this.BasePanelEquipment.TabIndex = 0; // + // DefaultSlots + // + this.DefaultSlots.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.DefaultSlots.BackColor = System.Drawing.SystemColors.Control; + this.DefaultSlots.Cursor = System.Windows.Forms.Cursors.Hand; + this.DefaultSlots.FormattingEnabled = true; + this.DefaultSlots.HorizontalScrollbar = true; + this.DefaultSlots.ItemHeight = 15; + this.DefaultSlots.Location = new System.Drawing.Point(124, 74); + this.DefaultSlots.Name = "DefaultSlots"; + this.DefaultSlots.SelectionMode = System.Windows.Forms.SelectionMode.None; + this.DefaultSlots.Size = new System.Drawing.Size(153, 184); + this.DefaultSlots.TabIndex = 21; + this.DefaultSlots.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DefaultSlots_MouseDown); + // + // TableEquipmentName + // + this.TableEquipmentName.AutoSize = true; + this.TableEquipmentName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableEquipmentName.Controls.Add(this.EquipmentType); + this.TableEquipmentName.Controls.Add(this.EquipmentName); + this.TableEquipmentName.Location = new System.Drawing.Point(3, 25); + this.TableEquipmentName.Name = "TableEquipmentName"; + this.TableEquipmentName.Size = new System.Drawing.Size(262, 22); + this.TableEquipmentName.TabIndex = 19; + // + // TableParameterSub + // + this.TableParameterSub.AutoSize = true; + this.TableParameterSub.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableParameterSub.ColumnCount = 4; + this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); + this.TableParameterSub.Controls.Add(this.imageLabel76, 3, 1); + this.TableParameterSub.Controls.Add(this.Rarity, 3, 0); + this.TableParameterSub.Controls.Add(this.Range, 1, 1); + this.TableParameterSub.Controls.Add(this.Speed, 1, 0); + this.TableParameterSub.Controls.Add(this.imageLabel72, 2, 1); + this.TableParameterSub.Controls.Add(this.imageLabel71, 2, 0); + this.TableParameterSub.Controls.Add(this.TitleRange, 0, 1); + this.TableParameterSub.Controls.Add(this.TitleSpeed, 0, 0); + this.TableParameterSub.Location = new System.Drawing.Point(3, 275); + this.TableParameterSub.Name = "TableParameterSub"; + this.TableParameterSub.RowCount = 2; + this.TableParameterSub.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterSub.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterSub.Size = new System.Drawing.Size(234, 44); + this.TableParameterSub.TabIndex = 15; + this.TableParameterSub.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableParameterSub_CellPaint); + // + // TableArsenal + // + this.TableArsenal.AutoSize = true; + this.TableArsenal.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableArsenal.ColumnCount = 5; + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); + this.TableArsenal.Controls.Add(this.MaterialBauxite, 4, 0); + this.TableArsenal.Controls.Add(this.MaterialFuel, 1, 0); + this.TableArsenal.Controls.Add(this.MaterialSteel, 3, 0); + this.TableArsenal.Controls.Add(this.MaterialAmmo, 2, 0); + this.TableArsenal.Controls.Add(this.imageLabel59, 0, 0); + this.TableArsenal.Location = new System.Drawing.Point(283, 275); + this.TableArsenal.Name = "TableArsenal"; + this.TableArsenal.RowCount = 1; + this.TableArsenal.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableArsenal.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableArsenal.Size = new System.Drawing.Size(223, 22); + this.TableArsenal.TabIndex = 9; + this.TableArsenal.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableArsenal_CellPaint); + // + // TableParameterMain + // + this.TableParameterMain.AutoSize = true; + this.TableParameterMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableParameterMain.ColumnCount = 2; + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.Controls.Add(this.Bomber, 1, 9); + this.TableParameterMain.Controls.Add(this.TitleBomber, 0, 9); + this.TableParameterMain.Controls.Add(this.LOS, 1, 7); + this.TableParameterMain.Controls.Add(this.ASW, 1, 5); + this.TableParameterMain.Controls.Add(this.imageLabel14, 1, 0); + this.TableParameterMain.Controls.Add(this.TitleLOS, 0, 7); + this.TableParameterMain.Controls.Add(this.Armor, 1, 4); + this.TableParameterMain.Controls.Add(this.AA, 1, 3); + this.TableParameterMain.Controls.Add(this.Torpedo, 1, 2); + this.TableParameterMain.Controls.Add(this.Firepower, 1, 1); + this.TableParameterMain.Controls.Add(this.TitleFirepower, 0, 1); + this.TableParameterMain.Controls.Add(this.TitleTorpedo, 0, 2); + this.TableParameterMain.Controls.Add(this.TitleAA, 0, 3); + this.TableParameterMain.Controls.Add(this.TitleArmor, 0, 4); + this.TableParameterMain.Controls.Add(this.TitleASW, 0, 5); + this.TableParameterMain.Controls.Add(this.TitleEvasion, 0, 6); + this.TableParameterMain.Controls.Add(this.Evasion, 1, 6); + this.TableParameterMain.Controls.Add(this.TitleAccuracy, 0, 8); + this.TableParameterMain.Controls.Add(this.Accuracy, 1, 8); + this.TableParameterMain.Location = new System.Drawing.Point(3, 49); + this.TableParameterMain.Name = "TableParameterMain"; + this.TableParameterMain.RowCount = 10; + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.Size = new System.Drawing.Size(110, 216); + this.TableParameterMain.TabIndex = 5; + this.TableParameterMain.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableParameterMain_CellPaint); + // + // EquipmentImage + // + this.EquipmentImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.EquipmentImage.Location = new System.Drawing.Point(283, 3); + this.EquipmentImage.Name = "EquipmentImage"; + this.EquipmentImage.Size = new System.Drawing.Size(260, 260); + this.EquipmentImage.TabIndex = 4; + this.EquipmentImage.TabStop = false; + // + // ToolTipInfo + // + this.ToolTipInfo.AutoPopDelay = 30000; + this.ToolTipInfo.InitialDelay = 500; + this.ToolTipInfo.ReshowDelay = 100; + this.ToolTipInfo.ShowAlways = true; + // + // SaveCSVDialog + // + this.SaveCSVDialog.Filter = "CSV|*.csv|File|*"; + this.SaveCSVDialog.Title = "CSVに出力"; + // + // TableAircraft + // + this.TableAircraft.AutoSize = true; + this.TableAircraft.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableAircraft.ColumnCount = 4; + this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.TableAircraft.Controls.Add(this.TitleAircraftDistance, 2, 0); + this.TableAircraft.Controls.Add(this.AircraftDistance, 3, 0); + this.TableAircraft.Controls.Add(this.AircraftCost, 1, 0); + this.TableAircraft.Controls.Add(this.TitleAircraftCost, 0, 0); + this.TableAircraft.Location = new System.Drawing.Point(3, 325); + this.TableAircraft.Name = "TableAircraft"; + this.TableAircraft.RowCount = 1; + this.TableAircraft.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.TableAircraft.Size = new System.Drawing.Size(253, 22); + this.TableAircraft.TabIndex = 26; + this.TableAircraft.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableAircraft_CellPaint); + // + // TitleAircraftDistance + // + this.TitleAircraftDistance.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.TitleAircraftDistance.BackColor = System.Drawing.Color.Transparent; + this.TitleAircraftDistance.Location = new System.Drawing.Point(118, 3); + this.TitleAircraftDistance.Name = "TitleAircraftDistance"; + this.TitleAircraftDistance.Size = new System.Drawing.Size(92, 16); + this.TitleAircraftDistance.TabIndex = 27; + this.TitleAircraftDistance.Text = "戦闘行動半径"; + this.TitleAircraftDistance.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // AircraftDistance + // + this.AircraftDistance.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.AircraftDistance.BackColor = System.Drawing.Color.Transparent; + this.AircraftDistance.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.AircraftDistance.Location = new System.Drawing.Point(228, 3); + this.AircraftDistance.Name = "AircraftDistance"; + this.AircraftDistance.Size = new System.Drawing.Size(22, 16); + this.AircraftDistance.TabIndex = 27; + this.AircraftDistance.Text = "123"; + this.AircraftDistance.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // AircraftCost + // + this.AircraftCost.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.AircraftCost.BackColor = System.Drawing.Color.Transparent; + this.AircraftCost.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.AircraftCost.Location = new System.Drawing.Point(90, 3); + this.AircraftCost.Name = "AircraftCost"; + this.AircraftCost.Size = new System.Drawing.Size(22, 16); + this.AircraftCost.TabIndex = 18; + this.AircraftCost.Text = "123"; + this.AircraftCost.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // TitleAircraftCost + // + this.TitleAircraftCost.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.TitleAircraftCost.BackColor = System.Drawing.Color.Transparent; + this.TitleAircraftCost.Location = new System.Drawing.Point(3, 3); + this.TitleAircraftCost.Name = "TitleAircraftCost"; + this.TitleAircraftCost.Size = new System.Drawing.Size(69, 16); + this.TitleAircraftCost.TabIndex = 17; + this.TitleAircraftCost.Text = "配備コスト"; + this.TitleAircraftCost.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // AlbumNo // this.AlbumNo.AutoSize = false; @@ -281,22 +501,6 @@ private void InitializeComponent() { this.imageLabel2.TabIndex = 24; this.imageLabel2.Text = "図鑑番号:"; // - // DefaultSlots - // - this.DefaultSlots.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.DefaultSlots.BackColor = System.Drawing.SystemColors.Control; - this.DefaultSlots.Cursor = System.Windows.Forms.Cursors.Hand; - this.DefaultSlots.FormattingEnabled = true; - this.DefaultSlots.HorizontalScrollbar = true; - this.DefaultSlots.ItemHeight = 15; - this.DefaultSlots.Location = new System.Drawing.Point(124, 74); - this.DefaultSlots.Name = "DefaultSlots"; - this.DefaultSlots.SelectionMode = System.Windows.Forms.SelectionMode.None; - this.DefaultSlots.Size = new System.Drawing.Size(153, 184); - this.DefaultSlots.TabIndex = 21; - this.DefaultSlots.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DefaultSlots_MouseDown); - // // Description // this.Description.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -314,17 +518,6 @@ private void InitializeComponent() { "て普及しています。\r\n"; this.Description.TextAlign = System.Drawing.ContentAlignment.TopLeft; // - // TableEquipmentName - // - this.TableEquipmentName.AutoSize = true; - this.TableEquipmentName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableEquipmentName.Controls.Add(this.EquipmentType); - this.TableEquipmentName.Controls.Add(this.EquipmentName); - this.TableEquipmentName.Location = new System.Drawing.Point(3, 25); - this.TableEquipmentName.Name = "TableEquipmentName"; - this.TableEquipmentName.Size = new System.Drawing.Size(262, 22); - this.TableEquipmentName.TabIndex = 19; - // // EquipmentType // this.EquipmentType.BackColor = System.Drawing.Color.Transparent; @@ -354,32 +547,6 @@ private void InitializeComponent() { this.EquipmentID.TabIndex = 18; this.EquipmentID.Text = "123"; // - // TableParameterSub - // - this.TableParameterSub.AutoSize = true; - this.TableParameterSub.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableParameterSub.ColumnCount = 4; - this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); - this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); - this.TableParameterSub.Controls.Add(this.imageLabel76, 3, 1); - this.TableParameterSub.Controls.Add(this.Rarity, 3, 0); - this.TableParameterSub.Controls.Add(this.Range, 1, 1); - this.TableParameterSub.Controls.Add(this.Speed, 1, 0); - this.TableParameterSub.Controls.Add(this.imageLabel72, 2, 1); - this.TableParameterSub.Controls.Add(this.imageLabel71, 2, 0); - this.TableParameterSub.Controls.Add(this.TitleRange, 0, 1); - this.TableParameterSub.Controls.Add(this.TitleSpeed, 0, 0); - this.TableParameterSub.Location = new System.Drawing.Point(3, 300); - this.TableParameterSub.Name = "TableParameterSub"; - this.TableParameterSub.RowCount = 2; - this.TableParameterSub.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterSub.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterSub.Size = new System.Drawing.Size(234, 44); - this.TableParameterSub.TabIndex = 15; - this.TableParameterSub.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableParameterSub_CellPaint); - // // imageLabel76 // this.imageLabel76.Anchor = System.Windows.Forms.AnchorStyles.Right; @@ -387,7 +554,7 @@ private void InitializeComponent() { this.imageLabel76.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; this.imageLabel76.Location = new System.Drawing.Point(209, 25); this.imageLabel76.Name = "imageLabel76"; - this.imageLabel76.Size = new System.Drawing.Size(22, 16); + this.imageLabel76.Size = new System.Drawing.Size(19, 16); this.imageLabel76.TabIndex = 17; this.imageLabel76.Text = "123"; this.imageLabel76.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -399,7 +566,7 @@ private void InitializeComponent() { this.Rarity.BackColor = System.Drawing.Color.Transparent; this.Rarity.Location = new System.Drawing.Point(157, 3); this.Rarity.Name = "Rarity"; - this.Rarity.Size = new System.Drawing.Size(74, 16); + this.Rarity.Size = new System.Drawing.Size(38, 16); this.Rarity.TabIndex = 16; this.Rarity.Text = "123"; this.Rarity.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -411,7 +578,7 @@ private void InitializeComponent() { this.Range.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; this.Range.Location = new System.Drawing.Point(85, 25); this.Range.Name = "Range"; - this.Range.Size = new System.Drawing.Size(22, 16); + this.Range.Size = new System.Drawing.Size(19, 16); this.Range.TabIndex = 16; this.Range.Text = "123"; this.Range.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -424,7 +591,7 @@ private void InitializeComponent() { this.Speed.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; this.Speed.Location = new System.Drawing.Point(85, 3); this.Speed.Name = "Speed"; - this.Speed.Size = new System.Drawing.Size(22, 16); + this.Speed.Size = new System.Drawing.Size(19, 16); this.Speed.TabIndex = 16; this.Speed.Text = "123"; this.Speed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -435,7 +602,7 @@ private void InitializeComponent() { this.imageLabel72.BackColor = System.Drawing.Color.Transparent; this.imageLabel72.Location = new System.Drawing.Point(113, 25); this.imageLabel72.Name = "imageLabel72"; - this.imageLabel72.Size = new System.Drawing.Size(38, 16); + this.imageLabel72.Size = new System.Drawing.Size(26, 16); this.imageLabel72.TabIndex = 16; this.imageLabel72.Text = "-"; this.imageLabel72.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -475,30 +642,6 @@ private void InitializeComponent() { this.TitleSpeed.Text = "速力"; this.TitleSpeed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // TableArsenal - // - this.TableArsenal.AutoSize = true; - this.TableArsenal.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableArsenal.ColumnCount = 5; - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.TableArsenal.Controls.Add(this.MaterialBauxite, 4, 0); - this.TableArsenal.Controls.Add(this.MaterialFuel, 1, 0); - this.TableArsenal.Controls.Add(this.MaterialSteel, 3, 0); - this.TableArsenal.Controls.Add(this.MaterialAmmo, 2, 0); - this.TableArsenal.Controls.Add(this.imageLabel59, 0, 0); - this.TableArsenal.Location = new System.Drawing.Point(300, 300); - this.TableArsenal.Name = "TableArsenal"; - this.TableArsenal.RowCount = 1; - this.TableArsenal.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableArsenal.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableArsenal.Size = new System.Drawing.Size(223, 22); - this.TableArsenal.TabIndex = 9; - this.TableArsenal.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableArsenal_CellPaint); - // // MaterialBauxite // this.MaterialBauxite.Anchor = System.Windows.Forms.AnchorStyles.Left; @@ -565,54 +708,6 @@ private void InitializeComponent() { this.imageLabel45.TabIndex = 6; this.imageLabel45.Text = "ID:"; // - // TableParameterMain - // - this.TableParameterMain.AutoSize = true; - this.TableParameterMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableParameterMain.ColumnCount = 2; - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.Controls.Add(this.Bomber, 1, 9); - this.TableParameterMain.Controls.Add(this.TitleBomber, 0, 9); - this.TableParameterMain.Controls.Add(this.LOS, 1, 7); - this.TableParameterMain.Controls.Add(this.ASW, 1, 5); - this.TableParameterMain.Controls.Add(this.imageLabel14, 1, 0); - this.TableParameterMain.Controls.Add(this.TitleLOS, 0, 7); - this.TableParameterMain.Controls.Add(this.Armor, 1, 4); - this.TableParameterMain.Controls.Add(this.AA, 1, 3); - this.TableParameterMain.Controls.Add(this.Torpedo, 1, 2); - this.TableParameterMain.Controls.Add(this.Firepower, 1, 1); - this.TableParameterMain.Controls.Add(this.TitleFirepower, 0, 1); - this.TableParameterMain.Controls.Add(this.TitleTorpedo, 0, 2); - this.TableParameterMain.Controls.Add(this.TitleAA, 0, 3); - this.TableParameterMain.Controls.Add(this.TitleArmor, 0, 4); - this.TableParameterMain.Controls.Add(this.TitleASW, 0, 5); - this.TableParameterMain.Controls.Add(this.TitleEvasion, 0, 6); - this.TableParameterMain.Controls.Add(this.Evasion, 1, 6); - this.TableParameterMain.Controls.Add(this.TitleAccuracy, 0, 8); - this.TableParameterMain.Controls.Add(this.Accuracy, 1, 8); - this.TableParameterMain.Location = new System.Drawing.Point(3, 49); - this.TableParameterMain.Name = "TableParameterMain"; - this.TableParameterMain.RowCount = 10; - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.Size = new System.Drawing.Size(110, 216); - this.TableParameterMain.TabIndex = 5; - this.TableParameterMain.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableParameterMain_CellPaint); - // // Bomber // this.Bomber.Anchor = System.Windows.Forms.AnchorStyles.Right; @@ -834,27 +929,6 @@ private void InitializeComponent() { this.Accuracy.Text = "123"; this.Accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // EquipmentImage - // - this.EquipmentImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.EquipmentImage.Location = new System.Drawing.Point(283, 3); - this.EquipmentImage.Name = "EquipmentImage"; - this.EquipmentImage.Size = new System.Drawing.Size(260, 260); - this.EquipmentImage.TabIndex = 4; - this.EquipmentImage.TabStop = false; - // - // ToolTipInfo - // - this.ToolTipInfo.AutoPopDelay = 30000; - this.ToolTipInfo.InitialDelay = 500; - this.ToolTipInfo.ReshowDelay = 100; - this.ToolTipInfo.ShowAlways = true; - // - // SaveCSVDialog - // - this.SaveCSVDialog.Filter = "CSV|*.csv|File|*"; - this.SaveCSVDialog.Title = "CSVに出力"; - // // DialogAlbumMasterEquipment // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -888,6 +962,8 @@ private void InitializeComponent() { this.TableParameterMain.ResumeLayout(false); this.TableParameterMain.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.EquipmentImage)).EndInit(); + this.TableAircraft.ResumeLayout(false); + this.TableAircraft.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -954,5 +1030,10 @@ private void InitializeComponent() { private System.Windows.Forms.DataGridViewImageColumn EquipmentView_Icon; private System.Windows.Forms.DataGridViewTextBoxColumn EquipmentView_Type; private System.Windows.Forms.DataGridViewTextBoxColumn EquipmentView_Name; + private System.Windows.Forms.TableLayoutPanel TableAircraft; + private Control.ImageLabel TitleAircraftDistance; + private Control.ImageLabel AircraftDistance; + private Control.ImageLabel AircraftCost; + private Control.ImageLabel TitleAircraftCost; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.cs b/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.cs index 183012f54..29270782a 100644 --- a/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.cs +++ b/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.cs @@ -1,6 +1,7 @@ using ElectronicObserver.Data; using ElectronicObserver.Resource; using ElectronicObserver.Resource.Record; +using ElectronicObserver.Utility.Data; using ElectronicObserver.Utility.Mathematics; using ElectronicObserver.Window.Control; using ElectronicObserver.Window.Support; @@ -33,6 +34,8 @@ public DialogAlbumMasterEquipment() { TitleBomber.ImageList = TitleSpeed.ImageList = TitleRange.ImageList = + TitleAircraftCost.ImageList = + TitleAircraftDistance.ImageList = Rarity.ImageList = MaterialFuel.ImageList = MaterialAmmo.ImageList = @@ -53,6 +56,8 @@ public DialogAlbumMasterEquipment() { TitleBomber.ImageIndex = (int)ResourceManager.IconContent.ParameterBomber; TitleSpeed.ImageIndex = (int)ResourceManager.IconContent.ParameterSpeed; TitleRange.ImageIndex = (int)ResourceManager.IconContent.ParameterRange; + TitleAircraftCost.ImageIndex = (int)ResourceManager.IconContent.ParameterAircraftCost; + TitleAircraftDistance.ImageIndex = (int)ResourceManager.IconContent.ParameterAircraftDistance; MaterialFuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel; MaterialAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo; MaterialSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel; @@ -238,6 +243,14 @@ private void UpdateAlbumPage( int equipmentID ) { SetParameterText( Accuracy, eq.Accuracy ); SetParameterText( Bomber, eq.Bomber ); + if ( eq.CategoryType == 48 ) { + TitleAccuracy.Text = "対爆"; + TitleEvasion.Text = "迎撃"; + } else { + TitleAccuracy.Text = "命中"; + TitleEvasion.Text = "回避"; + } + TableParameterMain.ResumeLayout(); @@ -252,6 +265,19 @@ private void UpdateAlbumPage( int equipmentID ) { TableParameterSub.ResumeLayout(); + // aircraft + if ( Calculator.IsAircraft( equipmentID, true, true ) ) { + TableAircraft.SuspendLayout(); + AircraftCost.Text = eq.AircraftCost.ToString(); + ToolTipInfo.SetToolTip( AircraftCost, "配備時のボーキ消費:" + ( ( Calculator.IsAircraft( equipmentID, false ) ? 18 : 4 ) * eq.AircraftCost ) ); + AircraftDistance.Text = eq.AircraftDistance.ToString(); + TableAircraft.ResumeLayout(); + TableAircraft.Visible = true; + } else { + TableAircraft.Visible = false; + } + + //default equipment DefaultSlots.BeginUpdate(); DefaultSlots.Items.Clear(); @@ -356,6 +382,9 @@ private void TableArsenal_CellPaint( object sender, TableLayoutCellPaintEventArg e.Graphics.DrawLine( Pens.Silver, e.CellBounds.X, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 ); } + private void TableAircraft_CellPaint( object sender, TableLayoutCellPaintEventArgs e ) { + e.Graphics.DrawLine( Pens.Silver, e.CellBounds.X, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 ); + } @@ -483,5 +512,6 @@ private void DialogAlbumMasterEquipment_FormClosed( object sender, FormClosedEve } + } } diff --git a/ElectronicObserver/Window/FormBaseAirCorps.Designer.cs b/ElectronicObserver/Window/FormBaseAirCorps.Designer.cs index 4b83d2748..90da0e48e 100644 --- a/ElectronicObserver/Window/FormBaseAirCorps.Designer.cs +++ b/ElectronicObserver/Window/FormBaseAirCorps.Designer.cs @@ -23,24 +23,42 @@ protected override void Dispose( bool disposing ) { /// the contents of this method with the code editor. /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.components = new System.ComponentModel.Container(); + this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); + this.TableMember = new System.Windows.Forms.TableLayoutPanel(); this.SuspendLayout(); // - // label1 + // ToolTipInfo // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 9); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(41, 15); - this.label1.TabIndex = 0; - this.label1.Text = "label1"; + this.ToolTipInfo.AutoPopDelay = 60000; + this.ToolTipInfo.InitialDelay = 500; + this.ToolTipInfo.ReshowDelay = 100; + this.ToolTipInfo.ShowAlways = true; + // + // TableMember + // + this.TableMember.AutoSize = true; + this.TableMember.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableMember.ColumnCount = 5; + this.TableMember.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableMember.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableMember.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableMember.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableMember.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableMember.Location = new System.Drawing.Point(0, 0); + this.TableMember.Name = "TableMember"; + this.TableMember.RowCount = 1; + this.TableMember.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F)); + this.TableMember.Size = new System.Drawing.Size(0, 21); + this.TableMember.TabIndex = 0; + this.TableMember.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableMember_CellPaint); // // FormBaseAirCorps // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScroll = true; this.ClientSize = new System.Drawing.Size(300, 200); - this.Controls.Add(this.label1); + this.Controls.Add(this.TableMember); this.DoubleBuffered = true; this.Font = new System.Drawing.Font("Meiryo UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; @@ -55,6 +73,8 @@ private void InitializeComponent() { #endregion - private System.Windows.Forms.Label label1; + private System.Windows.Forms.ToolTip ToolTipInfo; + private System.Windows.Forms.TableLayoutPanel TableMember; + } } \ No newline at end of file diff --git a/ElectronicObserver/Window/FormBaseAirCorps.cs b/ElectronicObserver/Window/FormBaseAirCorps.cs index 74318f1ca..d7e7b6f11 100644 --- a/ElectronicObserver/Window/FormBaseAirCorps.cs +++ b/ElectronicObserver/Window/FormBaseAirCorps.cs @@ -2,17 +2,274 @@ using ElectronicObserver.Resource; using ElectronicObserver.Utility.Data; using ElectronicObserver.Utility.Mathematics; +using ElectronicObserver.Window.Control; using System; +using System.Drawing; using System.Linq; using System.Text; +using System.Windows.Forms; using WeifenLuo.WinFormsUI.Docking; namespace ElectronicObserver.Window { public partial class FormBaseAirCorps : DockContent { + + private class TableBaseAirCorpsControl { + + public ImageLabel Name; + public ImageLabel ActionKind; + public ImageLabel AirSuperiority; + public ImageLabel Distance; + public ShipStatusEquipment Squadrons; + + public ToolTip ToolTipInfo; + + public TableBaseAirCorpsControl( FormBaseAirCorps parent ) { + + #region Initialize + + Name = new ImageLabel(); + Name.Text = "*"; + Name.Anchor = AnchorStyles.Left; + Name.TextAlign = ContentAlignment.MiddleLeft; + Name.ImageAlign = ContentAlignment.MiddleRight; + Name.ImageList = ResourceManager.Instance.Icons; + Name.Padding = new Padding( 0, 1, 0, 1 ); + Name.Margin = new Padding( 2, 0, 2, 0 ); + Name.AutoSize = true; + Name.Visible = false; + + ActionKind = new ImageLabel(); + ActionKind.Text = "*"; + ActionKind.Anchor = AnchorStyles.Left; + ActionKind.TextAlign = ContentAlignment.MiddleLeft; + ActionKind.ImageAlign = ContentAlignment.MiddleCenter; + //ActionKind.ImageList = + ActionKind.Padding = new Padding( 0, 1, 0, 1 ); + ActionKind.Margin = new Padding( 2, 0, 2, 0 ); + ActionKind.AutoSize = true; + ActionKind.Visible = false; + + AirSuperiority = new ImageLabel(); + AirSuperiority.Text = "*"; + AirSuperiority.Anchor = AnchorStyles.Left; + AirSuperiority.TextAlign = ContentAlignment.MiddleLeft; + AirSuperiority.ImageAlign = ContentAlignment.MiddleLeft; + AirSuperiority.ImageList = ResourceManager.Instance.Equipments; + AirSuperiority.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedFighter; + AirSuperiority.Padding = new Padding( 0, 1, 0, 1 ); + AirSuperiority.Margin = new Padding( 2, 0, 2, 0 ); + AirSuperiority.AutoSize = true; + AirSuperiority.Visible = false; + + Distance = new ImageLabel(); + Distance.Text = "*"; + Distance.Anchor = AnchorStyles.Left; + Distance.TextAlign = ContentAlignment.MiddleLeft; + Distance.ImageAlign = ContentAlignment.MiddleLeft; + Distance.ImageList = ResourceManager.Instance.Icons; + Distance.ImageIndex = (int)ResourceManager.IconContent.ParameterAircraftDistance; + Distance.Padding = new Padding( 0, 1, 0, 1 ); + Distance.Margin = new Padding( 2, 0, 2, 0 ); + Distance.AutoSize = true; + Distance.Visible = false; + + Squadrons = new ShipStatusEquipment(); + Squadrons.Anchor = AnchorStyles.Left; + Squadrons.Padding = new Padding( 0, 2, 0, 1 ); + Squadrons.Margin = new Padding( 2, 0, 2, 0 ); + Squadrons.Size = new Size( 40, 20 ); + Squadrons.AutoSize = true; + Squadrons.Visible = false; + Squadrons.ResumeLayout(); + + ConfigurationChanged( parent ); + + ToolTipInfo = parent.ToolTipInfo; + + #endregion + + } + + + public TableBaseAirCorpsControl( FormBaseAirCorps parent, TableLayoutPanel table, int row ) + : this( parent ) { + AddToTable( table, row ); + } + + public void AddToTable( TableLayoutPanel table, int row ) { + + table.SuspendLayout(); + table.Controls.Add( Name, 0, row ); + table.Controls.Add( ActionKind, 1, row ); + table.Controls.Add( AirSuperiority, 2, row ); + table.Controls.Add( Distance, 3, row ); + table.Controls.Add( Squadrons, 4, row ); + table.ResumeLayout(); + + #region set RowStyle + RowStyle rs = new RowStyle( SizeType.Absolute, 21 ); + + if ( table.RowStyles.Count > row ) + table.RowStyles[row] = rs; + else + while ( table.RowStyles.Count <= row ) + table.RowStyles.Add( rs ); + #endregion + } + + + public void Update( int baseAirCorpsID ) { + + KCDatabase db = KCDatabase.Instance; + var corps = db.BaseAirCorps[baseAirCorpsID]; + + if ( corps == null ) { + baseAirCorpsID = -1; + + } else { + + Name.Text = corps.Name; + + // state + if ( corps.Squadrons.Values.Any( sq => sq != null && sq.AircraftCurrent < sq.AircraftMax ) ) { + // 未補給 + Name.ImageAlign = ContentAlignment.MiddleRight; + Name.ImageIndex = (int)ResourceManager.IconContent.FleetNotReplenished; + ToolTipInfo.SetToolTip( Name, "未補給" ); + + } else if ( corps.Squadrons.Values.Any( sq => sq != null && sq.Condition > 1 ) ) { + // 疲労 + int tired = corps.Squadrons.Values.Max( sq => sq != null ? sq.Condition : 0 ); + + if ( tired == 2 ) { + Name.ImageAlign = ContentAlignment.MiddleRight; + Name.ImageIndex = (int)ResourceManager.IconContent.ConditionTired; + ToolTipInfo.SetToolTip( Name, "疲労" ); + + } else { + Name.ImageAlign = ContentAlignment.MiddleRight; + Name.ImageIndex = (int)ResourceManager.IconContent.ConditionVeryTired; + ToolTipInfo.SetToolTip( Name, "過労" ); + + } + + } else { + Name.ImageAlign = ContentAlignment.MiddleCenter; + Name.ImageIndex = -1; + ToolTipInfo.SetToolTip( Name, null ); + + } + + + ActionKind.Text = "[" + Constants.GetBaseAirCorpsActionKind( corps.ActionKind ) + "]"; + + { + int airSuperiority = Calculator.GetAirSuperiority( corps ); + 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 ), + (int)( airSuperiority / 1.5 ), + Math.Max( (int)( airSuperiority * 1.5 - 1 ), 0 ), + Math.Max( (int)( airSuperiority * 3.0 - 1 ), 0 ) ) ); + } + + Distance.Text = corps.Distance.ToString(); + + Squadrons.SetSlotList( corps ); + ToolTipInfo.SetToolTip( Squadrons, GetEquipmentString( corps ) ); + + } + + + Name.Visible = + ActionKind.Visible = + AirSuperiority.Visible = + Distance.Visible = + Squadrons.Visible = + baseAirCorpsID != -1; + } + + + public void ConfigurationChanged( FormBaseAirCorps parent ) { + var mainfont = Utility.Configuration.Config.UI.MainFont; + var subfont = Utility.Configuration.Config.UI.SubFont; + + Name.Font = mainfont; + ActionKind.Font = mainfont; + AirSuperiority.Font = mainfont; + Distance.Font = mainfont; + Squadrons.Font = subfont; + } + + + private string GetEquipmentString( BaseAirCorpsData corps ) { + var sb = new StringBuilder(); + + if ( corps == null ) + return "(未開放)\r\n"; + + foreach ( var squadron in corps.Squadrons.Values ) { + if ( squadron == null ) + continue; + + var eq = squadron.EquipmentInstance; + + switch ( squadron.State ) { + case 0: // 未配属 + default: + sb.AppendLine( "(なし)" ); + break; + + case 1: // 配属済み + if ( eq == null ) + goto case 0; + sb.AppendFormat( "[{0}/{1}] ", + squadron.AircraftCurrent, + squadron.AircraftMax ); + + switch ( squadron.Condition ) { + case 1: + default: + break; + case 2: + sb.Append( "[疲労] " ); + break; + case 3: + sb.Append( "[過労] " ); + break; + } + + sb.AppendLine( eq.NameWithLevel ); + break; + + case 2: // 配置転換中 + sb.AppendFormat( "配置転換中 (開始時刻: {0})\r\n", + DateTimeHelper.TimeToCSVString( squadron.RelocatedTime ) ); + break; + } + } + + return sb.ToString(); + } + + } + + + private TableBaseAirCorpsControl[] ControlMember; + public FormBaseAirCorps( FormMain parent ) { InitializeComponent(); + + ControlMember = new TableBaseAirCorpsControl[3]; + TableMember.SuspendLayout(); + for ( int i = 0; i < ControlMember.Length; i++ ) { + ControlMember[i] = new TableBaseAirCorpsControl( this, TableMember, i ); + } + TableMember.ResumeLayout(); + ConfigurationChanged(); Icon = ResourceManager.ImageToIcon( ResourceManager.Instance.Icons.Images[(int)ResourceManager.IconContent.FormBaseAirCorps] ); @@ -35,57 +292,37 @@ private void FormBaseAirCorps_Load( object sender, EventArgs e ) { private void ConfigurationChanged() { - // undone - } + var c = Utility.Configuration.Config; - void Updated( string apiname, dynamic data ) { - - var sb = new StringBuilder(); + Font = c.UI.MainFont; - var aircorps = KCDatabase.Instance.BaseAirCorps.Values; + foreach ( var control in ControlMember ) + control.ConfigurationChanged( this ); - foreach ( var corp in aircorps ) { - sb.AppendFormat( "{0} [{1}] 制空: {2}\r\n", corp.Name, Constants.GetBaseAirCorpsActionKind( corp.ActionKind ), Calculator.GetAirSuperiority( corp ) ); + } - foreach ( var sq in corp.Squadrons.Values ) { - var eq = sq.EquipmentInstance; - switch ( sq.State ) { - case 0: - sb.AppendLine( "  (未配属)" ); - break; - case 1: - sb.AppendFormat( "  {0} {1}/{2}\r\n", eq != null ? eq.NameWithLevel : "(未配属)", sq.AircraftCurrent, sq.AircraftMax ); - break; - case 2: - sb.AppendFormat( "  (配置転換中) {0}\r\n", DateTimeHelper.TimeToCSVString( sq.RelocatedTime ) ); - break; - } - } - sb.AppendLine(); - } + void Updated( string apiname, dynamic data ) { - sb.AppendLine(); + var db = KCDatabase.Instance; - var relocated = BaseAirCorpsData.RelocatedEquipments; - if ( relocated.Any() ) { - sb.AppendLine( "配置転換中装備:" ); - foreach ( var eqid in relocated ) { - var eq = KCDatabase.Instance.Equipments[eqid]; - sb.AppendFormat( "  {0} {1}\r\n", eq.NameWithLevel, eq.RelocatedTime ); - } + TableMember.SuspendLayout(); + for ( int i = 0; i < ControlMember.Length; i++ ) { + ControlMember[i].Update( i + 1 ); } + TableMember.ResumeLayout(); - label1.Text = sb.ToString(); } + private void TableMember_CellPaint( object sender, TableLayoutCellPaintEventArgs e ) { + e.Graphics.DrawLine( Pens.Silver, e.CellBounds.X, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 ); + } protected override string GetPersistString() { return "BaseAirCorps"; } - } } diff --git a/ElectronicObserver/Window/FormBaseAirCorps.resx b/ElectronicObserver/Window/FormBaseAirCorps.resx index 1af7de150..823b989af 100644 --- a/ElectronicObserver/Window/FormBaseAirCorps.resx +++ b/ElectronicObserver/Window/FormBaseAirCorps.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file From 0c801381cf6cbc186e13cb00196c8fdf6db75298 Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 27 Aug 2016 11:13:50 +0900 Subject: [PATCH 19/20] =?UTF-8?q?=E8=A3=85=E5=82=99=E4=B8=80=E8=A6=A7?= =?UTF-8?q?=EF=BC=9A=E9=85=8D=E7=BD=AE=E8=BB=A2=E6=8F=9B=E4=B8=AD=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=82=92=E5=8F=AF=E8=83=BD=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 防空戦での局地戦闘機の制空値計算式に対応 * 偵察機補正はまだ --- .../Data/EquipmentDataMaster.cs | 4 +-- ElectronicObserver/Utility/Data/Calculator.cs | 17 ++++++++---- .../Window/Dialog/DialogEquipmentList.cs | 27 +++++++++++++++++++ 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/ElectronicObserver/Data/EquipmentDataMaster.cs b/ElectronicObserver/Data/EquipmentDataMaster.cs index 11f029573..b51f5dfab 100644 --- a/ElectronicObserver/Data/EquipmentDataMaster.cs +++ b/ElectronicObserver/Data/EquipmentDataMaster.cs @@ -91,14 +91,14 @@ public int ASW { } /// - /// 命中 + /// 命中 / 対爆 /// public int Accuracy { get { return (int)RawData.api_houm; } } /// - /// 回避 + /// 回避 / 迎撃 /// public int Evasion { get { return (int)RawData.api_houk; } diff --git a/ElectronicObserver/Utility/Data/Calculator.cs b/ElectronicObserver/Utility/Data/Calculator.cs index dbcc7f339..2777c47ab 100644 --- a/ElectronicObserver/Utility/Data/Calculator.cs +++ b/ElectronicObserver/Utility/Data/Calculator.cs @@ -64,8 +64,9 @@ public static int GetParameterFromLevel( int min, int max, int lv ) { /// 搭載機数。 /// 艦載機熟練度。既定値は 0 です。 /// 改修レベル。既定値は 0 です。 + /// 基地航空隊による防空戦かどうか。 /// - public static int GetAirSuperiority( int equipmentID, int count, int aircraftLevel = 0, int level = 0 ) { + public static int GetAirSuperiority( int equipmentID, int count, int aircraftLevel = 0, int level = 0, bool isAirDefense = false ) { if ( count <= 0 ) return 0; @@ -78,8 +79,14 @@ public static int GetAirSuperiority( int equipmentID, int count, int aircraftLev if ( !AircraftLevelBonus.ContainsKey( category ) ) return 0; - double interceptorBonus = category == 48 ? ( eq.Evasion * 1.5 ) : 0; // 局地戦闘機の迎撃補正 double levelBonus = LevelBonus.ContainsKey( category ) ? LevelBonus[category] : 0; // 改修レベル補正 + double interceptorBonus = 0; // 局地戦闘機の迎撃補正 + if ( category == 48 ) { + if ( isAirDefense ) + interceptorBonus = eq.Accuracy * 2 + eq.Evasion; + else + interceptorBonus = eq.Evasion * 1.5; + } return (int)( ( eq.AA + levelBonus * level + interceptorBonus ) * Math.Sqrt( count ) + Math.Sqrt( AircraftExpTable[aircraftLevel] / 10.0 ) + AircraftLevelBonus[category][aircraftLevel] ); @@ -183,14 +190,14 @@ public static int GetAirSuperiority( BaseAirCorpsData aircorps ) { if ( aircorps == null ) return 0; - return aircorps.Squadrons.Values.Sum( sq => GetAirSuperiority( sq ) ); + return aircorps.Squadrons.Values.Sum( sq => GetAirSuperiority( sq, aircorps.ActionKind == 2 ) ); } /// /// 基地航空中隊の制空戦力を求めます。 /// /// 対象の基地航空中隊。 - public static int GetAirSuperiority( BaseAirCorpsSquadron squadron ) { + public static int GetAirSuperiority( BaseAirCorpsSquadron squadron, bool isAirDefense = false ) { if ( squadron == null || squadron.State != 1 ) return 0; @@ -198,7 +205,7 @@ public static int GetAirSuperiority( BaseAirCorpsSquadron squadron ) { if ( eq == null ) return 0; - return GetAirSuperiority( eq.EquipmentID, squadron.AircraftCurrent, eq.AircraftLevel ); + return GetAirSuperiority( eq.EquipmentID, squadron.AircraftCurrent, eq.AircraftLevel, eq.Level, isAirDefense ); } diff --git a/ElectronicObserver/Window/Dialog/DialogEquipmentList.cs b/ElectronicObserver/Window/Dialog/DialogEquipmentList.cs index 3c053f395..4afeaa8f5 100644 --- a/ElectronicObserver/Window/Dialog/DialogEquipmentList.cs +++ b/ElectronicObserver/Window/Dialog/DialogEquipmentList.cs @@ -220,6 +220,14 @@ private void UpdateView() { } + foreach ( int id in BaseAirCorpsData.RelocatedEquipments ) { + var eq = KCDatabase.Instance.Equipments[id]; + if ( eq == null ) + continue; + remainCount[eq.EquipmentID]--; + } + + //表示処理 EquipmentView.SuspendLayout(); @@ -340,6 +348,25 @@ private void UpdateDetailView( int equipmentID ) { } + // 基地航空隊 - 配置転換中の装備を集計 + foreach ( int id in BaseAirCorpsData.RelocatedEquipments ) { + var eq = KCDatabase.Instance.Equipments[id]; + if ( eq == null || eq.EquipmentID != equipmentID ) continue; + + countlist[DetailCounter.CalculateID( eq )].countRemain--; + } + + foreach ( var c in countlist.Values ) { + if ( c.countRemain != c.countRemainPrev ) { + + int diff = c.countRemainPrev - c.countRemain; + + c.equippedShips.Add( "配置転換中" + ( diff > 1 ? ( " x" + diff ) : "" ) ); + + c.countRemainPrev = c.countRemain; + } + } + //行に反映 var rows = new List( eqs.Count() ); From e9758b1f2b151b780079513e2a0b6020d3ea0e36 Mon Sep 17 00:00:00 2001 From: Andante Date: Sat, 27 Aug 2016 14:20:17 +0900 Subject: [PATCH 20/20] Version 2.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 司令部:基地航空隊補給・配備時の資源の減少を即時反映するように * 基地航空隊:クリップボードにコピーする機能の実装 * 情報:出撃による資源消費表示の詳細化 --- ElectronicObserver/Data/MaterialData.cs | 9 + .../kcsapi/api_req_air_corps/set_plane.cs | 3 + .../kcsapi/api_req_air_corps/supply.cs | 3 + .../Utility/SoftwareInformation.cs | 6 +- .../DialogAlbumMasterEquipment.Designer.cs | 337 +++++++++--------- .../Window/FormBaseAirCorps.Designer.cs | 20 ++ ElectronicObserver/Window/FormBaseAirCorps.cs | 49 +++ .../Window/FormBaseAirCorps.resx | 3 + ElectronicObserver/Window/FormHeadquarters.cs | 2 + ElectronicObserver/Window/FormInformation.cs | 24 +- README.md | 2 +- 11 files changed, 284 insertions(+), 174 deletions(-) diff --git a/ElectronicObserver/Data/MaterialData.cs b/ElectronicObserver/Data/MaterialData.cs index a72481a21..271813251 100644 --- a/ElectronicObserver/Data/MaterialData.cs +++ b/ElectronicObserver/Data/MaterialData.cs @@ -98,6 +98,15 @@ public override void LoadFromResponse( string apiname, dynamic data ) { ModdingMaterial = (int)data[7]; break; + case "api_req_air_corps/supply": + Fuel = (int)data.api_after_fuel; + Bauxite = (int)data.api_after_bauxite; + break; + + case "api_req_air_corps/set_plane": + if ( data.api_after_bauxite() ) + Bauxite = (int)data.api_after_bauxite; + break; } } diff --git a/ElectronicObserver/Observer/kcsapi/api_req_air_corps/set_plane.cs b/ElectronicObserver/Observer/kcsapi/api_req_air_corps/set_plane.cs index ee3e6d98f..a0095bc11 100644 --- a/ElectronicObserver/Observer/kcsapi/api_req_air_corps/set_plane.cs +++ b/ElectronicObserver/Observer/kcsapi/api_req_air_corps/set_plane.cs @@ -28,6 +28,9 @@ public override void OnResponseReceived( dynamic data ) { if ( corps.ContainsKey( _aircorpsID ) ) corps[_aircorpsID].LoadFromResponse( APIName, data ); + + KCDatabase.Instance.Material.LoadFromResponse( APIName, data ); + base.OnResponseReceived( (object)data ); } diff --git a/ElectronicObserver/Observer/kcsapi/api_req_air_corps/supply.cs b/ElectronicObserver/Observer/kcsapi/api_req_air_corps/supply.cs index b2e9e3ff7..35591f409 100644 --- a/ElectronicObserver/Observer/kcsapi/api_req_air_corps/supply.cs +++ b/ElectronicObserver/Observer/kcsapi/api_req_air_corps/supply.cs @@ -28,6 +28,9 @@ public override void OnResponseReceived( dynamic data ) { if ( corps.ContainsKey( _aircorpsID ) ) corps[_aircorpsID].LoadFromResponse( APIName, data ); + + KCDatabase.Instance.Material.LoadFromResponse( APIName, data ); + base.OnResponseReceived( (object)data ); } diff --git a/ElectronicObserver/Utility/SoftwareInformation.cs b/ElectronicObserver/Utility/SoftwareInformation.cs index 6703afbab..8ce6cd59f 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.3.5"; + return "2.4.0"; } } @@ -54,7 +54,7 @@ public static string VersionEnglish { /// public static DateTime UpdateTime { get { - return DateTimeHelper.CSVStringToTime( "2016/08/19 12:00:00" ); + return DateTimeHelper.CSVStringToTime( "2016/08/27 13:00:00" ); } } diff --git a/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.Designer.cs b/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.Designer.cs index df7a9288a..4488dcfe1 100644 --- a/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.Designer.cs +++ b/ElectronicObserver/Window/Dialog/DialogAlbumMasterEquipment.Designer.cs @@ -38,14 +38,6 @@ private void InitializeComponent() { this.EquipmentView_Type = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.EquipmentView_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.BasePanelEquipment = new System.Windows.Forms.Panel(); - this.DefaultSlots = new System.Windows.Forms.ListBox(); - this.TableEquipmentName = new System.Windows.Forms.FlowLayoutPanel(); - this.TableParameterSub = new System.Windows.Forms.TableLayoutPanel(); - this.TableArsenal = new System.Windows.Forms.TableLayoutPanel(); - this.TableParameterMain = new System.Windows.Forms.TableLayoutPanel(); - this.EquipmentImage = new System.Windows.Forms.PictureBox(); - this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); - this.SaveCSVDialog = new System.Windows.Forms.SaveFileDialog(); this.TableAircraft = new System.Windows.Forms.TableLayoutPanel(); this.TitleAircraftDistance = new ElectronicObserver.Window.Control.ImageLabel(); this.AircraftDistance = new ElectronicObserver.Window.Control.ImageLabel(); @@ -54,10 +46,13 @@ private void InitializeComponent() { this.AlbumNo = new ElectronicObserver.Window.Control.ImageLabel(); this.imageLabel1 = new ElectronicObserver.Window.Control.ImageLabel(); this.imageLabel2 = new ElectronicObserver.Window.Control.ImageLabel(); + this.DefaultSlots = new System.Windows.Forms.ListBox(); this.Description = new ElectronicObserver.Window.Control.ImageLabel(); + this.TableEquipmentName = new System.Windows.Forms.FlowLayoutPanel(); this.EquipmentType = new ElectronicObserver.Window.Control.ImageLabel(); this.EquipmentName = new ElectronicObserver.Window.Control.ImageLabel(); this.EquipmentID = new ElectronicObserver.Window.Control.ImageLabel(); + this.TableParameterSub = new System.Windows.Forms.TableLayoutPanel(); this.imageLabel76 = new ElectronicObserver.Window.Control.ImageLabel(); this.Rarity = new ElectronicObserver.Window.Control.ImageLabel(); this.Range = new ElectronicObserver.Window.Control.ImageLabel(); @@ -66,12 +61,14 @@ private void InitializeComponent() { this.imageLabel71 = new ElectronicObserver.Window.Control.ImageLabel(); this.TitleRange = new ElectronicObserver.Window.Control.ImageLabel(); this.TitleSpeed = new ElectronicObserver.Window.Control.ImageLabel(); + this.TableArsenal = new System.Windows.Forms.TableLayoutPanel(); this.MaterialBauxite = new ElectronicObserver.Window.Control.ImageLabel(); this.MaterialFuel = new ElectronicObserver.Window.Control.ImageLabel(); this.MaterialSteel = new ElectronicObserver.Window.Control.ImageLabel(); this.MaterialAmmo = new ElectronicObserver.Window.Control.ImageLabel(); this.imageLabel59 = new ElectronicObserver.Window.Control.ImageLabel(); this.imageLabel45 = new ElectronicObserver.Window.Control.ImageLabel(); + this.TableParameterMain = new System.Windows.Forms.TableLayoutPanel(); this.Bomber = new ElectronicObserver.Window.Control.ImageLabel(); this.TitleBomber = new ElectronicObserver.Window.Control.ImageLabel(); this.LOS = new ElectronicObserver.Window.Control.ImageLabel(); @@ -91,6 +88,9 @@ private void InitializeComponent() { this.Evasion = new ElectronicObserver.Window.Control.ImageLabel(); this.TitleAccuracy = new ElectronicObserver.Window.Control.ImageLabel(); this.Accuracy = new ElectronicObserver.Window.Control.ImageLabel(); + this.EquipmentImage = new System.Windows.Forms.PictureBox(); + this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); + this.SaveCSVDialog = new System.Windows.Forms.SaveFileDialog(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -98,12 +98,12 @@ private void InitializeComponent() { this.splitContainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.EquipmentView)).BeginInit(); this.BasePanelEquipment.SuspendLayout(); + this.TableAircraft.SuspendLayout(); this.TableEquipmentName.SuspendLayout(); this.TableParameterSub.SuspendLayout(); this.TableArsenal.SuspendLayout(); this.TableParameterMain.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.EquipmentImage)).BeginInit(); - this.TableAircraft.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -257,170 +257,25 @@ private void InitializeComponent() { this.BasePanelEquipment.Size = new System.Drawing.Size(546, 456); this.BasePanelEquipment.TabIndex = 0; // - // DefaultSlots - // - this.DefaultSlots.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.DefaultSlots.BackColor = System.Drawing.SystemColors.Control; - this.DefaultSlots.Cursor = System.Windows.Forms.Cursors.Hand; - this.DefaultSlots.FormattingEnabled = true; - this.DefaultSlots.HorizontalScrollbar = true; - this.DefaultSlots.ItemHeight = 15; - this.DefaultSlots.Location = new System.Drawing.Point(124, 74); - this.DefaultSlots.Name = "DefaultSlots"; - this.DefaultSlots.SelectionMode = System.Windows.Forms.SelectionMode.None; - this.DefaultSlots.Size = new System.Drawing.Size(153, 184); - this.DefaultSlots.TabIndex = 21; - this.DefaultSlots.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DefaultSlots_MouseDown); - // - // TableEquipmentName - // - this.TableEquipmentName.AutoSize = true; - this.TableEquipmentName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableEquipmentName.Controls.Add(this.EquipmentType); - this.TableEquipmentName.Controls.Add(this.EquipmentName); - this.TableEquipmentName.Location = new System.Drawing.Point(3, 25); - this.TableEquipmentName.Name = "TableEquipmentName"; - this.TableEquipmentName.Size = new System.Drawing.Size(262, 22); - this.TableEquipmentName.TabIndex = 19; - // - // TableParameterSub - // - this.TableParameterSub.AutoSize = true; - this.TableParameterSub.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableParameterSub.ColumnCount = 4; - this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); - this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); - this.TableParameterSub.Controls.Add(this.imageLabel76, 3, 1); - this.TableParameterSub.Controls.Add(this.Rarity, 3, 0); - this.TableParameterSub.Controls.Add(this.Range, 1, 1); - this.TableParameterSub.Controls.Add(this.Speed, 1, 0); - this.TableParameterSub.Controls.Add(this.imageLabel72, 2, 1); - this.TableParameterSub.Controls.Add(this.imageLabel71, 2, 0); - this.TableParameterSub.Controls.Add(this.TitleRange, 0, 1); - this.TableParameterSub.Controls.Add(this.TitleSpeed, 0, 0); - this.TableParameterSub.Location = new System.Drawing.Point(3, 275); - this.TableParameterSub.Name = "TableParameterSub"; - this.TableParameterSub.RowCount = 2; - this.TableParameterSub.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterSub.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterSub.Size = new System.Drawing.Size(234, 44); - this.TableParameterSub.TabIndex = 15; - this.TableParameterSub.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableParameterSub_CellPaint); - // - // TableArsenal - // - this.TableArsenal.AutoSize = true; - this.TableArsenal.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableArsenal.ColumnCount = 5; - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); - this.TableArsenal.Controls.Add(this.MaterialBauxite, 4, 0); - this.TableArsenal.Controls.Add(this.MaterialFuel, 1, 0); - this.TableArsenal.Controls.Add(this.MaterialSteel, 3, 0); - this.TableArsenal.Controls.Add(this.MaterialAmmo, 2, 0); - this.TableArsenal.Controls.Add(this.imageLabel59, 0, 0); - this.TableArsenal.Location = new System.Drawing.Point(283, 275); - this.TableArsenal.Name = "TableArsenal"; - this.TableArsenal.RowCount = 1; - this.TableArsenal.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableArsenal.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableArsenal.Size = new System.Drawing.Size(223, 22); - this.TableArsenal.TabIndex = 9; - this.TableArsenal.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableArsenal_CellPaint); - // - // TableParameterMain - // - this.TableParameterMain.AutoSize = true; - this.TableParameterMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableParameterMain.ColumnCount = 2; - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.Controls.Add(this.Bomber, 1, 9); - this.TableParameterMain.Controls.Add(this.TitleBomber, 0, 9); - this.TableParameterMain.Controls.Add(this.LOS, 1, 7); - this.TableParameterMain.Controls.Add(this.ASW, 1, 5); - this.TableParameterMain.Controls.Add(this.imageLabel14, 1, 0); - this.TableParameterMain.Controls.Add(this.TitleLOS, 0, 7); - this.TableParameterMain.Controls.Add(this.Armor, 1, 4); - this.TableParameterMain.Controls.Add(this.AA, 1, 3); - this.TableParameterMain.Controls.Add(this.Torpedo, 1, 2); - this.TableParameterMain.Controls.Add(this.Firepower, 1, 1); - this.TableParameterMain.Controls.Add(this.TitleFirepower, 0, 1); - this.TableParameterMain.Controls.Add(this.TitleTorpedo, 0, 2); - this.TableParameterMain.Controls.Add(this.TitleAA, 0, 3); - this.TableParameterMain.Controls.Add(this.TitleArmor, 0, 4); - this.TableParameterMain.Controls.Add(this.TitleASW, 0, 5); - this.TableParameterMain.Controls.Add(this.TitleEvasion, 0, 6); - this.TableParameterMain.Controls.Add(this.Evasion, 1, 6); - this.TableParameterMain.Controls.Add(this.TitleAccuracy, 0, 8); - this.TableParameterMain.Controls.Add(this.Accuracy, 1, 8); - this.TableParameterMain.Location = new System.Drawing.Point(3, 49); - this.TableParameterMain.Name = "TableParameterMain"; - this.TableParameterMain.RowCount = 10; - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.TableParameterMain.Size = new System.Drawing.Size(110, 216); - this.TableParameterMain.TabIndex = 5; - this.TableParameterMain.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableParameterMain_CellPaint); - // - // EquipmentImage - // - this.EquipmentImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.EquipmentImage.Location = new System.Drawing.Point(283, 3); - this.EquipmentImage.Name = "EquipmentImage"; - this.EquipmentImage.Size = new System.Drawing.Size(260, 260); - this.EquipmentImage.TabIndex = 4; - this.EquipmentImage.TabStop = false; - // - // ToolTipInfo - // - this.ToolTipInfo.AutoPopDelay = 30000; - this.ToolTipInfo.InitialDelay = 500; - this.ToolTipInfo.ReshowDelay = 100; - this.ToolTipInfo.ShowAlways = true; - // - // SaveCSVDialog - // - this.SaveCSVDialog.Filter = "CSV|*.csv|File|*"; - this.SaveCSVDialog.Title = "CSVに出力"; - // // TableAircraft // this.TableAircraft.AutoSize = true; this.TableAircraft.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.TableAircraft.ColumnCount = 4; + this.TableAircraft.ColumnCount = 5; this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 16F)); this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.TableAircraft.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); - this.TableAircraft.Controls.Add(this.TitleAircraftDistance, 2, 0); - this.TableAircraft.Controls.Add(this.AircraftDistance, 3, 0); this.TableAircraft.Controls.Add(this.AircraftCost, 1, 0); this.TableAircraft.Controls.Add(this.TitleAircraftCost, 0, 0); + this.TableAircraft.Controls.Add(this.AircraftDistance, 4, 0); + this.TableAircraft.Controls.Add(this.TitleAircraftDistance, 3, 0); this.TableAircraft.Location = new System.Drawing.Point(3, 325); this.TableAircraft.Name = "TableAircraft"; this.TableAircraft.RowCount = 1; this.TableAircraft.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.TableAircraft.Size = new System.Drawing.Size(253, 22); + this.TableAircraft.Size = new System.Drawing.Size(269, 22); this.TableAircraft.TabIndex = 26; this.TableAircraft.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableAircraft_CellPaint); // @@ -428,7 +283,7 @@ private void InitializeComponent() { // this.TitleAircraftDistance.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.TitleAircraftDistance.BackColor = System.Drawing.Color.Transparent; - this.TitleAircraftDistance.Location = new System.Drawing.Point(118, 3); + this.TitleAircraftDistance.Location = new System.Drawing.Point(134, 3); this.TitleAircraftDistance.Name = "TitleAircraftDistance"; this.TitleAircraftDistance.Size = new System.Drawing.Size(92, 16); this.TitleAircraftDistance.TabIndex = 27; @@ -440,7 +295,7 @@ private void InitializeComponent() { this.AircraftDistance.Anchor = System.Windows.Forms.AnchorStyles.Right; this.AircraftDistance.BackColor = System.Drawing.Color.Transparent; this.AircraftDistance.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.AircraftDistance.Location = new System.Drawing.Point(228, 3); + this.AircraftDistance.Location = new System.Drawing.Point(244, 3); this.AircraftDistance.Name = "AircraftDistance"; this.AircraftDistance.Size = new System.Drawing.Size(22, 16); this.AircraftDistance.TabIndex = 27; @@ -501,6 +356,22 @@ private void InitializeComponent() { this.imageLabel2.TabIndex = 24; this.imageLabel2.Text = "図鑑番号:"; // + // DefaultSlots + // + this.DefaultSlots.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.DefaultSlots.BackColor = System.Drawing.SystemColors.Control; + this.DefaultSlots.Cursor = System.Windows.Forms.Cursors.Hand; + this.DefaultSlots.FormattingEnabled = true; + this.DefaultSlots.HorizontalScrollbar = true; + this.DefaultSlots.ItemHeight = 15; + this.DefaultSlots.Location = new System.Drawing.Point(124, 74); + this.DefaultSlots.Name = "DefaultSlots"; + this.DefaultSlots.SelectionMode = System.Windows.Forms.SelectionMode.None; + this.DefaultSlots.Size = new System.Drawing.Size(153, 184); + this.DefaultSlots.TabIndex = 21; + this.DefaultSlots.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DefaultSlots_MouseDown); + // // Description // this.Description.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -518,6 +389,17 @@ private void InitializeComponent() { "て普及しています。\r\n"; this.Description.TextAlign = System.Drawing.ContentAlignment.TopLeft; // + // TableEquipmentName + // + this.TableEquipmentName.AutoSize = true; + this.TableEquipmentName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableEquipmentName.Controls.Add(this.EquipmentType); + this.TableEquipmentName.Controls.Add(this.EquipmentName); + this.TableEquipmentName.Location = new System.Drawing.Point(3, 25); + this.TableEquipmentName.Name = "TableEquipmentName"; + this.TableEquipmentName.Size = new System.Drawing.Size(262, 22); + this.TableEquipmentName.TabIndex = 19; + // // EquipmentType // this.EquipmentType.BackColor = System.Drawing.Color.Transparent; @@ -547,6 +429,32 @@ private void InitializeComponent() { this.EquipmentID.TabIndex = 18; this.EquipmentID.Text = "123"; // + // TableParameterSub + // + this.TableParameterSub.AutoSize = true; + this.TableParameterSub.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableParameterSub.ColumnCount = 4; + this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableParameterSub.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F)); + this.TableParameterSub.Controls.Add(this.imageLabel76, 3, 1); + this.TableParameterSub.Controls.Add(this.Rarity, 3, 0); + this.TableParameterSub.Controls.Add(this.Range, 1, 1); + this.TableParameterSub.Controls.Add(this.Speed, 1, 0); + this.TableParameterSub.Controls.Add(this.imageLabel72, 2, 1); + this.TableParameterSub.Controls.Add(this.imageLabel71, 2, 0); + this.TableParameterSub.Controls.Add(this.TitleRange, 0, 1); + this.TableParameterSub.Controls.Add(this.TitleSpeed, 0, 0); + this.TableParameterSub.Location = new System.Drawing.Point(3, 275); + this.TableParameterSub.Name = "TableParameterSub"; + this.TableParameterSub.RowCount = 2; + this.TableParameterSub.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterSub.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterSub.Size = new System.Drawing.Size(234, 44); + this.TableParameterSub.TabIndex = 15; + this.TableParameterSub.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableParameterSub_CellPaint); + // // imageLabel76 // this.imageLabel76.Anchor = System.Windows.Forms.AnchorStyles.Right; @@ -554,7 +462,7 @@ private void InitializeComponent() { this.imageLabel76.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; this.imageLabel76.Location = new System.Drawing.Point(209, 25); this.imageLabel76.Name = "imageLabel76"; - this.imageLabel76.Size = new System.Drawing.Size(19, 16); + this.imageLabel76.Size = new System.Drawing.Size(22, 16); this.imageLabel76.TabIndex = 17; this.imageLabel76.Text = "123"; this.imageLabel76.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -566,7 +474,7 @@ private void InitializeComponent() { this.Rarity.BackColor = System.Drawing.Color.Transparent; this.Rarity.Location = new System.Drawing.Point(157, 3); this.Rarity.Name = "Rarity"; - this.Rarity.Size = new System.Drawing.Size(38, 16); + this.Rarity.Size = new System.Drawing.Size(74, 16); this.Rarity.TabIndex = 16; this.Rarity.Text = "123"; this.Rarity.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -578,7 +486,7 @@ private void InitializeComponent() { this.Range.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; this.Range.Location = new System.Drawing.Point(85, 25); this.Range.Name = "Range"; - this.Range.Size = new System.Drawing.Size(19, 16); + this.Range.Size = new System.Drawing.Size(22, 16); this.Range.TabIndex = 16; this.Range.Text = "123"; this.Range.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -591,7 +499,7 @@ private void InitializeComponent() { this.Speed.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter; this.Speed.Location = new System.Drawing.Point(85, 3); this.Speed.Name = "Speed"; - this.Speed.Size = new System.Drawing.Size(19, 16); + this.Speed.Size = new System.Drawing.Size(22, 16); this.Speed.TabIndex = 16; this.Speed.Text = "123"; this.Speed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -602,7 +510,7 @@ private void InitializeComponent() { this.imageLabel72.BackColor = System.Drawing.Color.Transparent; this.imageLabel72.Location = new System.Drawing.Point(113, 25); this.imageLabel72.Name = "imageLabel72"; - this.imageLabel72.Size = new System.Drawing.Size(26, 16); + this.imageLabel72.Size = new System.Drawing.Size(38, 16); this.imageLabel72.TabIndex = 16; this.imageLabel72.Text = "-"; this.imageLabel72.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -642,6 +550,30 @@ private void InitializeComponent() { this.TitleSpeed.Text = "速力"; this.TitleSpeed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // TableArsenal + // + this.TableArsenal.AutoSize = true; + this.TableArsenal.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableArsenal.ColumnCount = 5; + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); + this.TableArsenal.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F)); + this.TableArsenal.Controls.Add(this.MaterialBauxite, 4, 0); + this.TableArsenal.Controls.Add(this.MaterialFuel, 1, 0); + this.TableArsenal.Controls.Add(this.MaterialSteel, 3, 0); + this.TableArsenal.Controls.Add(this.MaterialAmmo, 2, 0); + this.TableArsenal.Controls.Add(this.imageLabel59, 0, 0); + this.TableArsenal.Location = new System.Drawing.Point(283, 275); + this.TableArsenal.Name = "TableArsenal"; + this.TableArsenal.RowCount = 1; + this.TableArsenal.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableArsenal.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableArsenal.Size = new System.Drawing.Size(223, 22); + this.TableArsenal.TabIndex = 9; + this.TableArsenal.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableArsenal_CellPaint); + // // MaterialBauxite // this.MaterialBauxite.Anchor = System.Windows.Forms.AnchorStyles.Left; @@ -708,6 +640,54 @@ private void InitializeComponent() { this.imageLabel45.TabIndex = 6; this.imageLabel45.Text = "ID:"; // + // TableParameterMain + // + this.TableParameterMain.AutoSize = true; + this.TableParameterMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.TableParameterMain.ColumnCount = 2; + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 60F)); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.Controls.Add(this.Bomber, 1, 9); + this.TableParameterMain.Controls.Add(this.TitleBomber, 0, 9); + this.TableParameterMain.Controls.Add(this.LOS, 1, 7); + this.TableParameterMain.Controls.Add(this.ASW, 1, 5); + this.TableParameterMain.Controls.Add(this.imageLabel14, 1, 0); + this.TableParameterMain.Controls.Add(this.TitleLOS, 0, 7); + this.TableParameterMain.Controls.Add(this.Armor, 1, 4); + this.TableParameterMain.Controls.Add(this.AA, 1, 3); + this.TableParameterMain.Controls.Add(this.Torpedo, 1, 2); + this.TableParameterMain.Controls.Add(this.Firepower, 1, 1); + this.TableParameterMain.Controls.Add(this.TitleFirepower, 0, 1); + this.TableParameterMain.Controls.Add(this.TitleTorpedo, 0, 2); + this.TableParameterMain.Controls.Add(this.TitleAA, 0, 3); + this.TableParameterMain.Controls.Add(this.TitleArmor, 0, 4); + this.TableParameterMain.Controls.Add(this.TitleASW, 0, 5); + this.TableParameterMain.Controls.Add(this.TitleEvasion, 0, 6); + this.TableParameterMain.Controls.Add(this.Evasion, 1, 6); + this.TableParameterMain.Controls.Add(this.TitleAccuracy, 0, 8); + this.TableParameterMain.Controls.Add(this.Accuracy, 1, 8); + this.TableParameterMain.Location = new System.Drawing.Point(3, 49); + this.TableParameterMain.Name = "TableParameterMain"; + this.TableParameterMain.RowCount = 10; + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.TableParameterMain.Size = new System.Drawing.Size(110, 216); + this.TableParameterMain.TabIndex = 5; + this.TableParameterMain.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableParameterMain_CellPaint); + // // Bomber // this.Bomber.Anchor = System.Windows.Forms.AnchorStyles.Right; @@ -929,6 +909,27 @@ private void InitializeComponent() { this.Accuracy.Text = "123"; this.Accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // EquipmentImage + // + this.EquipmentImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.EquipmentImage.Location = new System.Drawing.Point(283, 3); + this.EquipmentImage.Name = "EquipmentImage"; + this.EquipmentImage.Size = new System.Drawing.Size(260, 260); + this.EquipmentImage.TabIndex = 4; + this.EquipmentImage.TabStop = false; + // + // ToolTipInfo + // + this.ToolTipInfo.AutoPopDelay = 30000; + this.ToolTipInfo.InitialDelay = 500; + this.ToolTipInfo.ReshowDelay = 100; + this.ToolTipInfo.ShowAlways = true; + // + // SaveCSVDialog + // + this.SaveCSVDialog.Filter = "CSV|*.csv|File|*"; + this.SaveCSVDialog.Title = "CSVに出力"; + // // DialogAlbumMasterEquipment // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -953,6 +954,8 @@ private void InitializeComponent() { ((System.ComponentModel.ISupportInitialize)(this.EquipmentView)).EndInit(); this.BasePanelEquipment.ResumeLayout(false); this.BasePanelEquipment.PerformLayout(); + this.TableAircraft.ResumeLayout(false); + this.TableAircraft.PerformLayout(); this.TableEquipmentName.ResumeLayout(false); this.TableEquipmentName.PerformLayout(); this.TableParameterSub.ResumeLayout(false); @@ -962,8 +965,6 @@ private void InitializeComponent() { this.TableParameterMain.ResumeLayout(false); this.TableParameterMain.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.EquipmentImage)).EndInit(); - this.TableAircraft.ResumeLayout(false); - this.TableAircraft.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ElectronicObserver/Window/FormBaseAirCorps.Designer.cs b/ElectronicObserver/Window/FormBaseAirCorps.Designer.cs index 90da0e48e..4f2d2983c 100644 --- a/ElectronicObserver/Window/FormBaseAirCorps.Designer.cs +++ b/ElectronicObserver/Window/FormBaseAirCorps.Designer.cs @@ -26,6 +26,9 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.ToolTipInfo = new System.Windows.Forms.ToolTip(this.components); this.TableMember = new System.Windows.Forms.TableLayoutPanel(); + this.ContextMenuBaseAirCorps = new System.Windows.Forms.ContextMenuStrip(this.components); + this.ContextMenuBaseAirCorps_CopyOrganization = new System.Windows.Forms.ToolStripMenuItem(); + this.ContextMenuBaseAirCorps.SuspendLayout(); this.SuspendLayout(); // // ToolTipInfo @@ -53,6 +56,20 @@ private void InitializeComponent() { this.TableMember.TabIndex = 0; this.TableMember.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.TableMember_CellPaint); // + // ContextMenuBaseAirCorps + // + this.ContextMenuBaseAirCorps.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ContextMenuBaseAirCorps_CopyOrganization}); + this.ContextMenuBaseAirCorps.Name = "ContextMenuBaseAirCorps"; + this.ContextMenuBaseAirCorps.Size = new System.Drawing.Size(188, 48); + // + // ContextMenuBaseAirCorps_CopyOrganization + // + this.ContextMenuBaseAirCorps_CopyOrganization.Name = "ContextMenuBaseAirCorps_CopyOrganization"; + this.ContextMenuBaseAirCorps_CopyOrganization.Size = new System.Drawing.Size(187, 22); + this.ContextMenuBaseAirCorps_CopyOrganization.Text = "クリップボードにコピー(&C)"; + this.ContextMenuBaseAirCorps_CopyOrganization.Click += new System.EventHandler(this.ContextMenuBaseAirCorps_CopyOrganization_Click); + // // FormBaseAirCorps // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -66,6 +83,7 @@ private void InitializeComponent() { this.Name = "FormBaseAirCorps"; this.Text = "基地航空隊"; this.Load += new System.EventHandler(this.FormBaseAirCorps_Load); + this.ContextMenuBaseAirCorps.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -75,6 +93,8 @@ private void InitializeComponent() { private System.Windows.Forms.ToolTip ToolTipInfo; private System.Windows.Forms.TableLayoutPanel TableMember; + private System.Windows.Forms.ContextMenuStrip ContextMenuBaseAirCorps; + private System.Windows.Forms.ToolStripMenuItem ContextMenuBaseAirCorps_CopyOrganization; } } \ No newline at end of file diff --git a/ElectronicObserver/Window/FormBaseAirCorps.cs b/ElectronicObserver/Window/FormBaseAirCorps.cs index d7e7b6f11..e42520d4a 100644 --- a/ElectronicObserver/Window/FormBaseAirCorps.cs +++ b/ElectronicObserver/Window/FormBaseAirCorps.cs @@ -37,6 +37,7 @@ public TableBaseAirCorpsControl( FormBaseAirCorps parent ) { Name.Padding = new Padding( 0, 1, 0, 1 ); Name.Margin = new Padding( 2, 0, 2, 0 ); Name.AutoSize = true; + Name.ContextMenuStrip = parent.ContextMenuBaseAirCorps; Name.Visible = false; ActionKind = new ImageLabel(); @@ -316,6 +317,53 @@ void Updated( string apiname, dynamic data ) { } + private void ContextMenuBaseAirCorps_CopyOrganization_Click( object sender, EventArgs e ) { + + var sb = new StringBuilder(); + + foreach ( var corps in KCDatabase.Instance.BaseAirCorps.Values ) { + + sb.AppendFormat( "{0}\t[{1}] 制空戦力{2}\r\n", + corps.Name, Constants.GetBaseAirCorpsActionKind( corps.ActionKind ), + Calculator.GetAirSuperiority( corps ) ); + + var sq = corps.Squadrons.Values.ToArray(); + + for ( int i = 0; i < sq.Length; i++ ) { + if ( i > 0 ) + sb.Append( "/" ); + + if ( sq[i] == null ) { + sb.Append( "(消息不明)" ); + continue; + } + + switch ( sq[i].State ) { + case 0: + sb.Append( "(未配属)" ); + break; + case 1: { + var eq = sq[i].EquipmentInstance; + + sb.Append( eq == null ? "(なし)" : eq.NameWithLevel ); + + if ( sq[i].AircraftCurrent < sq[i].AircraftMax ) + sb.AppendFormat( "[{0}/{1}]", sq[i].AircraftCurrent, sq[i].AircraftMax ); + } break; + case 2: + sb.Append( "(配置転換中)" ); + break; + } + } + + sb.AppendLine().AppendLine(); + } + + Clipboard.SetData( DataFormats.StringFormat, sb.ToString() ); + } + + + private void TableMember_CellPaint( object sender, TableLayoutCellPaintEventArgs e ) { e.Graphics.DrawLine( Pens.Silver, e.CellBounds.X, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1 ); } @@ -324,5 +372,6 @@ protected override string GetPersistString() { return "BaseAirCorps"; } + } } diff --git a/ElectronicObserver/Window/FormBaseAirCorps.resx b/ElectronicObserver/Window/FormBaseAirCorps.resx index 823b989af..152ea0849 100644 --- a/ElectronicObserver/Window/FormBaseAirCorps.resx +++ b/ElectronicObserver/Window/FormBaseAirCorps.resx @@ -120,4 +120,7 @@ 17, 17 + + 137, 17 + \ No newline at end of file diff --git a/ElectronicObserver/Window/FormHeadquarters.cs b/ElectronicObserver/Window/FormHeadquarters.cs index 4174eea48..813320673 100644 --- a/ElectronicObserver/Window/FormHeadquarters.cs +++ b/ElectronicObserver/Window/FormHeadquarters.cs @@ -92,6 +92,8 @@ private void FormHeadquarters_Load( object sender, EventArgs e ) { o.APIList["api_req_kousyou/remodel_slot"].ResponseReceived += Updated; o.APIList["api_get_member/material"].ResponseReceived += Updated; o.APIList["api_get_member/ship_deck"].ResponseReceived += Updated; + o.APIList["api_req_air_corps/set_plane"].ResponseReceived += Updated; + o.APIList["api_req_air_corps/supply"].ResponseReceived += Updated; Utility.Configuration.Instance.ConfigurationChanged += ConfigurationChanged; diff --git a/ElectronicObserver/Window/FormInformation.cs b/ElectronicObserver/Window/FormInformation.cs index 9959bf306..4f9708bc3 100644 --- a/ElectronicObserver/Window/FormInformation.cs +++ b/ElectronicObserver/Window/FormInformation.cs @@ -19,12 +19,14 @@ public partial class FormInformation : DockContent { private int _ignorePort; private List _inSortie; + private int[] _prevResource; public FormInformation( FormMain parent ) { InitializeComponent(); _ignorePort = 0; _inSortie = null; + _prevResource = new int[4]; ConfigurationChanged(); @@ -114,6 +116,15 @@ void Updated( string apiname, dynamic data ) { case "api_req_map/start": _inSortie = KCDatabase.Instance.Fleet.Fleets.Values.Where( f => f.IsInSortie || f.ExpeditionState == 1 ).Select( f => f.FleetID ).ToList(); + + // 出撃時の資源を記録 + { + var material = KCDatabase.Instance.Material; + _prevResource[0] = material.Fuel; + _prevResource[1] = material.Ammo; + _prevResource[2] = material.Steel; + _prevResource[3] = material.Bauxite; + } break; case "api_req_practice/battle": @@ -371,12 +382,18 @@ private string GetSupplyInformation( dynamic data ) { private string GetConsumptionResource( dynamic data ) { StringBuilder sb = new StringBuilder(); + var material = KCDatabase.Instance.Material; + int fuel_supply = 0, fuel_repair = 0, ammo = 0, steel = 0, bauxite = 0; + int fuel_diff = material.Fuel - _prevResource[0], + ammo_diff = material.Ammo - _prevResource[1], + steel_diff = material.Steel - _prevResource[2], + bauxite_diff = material.Bauxite - _prevResource[3]; sb.AppendLine( "[艦隊帰投]" ); @@ -391,8 +408,11 @@ private string GetConsumptionResource( dynamic data ) { } - sb.AppendFormat( "燃料: {0} (補給) + {1} (入渠) = {2}\r\n弾薬: {3}\r\n鋼材: {4}\r\nボーキ: {5} ( {6}機 )\r\n", - fuel_supply, fuel_repair, fuel_supply + fuel_repair, ammo, steel, bauxite, bauxite / 5 ); + sb.AppendFormat( "燃料: {0:+0;-0} ( 自然 {1:+0;-0} - 補給 {2} - 入渠 {3} )\r\n弾薬: {4:+0;-0} ( 自然 {5:+0;-0} - 補給 {6} )\r\n鋼材: {7:+0;-0} ( 自然 {8:+0;-0} - 入渠 {9} )\r\nボーキ: {10:+0;-0} ( 自然 {11:+0;-0} - 補給 {12} ( {13} 機 ) )", + fuel_diff - fuel_supply - fuel_repair, fuel_diff, fuel_supply, fuel_repair, + ammo_diff - ammo, ammo_diff, ammo, + steel_diff - steel, steel_diff, steel, + bauxite_diff - bauxite, bauxite_diff, bauxite, bauxite / 5 ); return sb.ToString(); } diff --git a/README.md b/README.md index 1b811dedc..f1980087a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ *このリンクの更新は遅れる可能性があります。最新版は[こちら](http://electronicobserver.blog.fc2.com/)で確認してください。* -[ver. 2.3.5 (2016/08/19)](http://bit.ly/2brBghS) +[ver. 2.4.0 (2016/08/27)](http://bit.ly/2cgTqVx) [更新内容・履歴はこちらで確認できます。](https://github.com/andanteyk/ElectronicObserver/wiki/ChangeLog)