Skip to content

Commit

Permalink
Release v2.5.1-m1
Browse files Browse the repository at this point in the history
解压自带记录文件时转换编码
合并、汉化原版 v2.5.1 更新内容:
新增索敌值计算公式 "新判定式(33)"
增强航空战数据分析 "对空炮火详情"
  • Loading branch information
RadarNyan committed Dec 8, 2016
2 parents bebd0da + 1d96044 commit 4a7c7a8
Show file tree
Hide file tree
Showing 96 changed files with 3,930 additions and 1,174 deletions.
40 changes: 30 additions & 10 deletions Browser/FormBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public partial class FormBrowser : Form, IBrowser {
private readonly Size KanColleSize = new Size( 800, 480 );


private readonly string StyleClassID = Guid.NewGuid().ToString().Substring( 0, 8 );
private readonly string RestoreScript = @"var node = document.getElementById('{0}'); if (node) document.getElementsByTagName('head')[0].removeChild(node);";
private bool RestoreStyleSheet = false;

// FormBrowserHostの通信サーバ
private string ServerUri;
Expand Down Expand Up @@ -92,6 +95,7 @@ private PictureBox ToolMenu_Other_LastScreenShot_Control {
/// <param name="serverUri">ホストプロセスとの通信用URL</param>
public FormBrowser( string serverUri ) {
InitializeComponent();
CoInternetSetFeatureEnabled( 21, 0x00000002, true );

ServerUri = serverUri;
StyleSheetApplied = false;
Expand Down Expand Up @@ -245,6 +249,7 @@ private void SizeAdjuster_SizeChanged( object sender, EventArgs e ) {
}

private void CenteringBrowser() {
if ( SizeAdjuster.Width == 0 || SizeAdjuster.Height == 0 ) return;
int x = Browser.Location.X, y = Browser.Location.Y;
bool isScrollable = Configuration.IsScrollable;

Expand Down Expand Up @@ -282,7 +287,7 @@ private void Browser_DocumentCompleted( object sender, WebBrowserDocumentComplet
/// </summary>
public void ApplyStyleSheet() {

if ( !Configuration.AppliesStyleSheet )
if ( !Configuration.AppliesStyleSheet && !RestoreStyleSheet )
return;

try {
Expand All @@ -292,16 +297,22 @@ public void ApplyStyleSheet() {

if ( document.Url.ToString().Contains( ".swf?" ) ) {

document.Body.SetAttribute( "width", "100%" );
document.Body.SetAttribute( "height", "100%" );
document.InvokeScript( "eval", new object[] { "document.body.style.margin=0;" } );

} else {
var swf = getFrameElementById( document, "externalswf" );
if ( swf == null ) return;

if ( RestoreStyleSheet ) {
document.InvokeScript( "eval", new object[] { string.Format( RestoreScript, StyleClassID ) } );
swf.Document.InvokeScript( "eval", new object[] { string.Format( RestoreScript, StyleClassID ) } );
StyleSheetApplied = false;
RestoreStyleSheet = false;
return;
}
// InvokeScriptは関数しか呼べないようなので、スクリプトをevalで渡す
document.InvokeScript( "eval", new object[] { Properties.Resources.PageScript } );
swf.Document.InvokeScript( "eval", new object[] { Properties.Resources.FrameScript } );
document.InvokeScript( "eval", new object[] { string.Format( Properties.Resources.PageScript, StyleClassID ) } );
swf.Document.InvokeScript( "eval", new object[] { string.Format( Properties.Resources.FrameScript, StyleClassID ) } );
}

StyleSheetApplied = true;
Expand All @@ -318,15 +329,17 @@ public void ApplyStyleSheet() {
/// 指定した URL のページを開きます。
/// </summary>
public void Navigate( string url ) {
StyleSheetApplied = false;
if ( url != Configuration.LogInPageURL || !Configuration.AppliesStyleSheet )
StyleSheetApplied = false;
Browser.Navigate( url );
}

/// <summary>
/// ブラウザを再読み込みします。
/// </summary>
public void RefreshBrowser() {
StyleSheetApplied = false;
if ( !Configuration.AppliesStyleSheet )
StyleSheetApplied = false;
Browser.Refresh( WebBrowserRefreshOption.Completely );
}

Expand Down Expand Up @@ -541,6 +554,7 @@ public void SetProxy( string proxy ) {
}

//AddLog( 1, "setproxy:" + proxy );
BrowserHost.AsyncRemoteRun( () => BrowserHost.Proxy.SetProxyCompleted() );
}


Expand Down Expand Up @@ -821,9 +835,10 @@ private void ToolMenu_Other_Navigate_Click( object sender, EventArgs e ) {

private void ToolMenu_Other_AppliesStyleSheet_Click( object sender, EventArgs e ) {
Configuration.AppliesStyleSheet = ToolMenu_Other_AppliesStyleSheet.Checked;
if ( Configuration.AppliesStyleSheet ) {
ApplyStyleSheet();
}
if ( !Configuration.AppliesStyleSheet )
RestoreStyleSheet = true;
ApplyStyleSheet();
ApplyZoom();
ConfigurationUpdated();
}

Expand Down Expand Up @@ -1001,6 +1016,11 @@ protected override void WndProc( ref Message m ) {

#region 呪文

[DllImport( "urlmon.dll" )]
[PreserveSig]
[return: MarshalAs( UnmanagedType.Error )]
static extern int CoInternetSetFeatureEnabled( int FeatureEntry, [MarshalAs( UnmanagedType.U4 )] int dwFlags, bool fEnable );

[DllImport( "user32.dll", EntryPoint = "GetWindowLongA", SetLastError = true )]
private static extern uint GetWindowLong( IntPtr hwnd, int nIndex );

Expand Down
37 changes: 25 additions & 12 deletions Browser/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,35 @@
</resheader>
<data name="FrameScript" xml:space="preserve">
<value>
try {
$(document.body).css({visibility:"hidden"});
$("#externalswf").css({visibility:"visible",position:"fixed",left:0,top:0});
}
catch(e) {
try {{
var node = document.getElementById('{0}');
if (node) document.getElementsByTagName('head')[0].removeChild(node);
node = document.createElement('div');
node.innerHTML = 'F&lt;style id=\'{0}\'>body {{ visibility: hidden; }} \
#flashWrap {{ position: fixed; left: 0; top: 0; width: 100% !important; height: 100% !important; }} \
#externalswf {{ visibility: visible; width: 100% !important; height: 100% !important; }}&lt;/style>';
document.getElementsByTagName('head')[0].appendChild(node.lastChild);
}}
catch(e) {{
alert("フレームCSS適用に失敗しました: "+e);
}</value>
}}</value>
</data>
<data name="PageScript" xml:space="preserve">
<value>
try {
$(document.body).css({visibility:"hidden",overflow:"hidden"});
$("#area-game").css({visibility:"visible",position:"fixed",left:0,top:0});
}
catch(e) {
try {{
var node = document.getElementById('{0}');
if (node) document.getElementsByTagName('head')[0].removeChild(node);
node = document.createElement('div');
node.innerHTML = 'P&lt;style id=\'{0}\'>body {{ visibility: hidden; overflow: hidden; }} \
div #block_background {{ visibility: visible; }} \
div #alert {{ visibility: visible; overflow: scroll; overflow-x: hidden; top: 3% !important; left: 3% !important; width: 94% !important; height: 94%; padding: 2%; box-sizing: border-box;}} \
div.dmm-ntgnavi {{ display: none; }} \
#area-game {{ position: fixed; left: 0; top: 0; width: 100%; height: 100%; }} \
#game_frame {{ visibility: visible; width: 100% !important; height: 100% !important; }}&lt;/style>';
document.getElementsByTagName('head')[0].appendChild(node.lastChild);
}}
catch(e) {{
alert("ページCSS適用に失敗しました: "+e);
}</value>
}}</value>
</data>
</root>
2 changes: 2 additions & 0 deletions BrowserLib/IBrowserHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ IntPtr HWND {
[OperationContract]
void RequestNavigation( string baseurl );

[OperationContract]
void SetProxyCompleted();
}

/// <summary>
Expand Down
Binary file modified ElectronicObserver/Assets.zip
Binary file not shown.
Binary file added ElectronicObserver/Assets/Form/AntiAirDefense.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 20 additions & 18 deletions ElectronicObserver/Data/BaseAirCorpsData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace ElectronicObserver.Data {
/// <summary>
/// 基地航空隊のデータを扱います。
/// </summary>
[DebuggerDisplay( "[{AirCorpsID}] {Name}" )]
public class BaseAirCorpsData : APIWrapper, IIdentifiable {


Expand Down Expand Up @@ -82,15 +81,6 @@ public BaseAirCorpsSquadron this[int i] {
}
}

/// <summary>
/// 配置転換中の装備固有IDリスト
/// </summary>
public static HashSet<int> RelocatedEquipments { get; private set; }


static BaseAirCorpsData() {
RelocatedEquipments = new HashSet<int>();
}


public BaseAirCorpsData() {
Expand Down Expand Up @@ -132,15 +122,14 @@ 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.EquipmentMasterID : 0 ).ToArray();
var prev = Squadrons.Values.Select( sq => sq != null && sq.State == 1 ? 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.EquipmentMasterID : 0 ) ) ) {
var eq = KCDatabase.Instance.Equipments[deleted];

if ( eq != null ) {
eq.RelocatedTime = DateTime.Now;
BaseAirCorpsData.RelocatedEquipments.Add( deleted );
KCDatabase.Instance.RelocatedEquipments.Add( new RelocationData( deleted, DateTime.Now ) );
}
}

Expand Down Expand Up @@ -171,13 +160,26 @@ private void SetSquadrons( string apiname, dynamic data ) {
}


public static void SetRelocatedEquipments( IEnumerable<int> values ) {
if ( values != null )
RelocatedEquipments = new HashSet<int>( values );

public override string ToString() {
return string.Format( "[{0}:{1}] {2}", MapAreaID, AirCorpsID, Name );
}


public int ID {
get { return AirCorpsID; }
get { return GetID( RawData ); }
}


public static int GetID( int mapAreaID, int airCorpsID ) {
return mapAreaID * 10 + airCorpsID;
}
public static int GetID( Dictionary<string, string> request ) {
return GetID( int.Parse( request["api_area_id"] ), int.Parse( request["api_base_id"] ) );
}
public static int GetID( dynamic response ) {
return GetID( response.api_area_id() ? (int)response.api_area_id : -1, (int)response.api_rid );
}

}
}
38 changes: 16 additions & 22 deletions ElectronicObserver/Data/Battle/BattleAirBattle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public class BattleAirBattle : BattleDay {
public override void LoadFromResponse( string apiname, dynamic data ) {
base.LoadFromResponse( apiname, (object)data );

BaseAirAttack = new PhaseBaseAirAttack( this );
AirBattle = new PhaseAirBattle( this );
Support = new PhaseSupport( this );
AirBattle2 = new PhaseAirBattle( this, "2" );
BaseAirAttack = new PhaseBaseAirAttack( this, "基地航空队攻击" );
AirBattle = new PhaseAirBattle( this, "第一次航空战" );
Support = new PhaseSupport( this, "支援攻击" );
AirBattle2 = new PhaseAirBattle( this, "第二次航空战", "2" );

BaseAirAttack.EmulateBattle( _resultHPs, _attackDamages );
AirBattle.EmulateBattle( _resultHPs, _attackDamages );
Expand All @@ -33,29 +33,23 @@ public override string APIName {
get { return "api_req_sortie/airbattle"; }
}

public override string BattleName {
get { return "通常舰队 航空战"; }
}

public override BattleData.BattleTypeFlag BattleType {
get { return BattleTypeFlag.Day; }
}


public override string GetBattleDetail( int index ) {
var sb = new StringBuilder();

string baseair = BaseAirAttack.GetBattleDetail( index );
string airbattle1 = AirBattle.GetBattleDetail( index );
string support = Support.GetBattleDetail( index );
string airbattle2 = AirBattle2.GetBattleDetail( index );

if ( baseair != null )
sb.AppendLine( "《基地航空队攻击》" ).Append( baseair );
if ( airbattle1 != null )
sb.AppendLine( "《第一次航空战》" ).Append( airbattle1 );
if ( support != null )
sb.AppendLine( "《支援攻击》" ).Append( support );
if ( airbattle2 != null )
sb.AppendLine( "《第二次航空战》" ).Append( airbattle2 );

return sb.ToString();
public override IEnumerable<PhaseBase> GetPhases() {
yield return Initial;
yield return Searching;
yield return BaseAirAttack;
yield return AirBattle;
yield return Support;
yield return AirBattle2;
}

}
}
26 changes: 12 additions & 14 deletions ElectronicObserver/Data/Battle/BattleAirRaid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class BattleAirRaid : BattleDay {
public override void LoadFromResponse( string apiname, dynamic data ) {
base.LoadFromResponse( apiname, (object)data );

BaseAirAttack = new PhaseBaseAirAttack( this );
AirBattle = new PhaseAirBattle( this );
BaseAirAttack = new PhaseBaseAirAttack( this, "基地航空队攻击" );
AirBattle = new PhaseAirBattle( this, "空袭战" );
// 支援は出ないものとする

BaseAirAttack.EmulateBattle( _resultHPs, _attackDamages );
Expand All @@ -27,22 +27,20 @@ public override string APIName {
get { return "api_req_sortie/ld_airbattle"; }
}

public override string BattleName {
get { return "通常舰队 长距离空袭战"; }
}

public override BattleTypeFlag BattleType {
get { return BattleTypeFlag.Day; }
}

public override string GetBattleDetail( int index ) {
var sb = new StringBuilder();

string baseair = BaseAirAttack.GetBattleDetail( index );
string airbattle = AirBattle.GetBattleDetail( index );

if ( baseair != null )
sb.AppendLine( "《基地航空队攻击》" ).Append( baseair );
if ( airbattle != null )
sb.AppendLine( "《航空战》" ).Append( airbattle );

return sb.ToString();

public override IEnumerable<PhaseBase> GetPhases() {
yield return Initial;
yield return Searching;
yield return BaseAirAttack;
yield return AirBattle;
}
}
}
42 changes: 42 additions & 0 deletions ElectronicObserver/Data/Battle/BattleBaseAirRaid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using ElectronicObserver.Data.Battle.Phase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ElectronicObserver.Data.Battle {

/// <summary>
/// 基地空襲戦
/// </summary>
public class BattleBaseAirRaid : BattleDay {

public override void LoadFromResponse( string apiname, dynamic data ) {
base.LoadFromResponse( apiname, (object)data );

AirBattle = new PhaseBaseAirRaid( this, "空袭战" );

AirBattle.EmulateBattle( _resultHPs, _attackDamages );
}


public override string APIName {
get { return "api_req_map/next"; }
}

public override string BattleName {
get { return "基地空袭战"; }
}

public override BattleData.BattleTypeFlag BattleType {
get { return BattleTypeFlag.Day | BattleTypeFlag.BaseAirRaid; }
}

public override IEnumerable<Phase.PhaseBase> GetPhases() {
yield return Initial;
yield return Searching;
yield return AirBattle;
}
}
}
Loading

0 comments on commit 4a7c7a8

Please sign in to comment.