Skip to content

Commit

Permalink
Merge branch 'feature/tsurai-kedo-ganbaru' of https://github.com/Grab…
Browse files Browse the repository at this point in the history
…acr07/KanColleViewer into prototype

* Grabacr07's redo of organization and fleet compositions. Looks like he borrowed some of my code? Fucking awesome!
* Translations have been moved from Homeport to KancolleClient. They now initialize properly on start up.
* Logger now initializes the enable setting from MainWindowViewModel when it sets the ready state.
* Logger now has a try-catch over the logging portion of the code.
* Fixed a Grabacr07 introduced bug with Logger (I think he misinterpreted what CreateItem is for, which is not for ships, but for equipment).

From the Merge:
* All ships update in real time in terms of fleet organization, modernization, repairs, construction, and destruction.
* Equipment count may or may not be complete.
* Item counts for instant buckets and repairs are in real-time
* The air superiority calculation does not take into account scout planes anymore.
* Sped up fleet updating overall in terms of processing time

Conflicts:
	Grabacr07.KanColleViewer/Models/ProductInfo.cs
	Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs
	Grabacr07.KanColleWrapper/Dockyard.cs
	Grabacr07.KanColleWrapper/Homeport.cs
	Grabacr07.KanColleWrapper/KanColleClient.cs
	Grabacr07.KanColleWrapper/Logger.cs
	Grabacr07.KanColleWrapper/Models/Fleet.cs
	Grabacr07.KanColleWrapper/Models/RawDataWrapper.cs
	Grabacr07.KanColleWrapper/Models/Ship.cs
  • Loading branch information
Zharay committed Apr 29, 2014
2 parents 275722c + cd501c9 commit 4e6cf9a
Show file tree
Hide file tree
Showing 47 changed files with 1,702 additions and 922 deletions.
42 changes: 21 additions & 21 deletions Grabacr07.KanColleViewer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ protected override void OnStartup(StartupEventArgs e)
KanColleClient.Current.Proxy.UpstreamProxyPort = Settings.Current.ProxyPort;

ResourceService.Current.ChangeCulture(Settings.Current.Culture);
KanColleClient.Current.Homeport.Logger.EnableLogging = Settings.Current.EnableLogging;
//KanColleClient.Current.Homeport.Logger.EnableLogging = Settings.Current.EnableLogging;

// Initialize translations
KanColleClient.Current.Homeport.Translations.EnableTranslations = Settings.Current.EnableTranslations;
KanColleClient.Current.Homeport.Translations.EnableAddUntranslated = Settings.Current.EnableAddUntranslated;
KanColleClient.Current.Homeport.Translations.ChangeCulture(Settings.Current.Culture);
KanColleClient.Current.Translations.EnableTranslations = Settings.Current.EnableTranslations;
KanColleClient.Current.Translations.EnableAddUntranslated = Settings.Current.EnableAddUntranslated;
KanColleClient.Current.Translations.ChangeCulture(Settings.Current.Culture);

// Update notification and download new translations (if enabled)
if (KanColleClient.Current.Updater.LoadVersion(AppSettings.Default.KCVUpdateUrl.AbsoluteUri))
Expand All @@ -66,33 +66,33 @@ protected override void OnStartup(StartupEventArgs e)

if (Settings.Current.EnableUpdateTransOnStart)
{
if (KanColleClient.Current.Updater.UpdateTranslations(AppSettings.Default.XMLTransUrl.AbsoluteUri, Settings.Current.Culture, KanColleClient.Current.Homeport.Translations) > 0)
if (KanColleClient.Current.Updater.UpdateTranslations(AppSettings.Default.XMLTransUrl.AbsoluteUri, Settings.Current.Culture, KanColleClient.Current.Translations) > 0)
{
WindowsNotification.Notifier.Show(
KanColleViewer.Properties.Resources.Updater_Notification_Title,
KanColleViewer.Properties.Resources.Updater_Notification_TransUpdate_Success,
() => App.ViewModelRoot.Activate());

KanColleClient.Current.Homeport.Translations.ChangeCulture(Settings.Current.Culture);
KanColleClient.Current.Translations.ChangeCulture(Settings.Current.Culture);
}
}
}

