Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
        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>();
        }
Esempio n. 5
0
 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>();
 }
Esempio n. 6
0
 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);
 }
Esempio n. 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);
        }
Esempio n. 8
0
        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;
        }
Esempio n. 9
0
 public ServerGameEventHandler(fbGame game)
     : base(game)
 {
     fallthrough = new GameEventHandler(game, null);
 }
Esempio n. 10
0
 protected fbEventHandler(fbGame game)
 {
     Game = game;
 }
Esempio n. 11
0
 public InterfaceEventHandler(fbGame game, fbInterface ui)
     : base(game)
 {
     Game    = game;
     this.ui = ui;
 }
Esempio n. 12
0
 public GameEventHandler(fbGame fbGame, fbEngine engine)
     : base(fbGame)
 {
     this.engine = engine;
 }