Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/Grabacr07/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuubari committed Feb 19, 2016
2 parents 14fa0d4 + a899855 commit 2d58f49
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 52 deletions.
2 changes: 1 addition & 1 deletion source/Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly)]

[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.2.3.0")]
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion source/Grabacr07.KanColleViewer/readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
提督業も忙しい! (KanColleViewer)
version 4.2.0 2016/02/08
version 4.2.1 2016/02/12
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━


Expand Down Expand Up @@ -167,6 +167,7 @@ Desktop Toast

■更新履歴

2016/02/12 - version 4.2.1 リリース
2016/02/08 - version 4.2 リリース
2015/11/10 - version 4.1.6 リリース
2015/10/30 - version 4.1.5 リリース
Expand Down
56 changes: 18 additions & 38 deletions source/Grabacr07.KanColleWrapper/Models/Expedition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ private set

#endregion

#region ReturnTime / IsInExecution 変更通知プロパティ
#region ReturnTime / Remaining / IsInExecution 変更通知プロパティ

private DateTimeOffset? _ReturnTime;

/// <summary>
/// 遠征から帰還する日時を取得します。
/// </summary>
public DateTimeOffset? ReturnTime
{
get { return this._ReturnTime; }
Expand All @@ -69,11 +71,19 @@ private set
this._ReturnTime = value;
this.notificated = false;
this.RaisePropertyChanged();
this.RaisePropertyChanged(nameof(this.Remaining));
this.RaisePropertyChanged(nameof(this.IsInExecution));
}
}
}

/// <summary>
/// 遠征から帰還するまでの時間を取得します。
/// </summary>
public TimeSpan? Remaining
=> !this.ReturnTime.HasValue ? (TimeSpan?)null
: this.ReturnTime.Value < DateTimeOffset.Now ? TimeSpan.Zero
: this.ReturnTime.Value - DateTimeOffset.Now;

/// <summary>
/// 現在遠征を実行中かどうかを示す値を取得します。
Expand All @@ -82,25 +92,6 @@ private set

#endregion

#region Remaining 変更通知プロパティ

private TimeSpan? _Remaining;

public TimeSpan? Remaining
{
get { return this._Remaining; }
set
{
if (this._Remaining != value)
{
this._Remaining = value;
this.RaisePropertyChanged();
}
}
}

#endregion

