public TextLetter(char c, TextSystem.TextEffect te, Random r, int l)
 {
     line = l;
     letter = c;
     effect = te;
     ra = r;
     offset = Vector2.Zero;
     currentColor = Color.White;
 }
        public GameStateMars(ContentManager c, Game1 g)
        {
            Game = g;
            Content = c;

            rockMap = new RockMap(Content);

            windowRect = new Rectangle(0, 0, 1500, int.MaxValue);

            inputHandler = new InputHandler();

            drillSound = Content.Load<SoundEffect>("Drill");
            thrustSound = Content.Load<SoundEffect>("Thrust");
            drillSoundInstance = Content.Load<SoundEffect>("Drill").CreateInstance();
            drillSoundInstance.IsLooped = true;
            thrustSoundInstance = Content.Load<SoundEffect>("Thrust").CreateInstance();
            thrustSoundInstance.IsLooped = true;
            boomSound = Content.Load<SoundEffect>("Boom");

            sdSystem = new TextSystem("profont.png", Content);
            sdSystem.resetString(new Vector2(5, 725));
            sdSystem.addString("Out of energy. Press \\3ESC to self-destruct");

            bg = new Sprite("mars-bg.png", Content, new Vector2(0, 0), false);
            player = new Player("miner.png", Content, new Vector2(windowRect.Width/2, 25));
            shop = new Sprite("shop.png", Content, new Vector2(500, 25));
            deadOverlay = new Sprite("dead.png", Content, new Vector2(0, 0), false);

            otherPlayers = new Dictionary<string, Player>();

            mapOffset = new Vector2(0,-125);

            thrusters = false;
            transY = 0f;
            transX = 0f;

            drillTime = 0f;

            redTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            redTexture.SetData(new Color[] { Color.Red });
            blueTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            blueTexture.SetData(new Color[] { Color.Blue });
            greenTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            greenTexture.SetData(new Color[] { Color.Green });
            blackTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
            blackTexture.SetData(new Color[] { Color.Black });
        }
        public GameStateMainMenu(ContentManager c, Game1 g)
        {
            Content = c;

            inputHandler = new InputHandler ();
            buttons = new List<Sprite> ();

            network = null;

            game = g;

            m = new Menu(new Vector2(5, 5), new String[] { "NEW GAME", "CONTROLS", "CREDITS", "QUIT" }, new Menu.menuAction[] { startGame, showControls, showCredits, quitGame }, 4, 1, "profont.png", Content);

            bg = new Sprite("excav-bg.png", Content, new Vector2(0, 0), false);
            topMask = new Sprite("excav-topmask.png", Content, new Vector2(0, 0), false);
            loadingOverlay = new Sprite("loading-overlay.png", Content, new Vector2(0, 0), false);

            string[] scrollLines = new string[] {
                "In the year 22XX",
                "A new world supply of energy is discovered.",
                "",
                "Marsium.",
                "",
                "As its name suggests, it can only be found",
                "on Mars.",
                "",
                "Within 50 years of its discovery, only one",
                "corporation controls the world supply.",
                "\\3MarsTek.",
                "",
                "You are a rookie drill technician, sent to",
                "a newly-discovered Marsium deposit far from",
                "Civilization.",
                "",
                "",
                ""};
            scrollSystems = new TextSystem[scrollLines.Length];
            for (int x = 0; x < scrollLines.Length; x++) {
                scrollSystems[x] = new TextSystem("profont.png", Content);
                scrollSystems[x].resetString(new Vector2(0, 0));
                scrollSystems[x].addString(scrollLines[x]);
                scrollSystems[x].setPosition(new Vector2(375 - scrollSystems[x].getWidth()/2, 780 + (scrollSystems[x].getHeight() + 2)*x));
                scrollSystems[x].update(1);
            }
        }
 public TextWindow(string[] dialog, ContentManager Content, Vector2 pos, Vector2 siz, double tpc = 25, double bgA = 0.5)
 {
     lines = dialog;
     position = pos;
     size = siz;
     currentLine = 0;
     currentCharacter = 0;
     totalTime = 0.0;
     timePerChar = tpc;
     bgAlpha = bgA;
     waitingForContinue = false;
     blackTexture = new Texture2D (Game1.graphics.GraphicsDevice, 1, 1);
     Color[] blackData = new Color[1];
     blackData [0] = Color.Black;
     blackTexture.SetData (blackData);
     textSystem = new TextSystem ("test-semifont.png", Content);
     textSystem.resetString(new Vector2 (position.X+5,position.Y+5));
     done = false;
 }
