Changes
This commit is contained in:
parent
0317d1e491
commit
4be95a08ec
15
LocalStorageHelperHolder.cs
Normal file
15
LocalStorageHelperHolder.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Components.Web;
|
||||||
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace WindowsPhoneSpeedyBlupi
|
||||||
|
{
|
||||||
|
public class LocalStorageHelperHolder
|
||||||
|
{
|
||||||
|
public static LocalStorageHelper LocalStorageHelper { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
10
Microsoft.Devices.Sensors/Accelerometer.cs
Normal file
10
Microsoft.Devices.Sensors/Accelerometer.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using Microsoft.Devices.Sensors;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
{
|
||||||
|
public class Accelerometer : SensorBase<AccelerometerReading>
|
||||||
|
{
|
||||||
|
public void Start() { }
|
||||||
|
public void Stop() { }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
{
|
||||||
|
public class AccelerometerFailedException : SensorFailedException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
12
Microsoft.Devices.Sensors/AccelerometerReading.cs
Normal file
12
Microsoft.Devices.Sensors/AccelerometerReading.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
|
||||||
|
{
|
||||||
|
public struct AccelerometerReading : ISensorReading
|
||||||
|
{
|
||||||
|
public Vector3 Acceleration { get; internal set; }
|
||||||
|
public DateTimeOffset Timestamp { get; internal set; }
|
||||||
|
}
|
||||||
|
}
|
10
Microsoft.Devices.Sensors/ISensorReading.cs
Normal file
10
Microsoft.Devices.Sensors/ISensorReading.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
|
||||||
|
{
|
||||||
|
public interface ISensorReading
|
||||||
|
{
|
||||||
|
DateTimeOffset Timestamp { get; }
|
||||||
|
}
|
||||||
|
}
|
15
Microsoft.Devices.Sensors/SensorBase.cs
Normal file
15
Microsoft.Devices.Sensors/SensorBase.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
{
|
||||||
|
public abstract class SensorBase<TSensorReading> : IDisposable where TSensorReading : ISensorReading
|
||||||
|
{
|
||||||
|
private TSensorReading currentValue;
|
||||||
|
|
||||||
|
public event EventHandler<SensorReadingEventArgs<TSensorReading>> CurrentValueChanged;
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
Microsoft.Devices.Sensors/SensorFailedException.cs
Normal file
8
Microsoft.Devices.Sensors/SensorFailedException.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
{
|
||||||
|
public class SensorFailedException : Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
10
Microsoft.Devices.Sensors/SensorReadingEventArgs.cs
Normal file
10
Microsoft.Devices.Sensors/SensorReadingEventArgs.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
{
|
||||||
|
|
||||||
|
public class SensorReadingEventArgs<T> : EventArgs where T : ISensorReading
|
||||||
|
{
|
||||||
|
public T SensorReading { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
Microsoft.Xna.Framework.GamerServices/Guide.cs
Normal file
13
Microsoft.Xna.Framework.GamerServices/Guide.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Microsoft.Xna.Framework.GamerServices
|
||||||
|
{
|
||||||
|
public static class Guide
|
||||||
|
{
|
||||||
|
public static void Show(PlayerIndex playerIndex)
|
||||||
|
{
|
||||||
|
Debug.Write("The Market Place should now be shown.");
|
||||||
|
}
|
||||||
|
public static bool IsTrialMode { get; set; }
|
||||||
|
}
|
||||||
|
}
|
70
Microsoft.Xna.Framework.GamerServices/TrialMode.cs
Normal file
70
Microsoft.Xna.Framework.GamerServices/TrialMode.cs
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace Xna.Framework.GamerServices
|
||||||
|
{
|
||||||
|
internal class TrialMode
|
||||||
|
{
|
||||||
|
private static DateTime trialStartTime;
|
||||||
|
|
||||||
|
public static void InitializeTrialMode()
|
||||||
|
{
|
||||||
|
// Assuming trial mode starts when the game is launched
|
||||||
|
trialStartTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsTrialModeExpired()
|
||||||
|
{
|
||||||
|
return IsTrialMode7DaysLimitExpired() || IsTrialMode10MinutesLimitExpired();
|
||||||
|
}
|
||||||
|
private static bool IsTrialMode10MinutesLimitExpired()
|
||||||
|
{
|
||||||
|
// Example: Trial expires after 10 minutes
|
||||||
|
var expired = (DateTime.Now - trialStartTime).TotalMinutes > 10;
|
||||||
|
return expired;
|
||||||
|
}
|
||||||
|
private static bool IsTrialMode7DaysLimitExpired()
|
||||||
|
{
|
||||||
|
// Save trial expiration status to a file or settings
|
||||||
|
const string TRIAL_END_TIME_TXT = "trialEndTime.txt";
|
||||||
|
var trialEndTime = File.Exists(TRIAL_END_TIME_TXT) ? DateTime.Parse(File.ReadAllText(TRIAL_END_TIME_TXT)) : DateTime.MinValue;
|
||||||
|
|
||||||
|
var expired = trialEndTime != DateTime.MinValue && DateTime.Now > trialEndTime;
|
||||||
|
if (expired)
|
||||||
|
{
|
||||||
|
return true; // Trial period is over
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example of setting trial end time (e.g., 7 days from now)
|
||||||
|
if (!File.Exists(TRIAL_END_TIME_TXT))
|
||||||
|
{
|
||||||
|
File.WriteAllText(TRIAL_END_TIME_TXT, DateTime.Now.AddDays(7).ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return false; // Trial period still active
|
||||||
|
}
|
||||||
|
private static int trialModeEnabled = -1;
|
||||||
|
public static bool IsTrialModeEnabled()
|
||||||
|
{
|
||||||
|
if (trialModeEnabled == 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trialModeEnabled == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const string TRIAL_MODE_ENABLED_TXT = "trialModeEnabled.txt";
|
||||||
|
var trialModeEnabledString = File.Exists(TRIAL_MODE_ENABLED_TXT) ? File.ReadAllText(TRIAL_MODE_ENABLED_TXT) : "0";
|
||||||
|
var trialModeEnabledLocal = trialModeEnabledString.Equals("1");
|
||||||
|
trialModeEnabled = trialModeEnabledLocal ? 1 : 0;
|
||||||
|
|
||||||
|
return trialModeEnabledLocal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.JSInterop;
|
using Microsoft.JSInterop;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using static WindowsPhoneSpeedyBlupi.EnvClasses;
|
||||||
|
|
||||||
namespace WindowsPhoneSpeedyBlupi.Pages
|
namespace WindowsPhoneSpeedyBlupi.Pages
|
||||||
{
|
{
|
||||||
@ -24,6 +25,7 @@ namespace WindowsPhoneSpeedyBlupi.Pages
|
|||||||
// init game
|
// init game
|
||||||
if (_game == null)
|
if (_game == null)
|
||||||
{
|
{
|
||||||
|
Env.init(Impl.KNI, Platform.Web);
|
||||||
_game = new Game1();
|
_game = new Game1();
|
||||||
_game.Run();
|
_game.Run();
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,11 @@ namespace WindowsPhoneSpeedyBlupi
|
|||||||
{
|
{
|
||||||
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
|
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
|
||||||
});
|
});
|
||||||
await builder.Build().RunAsync();
|
//builder.Services.AddSingleton<LocalStorageHelper>();
|
||||||
|
var app = builder.Build();
|
||||||
|
//LocalStorageHelper localStorageHelper = app.Services.GetRequiredService<LocalStorageHelper>();
|
||||||
|
//LocalStorageHelperHolder.LocalStorageHelper = localStorageHelper;
|
||||||
|
await app.RunAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit ea5dabf84b7b035870583d525736711c61c46ad3
|
Subproject commit 99910d425d9f3b77bf5287ee41d278f278322ccd
|
@ -17,9 +17,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DefineConstants>KNI;WEB</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DefineConstants>KNI;WEB</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -29,32 +31,38 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Accelerometer.cs" />
|
<Compile Include="Microsoft.Devices.Sensors\Accelerometer.cs" />
|
||||||
<Compile Include="AccelerometerDummyImpl.cs" />
|
<Compile Include="Microsoft.Devices.Sensors\AccelerometerFailedException.cs" />
|
||||||
<Compile Include="AccelerometerEventArgs.cs" />
|
<Compile Include="Microsoft.Devices.Sensors\AccelerometerReading.cs" />
|
||||||
<Compile Include="AccelerometerFactory.cs" />
|
<Compile Include="Microsoft.Devices.Sensors\ISensorReading.cs" />
|
||||||
<Compile Include="AccelerometerFailedException.cs" />
|
<Compile Include="Microsoft.Devices.Sensors\SensorBase.cs" />
|
||||||
<Compile Include="Decor.cs" />
|
<Compile Include="Microsoft.Devices.Sensors\SensorFailedException.cs" />
|
||||||
<Compile Include="Def.cs" />
|
<Compile Include="Microsoft.Devices.Sensors\SensorReadingEventArgs.cs" />
|
||||||
<Compile Include="GameData.cs" />
|
<Compile Include="Microsoft.Xna.Framework.GamerServices\Guide.cs" />
|
||||||
<Compile Include="InputPad.cs" />
|
<Compile Include="Microsoft.Xna.Framework.GamerServices\TrialMode.cs" />
|
||||||
<Compile Include="Jauge.cs" />
|
<Compile Include="LocalStorageHelperHolder.cs" />
|
||||||
<Compile Include="MarketPlace.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Decor.cs" />
|
||||||
<Compile Include="Misc.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Def.cs" />
|
||||||
<Compile Include="MyResource.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/GameData.cs" />
|
||||||
|
<Compile Include="WindowsPhoneSpeedyBlupi/InputPad.cs" />
|
||||||
|
<Compile Include="WindowsPhoneSpeedyBlupi/Jauge.cs" />
|
||||||
|
<Compile Include="WindowsPhoneSpeedyBlupi/Misc.cs" />
|
||||||
|
<Compile Include="WindowsPhoneSpeedyBlupi/MyResource.cs" />
|
||||||
<Compile Include="Pages\Index.razor.cs" />
|
<Compile Include="Pages\Index.razor.cs" />
|
||||||
<Compile Include="Pixmap.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Pixmap.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Game1.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Game1.cs" />
|
||||||
<Compile Include="Resource.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Resource.cs" />
|
||||||
<Compile Include="Slider.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Slider.cs" />
|
||||||
<Compile Include="Sound.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Sound.cs" />
|
||||||
<Compile Include="Tables.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Tables.cs" />
|
||||||
<Compile Include="Text.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Text.cs" />
|
||||||
<Compile Include="TinyPoint.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/TinyPoint.cs" />
|
||||||
<Compile Include="TinyRect.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/TinyRect.cs" />
|
||||||
<Compile Include="TrialMode.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Worlds.cs" />
|
||||||
<Compile Include="Worlds.cs" />
|
<Compile Include="WindowsPhoneSpeedyBlupi/Env.cs" />
|
||||||
|
<Compile Include="WindowsPhoneSpeedyBlupi\EnvClasses.cs" />
|
||||||
|
|
||||||
<Compile Include="worldscs\WorldTxt.cs" />
|
<Compile Include="worldscs\WorldTxt.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@ -405,4 +413,8 @@
|
|||||||
<KniContentReference Include="Content\Content.mgcb" />
|
<KniContentReference Include="Content\Content.mgcb" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="LocalStorageHelperHolder.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user