KanColleClient.Current.Homeport.Translations.Firepower = KanColleViewer.Properties.Resources.Stats_Firepower;
KanColleClient.Current.Homeport.Translations.AntiAir = KanColleViewer.Properties.Resources.Stats_AntiAir;
KanColleClient.Current.Homeport.Translations.Accuracy = KanColleViewer.Properties.Resources.Stats_Accuracy;
KanColleClient.Current.Homeport.Translations.Torpedo = KanColleViewer.Properties.Resources.Stats_Torpedo;
KanColleClient.Current.Homeport.Translations.AntiSub = KanColleViewer.Properties.Resources.Stats_AntiSub;
KanColleClient.Current.Homeport.Translations.Evasion = KanColleViewer.Properties.Resources.Stats_Evasion;
KanColleClient.Current.Homeport.Translations.SightRange = KanColleViewer.Properties.Resources.Stats_SightRange;
KanColleClient.Current.Homeport.Translations.Luck = KanColleViewer.Properties.Resources.Stats_Luck;
KanColleClient.Current.Homeport.Translations.Speed = KanColleViewer.Properties.Resources.Stats_Speed;
KanColleClient.Current.Homeport.Translations.Armor = KanColleViewer.Properties.Resources.Stats_Armor;
KanColleClient.Current.Homeport.Translations.Health = KanColleViewer.Properties.Resources.Stats_Health;
KanColleClient.Current.Homeport.Translations.AttackRange = KanColleViewer.Properties.Resources.Stats_AttackRange;
KanColleClient.Current.Homeport.Translations.DiveBomb = KanColleViewer.Properties.Resources.Stats_DiveBomb;

KanColleClient.Current.Homeport.Logger.EnableLogging = Settings.Current.EnableLogging;
KanColleClient.Current.Translations.Firepower = KanColleViewer.Properties.Resources.Stats_Firepower;
KanColleClient.Current.Translations.AntiAir = KanColleViewer.Properties.Resources.Stats_AntiAir;
KanColleClient.Current.Translations.Accuracy = KanColleViewer.Properties.Resources.Stats_Accuracy;
KanColleClient.Current.Translations.Torpedo = KanColleViewer.Properties.Resources.Stats_Torpedo;
KanColleClient.Current.Translations.AntiSub = KanColleViewer.Properties.Resources.Stats_AntiSub;
KanColleClient.Current.Translations.Evasion = KanColleViewer.Properties.Resources.Stats_Evasion;
KanColleClient.Current.Translations.SightRange = KanColleViewer.Properties.Resources.Stats_SightRange;
KanColleClient.Current.Translations.Luck = KanColleViewer.Properties.Resources.Stats_Luck;
KanColleClient.Current.Translations.Speed = KanColleViewer.Properties.Resources.Stats_Speed;
KanColleClient.Current.Translations.Armor = KanColleViewer.Properties.Resources.Stats_Armor;
KanColleClient.Current.Translations.Health = KanColleViewer.Properties.Resources.Stats_Health;
KanColleClient.Current.Translations.AttackRange = KanColleViewer.Properties.Resources.Stats_AttackRange;
KanColleClient.Current.Translations.DiveBomb = KanColleViewer.Properties.Resources.Stats_DiveBomb;

//KanColleClient.Current.Homeport.Logger.EnableLogging = Settings.Current.EnableLogging;

ThemeService.Current.Initialize(this, Theme.Dark, Accent.Purple);

Expand Down
1 change: 0 additions & 1 deletion Grabacr07.KanColleViewer/KanColleViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@
<Compile Include="ViewModels\Contents\Docks\RepairyardViewModel.cs" />
<Compile Include="ViewModels\Contents\ExpeditionsViewModel.cs" />
<Compile Include="ViewModels\Contents\Fleets\ExpeditionViewModel.cs" />
<Compile Include="ViewModels\Contents\Fleets\PlaneViewModel.cs" />
<Compile Include="ViewModels\Contents\Fleets\RepairingBarViewModel.cs" />
<Compile Include="ViewModels\Contents\Fleets\TimerViewModel.cs" />
<Compile Include="ViewModels\Contents\OverviewViewModel.cs" />
Expand Down
12 changes: 10 additions & 2 deletions Grabacr07.KanColleViewer/Models/ProductInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ProductInfo
private string _Copyright;
private string _Trademark;
private Version _Version;
private string _VersionString;
private IReadOnlyCollection<Library> _Libraries;

