Exemple #1
0
        public KeyController()
        {
            _manager = LayoutManager.GetManager();

            _characters = new HashSet<Keys>
            {
                Keys.A,
                Keys.B,
                Keys.C,
                Keys.D,
                Keys.E,
                Keys.F,
                Keys.G,
                Keys.H,
                Keys.I,
                Keys.J,
                Keys.K,
                Keys.L,
                Keys.M,
                Keys.N,
                Keys.O,
                Keys.P,
                Keys.Q,
                Keys.R,
                Keys.S,
                Keys.T,
                Keys.U,
                Keys.V,
                Keys.W,
                Keys.X,
                Keys.Y,
                Keys.Z
            };

            _numbers = new HashSet<Keys>
            {
                Keys.D0,
                Keys.D1,
                Keys.D2,
                Keys.D3,
                Keys.D4,
                Keys.D5,
                Keys.D6,
                Keys.D7,
                Keys.D8,
                Keys.D9,
            };

            _controls = new HashSet<Keys>
            {
                Keys.Escape,
                Keys.Enter,
                Keys.ControlKey,
                Keys.Alt,
                Keys.Space,
                Keys.Return,
                Keys.Delete
            };

            _keys = new Dictionary<ScreenType, Dictionary<Keys, EventHandler>>();

            _keys[ScreenType.MainMenu] = new Dictionary<Keys, EventHandler>();
            _keys[ScreenType.MainMenu][Keys.Escape] = Application.Exit;
        }
Exemple #2
0
        public void Draw(LayoutManager manager, IMapView map)
        {
            var converter = Proxy.GetInstance();
            var coordinates = new[]
                    {
                        new PointF(0, 0), converter.NewPoint(new PointF(Consts.OGL_WIDTH, 0)),
                        converter.NewPoint(new PointF(Consts.OGL_WIDTH, Consts.OGL_HEIGHT)),
                        converter.NewPoint(new PointF(0, Consts.OGL_HEIGHT))
                    };

            switch (manager.ScreenType)
            {
                #region MainMenuCase
                case ScreenType.MainMenu:
                    DrawTexture(Textures["Main Menu"], coordinates);

                    var c = new[]
                    {
                        new PointF(10,10),
                        new PointF(60,10),
                        new PointF(60,60),
                        new PointF(10,60)
                    };
                    Gl.glEnable(Gl.GL_BLEND);
                    DrawTexture(Textures["Station"], c);
                    Gl.glDisable(Gl.GL_BLEND);
                    break;

                #endregion

                #region GameCase
                case ScreenType.Game:
                {
                    DrawTexture(Textures["Battle Map"], coordinates);
                    DrawField(map);

                    DrawMapObjects(map); //по сути здесь будет отрисовка планет, станций и пр. статического.

                    Gl.glEnable(Gl.GL_BLEND);
                    DrawAction(map);

                    foreach (var a in ShipsInfo)
                        DrawShip(a.Value, map);
                    Gl.glDisable(Gl.GL_BLEND);

                    Animate(map);
                }
                break;
                #endregion

                case ScreenType.Editor:
                    DrawTexture(Textures["EditorBG"], coordinates);
                    break;
            }

            DrawUI(manager);
        }
Exemple #3
0
        private void DrawUI(LayoutManager manager)
        {
            foreach (var item in manager.Components)
            {
                item.Draw();
            }
            if (!manager.IsShowingModal)
                return;

            ObscureScreen();
            foreach (var item in manager.ModalComponents)
            {
                item.Draw();
            }
        }
Exemple #4
0
 public static LayoutManager GetManager()
 {
     return _ins ?? (_ins = new LayoutManager(ScreenType.MainMenu, false));
 }