示例#1
0
        public InformationPanel(Rectangle boundingBox)
            : base(MediaRepository.Textures["Blank"], boundingBox, new Color(255, 255, 255, 50))
        {
            directionPanel = new Panel(new Rectangle(5, 5, 240, 140), new Color(255, 255, 255, 100));

            detailPanel = new Panel(new Rectangle(255, 5, 480, 140), new Color(0, 0, 0, 50));
            mapPanel = new Panel(new Rectangle(745, 5, 140, 140), new Color(255, 255, 255, 100));

            arrowPanel = new DirectionPanel(new Rectangle(20, 20, 200, 100), World.ChangeDirection);
            mirrorArrowPanel = new DirectionPanel(new Rectangle(20, 20, 200, 100), World.ChangeDirection, true);

            professionPanel = new ProfessionPanel(new Rectangle(285, -52, 320, 52));
            missionResultBox = new TextBox(new Rectangle(0, -40, 230, 40), "", Color.White, TextBox.AlignType.Center);

            personStatusPanel = new PersonPanel(new Rectangle(0, 0, 200, 140));
            buildingStatusPanel = new BuildingPanel(new Rectangle(0, 0, 200, 140));
            researchPanel = new ResearchPanel(new Rectangle(0, 0, 200, 140));

            shopButton = new Button(MediaRepository.Textures["Blank"], new Rectangle(800, -30, 90, 30), new Color(0, 0, 150, 100),
                "Shop", MediaRepository.Fonts["DefaultFont"], Color.White);
            shopButton.AddActionListener(this);

            itemsButton = new Button(MediaRepository.Textures["Blank"], new Rectangle(700, -30, 90, 30), new Color(0, 0, 150, 100),
                "Items", MediaRepository.Fonts["DefaultFont"], Color.White);
            itemsButton.AddActionListener(this);

            shopPanel = new ShopPanel(new Rectangle(5, 5, 880, 140), new Color(255, 255, 255, 100));
            shopPanel.Deactivate();

            itemsPanel = new ItemsPanel(new Rectangle(5, 5, 880, 140), new Color(255, 255, 255, 100));
            itemsPanel.Deactivate();

            AddComponent(directionPanel);
            AddComponent(detailPanel);
            AddComponent(mapPanel);

            AddComponent(missionResultBox);
            AddComponent(professionPanel);
            AddComponent(shopButton);
            AddComponent(itemsButton);
            AddComponent(shopPanel);
            AddComponent(itemsPanel);

            directionPanel.AddComponent(arrowPanel);
            directionPanel.AddComponent(mirrorArrowPanel);

            detailPanel.AddComponent(personStatusPanel);
            detailPanel.AddComponent(buildingStatusPanel);
            detailPanel.AddComponent(researchPanel);

            this.consumesMouseEvent = false;
        }
示例#2
0
        public BuildingPanel(Rectangle boundingBox)
            : base(MediaRepository.Textures["Blank"], boundingBox, Color.TransparentWhite)
        {
            title = new TextBox(new Rectangle(25, 10, 100, 25), "Building", Color.White, TextBox.AlignType.Left);
            demolishButton = new Button(new Rectangle(300, 10, 135, 25), "Demolish", MediaRepository.Fonts["DefaultFont"], Color.Red);
            demolishButton.AddActionListener(this);

            effectPanels = new Panel[4];
            effectButtons = new Button[4];
            sequenceBars = new LightSequenceBar[4];
            descriptions = new TextBox[4];
            unknownTexts = new TextBox[4];

            effectPanels[0] = new Panel(new Rectangle(Indent, FirstButtonY, ButtonWidth, ButtonHeight), new Color(255, 255, 255, 100));
            effectPanels[1] = new Panel(new Rectangle(Indent, FirstButtonY + ButtonHeight + Indent, ButtonWidth, ButtonHeight), new Color(255, 255, 255, 100));
            effectPanels[2] = new Panel(new Rectangle(ButtonWidth + 3 * Indent, FirstButtonY, ButtonWidth, ButtonHeight), new Color(255, 255, 255, 100));
            effectPanels[3] = new Panel(new Rectangle(ButtonWidth + 3 * Indent, FirstButtonY + ButtonHeight + Indent, ButtonWidth, ButtonHeight), new Color(255, 255, 255, 100));

            int index = 0;
            foreach (Panel p in effectPanels) {
                effectButtons[index] = new Button(MediaRepository.Textures["Blank"], new Rectangle(0, 0, ButtonWidth, ButtonHeight), Color.TransparentWhite);
                effectButtons[index].AddActionListener(this);

                sequenceBars[index] = new LightSequenceBar(new LightSequence(), new Point(InnerButtonIndent, SequenceBarY), SequenceTileSize, Indent);
                descriptions[index] = new TextBox(new Rectangle(InnerButtonIndent, DescriptionY, 10, 10), "", Color.Black, MediaRepository.Fonts["Arial10"], TextBox.AlignType.Left);
                unknownTexts[index] = new TextBox(new Rectangle(0, 0, ButtonWidth, ButtonHeight), "Unknown", Color.Black, MediaRepository.Fonts["Arial10"], TextBox.AlignType.Center);

                p.AddComponent(effectButtons[index]);
                p.AddComponent(sequenceBars[index]);
                p.AddComponent(descriptions[index]);
                p.AddComponent(unknownTexts[index]);

                AddComponent(p);
                index++;
            }

            AddComponent(title);
            AddComponent(demolishButton);

            Deactivate();
        }
