Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Texture2D TrialSprite, PurchasedSprite; bool TrialmodeActive = false; bool TrialmodeDeactivateItNow = false; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; TargetElapsedTime = TimeSpan.FromTicks(333333); InactiveSleepTime = TimeSpan.FromSeconds(1); this.graphics.IsFullScreen = true; #if DEBUG Guide.SimulateTrialMode = true; #endif if (Guide.SimulateTrialMode == true) { TrialmodeActive = true; } } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); TrialSprite = Content.Load<Texture2D>("trialsprite"); PurchasedSprite = Content.Load<Texture2D>("purchasedsprite"); TouchPanel.EnabledGestures = GestureType.Tap; } protected override void Update(GameTime gameTime) { if (TrialmodeDeactivateItNow == true) { if (Guide.SimulateTrialMode == false) TrialmodeActive = false; TrialmodeDeactivateItNow = false; } while (TouchPanel.IsGestureAvailable) { GestureSample gs = TouchPanel.ReadGesture(); switch (gs.GestureType) { case GestureType.Tap: if (Guide.SimulateTrialMode == true) { Guide.ShowMarketplace(PlayerIndex.One); TrialmodeDeactivateItNow = true; } break; } } base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); if (TrialmodeActive == true) spriteBatch.Draw(TrialSprite, new Vector2(400, 100), Color.White); else spriteBatch.Draw(PurchasedSprite, new Vector2(400, 100), Color.White); spriteBatch.End(); base.Draw(gameTime); } } |
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
public Game1() { ... if (Guide.IsTrialMode == true) { TrialmodeActive = true; } else TrialmodeActive = false; } protected override void Update(GameTime gameTime) { if (TrialmodeDeactivateItNow == true) { if (Guide.IsTrialMode == false) TrialmodeActive = false; TrialmodeDeactivateItNow = false; } while (TouchPanel.IsGestureAvailable) { GestureSample gs = TouchPanel.ReadGesture(); switch (gs.GestureType) { case GestureType.Tap: if (Guide.IsTrialMode == true) { Guide.ShowMarketplace(PlayerIndex.One); TrialmodeDeactivateItNow = true; } break; } } base.Update(gameTime); } |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C#-Quelltext |
|
1 2 3 4 |
if (Guide.SimulateTrialMode == true) { //starte Trialmode } |
C#-Quelltext |
|
1 2 3 4 5 |
Guide.SimulateTrialMode = true; if (Guide.SimulateTrialMode == true) { //starte Trialmode } |
C#-Quelltext |
|
1 2 3 4 5 6 |
if (Guide.IsTrialMode == true) { //Trialmode starten } else //Bezahl-Modus starten |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C#-Quelltext |
|
1 2 |
bool TrialmodeActive = false; bool TrialmodeDeactivateItNow = false; |
C#-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Texture2D TrialSprite, PurchasedSprite; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; TargetElapsedTime = TimeSpan.FromTicks(333333); InactiveSleepTime = TimeSpan.FromSeconds(1); this.graphics.IsFullScreen = true; } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); TrialSprite = Content.Load<Texture2D>("extrasspr"); PurchasedSprite = Content.Load<Texture2D>("creditsspr"); TouchPanel.EnabledGestures = GestureType.Tap; } protected override void Update(GameTime gameTime) { while (TouchPanel.IsGestureAvailable) { GestureSample gs = TouchPanel.ReadGesture(); switch (gs.GestureType) { case GestureType.Tap: if (Guide.IsTrialMode == true) Guide.ShowMarketplace(PlayerIndex.One); break; } } base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); if (Guide.IsTrialMode == true) spriteBatch.Draw(TrialSprite, new Vector2(400, 100), Color.White); else spriteBatch.Draw(PurchasedSprite, new Vector2(400, 100), Color.White); spriteBatch.End(); base.Draw(gameTime); } } |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
C#-Quelltext |
|
1 2 |
bool TrialmodeActive = false; bool TrialmodeDeactivateItNow = false; |
C#-Quelltext |
|
1 2 3 4 |
if (Guide.SimulateTrialMode == true) { //starte Trialmode } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »BlueCobold« (09.12.2013, 07:17)
Best Practice:
Getting the value of IsTrialMode on Windows Phone is a synchronous (blocking) operation that can take 60ms or more to complete when your game is in trial mode.
To prevent significant delays in your game's framerate, don't place this call in your game's Draw or Update methods
Ich zitiere nochmal Deinen Code. Da steht eindeutig, dass es nicht im TrialMode startet:
C#-Quelltext
1 2 bool TrialmodeActive = false; bool TrialmodeDeactivateItNow = false;
Guide.SimulateTrialMode ist automatisch false beim Start, wenn Du ihm nichts anderes zuweist.
Wie soll der Code da jemals in dieses IF reinspringen?
C#-Quelltext
1 2 3 4 if (Guide.SimulateTrialMode == true) { //starte Trialmode }
C#-Quelltext |
|
1 |
Guide.ShowMarketplace(PlayerIndex.One); |
Von dem abgesehen, was unser Kobold sagt, solltest du auch in die MSDN schauen: (Hervorhebung von mir)
Best Practice:
Getting the value of IsTrialMode on Windows Phone is a synchronous (blocking) operation that can take 60ms or more to complete when your game is in trial mode.
To prevent significant delays in your game's framerate, don't place this call in your game's Draw or Update methods
C#-Quelltext |
|
1 2 3 4 |
if (Guide.IsTrialMode == true) spriteBatch.Draw(TrialSprite, new Vector2(400, 100), Color.White); else spriteBatch.Draw(PurchasedSprite, new Vector2(400, 100), Color.White); |
C#-Quelltext |
|
1 2 3 4 5 6 |
//beim Spielstart wird geprüft ob man sich im Trialmodus befindet, falls ja wird die Variable TrialmodeZeichnen auf true gesetzt. //in der Draw Methode: if (TrialmodeZeichnen == true) spriteBatch.Draw(TrialSprite, new Vector2(400, 100), Color.White); else spriteBatch.Draw(PurchasedSprite, new Vector2(400, 100), Color.White); |
Werbeanzeige