Several fixes after migration from XNA to MonoGame

This commit is contained in:
Your Name 2024-11-23 19:03:39 +01:00
parent a2d4fcf351
commit f0c1a1e4b3
6 changed files with 102 additions and 9 deletions

View File

@ -4318,7 +4318,7 @@ namespace WindowsPhoneSpeedyBlupi
m_blupiSuspend = false; m_blupiSuspend = false;
m_blupiAir = true; m_blupiAir = true;
m_blupiAction = 5; m_blupiAction = 5;
end.Y = end.Y; end.Y = end.Y;//Todo : check : Assignment made to same variable; did you mean to assign something else?
m_blupiVitesseY = 0.0; m_blupiVitesseY = 0.0;
m_blupiNoBarre = 5; m_blupiNoBarre = 5;
m_blupiActionOuf = 65; m_blupiActionOuf = 65;

View File

@ -2,7 +2,7 @@
// WindowsPhoneSpeedyBlupi.Game1 // WindowsPhoneSpeedyBlupi.Game1
using System; using System;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.GamerServices; //using Microsoft.Xna.Framework.GamerServices;//todo remove me
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Media;
using WindowsPhoneSpeedyBlupi; using WindowsPhoneSpeedyBlupi;
@ -97,6 +97,7 @@ namespace WindowsPhoneSpeedyBlupi
public Game1() public Game1()
{ {
Exiting += OnExiting;
graphics = new GraphicsDeviceManager(this); graphics = new GraphicsDeviceManager(this);
graphics.IsFullScreen = true; graphics.IsFullScreen = true;
base.Content.RootDirectory = "Content"; base.Content.RootDirectory = "Content";
@ -157,10 +158,9 @@ namespace WindowsPhoneSpeedyBlupi
base.OnActivated(sender, args); base.OnActivated(sender, args);
} }
protected override void OnExiting(object sender, EventArgs args) protected void OnExiting(object sender, EventArgs args)
{ {
decor.CurrentDelete(); decor.CurrentDelete();
base.OnExiting(sender, args);
} }
protected override void Update(GameTime gameTime) protected override void Update(GameTime gameTime)
@ -292,7 +292,7 @@ namespace WindowsPhoneSpeedyBlupi
return; return;
case Def.ButtonGlygh.InitBuy: case Def.ButtonGlygh.InitBuy:
case Def.ButtonGlygh.TrialBuy: case Def.ButtonGlygh.TrialBuy:
Guide.ShowMarketplace(PlayerIndex.One); MarketPlace.Show(PlayerIndex.One);
SetPhase(Def.Phase.Init); SetPhase(Def.Phase.Init);
return; return;
case Def.ButtonGlygh.InitRanking: case Def.ButtonGlygh.InitRanking:
@ -918,7 +918,7 @@ namespace WindowsPhoneSpeedyBlupi
fadeOutPhase = Def.Phase.None; fadeOutPhase = Def.Phase.None;
inputPad.Phase = this.phase; inputPad.Phase = this.phase;
playSetup = this.phase == Def.Phase.PlaySetup; playSetup = this.phase == Def.Phase.PlaySetup;
isTrialMode = Guide.IsTrialMode; isTrialMode = TrialMode.IsTrialModeEnabled();
phaseTime = 0; phaseTime = 0;
missionToStart2 = -1; missionToStart2 = -1;
decor.StopSound(); decor.StopSound();

19
MarketPlace.cs Normal file
View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
namespace WindowsPhoneSpeedyBlupi
{
public class MarketPlace
{
public static void Show(PlayerIndex playerIndex)
{
//Guide.ShowMarketplace(PlayerIndex.One);
Debug.Write("The Market Place should be shown.");
}
}
}

View File

@ -6,8 +6,8 @@ using System.Resources;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Speedy Blupi")] //[assembly: AssemblyTitle("Speedy Blupi")]
[assembly: AssemblyProduct("Speedy Blupi")] //[assembly: AssemblyProduct("Speedy Blupi")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("Dada Games")] [assembly: AssemblyCompany("Dada Games")]
[assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyCopyright("Copyright © 2013")]
@ -16,7 +16,7 @@ using System.Resources;
[assembly: NeutralResourcesLanguage("en-US")] [assembly: NeutralResourcesLanguage("en-US")]
// Configuration // Configuration
[assembly: AssemblyConfiguration("")] //[assembly: AssemblyConfiguration("")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)] [assembly: CompilationRelaxations(8)]

View File

@ -10,6 +10,10 @@
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>icon.ico</ApplicationIcon> <ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="icon.ico" /> <None Remove="icon.ico" />
<None Remove="icon.bmp" /> <None Remove="icon.bmp" />

70
TrialMode.cs Normal file
View File

@ -0,0 +1,70 @@
using System;
using System.IO;
namespace WindowsPhoneSpeedyBlupi
{
public class TrialMode
{
private static DateTime trialStartTime;
public static void InitializeTrialMode()
{
// Assuming trial mode starts when the game is launched
trialStartTime = DateTime.Now;
}
public static Boolean 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;
}
}
}