Example #1
0
        public RoomGameplay(FreelancerGame g, GameSession 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;
            hud            = new ScriptedHud(new LuaAPI(this), false, Game);
            hud.OnEntered += Hud_OnTextEntry;
            hud.Init();
            Game.Keyboard.TextInput += Game_TextInput;
            Game.Keyboard.KeyDown   += Keyboard_KeyDown;
            cursor = Game.ResourceManager.GetCursor("arrow");
            FadeIn(0.8, 1.7);
        }
Example #2
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);
        }
Example #3
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);
        }