Esempio n. 1
0
        private void CreateTools()
        {
            tools = new LETool[] {
                new LETSingle(),
                new LETCluster(),
                new LETPaint(),
                new LETRect()
            };
            curTool = tools[0];

            // Create Menu
            toolMenu = new ScrollMenu(wr, 180, 30, 5, 12, 30);
            toolMenu.Build((from tool in tools select tool.Name).ToArray());
            toolMenu.BaseColor          = Color.LightCoral;
            toolMenu.HighlightColor     = Color.Red;
            toolMenu.TextColor          = Color.Black;
            toolMenu.ScrollBarBaseColor = Color.Green;
            toolMenu.Widget.AlignY      = Alignment.BOTTOM;
            toolMenu.Parent             = voxMenu.Widget;
            toolMenu.Hook();

            // Set The Textures
            foreach (var tool in tools)
            {
                tool.LoadMouseTexture(G, @"LevelEditor\Mouse\" + tool.Name + ".png");
            }
            game.mRenderer.Texture = curTool.MouseTexture;
        }
Esempio n. 2
0
        private void CreateWidgets()
        {
            wr = new WidgetRenderer(G, game.Content.Load <SpriteFont>(@"Fonts\Impact32"));

            voxMenu = new ScrollMenu(wr, 180, 30, 5, 12, 30);
            voxMenu.Build(dVox.Keys.ToArray());
            voxMenu.BaseColor          = Color.LightCoral;
            voxMenu.HighlightColor     = Color.Red;
            voxMenu.TextColor          = Color.Black;
            voxMenu.ScrollBarBaseColor = Color.Green;
            voxMenu.Widget.AlignY      = Alignment.BOTTOM;
            voxMenu.Widget.Anchor      = new Point(0, game.Window.ClientBounds.Height);
            voxMenu.Hook();

            // TODO: Parse In Config
            leMenu = new LEMenu(wr, new UICLEMenu());
            leMenu.Activate();
            leMenu.SaveButton.OnButtonPress += SaveButton_OnButtonPress;
            leMenu.LoadButton.OnButtonPress += LoadButton_OnButtonPress;
        }
Esempio n. 3
0
        public override void OnEntry(GameTime gameTime)
        {
            // Load All The Races And Schemes
            Races   = new Dictionary <string, FileInfo>();
            schemes = new Dictionary <string, RTSColorScheme>();
            GameEngine.SearchAllInitInfo(new DirectoryInfo("Packs"), Races, schemes);
            if (schemes.Count < 1)
            {
                schemes.Add("Default", RTSColorScheme.Default);
            }
            string defScheme = "Default";

            foreach (var kvp in schemes)
            {
                defScheme = kvp.Key;
                break;
            }

            // Set Init Data To Be Nothing
            game.LoadScreen.LoadFile = null;
            eld       = new EngineLoadData();
            eld.Teams = new TeamInitOption[GameState.MAX_PLAYERS];
            for (int i = 0; i < eld.Teams.Length; i++)
            {
                eld.Teams[i].InputType  = RTSInputType.None;
                eld.Teams[i].Race       = null;
                eld.Teams[i].PlayerName = null;
                eld.Teams[i].Colors     = schemes[defScheme];
            }
            game.LoadScreen.LoadData = eld;

            wr      = new WidgetRenderer(G, game.Content.Load <SpriteFont>(@"Fonts\Impact32"));
            widgets = new TeamInitWidget[eld.Teams.Length];
            ButtonHighlightOptions bh1 = new ButtonHighlightOptions(120, 36, Color.Black);
            ButtonHighlightOptions bh2 = new ButtonHighlightOptions(120, 36, Color.DarkGray);

            string[] pt = { "None", "Player", "Computer", "Environment" };
            for (int i = 0; i < widgets.Length; i++)
            {
                widgets[i] = new TeamInitWidget(wr, 600, 44, 8, new Color(8, 8, 8), bh1, bh2, Color.Lime);
                if (i > 0)
                {
                    widgets[i].Parent = widgets[i - 1].BackRect;
                }
                widgets[i].TextIndex.Text = (i + 1).ToString();
                widgets[i].TextUser.Text  = "Unknown";
                widgets[i].Set(pt, Races, schemes);
            }
            widgets[0].TextUser.Text = UserConfig.UserName;

            menuPresets = new ScrollMenu(wr,
                                         game.Window.ClientBounds.Width - widgets[0].BackRect.Width - 20,
                                         24,
                                         game.Window.ClientBounds.Height / 24,
                                         20,
                                         40
                                         );
            menuPresets.BaseColor          = UserConfig.MainScheme.WidgetBase;
            menuPresets.TextColor          = UserConfig.MainScheme.Text;
            menuPresets.ScrollBarBaseColor = UserConfig.MainScheme.WidgetInactive;
            menuPresets.HighlightColor     = UserConfig.MainScheme.WidgetActive;
            menuPresets.Widget.Anchor      = new Point(game.Window.ClientBounds.Width - 20, 0);
            menuPresets.Widget.AlignX      = Alignment.RIGHT;
            menuPresets.Build((from gp in gPresets select gp.Name).ToArray());
            menuPresets.Hook();

            textMap              = new TextWidget(wr);
            textMap.Color        = UserConfig.MainScheme.Text;
            textMap.Offset       = new Point(0, 5);
            textMap.Height       = 32;
            textMap.OffsetAlignY = Alignment.BOTTOM;
            textMap.Parent       = widgets[widgets.Length - 1].BackRect;

            textGTController              = new TextWidget(wr);
            textGTController.Color        = UserConfig.MainScheme.Text;
            textGTController.Offset       = new Point(0, 5);
            textGTController.Height       = 32;
            textGTController.OffsetAlignY = Alignment.BOTTOM;
            textGTController.Parent       = textMap;

            SetWidgetData(gPresets[0]);

            DevConsole.OnNewCommand += DevConsole_OnNewCommand;
            KeyboardEventDispatcher.OnKeyPressed += OnKeyPressed;
            MouseEventDispatcher.OnMousePress    += OnMP;
        }