Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Input;
- namespace StarAttack
- {
- public class IntroComic
- {
- List<string> txt = new List<string>(15);
- public static Color textColor = MainMenu.TEXT_HIGHLIGHT;
- int pointer = 0;
- Range txt2show;
- float txtSpeed = 5;
- Animation button_b;
- public IntroComic()
- {
- button_b = TextureManager.buttonB.MakeAnim();
- txt.Add("The world was still fresh from the shock of the\n\"Steamfull\" war which brought about scientific\nprogress...");
- txt.Add("but also destroyed infrastructure and killed millions\nof innocent civilians.");
- txt.Add("War technologies were adapted to peacetime.\nManufacturing developed and automated factories\nwere opened. Cities had electricity, cars and\nairplanes. The world stepped into the industrial era.");
- txt.Add("Albert Steiner, mathematical and physics genius,\nwas finishing his project that could make him famous\nfor ages.");
- txt.Add("The project was the development of the differential\nsteam engine (DSE). Albert had recently finished its\nprototype. This DSE was way more powerful than any\nstandard engine and also used less energy.");
- txt.Add("Its purpose was to advance agriculture and ease the\nlife of farmers.");
- txt.Add("The scientist was so absorbed with his work that he\neven stopped teaching at the university and was\nnever seen outside of his laboratory.");
- txt.Add("His daughter Judith Steiner loved tinkering with the\nequipment and she would help him as much as she\ncould.");
- txt.Add("The situation in the country was volatile and\nterrorists were plotting against the Fat Queen. The\nworld was waiting for the next war.");
- txt.Add("One day, one of the terrorists came to Albert and\noffered a large amount of money for drafts of the\nDSE.");
- txt.Add("Albert declined the offer, but the terrorist brandished\na weapon and demanded that he hand over the DSE\ndrafts.");
- txt.Add("Albert refused so the terrorist shot him and took the\ndrawings.");
- txt.Add("When Judith came home she saw her dad dying. He\nasked her to stop the villain so that his designs would\nnot be used for the wrong purpose. Judith swore she\nwould not let that happen!");
- txt.Add("She straddled an experimental steam aircraft she\nand her father had been working on for the last\ncouple of months...");
- txt.Add("and chased after the terrorist!");
- //txt.Add("She known that there is an office of RF in here. So he\nmust go there.");
- //
- txt2show = new Range(0, txt[pointer].Length, txtSpeed);
- txt2show.growState = Range.GrowState.GROW_UP;
- }
- public void Update(GameTime gameTime)
- {
- if (AnyGamePad.OnButtonDown(Buttons.B) || StarGame.OnKeyDown(Keys.B) || StarGame.OnKeyDown(Keys.Escape))
- {
- ended = true;
- }
- if (ended)
- return;
- txt2show.Update(gameTime);
- if (Input())
- {
- if (txt2show.IsMax())
- {
- pointer++;
- if (pointer >= txt.Count)
- {
- pointer--;
- ended = true;
- }
- else
- {
- txt2show = new Range(0, txt[pointer].Length, txtSpeed);
- txt2show.growState = Range.GrowState.GROW_UP;
- }
- }
- else
- {
- txt2show.SetOnMax();
- }
- }
- }
- public static Vector2 ramkaPos = new Vector2(256 - 2 - 20, -1);
- public static Rectangle doubled = new Rectangle(1280/2 - 640/2, 720/2 - 360/2 - 360/4 - 32, 640, 360);
- public void Draw(Camera camera)
- {
- // some images used for more then one screen
- int img = pointer + 1;
- if (img == 1)
- img = 1;
- else if (img == 2 || img == 3)
- img = 1;
- else if (img == 4 || img == 5)
- img = 2;
- else if (img == 6 || img == 7)
- img = 3;
- else
- img -= 4;
- img--;
- camera.GetSpriteBatch().Draw(TextureManager.intro_comic_ramka, ramkaPos, Color.White);
- camera.GetSpriteBatch().Draw(TextureManager.intro_comic, doubled, new Rectangle(0, 360*img, 640, 360), Color.White);
- Rectangle rect = new Rectangle(172 + 136 / 2, 720 - 200 - 720 / 10, 804, 200);
- camera.GetSpriteBatch().Draw(TextureManager.blackBox64x64.images[0], rect, new Color(1,1,1,0.3f));
- string out_txt = txt[pointer].Substring(0, (int)txt2show);
- Vector2 pos = new Vector2(rect.X + 30, rect.Y + 20);
- camera.DrawString(StarGame.monoFont, out_txt, new Vector2(rect.X + 30, rect.Y + 20) + DialogItem.shadowOffset, MainMenu.SHADOW_COLOR);
- camera.DrawString(StarGame.monoFont, out_txt, new Vector2(rect.X + 30, rect.Y + 20), textColor);
- string skippText = "Press to skip intro";
- #if WINDOWS
- skippText = "Press to skip intro";
- #endif
- camera.DrawString(StarGame.monoFont, skippText, new Vector2(rect.X + 30, rect.Y + 202) + DialogItem.shadowOffset, MainMenu.SHADOW_COLOR);
- camera.DrawString(StarGame.monoFont, skippText, new Vector2(rect.X + 30, rect.Y + 202), textColor);
- #if XBOX
- camera.Draw(button_b, new Vector2(rect.X + 30 + 64 + 24, rect.Y + 202));
- #endif
- #if WINDOWS
- int size = 64;
- int x = 6;
- int y = 0;
- Rectangle src;
- src = new Rectangle(size * x, size * y, size, size);
- camera.Draw(TextureManager.klava.images[0], src, new Vector2(rect.X + 30 + 64 + 24 - 2, rect.Y + 202));
- #endif
- }
- bool Input()
- {
- bool mouseSelect = false;
- #if WINDOWS
- mouseSelect = Mouse.GetState().LeftButton == ButtonState.Pressed && StarGame.oldMouseState.LeftButton == ButtonState.Released;
- #endif
- return AnyGamePad.OnButtonDown(Buttons.A)
- || AnyGamePad.OnRightTriggerDown()
- || StarGame.OnKeyDown(Keys.Space)
- || StarGame.OnKeyDown(Keys.Z)
- || StarGame.OnKeyDown(Keys.Y)
- || StarGame.OnKeyDown(Keys.X)
- || StarGame.OnKeyDown(Keys.Enter)
- || mouseSelect;
- }
- bool ended = false;
- public bool IsEnded()
- {
- return ended;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement