Skip to content

Commit

Permalink
Version 1.1.0
Browse files Browse the repository at this point in the history
・Requestの保存名がResponseと同じになっていたのを修正
・編成時の操作によって編成が不正になる不具合を修正
・泊地修理判定の改善
・Browserの出力名を変更
  • Loading branch information
andanteyk committed Mar 28, 2015
1 parent 3880289 commit 999a262
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 66 deletions.
36 changes: 34 additions & 2 deletions Browser/Browser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Browser</RootNamespace>
<AssemblyName>Browser</AssemblyName>
<AssemblyName>EOBrowser</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -29,7 +44,7 @@
<OutputPath>..\ElectronicObserver\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<WarningLevel>1</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BCMakeCert">
Expand Down Expand Up @@ -117,6 +132,23 @@
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.5 %28x86 および x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
40 changes: 20 additions & 20 deletions Browser/FormBrowser.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Browser/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("Browser")]
[assembly: AssemblyTitle( "EOBrowser" )]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Browser")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyProduct( "ElectronicObserver" )]
[assembly: AssemblyCopyright( "Copyright © 2015 Andante" )]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
94 changes: 63 additions & 31 deletions ElectronicObserver/Data/FleetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ public ReadOnlyCollection<int> EscapedShipList {

public DateTime? ConditionTime { get; internal set; }
public bool IsConditionTimeLocked { get; internal set; }
public DateTime? AnchorageRepairTimer { get; internal set; }


public bool IsAnchorageRepairing { get; internal set; }


public int ID {
Expand Down Expand Up @@ -155,13 +153,15 @@ public override void LoadFromResponse( string apiname, dynamic data ) {

UnlockConditionTimer();
ShortenConditionTimer();
UpdateAnchorageRepairingState();
break;

case "api_get_member/ndock":
case "api_req_kousyou/destroyship":
case "api_get_member/ship3":
case "api_req_kaisou/powerup":
ShortenConditionTimer();
UpdateAnchorageRepairingState();
break;

default: //checkme
Expand Down Expand Up @@ -189,7 +189,7 @@ public override void LoadFromRequest( string apiname, Dictionary<string, string>
int index = int.Parse( data["api_ship_idx"] );
int shipID = int.Parse( data["api_ship_id"] );
int replacedID = data.ContainsKey( "replaced_id" ) ? int.Parse( data["replaced_id"] ) : -1;

int flagshipID = _members[0];

if ( FleetID == fleetID ) {
if ( index == -1 ) {
Expand All @@ -204,17 +204,22 @@ public override void LoadFromRequest( string apiname, Dictionary<string, string>
} else {
//入隊

_members[index] = shipID;

//入れ替え
for ( int i = 0; i < _members.Length; i++ ) {
if ( _members[i] == shipID ) {
_members[i] = replacedID;
if ( i != index && _members[i] == shipID ) {

if ( replacedID != -1 )
_members[i] = replacedID;
else
RemoveShip( i );

break;
}
}

//入隊
_members[index] = shipID;


}


Expand All @@ -226,7 +231,12 @@ public override void LoadFromRequest( string apiname, Dictionary<string, string>
//入れ替え
for ( int i = 0; i < _members.Length; i++ ) {
if ( _members[i] == shipID ) {
_members[i] = replacedID;

if ( replacedID != -1 )
_members[i] = replacedID;
else
RemoveShip( i );

break;
}
}
Expand All @@ -235,6 +245,11 @@ public override void LoadFromRequest( string apiname, Dictionary<string, string>

}

UpdateAnchorageRepairingState();
if ( flagshipID != _members[0] && MembersInstance[0] != null && MembersInstance[0].MasterShip.ShipType == 19 ) {
KCDatabase.Instance.Fleet.ResetAnchorageRepairing();
}

} break;


Expand All @@ -248,6 +263,7 @@ public override void LoadFromRequest( string apiname, Dictionary<string, string>
break;
}
}
UpdateAnchorageRepairingState();

} break;

Expand All @@ -261,16 +277,20 @@ public override void LoadFromRequest( string apiname, Dictionary<string, string>
}
}
}
UpdateAnchorageRepairingState();
} break;

case "api_req_kaisou/remodeling": //fixme: ここでリセットしてもまだデータが送られてきてないので無意味
if ( Members.Contains( int.Parse( data["api_id"] ) ) )
if ( Members.Contains( int.Parse( data["api_id"] ) ) ) {
SetConditionTimer();
UpdateAnchorageRepairingState();
}
break;

case "api_req_nyukyo/start":
case "api_req_nyukyo/speedchange":
ShortenConditionTimer();
UpdateAnchorageRepairingState();
break;

case "api_req_mission/start":
Expand Down Expand Up @@ -432,9 +452,6 @@ public enum FleetStates {
/// <returns>艦隊の状態を表す定数。</returns>
public static FleetStates UpdateFleetState( FleetData fleet, ImageLabel label, ToolTip tooltip, FleetStates prevstate, ref DateTime timer ) {

//memo: 泊地修理は工作艦が中破しているとできない、忘れないよう


KCDatabase db = KCDatabase.Instance;


Expand Down Expand Up @@ -524,25 +541,12 @@ public static FleetStates UpdateFleetState( FleetData fleet, ImageLabel label, T

//泊地修理中
{
ShipData flagship = db.Ships[fleet.Members[0]];
if ( flagship != null &&
flagship.MasterShip.ShipType == 19 && //旗艦工作艦
(double)flagship.HPCurrent / flagship.HPMax > 0.5 && //旗艦が中破未満
flagship.RepairingDockID == -1 && //旗艦が入渠中でない
fleet.Members.Take( 2 + flagship.SlotInstanceMaster.Count( eq => eq != null && eq.EquipmentType[2] == 31 ) ).Count( id => { //(2+装備)以内に50%<HP<100%&&非入渠中の艦がいる
ShipData ship = db.Ships[id];
if ( id == -1 ) return false;
if ( ship.RepairingDockID != -1 ) return false;
double rate = (double)ship.HPCurrent / ship.HPMax;
return 0.5 < rate && rate < 1.0;
} ) >= 1 ) {
if ( fleet.IsAnchorageRepairing ) {

if ( prevstate != FleetStates.AnchorageRepairing || ( DateTime.Now - timer ).TotalSeconds >= 20 * 60 )
timer = DateTime.Now;
label.Text = "泊地修理中 " + DateTimeHelper.ToTimeElapsedString( timer );
label.Text = "泊地修理中 " + DateTimeHelper.ToTimeElapsedString( KCDatabase.Instance.Fleet.AnchorageRepairingTimer );
label.ImageIndex = (int)ResourceManager.IconContent.FleetAnchorageRepairing;

tooltip.SetToolTip( label, string.Format( "開始日時 : {0}", timer ) );
tooltip.SetToolTip( label, string.Format( "開始日時 : {0}", KCDatabase.Instance.Fleet.AnchorageRepairingTimer ) );

return FleetStates.AnchorageRepairing;
}
Expand Down Expand Up @@ -645,13 +649,41 @@ public static void RefreshFleetState( ImageLabel label, FleetStates state, DateT
label.Text = "疲労 " + DateTimeHelper.ToTimeRemainString( timer );
break;
case FleetStates.AnchorageRepairing:
label.Text = "泊地修理中 " + DateTimeHelper.ToTimeElapsedString( timer );
label.Text = "泊地修理中 " + DateTimeHelper.ToTimeElapsedString( KCDatabase.Instance.Fleet.AnchorageRepairingTimer );
break;
}

}


private bool CanAnchorageRepair {
get {
KCDatabase db = KCDatabase.Instance;
ShipData flagship = db.Ships[Members[0]];
return (
ExpeditionState == 0 &&
flagship != null &&
flagship.MasterShip.ShipType == 19 && //旗艦工作艦
(double)flagship.HPCurrent / flagship.HPMax > 0.5 && //旗艦が中破未満
flagship.RepairingDockID == -1 && //旗艦が入渠中でない
Members.Take( 2 + flagship.SlotInstanceMaster.Count( eq => eq != null && eq.EquipmentType[2] == 31 ) ).Count( id => { //(2+装備)以内に50%<HP<100%&&非入渠中の艦がいる
ShipData ship = db.Ships[id];
if ( ship == null ) return false;
if ( ship.RepairingDockID != -1 ) return false;
double rate = (double)ship.HPCurrent / ship.HPMax;
return 0.5 < rate && rate < 1.0;
} ) > 0 );
}
}

public void UpdateAnchorageRepairingState() {

bool prev = IsAnchorageRepairing;
IsAnchorageRepairing = CanAnchorageRepair;
if ( !prev && IsAnchorageRepairing )
KCDatabase.Instance.Fleet.StartAnchorageRepairing();

}
}

}
Loading

0 comments on commit 999a262

Please sign in to comment.