public string Title
Expand Down Expand Up @@ -56,13 +57,20 @@ public Version Version

public string VersionString
{
get { return this._VersionString ?? (this._VersionString = string.Format("{0}{1}{2}", this.Version.ToString(3), this.IsBetaRelease ? " β" : "", this.Version.Revision == 0 ? "" : " rev." + this.Version.Revision)); }
}

public bool IsBetaRelease
{

#if BETA
get { return this.Version.ToString() + " β"; }
get { return true; }
#else
get { return this.Version.ToString(); }
get { return false; }
#endif
}


public IReadOnlyCollection<Library> Libraries
{
get
Expand Down
2 changes: 1 addition & 1 deletion Grabacr07.KanColleViewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.0.444")]
[assembly: AssemblyVersion("2.6.0.2")]
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public void SetFleets(MemberTable<Fleet> fleets)

this.shipIds = new HashSet<int>(fleets
.Where(x => x.Value.Expedition.IsInExecution)
.SelectMany(x => x.Value.GetShips().Select(s => s.Id)));
.SelectMany(x => x.Value.Ships.Select(s => s.Id)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ public ShipCatalogWindowViewModel()
.Subscribe(_ => this.IsReloading = false);
this.CompositeDisposable.Add(this.updateSource);

this.CompositeDisposable.Add(new PropertyChangedEventListener(this.homeport)
this.CompositeDisposable.Add(new PropertyChangedEventListener(this.homeport.Organization)
{
{ () => this.homeport.Ships, (sender, args) => this.Update() },
{ "Ships", (sender, args) => this.Update() },
});

this.Update();
Expand All @@ -193,7 +193,7 @@ public ShipCatalogWindowViewModel()

public void Update()
{
this.ShipExpeditionFilter.SetFleets(this.homeport.Fleets);
this.ShipExpeditionFilter.SetFleets(this.homeport.Organization.Fleets);

this.RaisePropertyChanged("CheckAllShipTypes");
this.updateSource.OnNext(Unit.Default);
Expand All @@ -212,7 +212,8 @@ public void UpdateReverse(ShipCatalogSortTarget sortTarget)

private void UpdateCore()
{
var list = this.homeport.Ships.Values
var list = this.homeport.Organization.Ships
.Select(kvp => kvp.Value)
.Where(x => this.ShipTypes.Where(t => t.IsSelected).Any(t => x.Info.ShipType.Id == t.Id))
.Where(this.ShipLevelFilter.Predicate)
.Where(this.ShipLockFilter.Predicate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static Task<List<SlotItemViewModel>> UpdateCore()
// これはひどい
// あとでちゃんと書き直す

var ships = KanColleClient.Current.Homeport.Ships;
var ships = KanColleClient.Current.Homeport.Organization.Ships;
var items = KanColleClient.Current.Homeport.SlotItems;
var master = KanColleClient.Current.Master.SlotItems;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,7 @@ public string TotalViewRange
/// </summary>
public ShipViewModel[] Ships
{
get { return this.source.GetShips().Select(x => new ShipViewModel(x)).ToArray(); }
}

/// <summary>
/// 艦隊に所属している艦娘が装備している艦載機を集計したコレクションを取得します。
/// </summary>
public IEnumerable<PlaneViewModel> Planes
{
get
{
return this.source.Ships
.SelectMany(x => x.SlotItems
.Where(y => y.Info.IsAircraft || y.Info.IsSeaplane)
.Select((y, i) => new { Item = y.Info, Count = x.OnSlot[i] }))
.GroupBy(x => x.Item.Id, x => x)
.Select(x => new { x.First().Item, Count = x.Aggregate(0, (i, y) => i + y.Count) })
.Select(x => new PlaneViewModel(x.Item, x.Count));
}
get { return this.source.Ships.Select(x => new ShipViewModel(x)).ToArray(); }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public bool IsSupportedNotification

public FleetsViewModel()
{
this.CompositeDisposable.Add(new PropertyChangedEventListener(KanColleClient.Current.Homeport)
this.CompositeDisposable.Add(new PropertyChangedEventListener(KanColleClient.Current.Homeport.Organization)
{
{ "Fleets", (sender, args) => this.UpdateFleets() },
});
Expand All @@ -98,7 +98,7 @@ public FleetsViewModel()

private void UpdateFleets()
{
this.Fleets = KanColleClient.Current.Homeport.Fleets.Select(kvp => new FleetViewModel(kvp.Value)).ToArray();
this.Fleets = KanColleClient.Current.Homeport.Organization.Fleets.Select(kvp => new FleetViewModel(kvp.Value)).ToArray();
this.SelectedFleet = this.Fleets.FirstOrDefault();
this.Fleets.ForEach(x => x.Expedition.IsNotifyReturned = this.IsNotifyReturned);
}
Expand Down

This file was deleted.

15 changes: 2 additions & 13 deletions Grabacr07.KanColleViewer/ViewModels/Contents/MaterialsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,16 @@
using System.Threading.Tasks;
using Grabacr07.KanColleWrapper;
using Livet;
using Livet.EventListeners;

namespace Grabacr07.KanColleViewer.ViewModels.Contents
{
public class MaterialsViewModel : ViewModel
{
#region Model 変更通知プロパティ

public Materials Model
{
get { return KanColleClient.Current.Homeport.Materials; }
}

#endregion
public Materials Model { get; private set; }

public MaterialsViewModel()
{
this.CompositeDisposable.Add(new PropertyChangedEventListener(KanColleClient.Current.Homeport)
{
{"Materials", (sender, args) => this.RaisePropertyChanged("Model") },
});
this.Model = KanColleClient.Current.Homeport.Materials;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public int Count

public ShipsViewModel()
{
this.CompositeDisposable.Add(new PropertyChangedEventListener(KanColleClient.Current.Homeport)
this.CompositeDisposable.Add(new PropertyChangedEventListener(KanColleClient.Current.Homeport.Organization)
{
{ "Ships", (sender, args) => this.Update() }
});
Expand All @@ -40,7 +40,7 @@ public ShipsViewModel()

private void Update()
{
this.Count = KanColleClient.Current.Homeport.Ships.Count;
this.Count = KanColleClient.Current.Homeport.Organization.Ships.Count;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ public CalculatorViewModel()
.Subscribe(_ => this.IsReloading = false);
this.CompositeDisposable.Add(this.updateSource);

this.CompositeDisposable.Add(new PropertyChangedEventListener(this.homeport)
this.CompositeDisposable.Add(new PropertyChangedEventListener(this.homeport.Organization)
{
{ () => this.homeport.Ships, (sender, args) => this.Update() },
{ () => this.homeport.Organization.Ships, (sender, args) => this.Update() },
});

SelectedSea = SeaExpTable.Keys.FirstOrDefault();
Expand All @@ -371,7 +371,7 @@ public void Update()

private void UpdateCore()
{
var list = this.homeport.Ships.Values
var list = this.homeport.Organization.Ships.Values
.Where(x => x.Level != 1);

this.Ships = this.SortWorker.Sort(list)
Expand Down
2 changes: 2 additions & 0 deletions Grabacr07.KanColleViewer/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public Mode Mode
this.Content = this.mainContent ?? (this.mainContent = new MainContentViewModel());
StatusService.Current.Set(Properties.Resources.StatusBar_Ready);
ThemeService.Current.ChangeAccent(Accent.Blue);
if (KanColleClient.Current.Homeport != null)
KanColleClient.Current.Homeport.Logger.EnableLogging = Settings.EnableLogging;
break;
case Mode.InSortie:
// 今後の実装にご期待ください
Expand Down
Loading

0 comments on commit 4e6cf9a

Please sign in to comment.