示例#3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            gameWindow = new Rectangle(0, 0, this.graphics.GraphicsDevice.Viewport.Width,
                    this.graphics.GraphicsDevice.Viewport.Height);

            base.Initialize();

            MouseController.Initialize();
            KeyController.Initialize();

            MouseController.AddMouseListener(this);
            MouseController.AddMouseMotionListener(this);
            MouseController.AddMouseScrollListener(this);
            KeyController.AddKeyListener(this);

            Display.InitializeDisplay(new Dimension(100, 50), new Point(0, 25), new Dimension(900, 600), new Rectangle(0, 25, 900, 425));
            World.InitalizeWorld(20, 18);
            Layer.Initialize();

            informationPanel = new InformationPanel(new Rectangle(5, 445, 890, 150));
            missionPanel = new MissionPanel(new Rectangle(0, 25, 300, 200));
            menuBar = new MenuBar(new Rectangle(0, 0, 900, 25));
            worldStatsBar = new WorldStatsPanel(new Rectangle(800, 25, 95, 100));

            Tree t1 = new Tree(2, 1);
            t1.Direction = Entity.DirectionType.East;
            World.AddEntity(t1);

            Tree t2 = new Tree(4, 5);
            t2.Direction = Entity.DirectionType.East;
            World.AddEntity(t2);

            Tree t3 = new Tree(9, 9);
            t3.Direction = Entity.DirectionType.North;
            World.AddEntity(t3);

            World.AddEntity(new School(6, 6));
            World.AddEntity(new Factory(8, 3));
            World.AddEntity(new ResearchCenter(1, 7));
            World.AddEntity(new Hospital(4, 10));

            Random random = new Random();

            Person p0 = new Person(2, 3);
            Person p1 = new Person(4, 6);
            Person p2 = new Person(6, 7);
            Person p3 = new Person(4, 7);
            Person p4 = new Person(6, 1);
            Person p5 = new Person(6, 9);
            Person p6 = new Person(7, 9);
            p0.Direction = Entity.DirectionType.South;
            p3.Profession = Person.ProfessionType.Educator;
            p3.Education = 3;
            p3.Direction = Entity.DirectionType.West;
            p2.Direction = Entity.DirectionType.West;
            p5.Direction = Entity.DirectionType.West;
            p6.Direction = Entity.DirectionType.West;
            p5.Profession = Person.ProfessionType.Educator;
            p6.Profession = Person.ProfessionType.Scientist;
            p5.Education = 3;
            p5.Health = 5;
            p6.Education = 3;
            World.AddEntity(p0);
            World.AddEntity(p1);
            World.AddEntity(p2);
            World.AddEntity(p3);
            World.AddEntity(p4);
            World.AddEntity(p5);
            World.AddEntity(p6);

            Mirror m1 = new Mirror(2, 4);
            Mirror m2 = new Mirror(5, 4);
            m1.Reflection = Mirror.ReflectionType.SouthWest;
            m2.Reflection = Mirror.ReflectionType.NorthEast;
            World.AddEntity(m1);
            World.AddEntity(m2);
        }