Skip to content

Commit

Permalink
moved missions button to SHIP submenu
Browse files Browse the repository at this point in the history
added galnet reader
  • Loading branch information
mhwlng committed Sep 26, 2020
1 parent 34e3e63 commit 91ef92b
Show file tree
Hide file tree
Showing 16 changed files with 415 additions and 37 deletions.
11 changes: 10 additions & 1 deletion Elite/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ private static void RefreshJson(SplashScreenWindow splashScreen = null)

splashScreen?.Dispatcher.Invoke(() => splashScreen.ProgressText.Text = "Loading Tritium Sell Stations...");
MiningStations.FullMiningStationsList[MiningStations.MaterialTypes.TritiumSell] = MiningStations.GetAllMiningStations(@"Data\tritiumstations.json");


splashScreen?.Dispatcher.Invoke(() => splashScreen.ProgressText.Text = "Loading Galnet News feed...");
Galnet.GalnetList = Galnet.GetGalnet(@"Data\galnet.json");

splashScreen?.Dispatcher.Invoke(() => splashScreen.ProgressText.Text = "Loading Galnet Images...");
Galnet.GetGalnetImages(Galnet.GalnetList);

}

if (splashScreen == null)
Expand Down Expand Up @@ -264,7 +272,7 @@ protected override void OnStartup(StartupEventArgs evtArgs)
Engine.Razor.Compile("ship.cshtml", null);
Engine.Razor.Compile("navigation.cshtml", null);
Engine.Razor.Compile("target.cshtml", null);
Engine.Razor.Compile("missions.cshtml", null);
Engine.Razor.Compile("galnet.cshtml", null);
Engine.Razor.Compile("poi.cshtml", null);
Engine.Razor.Compile("galaxy.cshtml", null);
Expand All @@ -274,6 +282,7 @@ protected override void OnStartup(StartupEventArgs evtArgs)
Engine.Razor.Compile("cargo.cshtml", null);
Engine.Razor.Compile("engineer.cshtml", null);
Engine.Razor.Compile("mining.cshtml", null);
Engine.Razor.Compile("missions.cshtml", null);
Engine.Razor.Compile("events.cshtml", null);
CssData = TheArtOfDev.HtmlRenderer.WinForms.HtmlRender.ParseStyleSheet(
Expand Down
14 changes: 11 additions & 3 deletions Elite/Elite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="CsvHelper, Version=15.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
<HintPath>..\packages\CsvHelper.15.0.5\lib\net47\CsvHelper.dll</HintPath>
<HintPath>..\packages\CsvHelper.15.0.6\lib\net47\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
Expand All @@ -71,8 +71,8 @@
<Reference Include="INIFileParser, Version=2.5.2.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
<HintPath>..\packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.9.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.10\lib\net45\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.11\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
Expand Down Expand Up @@ -128,6 +128,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Galnet.cs" />
<Compile Include="SystemInfo.cs" />
<Compile Include="Route.cs" />
<Compile Include="Cargo.cs" />
Expand Down Expand Up @@ -201,6 +202,9 @@
<None Include="Templates\cargo.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Templates\galnet.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Templates\system.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -262,6 +266,9 @@
<Content Include="Templates\images\galaxyP.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Templates\images\galnet\NewsImageDeathOfEmperor.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Templates\images\powers\Aisling Duval.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -435,6 +442,7 @@
<Name>EliteJournalReader</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
99 changes: 82 additions & 17 deletions Elite/FipPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public enum LcdTab
Commander = 1,
Navigation = 2,
Target = 3,
Missions = 4,
Galnet = 4,
ShipMenu = 5, // ship ->
LocationsMenu = 6, // locations ->

Expand All @@ -60,7 +60,7 @@ public enum LcdTab
Materials = 9,
Cargo = 10,
Engineer = 11,
Events = 12,
Missions = 12,

//---------------

Expand Down Expand Up @@ -659,9 +659,8 @@ public void HandleJoystickButton(JoystickButton joystickButton, bool state, bool

switch (_currentTabCursor)
{

case LcdTab.Events:
//Events > Engineer > Cargo > Materials > Ship > ShipBack
case LcdTab.Missions:
//Missions > Engineer > Cargo > Materials > Ship > ShipBack

_currentTabCursor -= 1;

Expand All @@ -676,7 +675,7 @@ public void HandleJoystickButton(JoystickButton joystickButton, bool state, bool
_currentTabCursor = LcdTab.LocationsMenu;
break;
case LcdTab.ShipBack:
_currentTabCursor = LcdTab.Events;
_currentTabCursor = LcdTab.Missions;
break;
case LcdTab.LocationsBack:
_currentTabCursor = LcdTab.Mining;
Expand Down Expand Up @@ -708,7 +707,7 @@ public void HandleJoystickButton(JoystickButton joystickButton, bool state, bool
{

case LcdTab.Cargo:
//ShipBack > Ship > Materials > Cargo > Engineer > Events
//ShipBack > Ship > Materials > Cargo > Engineer > Missions

_currentTabCursor += 1;

Expand All @@ -722,7 +721,7 @@ public void HandleJoystickButton(JoystickButton joystickButton, bool state, bool
case LcdTab.LocationsMenu:
_currentTabCursor = LcdTab.Commander;
break;
case LcdTab.Events:
case LcdTab.Missions:
_currentTabCursor = LcdTab.ShipBack;
break;
case LcdTab.Mining:
Expand Down Expand Up @@ -876,7 +875,8 @@ private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)
if (state && (CurrentTab == LcdTab.POI || CurrentTab == LcdTab.Powers ||
CurrentTab == LcdTab.Materials || CurrentTab == LcdTab.Galaxy ||
CurrentTab == LcdTab.Ship || CurrentTab == LcdTab.Mining ||
CurrentTab == LcdTab.Navigation || CurrentTab == LcdTab.Engineer))
CurrentTab == LcdTab.Navigation || CurrentTab == LcdTab.Engineer ||
CurrentTab == LcdTab.Galnet))
{

_currentCard[(int) CurrentTab]++;
Expand All @@ -892,7 +892,8 @@ private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)
if (state && (CurrentTab == LcdTab.POI || CurrentTab == LcdTab.Powers ||
CurrentTab == LcdTab.Materials || CurrentTab == LcdTab.Galaxy ||
CurrentTab == LcdTab.Ship || CurrentTab == LcdTab.Mining ||
CurrentTab == LcdTab.Navigation || CurrentTab == LcdTab.Engineer))
CurrentTab == LcdTab.Navigation || CurrentTab == LcdTab.Engineer ||
CurrentTab == LcdTab.Galnet))
{
_currentCard[(int) CurrentTab]--;
_currentZoomLevel[(int) CurrentTab]--;
Expand Down Expand Up @@ -973,7 +974,7 @@ private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)
mustRefresh = SetTab(LcdTab.Target);
break;
case 256:
mustRefresh = SetTab(LcdTab.Missions);
mustRefresh = SetTab(LcdTab.Galnet);
break;
case 512:
mustRefresh = true;
Expand Down Expand Up @@ -1022,7 +1023,7 @@ private void SoftButtonCallback(IntPtr device, IntPtr buttons, IntPtr context)
}
break;
case 1024:
mustRefresh = SetTab(LcdTab.Events);
mustRefresh = SetTab(LcdTab.Missions);
break;
case 2048:
mustRefresh = true;
Expand Down Expand Up @@ -1384,6 +1385,20 @@ public void RefreshDevicePage(bool mustRender = true)
}

