示例#1
0
        public InterfaceInputHandler(fbInterface ui)
        {
            this.ui = ui;
            game    = ui.Game;
            engine  = ui.Engine;

            new InputSubscriber(this)
            .Subscribe("move-nw")
            .Subscribe("move-n")
            .Subscribe("move-ne")
            .Subscribe("move-e")
            .Subscribe("move-se")
            .Subscribe("move-s")
            .Subscribe("move-sw")
            .Subscribe("move-w")
            .Subscribe("pass")
            .Subscribe("warp")
            .Subscribe("bombard")
            .Subscribe("dev-login")
            .Subscribe("dev-test")
            .Subscribe("dev-save")
            .Subscribe("dev-spawn-station")
            .Subscribe("dev-spawn-planet")
            .Subscribe("dev-spawn-playerstart")
            .Subscribe("select-next-idle")
            .Subscribe("quit")
            .Register();
        }
示例#2
0
        protected override void Initialize()
        {
            base.Initialize();
            SpriteBatch = new SpriteBatch(GraphicsDevice);

            Engine = new fbEngine(this);
            Engine.SetSize(1280, 720);
            LoadTexturesFromFile("cfg/textures.cfg");

            Engine.DefaultFont           = new Font();
            Engine.DefaultFont.FontSheet = Engine.GetTexture("font");
            Engine.DefaultFont.CharSize  = new Vector2(8);

            NetMessage3.Setup();

            Game       = new fbGame();
            Game.Ready = false;
            Game.SetupClientSideEventHandler(Engine);

            //eugh
            fbNetClient.Game = Game;

            UI = new fbInterface(Game, Engine);

            Engine.StartNetClient();
        }
示例#3
0
文件: Project.cs 项目: Koneke/Farbase
 public TechProject(
     fbGame game,
     int owner,
     Station station,
     int length,
     TechID tech
     ) : base(game, owner, station, Tech.Techs[tech].Cost, length)
 {
     this.tech = tech;
     Prerequisites.AddRange(Tech.Techs[tech].Prerequisites);
 }
示例#4
0
文件: fbWorld.cs 项目: Koneke/Farbase
        public fbWorld(fbGame game, int w, int h)
        {
            Game    = game;
            Map     = new fbMap(w, h);
            Players = new Dictionary <int, Player>();

            Units          = new Dictionary <int, Unit>();
            PlayerUnits    = new Dictionary <int, List <int> >();
            PlayerStations = new Dictionary <int, List <int> >();
            PlayerStarts   = new List <Vector2i>();
        }
示例#5
0
文件: Project.cs 项目: Koneke/Farbase
 protected Project(
     fbGame game,
     int owner,
     Station station,
     int cost,
     int length
     )
 {
     Game          = game;
     Owner         = owner;
     Station       = station;
     Cost          = cost;
     Remaining     = Length = length;
     finished      = false;
     Prerequisites = new List <TechID>();
 }
示例#6
0
文件: Project.cs 项目: Koneke/Farbase
 public BuildingProject(
     fbGame game,
     int owner,
     Station station,
     int length,
     UnitType unitType
     ) : base(
         game,
         owner,
         station,
         unitType.Cost,
         length
         )
 {
     this.unitType = unitType;
     Prerequisites.AddRange(unitType.Prerequisites);
 }
示例#7
0
        public fbInterface(
            fbGame game,
            fbEngine engine
            )
        {
            Game         = game;
            Engine       = engine;
            Camera       = new fbCamera(engine);
            Widgets      = new List <Widget>();
            NamedWidgets = new Dictionary <string, Widget>();

            DefaultTheme = new Theme(
                new ColorSet(
                    Color.White,
                    Color.White,
                    Color.Gray
                    ),
                new ColorSet(
                    new Color(0, 0, 0, 0.6f),
                    Color.DarkGray * 0.9f,
                    Color.DarkGray * 0.7f
                    ),
                new ColorSet(
                    Color.White * 0.8f,
                    Color.White * 0.8f,
                    Color.White * 0.8f
                    )
                );

            LoadUIFromXml("ui/main.xml");

            EventHandler = (InterfaceEventHandler)
                           new InterfaceEventHandler(game, this)
                           .Subscribe(engine, EventType.NameEvent)
                           .Subscribe(engine, EventType.BuildUnitEvent);

            new InterfaceInputHandler(this);
        }
示例#8
0
文件: Unit.cs 项目: Koneke/Farbase
        public Unit(
            fbWorld world,
            UnitType unitType,
            int owner,
            int id,
            int x,
            int y
            )
        {
            animateable = new Animateable(this);

            World = world;
            game  = World.Game;

            UnitType = unitType;
            Owner    = owner;
            ID       = id;
            this.x   = x;
            this.y   = y;
            Moves    = UnitType.Moves;
            Attacks  = UnitType.Attacks;
            Strength = UnitType.Strength;
        }
示例#9
0
 public ServerGameEventHandler(fbGame game)
     : base(game)
 {
     fallthrough = new GameEventHandler(game, null);
 }
示例#10
0
 protected fbEventHandler(fbGame game)
 {
     Game = game;
 }
示例#11
0
 public InterfaceEventHandler(fbGame game, fbInterface ui)
     : base(game)
 {
     Game    = game;
     this.ui = ui;
 }
示例#12
0
 public GameEventHandler(fbGame fbGame, fbEngine engine)
     : base(fbGame)
 {
     this.engine = engine;
 }