Ejemplo n.º 1
0
        public RoomGameplay(FreelancerGame g, CGameSession session, string newBase, BaseRoom room = null, string virtualRoom = null) : base(g)
        {
            this.session = session;
            baseId       = newBase;
            currentBase  = g.GameData.GetBase(newBase);
            currentRoom  = room ?? currentBase.StartRoom;
            currentRoom.InitForDisplay();
            SwitchToRoom();
            tophotspots = new List <BaseHotspot>();
            foreach (var hp in currentRoom.Hotspots)
            {
                if (TOP_IDS.Contains(hp.Name))
                {
                    tophotspots.Add(hp);
                }
            }
            var rm = virtualRoom ?? currentRoom.Nickname;

            SetActiveHotspot(rm);
            this.virtualRoom = virtualRoom;
            ui         = new UiContext(Game, "baseside.xml");
            ui.GameApi = new BaseUiApi(this);
            ui.Start();
            Game.Keyboard.TextInput += Game_TextInput;
            Game.Keyboard.KeyDown   += Keyboard_KeyDown;
            cursor = Game.ResourceManager.GetCursor("arrow");
            FadeIn(0.8, 1.7);
        }
Ejemplo n.º 2
0
 public override void NewGame()
 {
     state.FadeOut(0.2, () =>
     {
         var embeddedServer = new EmbeddedServer(state.Game.GameData);
         var session        = new CGameSession(state.Game, embeddedServer);
         embeddedServer.StartFromSave(state.Game.GameData.VFS.Resolve("EXE\\newplayer.fl"));
         state.Game.ChangeState(new NetWaitState(session, state.Game));
     });
 }
Ejemplo n.º 3
0
 public void LoadSelectedGame()
 {
     state.FadeOut(0.2, () =>
     {
         var embeddedServer = new EmbeddedServer(state.Game.GameData);
         var session        = new CGameSession(state.Game, embeddedServer);
         embeddedServer.StartFromSave(state.Game.Saves.SelectedFile);
         state.Game.ChangeState(new NetWaitState(session, state.Game));
     });
 }
Ejemplo n.º 4
0
 public SpaceGameplay(FreelancerGame g, CGameSession session) : base(g)
 {
     FLLog.Info("Game", "Entering system " + session.PlayerSystem);
     g.ResourceManager.ClearTextures(); //Do before loading things
     this.session = session;
     sys          = g.GameData.GetSystem(session.PlayerSystem);
     ui           = Game.Ui;
     ui.GameApi   = uiApi = new LuaAPI(this);
     loader       = new LoadingScreen(g, g.GameData.LoadSystemResources(sys));
     loader.Init();
 }
Ejemplo n.º 5
0
 public void StartNetworking()
 {
     StopNetworking();
     netClient               = new GameNetClient(state.Game);
     netSession              = new CGameSession(state.Game, netClient);
     netClient.UUID          = state.Game.Config.UUID.Value;
     netClient.ServerFound  += info => serverList.Servers.Add(info);
     netClient.Disconnected += NetClientOnDisconnected;
     netClient.Start();
     RefreshServers();
 }
Ejemplo n.º 6
0
        public RoomGameplay(FreelancerGame g, CGameSession session, string newBase, BaseRoom room = null, string virtualRoom = null) : base(g)
        {
            //Load room data
            this.session = session;
            baseId       = newBase;
            currentBase  = g.GameData.GetBase(newBase);
            currentRoom  = room ?? currentBase.StartRoom;
            currentRoom.InitForDisplay();
            var rm = virtualRoom ?? currentRoom.Nickname;

            this.virtualRoom = virtualRoom;
            //Find infocard
            sys = g.GameData.GetSystem(currentBase.System);
            var obj = sys.Objects.FirstOrDefault((o) =>
            {
                return(o.Base?.Equals(newBase, StringComparison.OrdinalIgnoreCase) ?? false);
            });
            int ids = 0;

            if (obj?.IdsInfo.Length > 0)
            {
                ids = obj.IdsInfo[0];
            }
            roomInfocard = g.GameData.GetInfocard(ids, g.Fonts);
            if (g.GameData.GetRelatedInfocard(ids, g.Fonts, out var ic2))
            {
                roomInfocard.Nodes.Add(new RichTextParagraphNode());
                roomInfocard.Nodes.AddRange(ic2.Nodes);
            }
            //Create user interface
            tophotspots = new List <BaseHotspot>();
            foreach (var hp in currentRoom.Hotspots)
            {
                if (TOP_IDS.Contains(hp.Name))
                {
                    tophotspots.Add(hp);
                }
            }
            SetActiveHotspot(rm);
            Game.Keyboard.TextInput += Game_TextInput;
            Game.Keyboard.KeyDown   += Keyboard_KeyDown;
            Game.Mouse.MouseDown    += MouseOnMouseDown;
            cursor     = Game.ResourceManager.GetCursor("arrow");
            talk_story = Game.ResourceManager.GetCursor("talk_story");
            ui         = Game.Ui;
            ui.GameApi = new BaseUiApi(this);
            ui.OpenScene("baseside");
            //Set up THN
            SwitchToRoom(room == null);
            FadeIn(0.8, 1.7);
        }
Ejemplo n.º 7
0
            public void LoadCharacter()
            {
                netClient.SendPacket(new CharacterListActionPacket()
                {
                    Action = CharacterListAction.SelectCharacter,
                    IntArg = cselInfo.Selected
                }, PacketDeliveryMethod.ReliableOrdered);
                var session = new CGameSession(state.Game, netClient);

                netClient.Disconnected += (str) => session.Disconnected();
                netClient.Disconnected -= NetClientOnDisconnected;
                netClient = null;
                state.FadeOut(0.2, () =>
                {
                    state.Game.ChangeState(new NetWaitState(session, state.Game));
                });
            }
Ejemplo n.º 8
0
 public Trader(CGameSession session)
 {
     this.session = session;
 }
Ejemplo n.º 9
0
 public NetWaitState(CGameSession session, FreelancerGame game) : base(game)
 {
     this.session = session;
 }
Ejemplo n.º 10
0
 public ShipDealer(CGameSession session)
 {
     this.session = session;
 }