Пример #1
0
        public override void OnEntry(GameTime gameTime)
        {
            DevConsole.OnNewCommand += DevConsole_OnNewCommand;
            KeyboardEventDispatcher.OnKeyPressed += KeyboardEventDispatcher_OnKeyPressed;
            input.Refresh();
            sP.Hook();
            sS.Hook();
            sT.Hook();
            RendererInitArgs ria = ZXParser.ParseFile(@"Content\FX\RIA.txt", typeof(RendererInitArgs)) as RendererInitArgs;

            renderer = new RTSRenderer(game.Graphics, game.Content, ria, game.Window);

            // Rendering Effect
            fx = new RTSFXEntity(renderer.LoadEffect(FX_FILE_PATH));

            // Default Team
            sP.Color         = RTSColorScheme.Default.Primary;
            sS.Color         = RTSColorScheme.Default.Secondary;
            sT.Color         = RTSColorScheme.Default.Tertiary;
            colorScheme.Name = RTSColorScheme.Default.Name;

            // Create Camera
            camera       = new OrbitingCamera(Vector3.Zero, 4f, G.Viewport.AspectRatio);
            camera.Pitch = MathHelper.PiOver4;
            camera.Yaw   = 0;
            camera.FOV   = MathHelper.PiOver4;

            unitDataFiles = new List <FileInfo>();
            schemeFiles   = new List <FileInfo>();

            FindAllData();
            curUnit = 0;
        }
Пример #2
0
 public override void OnExit(GameTime gameTime)
 {
     DevConsole.OnNewCommand -= DevConsole_OnNewCommand;
     KeyboardEventDispatcher.OnKeyPressed -= KeyboardEventDispatcher_OnKeyPressed;
     DevConsole.Deactivate();
     if (unitModel != null)
     {
         DisposeUnit();
     }
     renderer.Dispose();
     camera = null;
     sP.Unhook();
     sS.Unhook();
     sT.Unhook();
     //MouseEventDispatcher.OnMousePress -= sP.OnMousePress;
     //MouseEventDispatcher.OnMouseMotion -= sP.OnMouseMovement;
     //MouseEventDispatcher.OnMouseRelease -= sP.OnMouseRelease;
     //MouseEventDispatcher.OnMousePress -= sS.OnMousePress;
     //MouseEventDispatcher.OnMouseMotion -= sS.OnMouseMovement;
     //MouseEventDispatcher.OnMouseRelease -= sS.OnMouseRelease;
     //MouseEventDispatcher.OnMousePress -= sT.OnMousePress;
     //MouseEventDispatcher.OnMouseMotion -= sT.OnMouseMovement;
     //MouseEventDispatcher.OnMouseRelease -= sT.OnMouseRelease;
 }