Skip to content

Commit

Permalink
Merge branch 'ui-localisation' into translation
Browse files Browse the repository at this point in the history
Conflicts:
	source/Grabacr07.KanColleViewer/ViewModels/Contents/ShipViewModel.cs
	source/Grabacr07.KanColleWrapper/Models/ShipType.cs
  • Loading branch information
Yuubari committed Nov 8, 2015
2 parents 1f50693 + 837ed35 commit b39b613
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public string StatsToolTip
}
}

public string RepairToolTip =>
!((this.Ship.HP.Maximum - this.Ship.HP.Current) > 0) ?
"OK" :
string.Format(Resources.Ship_RepairDockToolTip, this.Ship.RepairTimeDock)
+ ((((this.Ship.HP.Current / (double)this.Ship.HP.Maximum) > 0.5) && this.Ship.RepairTimeFacility != this.Ship.RepairTimeDock) ?
"\n" + string.Format(Resources.Ship_RepairFacilityToolTip, this.Ship.RepairTimeFacility) :
"");

public ShipViewModel(Ship ship)
{
this.Ship = ship;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
</Style>
</TextBlock.Style>
</TextBlock>-->
<Viewbox Width="53" Height="12pt" >
<Viewbox Width="53" Height="12" VerticalAlignment="Top">
<kcvc:AircraftProficiencyIcon Level="{Binding CounterKey.Adept}"/>
<Viewbox.ToolTip>
<TextBlock>
Expand Down
3 changes: 2 additions & 1 deletion source/Grabacr07.KanColleViewer/Views/Contents/Fleets.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@
Grid.Column="4"
Grid.Row="0"
Margin="10,0,10,10"
Grid.RowSpan="2">
Grid.RowSpan="2"
ToolTip="{Binding RepairToolTip, Mode=OneWay}">
<Run Text="HP:" />
<Run Text="{Binding Ship.HP.Current, Mode=OneWay}"
Style="{DynamicResource EmphaticTextElementStyleKey}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock>
<TextBlock ToolTip="{Binding RepairToolTip, Mode=OneWay}">
<Run Text="HP:" />
<Run Text="{Binding Ship.HP.Current, Mode=OneWay}"
Style="{DynamicResource EmphaticTextElementStyleKey}" />
Expand Down
2 changes: 1 addition & 1 deletion source/Grabacr07.KanColleViewer/Views/FleetWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
</MultiBinding>
</Run>-->
</TextBlock>
<Viewbox>
<Viewbox Height="12">
<kcvc:AircraftProficiencyIcon Level="{Binding Path=Item.Adept, Mode=OneWay}" />
</Viewbox>
</StackPanel>
Expand Down
9 changes: 9 additions & 0 deletions source/Grabacr07.KanColleWrapper/Models/Ship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public class Ship : RawDataWrapper<kcsapi_ship2>, IIdentifiable
/// </summary>
public int ExpForLevelMax => Experience.GetShipExpForSpecifiedLevel(this.Exp, 150);

public TimeSpan RepairTimeDock =>
TimeSpan.FromSeconds(Math.Floor(BaseRepairTime(this.Level) * (this.HP.Maximum - this.HP.Current) * this.Info.ShipType.RepairMultiplier) + 30);

public TimeSpan RepairTimeFacility =>
(BaseRepairTime() < 1200) ? this.RepairTimeDock : TimeSpan.FromMinutes((this.HP.Maximum - this.HP.Current) * 20);

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

private LimitedValue _HP;
Expand Down Expand Up @@ -387,6 +393,9 @@ internal void Repair()
this.HP = this.HP.Update(max);
}

private double BaseRepairTime(double level = 1.0) =>
(Math.Min(level, 150) * ((level < 12) ? 10 : 5) + ((level < 12) ? 0 : (Math.Floor(Math.Sqrt(level - 11) * 10 + 50))));

public override string ToString()
{
return $"ID = {this.Id}, Name = \"{this.Info.Name}\", ShipType = \"{this.Info.ShipType.Name}\", Level = {this.Level}";
Expand Down
136 changes: 136 additions & 0 deletions source/Grabacr07.KanColleWrapper/Models/ShipType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,33 @@ public override string ToString()
return $"ID = {this.Id}, Name = \"{this.Name}\"";
}

public double RepairMultiplier
{
get
{
switch ((ShipTypeId)this.Id)
{
case ShipTypeId.Submarine:
return 0.5;
case ShipTypeId.HeavyCruiser:
case ShipTypeId.AerialCruiser:
case ShipTypeId.FastBattleship:
case ShipTypeId.LightAircraftCarrier:
case ShipTypeId.SubmarineTender:
return 1.5;
case ShipTypeId.Battleship:
case ShipTypeId.Superdreadnought:
case ShipTypeId.AerialBattleship:
case ShipTypeId.AircraftCarrier:
case ShipTypeId.ArmoredAircraftCarrier:
case ShipTypeId.RepairShip:
return 2;
default:
return 1;
}
}
}

#region static members

public static ShipType Dummy { get; } = new ShipType(new kcsapi_mst_stype
Expand All @@ -44,5 +71,114 @@ public override string ToString()
});

#endregion

public enum ShipTypeId
{
Unknown = 0,

/// <summary>
/// 海防艦。
/// </summary>
EscortShip = 1,

/// <summary>
/// 駆逐艦。
/// </summary>
Destroyer = 2,

/// <summary>
/// 軽巡洋艦。
/// </summary>
LightCruiser = 3,

/// <summary>
/// 重雷装巡洋艦。
/// </summary>
TorpedoCruiser = 4,

/// <summary>
/// 重巡洋艦。
/// </summary>
HeavyCruiser = 5,

/// <summary>
/// 航空巡洋艦。
/// </summary>
AerialCruiser = 6,

/// <summary>
/// 軽空母。
/// </summary>
LightAircraftCarrier = 7,

/// <summary>
/// 高速戦艦。
/// </summary>
FastBattleship = 8,

/// <summary>
/// 戦艦。
/// </summary>
Battleship = 9,

/// <summary>
/// 航空戦艦。
/// </summary>
AerialBattleship = 10,

/// <summary>
/// 正規空母。
/// </summary>
AircraftCarrier = 11,

/// <summary>
/// 超弩級戦艦。
/// </summary>
Superdreadnought = 12,

/// <summary>
/// 潜水艦。
/// </summary>
Submarine = 13,

/// <summary>
/// 潜水空母。
/// </summary>
AircraftCarryingSubmarine = 14,

/// <summary>
/// 補給艦。
/// </summary>
ReplenishmentOiler = 15,

/// <summary>
/// 水上機母艦。
/// </summary>
SeaplaneCarrier = 16,

/// <summary>
/// 揚陸艦
/// </summary>
AmphibiousAssault = 17,

/// <summary>
/// 装甲空母
/// </summary>
ArmoredAircraftCarrier = 18,

/// <summary>
/// 工作艦
/// </summary>
RepairShip = 19,

/// <summary>
/// 潜水母艦
/// </summary>
SubmarineTender = 20,

TrainingCruiser = 21,

FleetOiler = 22,
}
}
}

0 comments on commit b39b613

Please sign in to comment.