mirror of
https://github.com/openeggbert/mobile-eggbert-fna-desktop.git
synced 2025-03-25 15:47:48 +01:00
Issues were fixed
This commit is contained in:
parent
f83dfbacce
commit
47d488f811
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
|
||||||
|
{
|
||||||
|
public interface ISensorReading
|
||||||
|
{
|
||||||
|
DateTimeOffset Timestamp { get; }
|
||||||
|
}
|
||||||
|
}
|
15
mobile-eggbert-fna/Microsoft.Devices.Sensors/SensorBase.cs
Normal file
15
mobile-eggbert-fna/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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
{
|
||||||
|
public class SensorFailedException : Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.Devices.Sensors
|
||||||
|
{
|
||||||
|
|
||||||
|
public class SensorReadingEventArgs<T> : EventArgs where T : ISensorReading
|
||||||
|
{
|
||||||
|
public T SensorReading { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
@ -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,4 +1,6 @@
|
|||||||
static class Program
|
using WindowsPhoneSpeedyBlupi;
|
||||||
|
|
||||||
|
static class Program
|
||||||
{
|
{
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
@ -6,6 +8,7 @@
|
|||||||
//Microsoft.Xna.Framework.FNADllMap.Init();
|
//Microsoft.Xna.Framework.FNADllMap.Init();
|
||||||
// See https://aka.ms/new-console-template for more information
|
// See https://aka.ms/new-console-template for more information
|
||||||
//Console.WriteLine("Hello, World!");
|
//Console.WriteLine("Hello, World!");
|
||||||
|
Env.init(EnvClasses.Impl.FNA, EnvClasses.Platform.Desktop);
|
||||||
var game = new WindowsPhoneSpeedyBlupi.Game1();
|
var game = new WindowsPhoneSpeedyBlupi.Game1();
|
||||||
game.Run();
|
game.Run();
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit c8d567e85331047be2e62fc0b674cce5c6830cf0
|
Subproject commit f38980e4e64ddb09af75d70f9c3eb3f7b6dfdc69
|
Loading…
x
Reference in New Issue
Block a user