Skip to content

Commit

Permalink
Merge branch 'ui-localisation' into translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuubari committed Apr 1, 2016
2 parents 8018bf2 + 7c4a499 commit d165915
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 17 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 @@ -21,4 +21,4 @@
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly)]

[assembly: AssemblyVersion("4.2.3.0")]
[assembly: AssemblyVersion("4.2.4.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -682,4 +682,82 @@ public override bool Predicate(Ship ship)
return false;
}
}

public class ShipConditionFilter : ShipCatalogFilter
{
#region Both 変更通知プロパティ

private bool _Both;

public bool Both
{
get { return this._Both; }
set
{
if (this._Both != value)
{
this._Both = value;
this.RaisePropertyChanged();
this.Update();
}
}
}

#endregion

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

private bool _Brilliant;

public bool Brilliant
{
get { return this._Brilliant; }
set
{
if (this._Brilliant != value)
{
this._Brilliant = value;
this.RaisePropertyChanged();
this.Update();
}
}
}

#endregion

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

private bool _Unbrilliant;

public bool Unbrilliant
{
get { return this._Unbrilliant; }
set
{
if (this._Unbrilliant != value)
{
this._Unbrilliant = value;
this.RaisePropertyChanged();
this.Update();
}
}
}

#endregion

public ShipConditionFilter(Action updateAction)
: base(updateAction)
{
this._Both = true;
}

public override bool Predicate(Ship ship)
{
if (this.Both) return true;
if (this.Brilliant && ship.ConditionType == ConditionType.Brilliant) return true;
if (this.Unbrilliant && ship.ConditionType >= ConditionType.Normal) return true;

return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class ShipCatalogWindowViewModel : WindowViewModel
public ShipExpeditionFilter ShipExpeditionFilter { get; }
public ShipSallyAreaFilter ShipSallyAreaFilter { get; }
public ShipDamagedFilter ShipDamagedFilter { get; }
public ShipConditionFilter ShipConditionFilter { get; }

public bool CheckAllShipTypes
{
Expand Down Expand Up @@ -157,6 +158,7 @@ public ShipCatalogWindowViewModel()
this.ShipExpeditionFilter = new ShipExpeditionFilter(this.Update);
this.ShipSallyAreaFilter = new ShipSallyAreaFilter(this.Update);
this.ShipDamagedFilter = new ShipDamagedFilter(this.Update);
this.ShipConditionFilter = new ShipConditionFilter(this.Update);

this.updateSource
.Do(_ => this.IsReloading = true)
Expand Down Expand Up @@ -193,7 +195,8 @@ private IObservable<Unit> UpdateAsync(SallyArea[] areas)
.Where(this.ShipRemodelingFilter.Predicate)
.Where(this.ShipExpeditionFilter.Predicate)
.Where(this.ShipSallyAreaFilter.Predicate)
.Where(this.ShipDamagedFilter.Predicate);
.Where(this.ShipDamagedFilter.Predicate)
.Where(this.ShipConditionFilter.Predicate);

this.Ships = this.SortWorker.Sort(list)
.Select((x, i) => new ShipViewModel(i + 1, x, areas.FirstOrDefault(y => y.Area == x.SallyArea)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
</Style>
<Style TargetType="{x:Type StackPanel}">
<Setter Property="Margin"
Value="0,0,40,0" />
Value="0,0,25,0" />
<Setter Property="Grid.IsSharedSizeScope"
Value="True" />
</Style>
Expand Down Expand Up @@ -427,6 +427,28 @@
IsChecked="{Binding Undamaged, Mode=TwoWay}" />
</WrapPanel>
</Grid>

<Grid DataContext="{Binding ShipConditionFilter}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"
SharedSizeGroup="FilterName" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Margin="0,2"
HorizontalAlignment="Right">
<Run Text="condition値" />
<Run Text=":" />
</TextBlock>
<WrapPanel Grid.Column="2">
<RadioButton Content="すべて"
IsChecked="{Binding Both, Mode=TwoWay}" />
<RadioButton Content="50以上"
IsChecked="{Binding Brilliant, Mode=TwoWay}" />
<RadioButton Content="49以下"
IsChecked="{Binding Unbrilliant, Mode=TwoWay}" />
</WrapPanel>
</Grid>
</StackPanel>
</WrapPanel>
</Border>
Expand Down
16 changes: 9 additions & 7 deletions source/Grabacr07.KanColleWrapper/KanColleClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@ private KanColleClient()
public void Initialieze()
{
var proxy = this.Proxy ?? (this.Proxy = new KanColleProxy());
var basic = proxy.api_get_member_basic.TryParse<kcsapi_basic>().FirstAsync().ToTask();
var kdock = proxy.api_get_member_kdock.TryParse<kcsapi_kdock[]>().FirstAsync().ToTask();
var sitem = proxy.api_get_member_slot_item.TryParse<kcsapi_slotitem[]>().FirstAsync().ToTask();
var requireInfo = proxy.api_get_member_require_info.TryParse<kcsapi_require_info>().FirstAsync().ToTask();
//var basic = proxy.api_get_member_basic.TryParse<kcsapi_basic>().FirstAsync().ToTask();
//var kdock = proxy.api_get_member_kdock.TryParse<kcsapi_kdock[]>().FirstAsync().ToTask();
//var sitem = proxy.api_get_member_slot_item.TryParse<kcsapi_slotitem[]>().FirstAsync().ToTask();

proxy.api_start2.FirstAsync().Subscribe(async session =>
{
var timeout = Task.Delay(TimeSpan.FromSeconds(20));
var canInitialize = await Task.WhenAny(new Task[] { basic, kdock, sitem }.WhenAll(), timeout) != timeout;
var canInitialize = await Task.WhenAny(new Task[] { requireInfo }.WhenAll(), timeout) != timeout;

// タイムアウト仕掛けてるのは、今後のアップデートで basic, kdock, slot_item のいずれかが来なくなったときに
// 起動できなくなる (IsStarted を true にできなくなる) のを防ぐため
Expand All @@ -145,9 +146,10 @@ public void Initialieze()

if (canInitialize)
{
this.Homeport.UpdateAdmiral((await basic).Data);
this.Homeport.Itemyard.Update((await sitem).Data);
this.Homeport.Dockyard.Update((await kdock).Data);
var data = await requireInfo;
this.Homeport.UpdateAdmiral(data.Data.api_basic);
this.Homeport.Itemyard.Update(data.Data.api_slot_item);
this.Homeport.Dockyard.Update(data.Data.api_kdock);
}

this.IsStarted = true;
Expand Down
8 changes: 8 additions & 0 deletions source/Grabacr07.KanColleWrapper/KanColleProxy.Endpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,5 +350,13 @@ public IObservable<Session> api_req_combined_battle_goback_port
get { return this.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/goback_port"); }
}

/// <summary>
/// エンド ポイント "/kcsapi/api_get_member/require_info" からのセッションを配信します。
/// </summary>
public IObservable<Session> api_get_member_require_info
{
get { return this.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_get_member/require_info"); }
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"/kcsapi/api_req_combined_battle/airbattle",
"/kcsapi/api_req_combined_battle/battleresult",
"/kcsapi/api_req_combined_battle/goback_port",
"/kcsapi/api_get_member/require_info",
};
#>
//
Expand Down
1 change: 1 addition & 0 deletions source/Grabacr07.KanColleWrapper/KanColleWrapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<Compile Include="Models\CreatedSlotItem.cs" />
<Compile Include="Models\FleetCondition.cs" />
<Compile Include="Models\Raw\kcsapi_mst_mapcell.cs" />
<Compile Include="Models\Raw\kcsapi_require_info.cs" />
<Compile Include="Models\Raw\kcsapi_ship_deck.cs" />
<Compile Include="Models\Raw\kcsapi_mst_maparea.cs" />
<Compile Include="Models\Raw\kcsapi_mst_mapinfo.cs" />
Expand Down
18 changes: 18 additions & 0 deletions source/Grabacr07.KanColleWrapper/Models/Raw/kcsapi_require_info.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Grabacr07.KanColleWrapper.Models.Raw
{
public class kcsapi_require_info
{
public kcsapi_basic api_basic { get; set; }
public kcsapi_slotitem[] api_slot_item { get; set; }
//public Api_Unsetslot api_unsetslot { get; set; }
public kcsapi_kdock[] api_kdock { get; set; }
public kcsapi_useitem[] api_useitem { get; set; }
//public Api_Furniture[] api_furniture { get; set; }
}
}
4 changes: 2 additions & 2 deletions source/Grabacr07.KanColleWrapper/Models/Raw/kcsapi_start2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class Api_Mst_Shipgraph
public int api_id { get; set; }
public int api_sortno { get; set; }
public string api_filename { get; set; }
public string api_version { get; set; }
//public string api_version { get; set; }
public int[] api_boko_n { get; set; }
public int[] api_boko_d { get; set; }
public int[] api_kaisyu_n { get; set; }
Expand Down Expand Up @@ -228,7 +228,7 @@ public class Api_Mst_Furnituregraph
public int api_type { get; set; }
public int api_no { get; set; }
public string api_filename { get; set; }
public string api_version { get; set; }
//public string api_version { get; set; }
}

public class Api_Mst_Useitem
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.5.0")]
[assembly: AssemblyInformationalVersion("1.5.0")]
[assembly: AssemblyVersion("1.5.1")]
[assembly: AssemblyInformationalVersion("1.5.1")]
4 changes: 2 additions & 2 deletions source/Tools/Grabacr07.Tools.JsonViewer/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
</startup>
</configuration>
2 changes: 1 addition & 1 deletion source/Tools/Grabacr07.Tools.JsonViewer/JsonViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Grabacr07.Tools.JsonViewer</RootNamespace>
<AssemblyName>Grabacr07.Tools.JsonViewer</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
Expand Down

0 comments on commit d165915

Please sign in to comment.