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

            activateButton = new Button(MediaRepository.Textures["Blank"], new Rectangle(370, 10, 100, 25), new Color(100, 100, 255, 200), "Activate", MediaRepository.Fonts["Arial10"], Color.Black);
            abortButton = new Button(MediaRepository.Textures["Blank"], new Rectangle(370, 10, 100, 25), new Color(255, 100, 100, 200), "Abort", MediaRepository.Fonts["Arial10"], Color.Black);
            activateButton.AddActionListener(this);
            abortButton.AddActionListener(this);

            descriptionHeader = new TextBox(new Rectangle(Indent, DescriptionY, 10, LineHeight), "Description:", Color.White, MediaRepository.Fonts["Arial10"], TextBox.AlignType.Left);
            descriptionText = new TextBox(new Rectangle(90, DescriptionY, 10, LineHeight), "description...", Color.Black, MediaRepository.Fonts["Arial10"], TextBox.AlignType.Left);
            statusHeader = new TextBox(new Rectangle(Indent, DescriptionY + LineHeight, 10, LineHeight), "Status:", Color.White, MediaRepository.Fonts["Arial10"], TextBox.AlignType.Left);
            statusText = new TextBox(new Rectangle(60, DescriptionY + LineHeight, 10, LineHeight), "status...", Color.Black, MediaRepository.Fonts["Arial10"], TextBox.AlignType.Left);
            tasksHeader = new TextBox(new Rectangle(Indent, DescriptionY + 2 * LineHeight, 10, LineHeight), "Tasks:", Color.White, MediaRepository.Fonts["Arial10"], TextBox.AlignType.Left);

            tasksDisplay = new LightSequenceBar[MaxTasksPerResearch];
            Point pivot = new Point(55, DescriptionY + 2 * LineHeight + 2);
            for (int index = 0; index < MaxTasksPerResearch; index++) {
                tasksDisplay[index] = new LightSequenceBar(new LightSequence(""), pivot, new Dimension(10, 10), 5);
                pivot = Geometry.Sum(pivot, new Point(0, LineHeight));
                AddComponent(tasksDisplay[index]);
            }

            schoolResearchButton_1 = new Button(MediaRepository.Textures["Blank"], new Rectangle(300, 50, 120, 30), new Color(255, 255, 255, 100), "School Research 1", MediaRepository.Fonts["Arial10"], Color.Black);
            schoolResearchButton_1.AddActionListener(this);
            AddComponent(schoolResearchButton_1);

            schoolResearchButton_2 = new Button(MediaRepository.Textures["Blank"], new Rectangle(300, 90, 120, 30), new Color(255, 255, 255, 100), "School Research 2", MediaRepository.Fonts["Arial10"], Color.Black);
            schoolResearchButton_2.AddActionListener(this);
            AddComponent(schoolResearchButton_2);

            AddComponent(title);
            AddComponent(demolishButton);
            AddComponent(descriptionHeader);
            AddComponent(descriptionText);
            AddComponent(statusHeader);
            AddComponent(statusText);
            AddComponent(tasksHeader);
            AddComponent(activateButton);
            AddComponent(abortButton);

            DeactivatePanel(true);
        }
示例#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();
        }