protected override void LoadContent() { base.LoadContent(); ContentHolder.Init(this, CustomContentLocations.TextureLocations); Levels.Init(); #if !ANDROID && !IOS Engine.SpawnInstance <ControlFullscreen>(); #endif Engine.SpawnInstance <ControlBack>(); Engine.SpawnInstance <Background>(); #if DEBUG Engine.SpawnInstance(new DebuggerWithTerminal(ContentHolder.Get(AvailableFonts.retro_computer))); #endif #if ADS #if ANDROID #if AMAZON Engine.SpawnInstance <AndroidAds>(); #endif #endif #endif #if XBOX_LIVE XboxLiveObject.SignOutCompleted += XboxLiveStatsManager.OnSignOutCompleted; XboxLiveObject.SignInCompleted += XboxLiveStatsManager.OnSignInCompleted; ExitEvent += XboxLiveStatsManager.OnExitGame; XboxLiveObject.SignIn(); #endif Engine.ChangeRoom <RoomInit>(); }
public override void onDraw(SpriteBatch sprite_batch) { base.onDraw(sprite_batch); if (this.State == AdState.Loading || this.State == AdState.Playing || this.State == AdState.NoAdsFound) { var rect = new Rectangle(0, 0, Engine.Game.CanvasWidth, Engine.Game.CanvasHeight); RectangleDrawer.Draw(sprite_batch, rect, new Color(0X04, 0X04, 0X04), layerDepth: 0.001f); var font = ContentHolder.Get(AvailableFonts.retro_computer); var font_color = new Color(0XCC, 0XCC, 0XCC); var splash_texture = ContentHolder.Get(AvailableTextures.splash_ad_buffer); var splash_position = new Vector2(Engine.Game.CanvasWidth / 2 - splash_texture.Width / 2, 57); sprite_batch.Draw(splash_texture, splash_position, Color.White); sprite_batch.DrawString(font, "Snake Will Be Right Back", splash_position + new Vector2(splash_texture.Width / 2f, 188), font_color, scale: 0.4375f, draw_from: DrawFrom.TopCenter); string text; if (this.State == AdState.Loading) { text = "Fetching Ad Data..."; } else if (this.State == AdState.Playing) { text = "Loading Ad"; } else { text = "No Ads Found"; } sprite_batch.DrawString(font, text, new Vector2(Engine.Game.CanvasWidth / 2f, Engine.Game.CanvasHeight - 80), font_color, scale: 0.5f, draw_from: DrawFrom.TopCenter); } }
public override void onDraw(SpriteBatch sprite_batch) { base.onDraw(sprite_batch); if (XboxLiveObject.CurrentUser != null && XboxLiveObject.CurrentUser.IsSignedIn) { string gamertag_string = this._gamertagRegex.Replace(XboxLiveObject.CurrentUser.Gamertag, ""); sprite_batch.DrawString(ContentHolder.Get(AvailableFonts.retro_computer), gamertag_string, this.Position, Color.Black, scale: XboxLiveIndicator.FontScale); } else { const string sign_in_string = "Sign In [X]"; sprite_batch.DrawString(ContentHolder.Get(AvailableFonts.retro_computer), sign_in_string, this.Position, Color.Black, scale: XboxLiveIndicator.FontScale); } }
public override void onDraw(SpriteBatch sprite_batch) { base.onDraw(sprite_batch); if (!(Engine.Room is RoomMain)) { return; } if (!Upgrade.IsUpgraded && !this.FetchingIsUpgraded) { if (Settings.CurrentTheme == 6 || Settings.CurrentTheme == 7) { Color wall_color; if (Settings.CurrentTheme == 6) { wall_color = new Color(0xdf, 0x5a, 0x1f); } else { wall_color = new Color(0x84, 0xb0, 0x4e); } RectangleDrawer.Draw(sprite_batch, this.Position.X - Wall.Size / 2f, this.Position.Y - Wall.Size / 2f, Wall.Size, Wall.Size, wall_color); } var background_color = Color.White; if (Settings.CurrentTheme < this.BackgroundColors.Length) { background_color = this.BackgroundColors[Settings.CurrentTheme]; } RectangleDrawer.Draw(sprite_batch, this.Position.X - Wall.Size / 2f + 4, this.Position.Y - Wall.Size / 2f + 4, Wall.Size - 8, Wall.Size - 8, background_color); var text_color = Color.Black; if (Settings.CurrentTheme < this.FoodColors.Length) { text_color = this.FoodColors[Settings.CurrentTheme]; } for (int i = 0; i < 3; i++) { RectangleDrawer.Draw(sprite_batch, this.Position.X - 8, this.Position.Y - 1.5f - 5 + 5 * i, 16, 3, text_color); } sprite_batch.DrawString(ContentHolder.Get(AvailableFonts.retro_computer), "Upgrade", this.Position + new Vector2(Wall.Size / 2 + 3, 0), text_color, scale: 0.3125f, draw_from: DrawFrom.LeftCenter); } }
public static void Play(AvailableSounds sound, float volume = 1.0f, float pitch = 0f, float pan = 0f) { Utilities.Try(() => ContentHolder.Get(sound).Play(volume, pitch, pan)); }