//private SpriteBatch spriteBatch; public Scene(SpriteBatch spriteBatch, ContentManager content, Vector2 screenSize, Game1 game) { entities = new List <Entity>(); entitiesID = new Dictionary <int, Entity>(); deadEntities = new List <Entity>(); players = new List <Player>(); localPlayers = new List <Player>(); enemies = new List <BaseEnemy>(); worldObjects = new List <WorldObject>(); cargos = new List <Cargo>(); activeAbilities = new List <ActiveAbility>(); camera = new Camera(spriteBatch, screenSize, cargos, players, enemies, worldObjects, activeAbilities); this.game = game; networkThread = game.networkThread; //SoundCollection.Instance.LoadSounds(content); //textureCollection = new TextureCollection(content); //TextureCollection.Instance.loadTextures(content); collisionCheck = new CollisionCheck(cargos, players, enemies, worldObjects, activeAbilities); worldObjectHandling = new WorldObjectHandling(this, worldObjects); tilemap = new Tilemap(1, content); //enemyAI = new EnemyAI(tilemap, enemies, cargo); enemyAI = new EnemyAI(worldObjects, enemies, cargos); this.content = content; }
public WaitForServerStart(Network.NetworkThread networkThread, SpriteBatch spriteBatchInit) : base(spriteBatchInit, null, 4) { this.networkThread = networkThread; registerServer = false; lastKeys = Keyboard.GetState().GetPressedKeys(); background = TextureCollection.Instance.GetTexture(TextureType.Menu_Background); carrierTexture = TextureCollection.Instance.GetTexture(TextureType.MainMenuCarrier); menuYes = TextureCollection.Instance.GetTexture(TextureType.Menu_Yes); menuNo = TextureCollection.Instance.GetTexture(TextureType.Menu_No); spriteFont = FontCollection.Instance.GetFont(FontCollection.Fonttyp.MainMenuButtonFont); serverPollCounter = 0; numButtons = 4; buttons = new List <Vector2>(); for (int i = 0; i < numButtons; i++) { buttons.Add(new Vector2(300, 300 + (int)i * 100)); } serverName = Settings.Instance.PlayerName + "sServer"; port = "23451"; texts = new String[numButtons]; texts[0] = "Server Name"; texts[1] = "Port"; texts[2] = "Public"; texts[3] = "Start Server"; inputMode = false; }
public LaunchMenu(SpriteBatch spriteBatchInit, Game1 game, Network.NetworkThread networkThread) : base(spriteBatchInit, game, 3) { this.networkThread = networkThread; buttons = new List <Vector2>(); for (int i = 0; i < numButtons; i++) { buttons.Add(new Vector2(300, 300 + (int)i * 100)); } texts = new String[numButtons]; texts[0] = "Local Game"; texts[1] = "Host Game"; texts[2] = "Join Game"; //Texture //Set Background MainMenuBackground = TextureCollection.Instance.GetTexture(TextureType.MainMenuBackground); carrierTexture = TextureCollection.Instance.GetTexture(TextureType.MainMenuCarrier); //Set font for Buttontext spriteFont = FontCollection.Instance.GetFont(FontCollection.Fonttyp.MainMenuButtonFont); soundHorn = SoundCollection.Instance.GetSoundInstance(SoundType.Car_Horn); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here Settings.Instance.loadSettings(); TextureCollection.Instance.SetContent(Content); SoundCollection.Instance.SetContent(Content); FontCollection.Instance.LoadFonts(Content); spriteBatch = new SpriteBatch(GraphicsDevice); lobbyOnline = new LobbyOnline(spriteBatch, this); localUpdates = new Network.LocalUpdates(this, lobbyOnline); networkThread = new Network.NetworkThread(localUpdates); scene = new Scene(spriteBatch, Content, new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), this); lobbySearch = new LobbySearch(spriteBatch, this); localUpdates.SetNetworkThread(networkThread); localUpdates.SetScene(scene); mainMenu = new MainMenu(spriteBatch, this); postGameMenu = new PostGameMenu(spriteBatch, this); modifierMenu = new ModifierMenu(spriteBatch, this); menuSettings = new MenuSettings(spriteBatch, this); menuControls = new MenuControls(spriteBatch, this); menuPause = new MenuPause(spriteBatch, this); creditScreen = new CreditScreen(spriteBatch, this); loadingScreen = new LoadingScreen(spriteBatch, this); launchMenu = new LaunchMenu(spriteBatch, this, networkThread); waitForServerStart = new WaitForServerStart(networkThread, spriteBatch); music = SoundCollection.Instance.GetSoundInstance(SoundType.Menu_Music); music.IsLooped = true; music.Volume = 0.5f * Settings.Instance.VolumeMusic; music.Play(); }
public NetworkThread(LocalUpdates localUpdates) { this.localUpdates = localUpdates; NetPeerConfiguration config = new NetPeerConfiguration("GameServer"); config.AutoFlushSendQueue = false; config.EnableMessageType(NetIncomingMessageType.UnconnectedData); s_client = new NetClient(config); //s_client.RegisterReceivedCallback(new SendOrPostCallback(GotMessage),new SynchronizationContext()); port = 23451; Instance = this; s_client.Start(); }
public void SetNetworkThread(NetworkThread networkThread) { this.networkThread = networkThread; }