Beispiel #5
0
 public Menu(Vector2 loc, string[] options, menuAction[] a, int r, int c, string font, ContentManager Content)
 {
     actions = a;
     cursor = 0;
     rows = r;
     cols = c;
     location = loc;
     boop = Content.Load<SoundEffect>("boop");
     bufferedLocation = new Vector2 (loc.X + 4, loc.Y + 4);
     textSystems = new TextSystem[options.Length];
     for (int x = 0; x < options.Length; x++) {
         textSystems [x] = new TextSystem (font, Content);
         foreach (char ch in options[x].ToCharArray()) {
             textSystems[x].addLetter(ch);
         }
     }
     for (int x = 0; x < textSystems.Length; x++) {
         TextSystem ts = textSystems[x];
         ts.location = getTrueLocation (getVectorFromIndex (x));
     }
     int farthestRightOption = textSystems.Length - 1;
     for (int x = 0; x < textSystems.Length; x++) {
         if (x % cols == cols - 1 && textSystems [x].getWidth () > textSystems [farthestRightOption].getWidth ()) {
             farthestRightOption = x;
         }
     }
     size = new Vector2(textSystems[farthestRightOption].location.X + textSystems[farthestRightOption].getWidth() - location.X - 8,
                        textSystems[textSystems.Length - 1].location.Y + textSystems[textSystems.Length - 1].getHeight() - location.Y - 8);
     blackTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
     Color[] blackTextureData = new Color[1];
     blackTextureData[0] = Color.Black;
     blackTexture.SetData(blackTextureData);
     yellowTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1);
     Color[] yellowTextureData = new Color[1];
     yellowTextureData[0] = Color.Gold;
     yellowTexture.SetData(yellowTextureData);
 }
        public GameStateShop(Game1 g, ContentManager c, Inventory inv)
        {
            Game = g;
            Content = c;
            inventory = inv;
            inputHandler = new InputHandler();
            background = new Sprite("shop-bg.png", Content, Vector2.Zero, false);
            itemSystems = new TextSystem[8];
            headerSystem = new TextSystem("profont.png", Content);
            setHeader();
            descriptionSystem = new TextSystem("profont.png", Content);
            descriptionLocation = new Vector2(350, 75);

            boop = Content.Load<SoundEffect>("Boop");

            backButton = new Sprite("shop_exit.png", Content, new Vector2(25, 675), false);
            purchaseButton = new Sprite("shop_purchase.png", Content, new Vector2(575, 675), false);
            ownedButton = new Sprite("shop_alreadypurchased.png", Content, new Vector2(575, 675), false);

            energyButton = new Sprite("shop_energyrestore.png", Content, new Vector2(105, 675), false);
            hpButton = new Sprite("shop_healthrestore.png", Content, new Vector2(259, 675), false);
            sellButton = new Sprite("shop_sellcargo.png", Content, new Vector2(413, 675), false);

            yesButton = new Sprite("shop_yes.png", Content, new Vector2(25, 550), false);
            noButton = new Sprite("shop_no.png", Content, new Vector2(80, 550), false);

            poorButton1 = new Sprite("shop_poor1.png", Content, Vector2.Zero, false);
            poorButton2 = new Sprite("shop_poor2.png", Content, Vector2.Zero, false);

            confirmSystem = new TextSystem("profont.png", Content);
            action = -1;

            itemNames = new string[] {
                "Power Drill",
                "Marsium Drill",
                "Reinforced Hull",
                "Impenetrable Hull",
                "Cargo Bay Expansion",
                "Cargo Teleportation Bay",
                "TESLA Battery",
                "Fusion Reactor"};
            costs = new int[] {
                350,
                5000,
                150,
                750,
                750,
                1500,
                750,
                1250
            };
            descriptions = new string[] {
                "\\1DRILLS UP TO 2x FASTER THAN\\nYOUR STANDARD DRILL!\\0\\nMade from a lightweight alloy,\\nthis drill generates double\\nthe power from the same\\namount of energy as a\\nregular drill. Great\\nfor tearing through tough\\nbedrock and solid chunks\\nof diamond!",
                "\\1THE DRILL YOUR MOTHER WARNED\\nYOU ABOUT!\\0\\nState-of-the-art drill technology\\nand chemically treated Marsium\\nstrength combine to bring\\nto you the most powerful\\ndrill ever made. Performs\\nthe work of eight standard drills\\nand without using a single\\ndrop extra of energy.\\nBuy now! What are you, poor?",
                "\\1NEVER FEAR A HIGH FALL AGAIN!\\0\\nStandard \\3Marstek\\0(tm)\\nEXC-07 hull reinforced with\\ndiamonds to provide enhanced\\nprotection against rough\\nlandings, pockets of lava, and\\neverything inbetween.",
                "\\1THE BEST ARMOR MONEY CAN BUY!\\0\\nAfter decades of advanced\\nresearch, top \\3Marstek\\0(tm)\\nscientists have yet to find a\\nprojectile that can damage this\\nhull! Hypertrains, space\\nelevators, and even FTL particles\\nfail to leave a dent!",
                "\\1WHAT'RE YOU GONNA DO WITH ALL\\nTHAT JUNK?\\0\\nStore it in this expanded\\ncargo bay! Double the\\ncapacity of the standard\\nmodel, this cargo expansion\\nprovides all the space you\\nneed to store Marsium on\\nlong mining expeditions.",
                "\\1A WHOLE NEW MEANING OF\\nCLOUD STORAGE!\\0\\nWhy store cargo on your ship,\\nwhen you could store it\\nin our warehouse! Just\\nthrow your cargo in and\\nhit the button, and\\nyour precious cargo will be\\ninstantly transported to\\nsecure \\3MarsTek\\0(tm) storage\\nfacilities. Don't worry, we\\npromise we'll give it back!",
                "\\1THE BATTERY OF THE FUTURE!\\0\\nEver since the days of the 21st\\ncentury, men have strived to\\nbuild the ultimate battery. Now,\\n\\3MarsTek\\0(tm) has done it! This\\nbattery harnesses the power of\\nquantum entanglement to deliver\\n5x the power of any other\\nbattery on the market.",
                "\\1IS THIS THING EVEN SAFE?\\0\\nOf course it is! Why carry\\naround a bulky inefficient\\nbattery when you could suck\\npower from your very own\\nsupergiant star! Provides\\nnear-limitless energy, and\\nwill only create a black hole if\\nyou forget to clean the\\nexhaust pipe."
            };

            selectedItem = -1;

            for (int x = 0; x < 8; x++)
            {
                itemSystems[x] = new TextSystem("profont.png", Content);
                itemSystems[x].resetString(new Vector2(25, 50 + (x * 50)));
                itemSystems[x].addString(itemNames[x]);
            }
        }