Exemple #1
0
        public override void OnEntry(GameTime gameTime)
        {
            tPopup = null;
            end    = false;
            MouseEventDispatcher.OnMousePress     += OnMP;
            KeyboardEventDispatcher.OnKeyPressed  += OnKP;
            KeyboardEventDispatcher.OnKeyReleased += OnKR;
            DevConsole.OnNewCommand += DevConsole_OnNewCommand;

            team = 0;
            type = 0;

            state             = game.LoadScreen.LoadedState;
            state.OnNewPopup += OnNewPopup;
            camera            = game.LoadScreen.LoadedCamera;
            renderer          = game.LoadScreen.LoadedRenderer;
            renderer.UseFOW   = true;
            gameInput         = (from t in state.teams
                                 where t.Input != null && t.Input.Type == RTSInputType.Player
                                 select t.Input).FirstOrDefault();
            vInput         = gameInput == null ? null : gameInput as IVisualInputController;
            playController = game.LoadScreen.LoadedGPlay;

            sfDebug = renderer.LoadFont(@"Fonts\CourierNew32");


            // Create Game Engine Thread
            playController.BeginPlaying(state);
            tEngine          = new Thread(EngineThread);
            tEngine.Priority = ThreadPriority.Highest;
            tEngine.TrySetApartmentState(ApartmentState.MTA);
            tEngine.IsBackground = true;
            playing     = 1;
            pauseEngine = false;
            pauseRender = false;
            tEngine.Start();

            // Create Background Music
            jukeBox = new Jukebox();
            jukeBox.LoadFromDirectory(new DirectoryInfo(BS_SOUND_DIR));
        }
Exemple #2
0
        public RTSUI(RTSRenderer renderer, string uicFile, bool showBuildPanel)
        {
            uic = ZXParser.ParseFile(uicFile, typeof(UICRTS)) as UICRTS;

            SpriteFont font = renderer.LoadFont(uic.Font);

            wrButtonPanel = new WidgetRenderer(renderer.G, font);
            wrMain        = new WidgetRenderer(renderer.G, font);

            BuildBounds(renderer);
            BuildMinimap(renderer, uic.UICMinimap);
            BuildBBPanel(renderer);
            BuildBuildingPanel(showBuildPanel);
            BuildSelectionPanel(renderer);
            BuildUnitDataPanel(renderer);
            BuildBuildingDataPanel(renderer);
            BuildTeamDataPanel();
            AlertQueue = new RTSUIAlertQueue(wrMain, uic.UICAlertQueue);
            AlertQueue.WidgetBase.Parent = Minimap.WidgetBase;
            SelectionToggle = 0;
        }