Exemplo n.º 1
0
        //Audio audioHelper, Cue mystery)
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public CreateOrFindSessionScreen(ScreenManager screenManager, NetworkSessionType sessionType, AudioManager audioManager)
            : base(GetMenuTitle(sessionType), false)
        {
            networkHelper = new NetworkHelper();
            networkInterface = new NetworkInterface();
            networkInterface.InitNetwork(screenManager.Game);
            this.audioManager = audioManager;
            //this.audioHelper = audioHelper;
            //this.mystery = mystery;
            this.sessionType = sessionType;

            // Create our menu entries.
            MenuEntry createSessionMenuEntry = new MenuEntry(Resources.CreateSession);
            MenuEntry findSessionsMenuEntry = new MenuEntry(Resources.FindSessions);
            MenuEntry backMenuEntry = new MenuEntry(Resources.Back);

            // Hook up menu event handlers.
            createSessionMenuEntry.Selected += CreateSessionMenuEntrySelected;
            findSessionsMenuEntry.Selected += FindSessionsMenuEntrySelected;
            backMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(createSessionMenuEntry);
            MenuEntries.Add(findSessionsMenuEntry);
            MenuEntries.Add(backMenuEntry);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructs a new lobby screen.
        /// </summary>
        public LobbyScreen(NetworkSession networkSession)
        {
            this.networkSession = networkSession;

            networkSession.GamerJoined += GamerJoined;

            networkHelper = new NetworkHelper();

            GetVariables();

            if (networkSession.LocalGamers.Count > 0)
            {
                localPlayer = networkSession.LocalGamers[0].Tag as Player;
            }

            // Adds a simple message to tell the user what to do.
            // Since we will be using the guide to get commands,
            // we need to tell them how to open it up!
            messages.Add(new string[] { "System", "Press [Tab] to send a message " });

            /*
            if (audioHelper == null)
                this.audioHelper = new Audio("Content\\TRA_Game.xgs");
            else
                this.audioHelper = audioHelper;
            if (audio_on == false)
            {
                mystery = this.audioHelper.GetCue("mystery");
                this.audioHelper.Play(mystery, false, new AudioListener(), new AudioEmitter());
            }
            else
                mystery = this.audioHelper.GetCue("mystery");

            this.audioHelper.Update();*/
            TransitionOnTime = TimeSpan.FromSeconds(0.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);
        }
Exemplo n.º 3
0
 public SessionManager(Game game)
 {
     networkHelper = (NetworkHelper)
                     game.Services.GetService(typeof(NetworkHelper));
 }
Exemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public int InitNetwork(Game game)
        {
            networkHelper = (NetworkHelper)
            game.Services.GetService(typeof(NetworkHelper));

            return 0;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public SessionPropertiesScreen(ScreenManager screenManager, NetworkSessionType sessionType, //Audio audioHelper, Cue mystery
            bool createSession, NetworkHelper networkHelper)
            : base(Resources.SessionProperties + GetMenuTitle(sessionType), false)
        {
            if (networkHelper != null)
                this.networkHelper = networkHelper;
            else
                this.networkHelper = new NetworkHelper();
            networkInterface = new NetworkInterface();
            networkInterface.InitNetwork(screenManager.Game);

            //this.audioHelper = audioHelper;
            //this.mystery = mystery;
            this.sessionType = sessionType;
            //famas_1 = audioHelper.GetCue("famas-1");

            this.createSession = createSession;

            // Create our menu entries.
            MenuEntry levelMenuEntry = new MenuEntry(Resources.Level);
            MenuEntry gameModeMenuEntry = new MenuEntry(Resources.GameMode);
            MenuEntry weaponsMenuEntry = new MenuEntry(Resources.Weapons);
            MenuEntry scoreToWinMenuEntry = new MenuEntry(Resources.ScoreToWin);
            MenuEntry createSessionMenuEntry = new MenuEntry(Resources.CreateSession);
            MenuEntry searchSessionMenuEntry = new MenuEntry(Resources.SearchSessions);
            MenuEntry StartGameMenuEntry = new MenuEntry(Resources.StartGame);
            MenuEntry noofbotsMenuEntry = new MenuEntry(Resources.NumberOfBots);
            MenuEntry backMenuEntry = new MenuEntry(Resources.Back);

            if (createSession)
            {
                level = NetworkSessionComponent.Level.shipMap;
                gameModeType = NetworkSessionComponent.GameMode.DeathMatch;
                weaponsType = NetworkSessionComponent.Weapons.Normal;
                scoreToWinType = NetworkSessionComponent.ScoreToWin.One;
                noOfBots = NetworkSessionComponent.NoOfBots.Ten;
            }
            else
            {
                level = NetworkSessionComponent.Level.Any;
                gameModeType = NetworkSessionComponent.GameMode.Any;
                weaponsType = NetworkSessionComponent.Weapons.Any;
                scoreToWinType = NetworkSessionComponent.ScoreToWin.Any;
                noOfBots = NetworkSessionComponent.NoOfBots.Any;
            }

            // Hook up menu event handlers.
            levelMenuEntry.Selected += LevelMenuEntrySelected;
            gameModeMenuEntry.Selected += GameModeMenuEntrySelected;
            weaponsMenuEntry.Selected += WeaponsMenuEntrySelected;
            scoreToWinMenuEntry.Selected += ScoreToWinMenuEntrySelected;
            createSessionMenuEntry.Selected += CreateSessionMenuEntrySelected;
            searchSessionMenuEntry.Selected += SearchSessionsMenuEntrySelected;
            StartGameMenuEntry.Selected += StartGameMenuEntrySelected;
            noofbotsMenuEntry.Selected += NoOfBotsMenuEntry;
            backMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(levelMenuEntry);
            MenuEntries.Add(gameModeMenuEntry);
            MenuEntries.Add(weaponsMenuEntry);
            MenuEntries.Add(scoreToWinMenuEntry);
            MenuEntries.Add(noofbotsMenuEntry);

            if (sessionType != NetworkSessionType.Local)
                if (createSession)
                    MenuEntries.Add(createSessionMenuEntry);
                else
                    MenuEntries.Add(searchSessionMenuEntry);
            else
                MenuEntries.Add(StartGameMenuEntry);
            MenuEntries.Add(backMenuEntry);
        }