public override void Initialize(ContentManager content) { base.Initialize(content); MenuObj bg = new MenuObj("ui/mainmenu"); bg.Initialize(Content); bg.CreateFramesFromXML("ui/mainmenu_frames"); bg.CurrentFrame = "mainmenu"; bg.ResetDimensions(); float widthDif = BaseGame.Get.BackBufferWidth / 1000.0f; bg.Width *= widthDif; bg.Height *= widthDif; Components.Add(bg); Button b = new Button("ui/ui"); b.CreateFramesFromXML("ui/ui_frames"); b.Initialize(Content); b.CurrentFrame = "levelbutton"; b.ResetDimensions(); b.RegularScale = ScaleFactor * 1.5f; b.ScaleOnHover = b.RegularScale * 1.1f; b.PosX = -0.24f * BaseGame.Get.BackBufferWidth; b.PosY = -0.3f * BaseGame.Get.HalfBackBufferHeight; b.SetText("Play", "ui/Play"); b.Text.Colour = Color.Black; b.PlaySFXOnRelease = "Sounds/PlayStateSelect"; b.TextScaler = 0.75f; b.UniformScale = b.RegularScale; Components.Add(b); b = new Button("ui/ui"); b.CreateFramesFromXML("ui/ui_frames"); b.Initialize(Content); b.CurrentFrame = "settings"; b.ResetDimensions(); b.RegularScale = ScaleFactor * 0.5f; b.ScaleOnHover = b.RegularScale * 1.1f; b.PosX = -0.45f * BaseGame.Get.BackBufferWidth; b.PosY = -0.5f * BaseGame.Get.HalfBackBufferHeight; b.UniformScale = b.RegularScale; Components.Add(b); AudioManager.PlayMusic("troublemaker"); BlankNess blank = new BlankNess(); blank.Initialize(Content); blank.RaiseFlag(Flags.FADE_OUT); blank.fadeInTimer = 1.0f; blank.fullBlankity = 1.0f; Components.Add(blank); }
public static void CreateAustralia(GameScene scene, int leftmostpos, int rightmostpos) { if (content != null) { content.Dispose(); content = null; } if (LastMusicPlayed != "uluru") { LastMusicPlayed = "uluru"; AudioManager.PlayMusic("uluru"); } content = new ContentManager(BaseGame.Get.Services); content.RootDirectory = "Content"; int j = 0; for (int i = leftmostpos - 5000; i < rightmostpos + 5000; ) { Sprite s = new Sprite("textures/backgrounds/australia/australia"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames"); s.CurrentFrame = "underground"; s.ResetDimensions(); s.UniformScale = 4.0f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.Layer = BaseSprite.SpriteLayer.LAYER8; s.PosX = i;// +s.Width * s.ScaleX / 1.01f; s.PosY = -s.Height * s.ScaleY / 2.0f; i += (int)(s.Width * s.ScaleX / 1.01f); scene.AddNode(s); } j = 0; //for (int i = leftmostpos - 5000; i < rightmostpos + 5000; ) { Sprite s = new Sprite("textures/backgrounds/australia/australia"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames"); s.CurrentFrame = "distantmountain"; s.ResetDimensions(); s.UniformScale = 4.0f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.CamPosScale = new Vector2(0.05f, 1.0f); s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER4; s.PosX = 0;// j++ * s.Width * s.ScaleX / 1.01f; s.PosY = s.Height * s.ScaleY / 2.0f; //i += (int)(s.Width * s.ScaleX / 1.01f); scene.AddNode(s); } j = 0; float height = 0; for (int i = leftmostpos - 5000; i < rightmostpos + 5000; ) { Sprite s = new Sprite("textures/backgrounds/australia/australia"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames"); s.CurrentFrame = "skycloud"; s.ResetDimensions(); s.UniformScale = 4.0f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.CamPosScale = new Vector2(0.05f, 1.0f); s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER5; s.PosX = i;// (j++ * 1.0f) * s.Width * s.ScaleX / 1.01f; s.PosY = s.Height * s.ScaleY / 2.0f; i += (int)(s.Width * s.ScaleX / 1.01f); height = s.Height * s.ScaleY; scene.AddNode(s); } { Sprite s = new Sprite("textures/backgrounds/australia/australia"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames"); s.CurrentFrame = "topsky"; s.ResetDimensions(); s.UniformScale = 2.0f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.CamPosScale = new Vector2(0.05f, 1.0f); s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER5; s.PosX = 0;// (j++ * 1.0f) * s.Width * s.ScaleX / 1.01f; s.PosY = height + s.Height*s.ScaleY/2.1f;// *2.0f; s.Width = 1000000; scene.AddNode(s); } { MenuObj s = new MenuObj("textures/backgrounds/australia/australia"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames"); s.CurrentFrame = "rawbg"; s.ResetDimensions(); s.UniformScale = 1.5f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER6; s.Width = BaseGame.Get.BackBufferWidth; s.Height = BaseGame.Get.BackBufferHeight; s.Position = Vector2.Zero; scene.AddNode(s); } /* { Sprite s = new Sprite("textures/backgrounds/australia/australia"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames"); s.CurrentFrame = "rawbg"; s.ResetDimensions(); s.UniformScale = 2.0f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER6; s.Width = 1000000; s.Height = 1000000; s.PosY = s.Height * s.ScaleY / 2.0f + 100; scene.AddNode(s); }*/ for (int i = leftmostpos - 5000; i < rightmostpos + 5000; ) { Sprite s = new Sprite("textures/backgrounds/australia/australia"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames"); s.CurrentFrame = "bgstripclose"; s.ResetDimensions(); s.UniformScale = 2.6f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER2; s.PosX = i;// +s.Width * s.ScaleX / 1.01f; s.PosY = s.Height * s.ScaleY / 2.0f; s.CamPosScale = new Vector2(0.3f, 1.0f); i += (int)(s.Width * s.ScaleX / 1.01f); scene.AddNode(s); } j = 0; for (int i = leftmostpos - 5000; i < rightmostpos + 5000; ) { Sprite s = new Sprite("textures/backgrounds/australia/australia"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/australia/australia_frames"); s.CurrentFrame = "bgstripfar"; s.ResetDimensions(); s.UniformScale = 2.0f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER3; s.CamPosScale = new Vector2(0.1f, 1.0f); s.PosX = i;// +s.Width * s.ScaleX / 1.01f; s.PosY = s.Height * s.ScaleY / 2.0f; i += (int)(s.Width * s.ScaleX / 1.01f); scene.AddNode(s); } j = 0; }
public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager Content) { base.Initialize(Content); /* text.Initialize(Content); text.Text = "Highscore: "; text.Handle = SpriteHandle.CENTERLEFT; */ textScore = new Jabber.Media.MediaTextDrawer("ui/ui", "ui/ui_frames"); textScore.Initialize(Content); textScore.Text = "10000"; textScore.Handle = SpriteHandle.CENTERLEFT; PosX = 0.15f * BaseGame.Get.BackBufferWidth - 15 * ScaleFactor; PosY = 0.355f * BaseGame.Get.BackBufferHeight; UniformScale = 1.0f * ScaleFactor; curscore = new MediaTextDrawer("ui/ui", "ui/ui_frames"); curscore.Initialize(Content); curscore.CreateFramesFromXML("ui/ui_frames"); // curscore.PosX = 0.15f * BaseGame.Get.BackBufferWidth - 15 * ScaleFactor; // curscore.PosY = 0.4f * BaseGame.Get.BackBufferHeight; curscore.UniformScale = ScaleFactor; curscore.Text = "0123456789"; curscore.Handle = SpriteHandle.CENTERLEFT; highscore = new MenuObj("ui/ui"); highscore.Initialize(Content); highscore.CreateFramesFromXML("ui/ui_frames"); highscore.CurrentFrame = "highscore"; highscore.ResetDimensions(); highscore.PosX = 0.35f * BaseGame.Get.BackBufferWidth - 15 * ScaleFactor; highscore.PosY = 0.455f * BaseGame.Get.BackBufferHeight; highscore.UniformScale = ScaleFactor * 0.75f; scoretext = new MenuObj("ui/ui"); scoretext.Initialize(Content); scoretext.CreateFramesFromXML("ui/ui_frames"); scoretext.CurrentFrame = "score"; scoretext.ResetDimensions(); scoretext.PosX = 0.35f * BaseGame.Get.BackBufferWidth - 15 * ScaleFactor; scoretext.PosY = 0.45f * BaseGame.Get.BackBufferHeight; scoretext.UniformScale = ScaleFactor * 0.75f; scoretext.Handle = SpriteHandle.CENTERRIGHT; }
public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content) { base.Initialize(content); BlankNess n = new BlankNess(); n.Initialize(Content); n.RaiseFlag(Jabber.Flags.FADE_IN); n.fullBlankity = 0.25f; Components.Add(n); if (gameplay.GetRemainingFox() == 0) { MenuObj logo = new MenuObj("ui/ui"); logo.Initialize(Content); logo.CreateFramesFromXML("ui/ui_frames"); logo.CurrentFrame = "cannonfire"; logo.ResetDimensions(); logo.UniformScale = ScaleFactor; logo.PosX = 0.1f * BaseGame.Get.BackBufferWidth; logo.PosY = 0.1f * BaseGame.Get.BackBufferHeight; logo.PosY -= 0.1f * BaseGame.Get.BackBufferHeight; logo.Colour = Color.White * 0.5f; Components.Add(logo); } else { MenuObj logo = new MenuObj("ui/ui"); logo.Initialize(Content); logo.CreateFramesFromXML("ui/ui_frames"); logo.CurrentFrame = "chickenincannon"; logo.ResetDimensions(); logo.UniformScale = ScaleFactor; logo.Colour = Color.White * 0.5f; logo.PosY -= 0.1f * BaseGame.Get.BackBufferHeight; Components.Add(logo); } ThinBlackLine b = new ThinBlackLine(); b.Initialize(Content); Components.Add(b); Button restart = new FadeInButton(); restart.Initialize(Content); restart.CreateFramesFromXML("ui/ui_frames"); restart.CurrentFrame = "restart"; restart.ResetDimensions(); restart.Colour = Color.LightGreen; restart.RegularScale = ScaleFactor / 2.0f; restart.ScaleOnHover = restart.RegularScale * 1.1f; restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f; Components.Add(restart); if (gameplay.GetRemainingFox() == 0) { restart = new FadeInButton(); restart.Initialize(Content); restart.CreateFramesFromXML("ui/ui_frames"); restart.CurrentFrame = "doublearrow"; restart.ResetDimensions(); restart.Colour = Color.LightBlue; restart.RegularScale = ScaleFactor / 2.0f; restart.ScaleOnHover = restart.RegularScale * 1.1f; restart.PosX = BaseGame.Get.BackBufferWidth * 0.14f; restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f; Components.Add(restart); } restart = new FadeInButton(); restart.Initialize(Content); restart.CreateFramesFromXML("ui/ui_frames"); restart.CurrentFrame = "quit"; restart.ResetDimensions(); restart.Colour = Color.Red * 0.8f; restart.RegularScale = ScaleFactor / 2.0f; restart.ScaleOnHover = restart.RegularScale * 1.1f; restart.PosX = -BaseGame.Get.BackBufferWidth * 0.14f; restart.PosY = -BaseGame.Get.HalfBackBufferHeight * 0.5f; Components.Add(restart); TextDrawer text = new TextDrawer("ui/LevelFont"); text.Handle = BaseSprite.SpriteHandle.CENTER; text.Initialize(Content); text.Text = "Best: " + ChicksnVixensGame.Get.GetLevelState(gameplay.location, gameplay.levelNum).Score; text.PosX = 0 * BaseGame.Get.BackBufferWidth; text.PosY = 0.1f * BaseGame.Get.BackBufferHeight; text.UniformScale = ScaleFactor * 0.7f; Components.Add(text); text = new TextDrawer("ui/LevelFont"); text.Handle = BaseSprite.SpriteHandle.CENTER; text.Initialize(Content); text.Text = "Score: " + gameplay.score.score.ToString(); text.Colour = Color.OrangeRed; text.UniformScale = ScaleFactor; text.PosX = 0; text.PosY = 0.175f * BaseGame.Get.BackBufferHeight; Components.Add(text); StarDrawer s = new StarDrawer(gameplay.NumStars); s.Initialize(Content); Components.Add(s); Donut.Initialize(Content); Donut.CreateFramesFromXML("misc_frames"); Donut.CurrentFrame = "donut"; Donut.ResetDimensions(); Donut.UniformScale = ScaleFactor; Donut.PosY = -0.06f * BaseGame.Get.BackBufferHeight; Donut.Colour = Color.White * 0.4f; Components.Add(Donut); text = new TextDrawer("ui/LevelFont"); text.Handle = BaseSprite.SpriteHandle.CENTER; text.Initialize(Content); text.Text = "Donuts: " + gameplay.donutScore.TargetScore; text.Colour = Color.OrangeRed; text.UniformScale = ScaleFactor; text.PosX = 0; text.PosY = -0.025f * BaseGame.Get.BackBufferHeight; Components.Add(text); text = new TextDrawer("ui/LevelFont"); text.Handle = BaseSprite.SpriteHandle.CENTER; text.Initialize(Content); text.Text = "Best: " + ChicksnVixensGame.Get.GetLevelState(gameplay.location, gameplay.levelNum).NumDonuts; text.UniformScale = ScaleFactor * 0.7f; text.PosX = 0; text.PosY = -0.1f * BaseGame.Get.BackBufferHeight; Components.Add(text); }
public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content) { base.Initialize(content); FarWorld world = new FarWorld(); scene = new GameScene(world, Content); locationText.Initialize(Content); locationText.Text = "NONE"; ArrowScroll a = new ArrowScroll(); a.Initialize(Content); a.Right = false; scene.AddNode(a); a = new ArrowScroll(); a.Initialize(Content); scene.AddNode(a); map = new MapUI(); map.Initialize(Content); scene.AddNode(map); Components.Add(scene); for (int i = 0; i < ChicksnVixensGame.Get.locationOrder.Count; i++) { worldLocations.Add(ChicksnVixensGame.Get.locationOrder[i]); } BlankNess faderInner = new BlankNess(); faderInner.Initialize(Content); faderInner.fullBlankity = 1.0f; faderInner.fadeInTimer = 1.0f; faderInner.fadeSpeed = 2.0f; faderInner.RaiseFlag(Flags.FADE_OUT); Components.Add(faderInner); locked = new MenuObj("ui/ui"); locked.Initialize(content); locked.CreateFramesFromXML("ui/ui_frames"); locked.CurrentFrame = "lock"; locked.ResetDimensions(); locked.UniformScale = ScaleFactor * 2.0f; locked.Position = Vector2.Zero; locked.Colour = new Color(0, 0, 0, 0); Components.Add(locked); EventManager.Get.SendImmediateEvent(new NewLocationSelected()); string location = worldLocations[curLocation]; Cam.TargetPos = map.GetLocation(location); Cam.targetScale = 2; Cam.LevelSelect = false; }
//todo: add left/right extreme values for create[location] functions! public static void CreateParis(GameScene scene, int leftmostpos, int rightmostpos) { if (content != null) { content.Dispose(); content = null; } if (LastMusicPlayed != "paris") { LastMusicPlayed = "paris"; AudioManager.PlayMusic("paris"); } content = new ContentManager(BaseGame.Get.Services); content.RootDirectory = "Content"; int j = 0; for (int i = leftmostpos - 5000; i < rightmostpos + 5000; ) { Sprite s = new Sprite("textures/backgrounds/paris/paris"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames"); s.CurrentFrame = "underground"; s.ResetDimensions(); s.UniformScale = 4.0f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.Layer = BaseSprite.SpriteLayer.LAYER8; s.PosX = i;// +s.Width * s.ScaleX / 1.01f; s.PosY = -s.Height * s.ScaleY / 2.0f; i += (int)(s.Width * s.ScaleX / 1.01f); scene.AddNode(s); } j = 0; for (int i = leftmostpos - 5000; i < rightmostpos + 5000; ) { Sprite s = new Sprite("textures/backgrounds/paris/paris"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames"); s.CurrentFrame = "distantbg"; s.ResetDimensions(); s.UniformScale = 4.0f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.CamPosScale = new Vector2(0.05f, 1.0f); s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER3; s.PosX = i;// j++ * s.Width * s.ScaleX / 1.01f; s.PosY = s.Height * s.ScaleY / 2.0f; i += (int)(s.Width * s.ScaleX / 1.01f); scene.AddNode(s); } j = 0; { MenuObj s = new MenuObj("textures/backgrounds/paris/paris"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames"); s.CurrentFrame = "rawbg"; s.ResetDimensions(); s.UniformScale = 1.5f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER6; s.Width = BaseGame.Get.BackBufferWidth; s.Height = BaseGame.Get.BackBufferHeight; s.Position = Vector2.Zero; scene.AddNode(s); } /* for (int i = leftmostpos - 5000; i < rightmostpos + 5000; ) { Sprite s = new Sprite("textures/backgrounds/paris/paris"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames"); s.CurrentFrame = "cloud1"; s.ResetDimensions(); s.UniformScale = 2.0f; s.Handle = BaseSprite.SpriteHandle.CENTER; s.CamPosScale = new Vector2(0.05f, 1.0f); s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER4; s.PosX = (j++ * 1.5f) * s.Width * s.ScaleX / 1.01f; s.PosY = s.Height * s.ScaleY / 2.0f + 150; i += (int)(s.Width * s.ScaleX); scene.AddNode(s); }*/ /* { Sprite s = new Sprite("textures/backgrounds/paris/paris"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames"); s.CurrentFrame = "rawbg"; s.ResetDimensions(); s.UniformScale = 2.0f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER5; s.Width = 1000000; s.PosY = s.Height * s.ScaleY / 2.0f; scene.AddNode(s); }*/ /* { Sprite s = new Jabber.Util.UI.MenuObj("textures/backgrounds/paris/paris"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames"); s.CurrentFrame = "skycore"; s.ResetDimensions(); s.UniformScale = 1.0f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER6; s.Width = BaseGame.Get.BackBufferWidth; s.Height = BaseGame.Get.BackBufferHeight; s.Position = Vector2.Zero; scene.AddNode(s); }*/ { Sprite s = new Sprite("textures/backgrounds/paris/paris"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames"); s.CurrentFrame = "eiffel"; s.ResetDimensions(); s.UniformScale = 4.0f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER2; s.PosY = s.Height * s.ScaleY / 2.0f; s.CamPosScale = new Vector2(0.8f, 1.0f); scene.AddNode(s); } /* for (int i = -100; i < 100; i++) { Sprite s = new Sprite("parisbg"); s.Initialize(content); s.CreateFramesFromXML("textures/backgrounds/paris/paris_frames"); s.CurrentFrame = "closebuildings"; s.ResetDimensions(); s.UniformScale = 2.0f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER2; s.PosX = i * s.Width * s.ScaleX * 0.999f; s.PosY = s.Height * s.ScaleY / 2.0f; s.CamPosScale = new Vector2(0.4f, 1.0f); scene.AddNode(s); }*/ /* { Sprite s = new Sprite("parisbg"); s.Initialize(content); s.CreateFramesFromXML("Content/paris_frames.xml"); s.CurrentFrame = "SkyGradient"; s.ResetDimensions(); s.UniformScale = 2.0f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER3; s.Width = 1000000; s.PosY = s.Height * s.ScaleY / 2.0f; scene.AddNode(s); } { Sprite s = new Sprite("parisbg"); s.Initialize(content); s.CreateFramesFromXML("Content/paris_frames.xml"); s.CurrentFrame = "Sky"; s.ResetDimensions(); s.UniformScale = 2.0f; s.Layer = BaseSprite.SpriteLayer.BACKGROUND_LAYER5; s.Width = 1000000; s.Height = 1000000; s.PosY = s.Height * s.ScaleY / 2.0f + 100; scene.AddNode(s); }*/ }