Exemplo n.º 1
0
 void GetVariables()
 {
     currentLevel = (NetworkSessionComponent.Level)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.Level];
     gameMode     = (NetworkSessionComponent.GameMode)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.GameMode];
     Weapons      = (NetworkSessionComponent.Weapons)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.Weapons];
     scoreToWin   = (NetworkSessionComponent.ScoreToWin)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.ScoreToWin];
     noOfBots     = (NetworkSessionComponent.NoOfBots)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.NoOfBots];
 }
Exemplo n.º 2
0
 void ChangeLevel()
 {
     if (level == NetworkSessionComponent.Level.shipMap)
     {
         level = NetworkSessionComponent.Level.Level_1;
     }
     else if (level == NetworkSessionComponent.Level.Level_1)
     {
         level = NetworkSessionComponent.Level.shipMap;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameplayScreen(Microsoft.Xna.Framework.Net.NetworkSession networkSession)
        {
            networkHelper       = new NetworkHelper();
            this.networkSession = networkSession;
            this.currentLevel   = currentLevel;
            networkHelper.NetworkGameSession = networkSession;

            GetVariables();

            TransitionOnTime  = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);
        }
Exemplo n.º 4
0
        public static GameLevel CreateLevel(Game game, NetworkSessionComponent.Level level)
        {
            switch (level)
            {
            case NetworkSessionComponent.Level.shipMap:
                return(CreateShipMapLevel(game));

            case NetworkSessionComponent.Level.Level_1:
                return(CreateLevel_1Level(game));

            default:
                throw new ArgumentException("Invalid game level");
            }
        }
Exemplo n.º 5
0
 void ChangeLevel()
 {
     if (level == NetworkSessionComponent.Level.shipMap)
     {
         if (!createSession)
         {
             level = NetworkSessionComponent.Level.Any;
         }
         else
         {
             level = NetworkSessionComponent.Level.Level_1;
         }
     }
     else if (level == NetworkSessionComponent.Level.Level_1)
     {
         level = NetworkSessionComponent.Level.shipMap;
     }
     else if (level == NetworkSessionComponent.Level.Any)
     {
         level = NetworkSessionComponent.Level.shipMap;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public BackgroundScreen(NetworkSessionComponent.Level currentLevel)
 {
     TransitionOnTime = TimeSpan.FromSeconds(0.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
     this.currentLevel = currentLevel;
 }
Exemplo n.º 7
0
 void GetVariables()
 {
     level = (NetworkSessionComponent.Level)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.Level];
     gameModeType = (NetworkSessionComponent.GameMode)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.GameMode];
     weapons = (NetworkSessionComponent.Weapons)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.Weapons];
     scoreToWinType = (NetworkSessionComponent.ScoreToWin)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.ScoreToWin];
     noOfBots = (NetworkSessionComponent.NoOfBots)networkSession.SessionProperties[(int)NetworkSessionComponent.SessionProperties.NoOfBots];
 }
Exemplo n.º 8
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);
        }
 void ChangeLevel()
 {
     if (level == NetworkSessionComponent.Level.shipMap)
         level = NetworkSessionComponent.Level.Level_1;
     else if (level == NetworkSessionComponent.Level.Level_1)
         level = NetworkSessionComponent.Level.shipMap;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public BackgroundScreen(NetworkSessionComponent.Level currentLevel)
 {
     TransitionOnTime  = TimeSpan.FromSeconds(0.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
     this.currentLevel = currentLevel;
 }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
 void ChangeLevel()
 {
     if (level == NetworkSessionComponent.Level.shipMap)
         if (!createSession)
             level = NetworkSessionComponent.Level.Any;
         else
             level = NetworkSessionComponent.Level.Level_1;
     else if (level == NetworkSessionComponent.Level.Level_1)
         level = NetworkSessionComponent.Level.shipMap;
     else if (level == NetworkSessionComponent.Level.Any)
         level = NetworkSessionComponent.Level.shipMap;
 }