break;
case LcdTab.Galnet:

if (_currentCard[(int)CurrentTab] < 0)
{
_currentCard[(int)CurrentTab] = 0;
}
else
if (_currentCard[(int)CurrentTab] > (Galnet.GalnetList?.Count ?? 1) - 1)
{
_currentCard[(int)CurrentTab] = (Galnet.GalnetList?.Count ?? 1) - 1;
}

break;

}

if (mustRender)
Expand Down Expand Up @@ -1672,19 +1687,29 @@ public void RefreshDevicePage(bool mustRender = true)

break;

case LcdTab.Missions:
case LcdTab.Galnet:

var currentCard = _currentCard[(int)CurrentTab];

if (Galnet.GalnetList?.Count <= currentCard -1)
{
currentCard = _currentCard[(int) CurrentTab] = 0;
}

str =
Engine.Razor.Run("missions.cshtml", null, new
Engine.Razor.Run("galnet.cshtml", null, new
{
CurrentTab = CurrentTab,
CurrentPage = _currentPage,
CurrentCard = currentCard,

MissionList = Missions.MissionList
Galnet = Galnet.GalnetList.Skip(currentCard).FirstOrDefault().Value

});

break;


case LcdTab.POI:

lock (App.RefreshJsonLock)
Expand Down Expand Up @@ -1931,6 +1956,19 @@ public void RefreshDevicePage(bool mustRender = true)

break;

case LcdTab.Missions:

str =
Engine.Razor.Run("missions.cshtml", null, new
{
CurrentTab = CurrentTab,
CurrentPage = _currentPage,

MissionList = Missions.MissionList
});

break;
/*
case LcdTab.Events:
var eventlist = "";
Expand All @@ -1949,7 +1987,7 @@ public void RefreshDevicePage(bool mustRender = true)
});
break;

*/
}


Expand Down Expand Up @@ -2013,12 +2051,39 @@ public void RefreshDevicePage(bool mustRender = true)
{
if (mustRender)
{
var currentCard = _currentCard[(int) CurrentTab];

var galnetDate = "???";
var galnetCaption = "Galnet";

var galNetCount = Galnet.GalnetList?.Count ?? 0;

if (CurrentTab == LcdTab.Galnet && galNetCount > currentCard)
{
galnetDate = Galnet.GalnetList.Skip(currentCard).FirstOrDefault().Value
.FirstOrDefault()?.Date;
}

if (currentCard > 0)
{
galnetCaption = "&#x25c0; " + galnetCaption;
}

galnetCaption += " : " + galnetDate;

if (currentCard < galNetCount -1)
{
galnetCaption += " &#x25b6;";
}

var cardcaptionstr =
Engine.Razor.Run("cardcaption.cshtml", null, new
{
CurrentTab = CurrentTab,
CurrentPage = _currentPage,
CurrentCard = _currentCard[(int)CurrentTab]
CurrentCard = currentCard,

GalnetCaption = galnetCaption
});

_cardcaptionHtmlImage = HtmlRender.RenderToImage(cardcaptionstr,
Expand Down
Loading

0 comments on commit 91ef92b

Please sign in to comment.