/// <summary>
/// 艦隊が遠征から帰ったときに発生します。
/// </summary>
Expand All @@ -119,7 +110,6 @@ internal void Update(long[] rawData)
this.Id = -1;
this.Mission = null;
this.ReturnTime = null;
this.Remaining = null;
}
else
{
Expand All @@ -132,24 +122,14 @@ internal void Update(long[] rawData)

private void UpdateCore()
{
if (this.ReturnTime.HasValue)
{
var remaining = this.ReturnTime.Value - DateTimeOffset.Now;
if (remaining.Ticks < 0) remaining = TimeSpan.Zero;

this.Remaining = remaining;
this.RaisePropertyChanged(nameof(this.Remaining));

if (!this.notificated
&& this.Returned != null
&& remaining <= TimeSpan.FromSeconds(KanColleClient.Current.Settings.NotificationShorteningTime))
{
this.Returned(this, new ExpeditionReturnedEventArgs(this.fleet.Name));
this.notificated = true;
}
}
else
if (!this.notificated
&& this.Returned != null
&& this.Remaining <= TimeSpan.FromSeconds(KanColleClient.Current.Settings.NotificationShorteningTime))
{
this.Remaining = null;
this.Returned(this, new ExpeditionReturnedEventArgs(this.fleet.Name));
this.notificated = true;
}
}

Expand Down
7 changes: 4 additions & 3 deletions source/Grabacr07.KanColleWrapper/Models/FleetState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,13 @@ public FleetState(Homeport homeport, params Fleet[] fleets)
public void Calculate()
{
var ships = this.source.SelectMany(x => x.Ships).WithoutEvacuated().ToArray();
var firstFleetShips = this.source.FirstOrDefault()?.Ships.WithoutEvacuated().ToArray() ?? new Ship[0];

this.TotalLevel = ships.HasItems() ? ships.Sum(x => x.Level) : 0;
this.AverageLevel = ships.HasItems() ? (double)this.TotalLevel / ships.Length : 0.0;
this.AirSuperiorityPotential = ships.Sum(s => s.CalcAirSuperiorityPotential());
this.MinAirSuperiorityPotential = ships.Sum(s => s.CalcMinAirSuperiorityPotential());
this.MaxAirSuperiorityPotential = ships.Sum(s => s.CalcMaxAirSuperiorityPotential());
this.AirSuperiorityPotential = firstFleetShips.Sum(s => s.CalcAirSuperiorityPotential());
this.MinAirSuperiorityPotential = firstFleetShips.Sum(s => s.CalcMinAirSuperiorityPotential());
this.MaxAirSuperiorityPotential = firstFleetShips.Sum(s => s.CalcMaxAirSuperiorityPotential());
this.Speed = ships.All(x => x.Info.Speed == ShipSpeed.Fast)
? FleetSpeed.Fast
: ships.All(x => x.Info.Speed == ShipSpeed.Low)
Expand Down
4 changes: 2 additions & 2 deletions source/Grabacr07.KanColleWrapper/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
[assembly: ComVisible(false)]
[assembly: Guid("8A13AB28-4E9F-423D-80AD-23EEF2821959")]

[assembly: AssemblyVersion("1.4.0")]
[assembly: AssemblyInformationalVersion("1.4.0")]
[assembly: AssemblyVersion("1.5.0")]
[assembly: AssemblyInformationalVersion("1.5.0")]
4 changes: 2 additions & 2 deletions source/Plugins/TaskbarProgress/ExpeditionProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ namespace Grabacr07.KanColleViewer.Plugins
[Export(typeof(ITaskbarProgress))]
[Export(typeof(ISettings))]
[ExportMetadata("Guid", guid)]
[ExportMetadata("Title", "ExpeditionProgressIndicator")]
[ExportMetadata("Title", "タスク バー遠征モニター")]
[ExportMetadata("Description", "遠征の状況をタスク バー インジケーターに報告します。")]
[ExportMetadata("Version", "1.0")]
[ExportMetadata("Version", "1.1")]
[ExportMetadata("Author", "@Grabacr07")]
public class ExpeditionProgress : IPlugin, ITaskbarProgress, ISettings, IDisposableHolder
{
Expand Down
4 changes: 1 addition & 3 deletions source/Plugins/TaskbarProgress/ExpeditionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public ExpeditionWrapper(int id, Expedition expedition)
{
this.Id = id;
this.Source = expedition;
this.Source
.Subscribe(nameof(Expedition.ReturnTime), () => this.UpdateState()).AddTo(this)
.Subscribe(nameof(Expedition.Remaining), () => this.UpdateState()).AddTo(this);
this.Source.Subscribe(nameof(Expedition.Remaining), () => this.UpdateState()).AddTo(this);

}

Expand Down
3 changes: 2 additions & 1 deletion source/Plugins/TaskbarProgress/HpProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Grabacr07.KanColleViewer.Plugins
[ExportMetadata("Guid", guid)]
[ExportMetadata("Title", "HpProgressIndicator")]
[ExportMetadata("Description", "艦隊内の最大損害艦 HP をタスク バー インジケーターに報告します。")]
[ExportMetadata("Version", "1.0")]
[ExportMetadata("Version", "1.1")]
[ExportMetadata("Author", "@veigr")]
public class HpProgress : IPlugin, ITaskbarProgress, IDisposableHolder
{
Expand Down Expand Up @@ -86,6 +86,7 @@ public void Update()
ships = org.Fleets.Values
.Where(x => x.IsInSortie)
.SelectMany(x => x.Ships)
.Where(s => (s.Situation & (ShipSituation.Tow | ShipSituation.Evacuation)) == 0)
.ToArray();
}
else
Expand Down
2 changes: 1 addition & 1 deletion source/Plugins/TaskbarProgress/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly)]

[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyVersion("1.2.0")]

0 comments on commit 2d58f49

Please sign in to comment.