Skip to content

Commit

Permalink
Minor repair times, UI tweaks, and F5 refresh hotkey
Browse files Browse the repository at this point in the history
* All ships have a tool tip over their HP values that show repair times.
* Vertical - Separator bar between tools/settings has been made tighter
* Calculator is again in descending level order.
* F5 key refreshes KCV's browser. No longer need to go to settings menu.

Note - Grabacr07 seems to be reworking how the fleets are organized internally. So my planned feature of a Repair Queue is on hold until after he finishes his end of the work.
  • Loading branch information
Zharay committed Apr 28, 2014
1 parent 4b17195 commit bb34dce
Show file tree
Hide file tree
Showing 17 changed files with 163 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,4 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
/KanColleViewer-Compiled
/*.rar
1 change: 1 addition & 0 deletions Grabacr07.KanColleViewer/KanColleViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
<Compile Include="Models\Helper.cs" />
<Compile Include="Models\Internal\Windows7Notifier.cs" />
<Compile Include="Models\Mode.cs" />
<Compile Include="Models\RelayCommand.cs" />
<Compile Include="Models\ResourceService.cs" />
<Compile Include="Models\StatusService.cs" />
<Compile Include="Models\Settings.cs" />
Expand Down
59 changes: 59 additions & 0 deletions Grabacr07.KanColleViewer/Models/RelayCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Diagnostics;

namespace Grabacr07.KanColleViewer.Models
{
public class RelayCommand :ICommand
{

readonly Action _execute;
readonly Func<bool> _canExecute;

public RelayCommand(Action execute)
: this(execute, null)
{
}

public RelayCommand(Action execute, Func<bool> canExecute)
{
if (execute == null)
throw new ArgumentNullException("execute");

_execute = execute;
_canExecute = canExecute;
}

[DebuggerStepThrough]
public bool CanExecute(object parameter)
{
return _canExecute == null || _canExecute();
}

public event EventHandler CanExecuteChanged
{
add
{
if (_canExecute != null)
CommandManager.RequerySuggested += value;
}
remove
{
if (_canExecute != null)
CommandManager.RequerySuggested -= value;
}
}


public void Execute(object parameter)
{
_execute();
}

public Action CurrentAction { get { return _execute; } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public CalculatorViewModel()
this.ResultList = Results.ToList();

this.SortWorker = new ShipCatalogSortWorker();
this.SortWorker.SetTarget(ShipCatalogSortTarget.Level, false);
this.SortWorker.SetTarget(ShipCatalogSortTarget.Level, true);

this.updateSource
.Do(_ => this.IsReloading = true)
Expand Down
6 changes: 3 additions & 3 deletions Grabacr07.KanColleViewer/ViewModels/MainContentViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public MainContentViewModel()
{
new SettingsViewModel(),
#region DEBUG
#if DEBUG
new DebugTabViewModel(),
#endif
// #if DEBUG
// new DebugTabViewModel(),
// #endif
#endregion
};
this.SelectedItem = this.TabItems.FirstOrDefault();
Expand Down
14 changes: 14 additions & 0 deletions Grabacr07.KanColleViewer/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
using Grabacr07.KanColleViewer.Models;
using Grabacr07.KanColleViewer.ViewModels.Messages;
using Grabacr07.KanColleWrapper;
Expand All @@ -21,6 +22,16 @@ public class MainWindowViewModel : WindowViewModel
public NavigatorViewModel Navigator { get; private set; }
public SettingsViewModel Settings { get; private set; }

#region RefreshNavigator

private ICommand _RefreshNavigator;
public ICommand RefreshNavigator
{
get { return _RefreshNavigator; }
}

#endregion

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

public Mode Mode
Expand Down Expand Up @@ -148,6 +159,8 @@ public MainWindowViewModel()
});

this.Mode = Mode.NotStarted;

_RefreshNavigator = new RelayCommand(Navigator.ReNavigate);
}

public void TakeScreenshot()
Expand All @@ -171,5 +184,6 @@ public void Activate()
{
this.Messenger.Raise(new WindowActionMessage(WindowAction.Active, "Window/Activate"));
}

}
}
2 changes: 1 addition & 1 deletion Grabacr07.KanColleViewer/Views/BrowserNavigator.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
Height="30"
Margin="2,0"
Style="{DynamicResource CircleButtonStyleKey}"
ToolTip="Reload">
ToolTip="Reload (F5)">
<Viewbox Margin="5,5,5,6">
<Path Data="M18.369141,1.6116142 L26.235352,9.4778252 L18.383789,17.344036 L18.383789,11.660442 C17.104492,11.660442 15.859374,11.894817 14.648438,12.363567 C13.437499,12.832317 12.343749,13.550091 11.367188,14.516888 C10.371094,15.503216 9.6240234,16.616497 9.1259766,17.856731 C8.6279297,19.096966 8.3789063,20.366497 8.3789063,21.665325 C8.3789063,22.944622 8.6157227,24.192181 9.0893555,25.408001 C9.5629883,26.623821 10.283203,27.720013 11.25,28.696575 C11.738281,29.194622 12.263184,29.631634 12.824707,30.00761 C13.38623,30.383587 13.972167,30.696087 14.58252,30.94511 C15.19287,31.194134 15.81787,31.379681 16.45752,31.501751 C17.097168,31.623821 17.739258,31.684856 18.383789,31.684856 C19.663086,31.684856 20.905762,31.44804 22.111816,30.974407 C23.317871,30.500774 24.414063,29.78056 25.400391,28.813763 C25.898436,28.325481 26.333006,27.798138 26.704102,27.231731 C27.075193,26.665325 27.385252,26.079388 27.634277,25.473919 C27.883299,24.86845 28.071287,24.24345 28.198242,23.598919 C28.325193,22.954388 28.38867,22.309856 28.388672,21.665325 C28.38867,21.011028 28.320311,20.342083 28.183594,19.658489 L32.53418,19.658489 C32.62207,20.322552 32.666016,20.986614 32.666016,21.650677 C32.666016,22.578411 32.578125,23.501263 32.402344,24.419231 C32.226563,25.3372 31.960447,26.233196 31.604004,27.10722 C31.247557,27.981243 30.803221,28.818645 30.270996,29.619427 C29.738768,30.420208 29.116209,31.172161 28.40332,31.875286 C27.709959,32.55888 26.967772,33.157024 26.176758,33.66972 C25.38574,34.182415 24.562986,34.609661 23.708496,34.951458 C22.854004,35.293255 21.97998,35.549603 21.086426,35.720501 C20.192871,35.891399 19.291992,35.976849 18.383789,35.976849 C17.456055,35.976849 16.535645,35.888958 15.622559,35.713177 C14.709472,35.537395 13.8208,35.271282 12.956543,34.914837 C12.092285,34.558392 11.259766,34.114056 10.458984,33.581829 C9.6582031,33.049603 8.90625,32.427044 8.203125,31.714153 C7.5195308,31.020794 6.9213862,30.276165 6.4086914,29.480267 C5.8959961,28.684368 5.4663086,27.859173 5.1196289,27.004681 C4.7729492,26.150188 4.5141602,25.271282 4.3432617,24.367962 C4.1723633,23.464642 4.0869141,22.55888 4.0869141,21.650677 C4.0869141,20.722942 4.1748047,19.802532 4.3505859,18.889446 C4.5263672,17.97636 4.7924805,17.085247 5.1489258,16.216106 C5.5053711,15.346966 5.949707,14.512005 6.4819336,13.711224 C7.0141597,12.910442 7.6367183,12.158489 8.3496094,11.455364 C9.0429688,10.77177 9.7875977,10.176067 10.583496,9.6682549 C11.379395,9.1604424 12.202148,8.7380791 13.051758,8.401165 C13.901366,8.0642529 14.77539,7.8103466 15.673828,7.6394463 C16.572266,7.4685497 17.470703,7.3831005 18.369141,7.3830986 z"
Stretch="Uniform"
Expand Down
6 changes: 4 additions & 2 deletions Grabacr07.KanColleViewer/Views/Contents/Fleets.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
<TextBlock Grid.Column="4"
Grid.Row="0"
Margin="10,0,10,10"
Grid.RowSpan="2">
Grid.RowSpan="2"
ToolTip="{Binding Ship.RepairTime, Mode=OneWay}">
<Run Text="HP:" />
<Run Text="{Binding Ship.HP.Current, Mode=OneWay}"
Style="{DynamicResource PickupTextElementStyleKey}" />
Expand All @@ -218,7 +219,8 @@
Height="6"
VerticalAlignment="Bottom"
Margin="10,0,10,2"
LimitedValue="{Binding Ship.HP, Mode=OneWay}" />
LimitedValue="{Binding Ship.HP, Mode=OneWay}"
ToolTip="{Binding Ship.RepairTime, Mode=OneWay}"/>

<TextBlock Grid.Column="5"
Grid.Row="0"
Expand Down
9 changes: 5 additions & 4 deletions Grabacr07.KanColleViewer/Views/Contents/Overview.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,17 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock>
<TextBlock ToolTip="{Binding Ship.RepairTime, Mode=OneWay}">
<Run Text="HP:" />
<Run Text="{Binding Ship.HP.Current, Mode=OneWay}"
Style="{DynamicResource PickupTextElementStyleKey}" />
<Run Text="{Binding Ship.HP.Maximum, StringFormat=/{0}, Mode=OneWay}" />
</TextBlock>
<controls:ColorIndicator Grid.Row="1"
Height="6"
LimitedValue="{Binding Ship.HP, Mode=OneWay}"
Margin="0,2,0,0" />
Height="6"
LimitedValue="{Binding Ship.HP, Mode=OneWay}"
Margin="0,2,0,0"
ToolTip="{Binding Ship.RepairTime, Mode=OneWay}"/>
</Grid>
<TextBlock Grid.Column="3"
Margin="10,0,0,0">
Expand Down
2 changes: 1 addition & 1 deletion Grabacr07.KanColleViewer/Views/MainContent.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

<Rectangle Grid.Row="1"
Height="1"
Margin="20,10"
Margin="20,5,20,0"
Fill="{DynamicResource InactiveForegroundBrushKey}"
Opacity="0.5" />

Expand Down
3 changes: 3 additions & 0 deletions Grabacr07.KanColleViewer/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
IsRestoringWindowPlacement="True"
SnapsToDevicePixels="True"
TextOptions.TextFormattingMode="Display">
<Window.InputBindings>
<KeyBinding Key="F5" Command="{Binding RefreshNavigator}" />
</Window.InputBindings>

<i:Interaction.Triggers>
<livet:InteractionMessageTrigger Messenger="{Binding Messenger}"
Expand Down
5 changes: 5 additions & 0 deletions Grabacr07.KanColleViewer/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@ protected override void OnClosing(CancelEventArgs e)

base.OnClosing(e);
}

public void RefreshNavigator()
{
App.ViewModelRoot.Navigator.Refresh();
}
}
}
2 changes: 2 additions & 0 deletions Grabacr07.KanColleWrapper/Models/Fleet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ public override string ToString()

public virtual void Dispose()
{
this.ReSortie.Dispose();
this.ReSortie.SafeDispose();
this.Expedition.Dispose();
this.Expedition.SafeDispose();
}
}
Expand Down
17 changes: 17 additions & 0 deletions Grabacr07.KanColleWrapper/Models/Ship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public class Ship : RawDataWrapper<kcsapi_ship2>, IIdentifiable
{
private readonly Homeport homeport;

private int[] BaseRepairTime = { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 125, 130, 145, 150, 155, 160, 165, 180,
185, 190, 195, 200, 205, 210, 225, 230, 235, 240, 245, 250, 255, 260, 265, 280, 285, 290, 295, 300,
305, 310, 315, 320, 325, 330, 345, 350, 355, 360, 365, 370, 375, 380, 385, 390, 395, 400, 405, 420,
425, 430, 435, 440, 445, 450, 455, 460, 465, 470, 475, 480, 485, 490, 505, 510, 515, 520, 525, 530,
535, 540, 545, 550, 555, 560, 565, 570, 575, 580, 585, 600, 605, 610, 615, 620, 652, 630, 635, 635};

/// <summary>
/// この艦娘を識別する ID を取得します。
/// </summary>
Expand Down Expand Up @@ -172,6 +178,17 @@ public string NameLv
get { return string.Format("{0, -20} [Lv.{1}]", this.Info.Name, this.Level); }
}

/// <summary>
/// Repair time taking in consideration HP, LV, and Ship Type.
/// </summary>
public string RepairTime
{
get
{
return TimeSpan.FromSeconds((this.HP.Maximum - this.HP.Current) > 0 ? (this.HP.Maximum - this.HP.Current) * BaseRepairTime[Math.Min(this.Level, 99)] * this.Info.ShipType.RepairMultiplier + 30 : 0).ToString();
}
}

public string Detail
{
get
Expand Down
25 changes: 25 additions & 0 deletions Grabacr07.KanColleWrapper/Models/ShipType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,31 @@ public int SortNumber
get { return this.RawData.api_sortno; }
}

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

public ShipType(kcsapi_mst_stype rawData) : base(rawData) { }

public override string ToString()
Expand Down
15 changes: 15 additions & 0 deletions Grabacr07.KanColleWrapper/Models/ShipTypeId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,20 @@ public enum ShipTypeId
/// 水上機母艦。
/// </summary>
SeaplaneCarrier = 16,

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

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

/// <summary>
/// 工作艦
/// </summary>
RepairShip = 19
}
}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ Also be sure to have the latest version of [Flash for Internet Explorer](http://
#### The game will not start or KCV makes me download a flash file instead of opening the link
Install [Flash for Internet Explorer](http://get.adobe.com/flashplayer/otherversions/). You may also have to disable any programs that have been installed on to IE without your consent such as antivirus software and other programs.

#### I'm on Windows 7/XP and the program does not run!
#### I'm on Windows 7 and the program does not run!
You need to have [.NET Framework 4.5](http://www.microsoft.com/en-us/download/details.aspx?id=30653) installed for your version of Windows. Those on Windows 8 do not have to do this.

#### I'm on Windows XP/Mac/Linux and I want to have fun too!
Sadly, Microsoft doesn't fully support .NET 4.5. There may be 3rd party ways of getting support for the package, but Microsoft has basically abandoned the XP and other OSs in terms of support. Your only two choices realistically is to either get to Windows 7/8 or use [Logbook](https://github.com/Zharay/logbook) which is another Kancolle project that is being worked on that uses Java and is multi-platform also being worked on by [@Zharay](http://twitter.com/Zharay). It is much simpler, but does an awesome job at what it does.

#### I have a white screen / error message about being unable to connect.
Please let me know if this is happening and tell me what OS you are using and the version of IE. My suspicion is an outdated version of IE. Reports have also shown that clearing your cache+cookies and re-installing flash will also fix this issue.

If you are getting connection errors, try changing the program's proxy server port within KanColleViewer.exe.config. Find the number 37564 and replace it with 37565 or another random number. Restart KCV and see if the problem goes away.

#### My Fleets and Expeditions don't show/update!
Clear your cache and relaunch KCV again. Especially after updates or playing between versions of KCV, this should fix any issues regarding this.

Expand Down

0 comments on commit bb34dce

Please sign in to comment.