Пример #1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            // Draw background
            background.Draw(spriteBatch);

            // Draw buttons
            foreach (Button button in menuButtons)
            {
                button.Draw(spriteBatch);
            }

            // Draw fields
            foreach (Field field in menuFields)
            {
                switch (field.id)
                {
                case 0: field.Draw(spriteBatch, SettingsManager.getUsername()); break;

                case 1: field.Draw(spriteBatch, SettingsManager.getVerboseDifficulty()); break;

                case 2: field.Draw(spriteBatch, SettingsManager.getResolutionWidth() + "x" + SettingsManager.getResolutionHeight()); break;

                case 8: field.Draw(spriteBatch, SettingsManager.getShowDebug().ToString()); break;

                case 9: field.Draw(spriteBatch, SettingsManager.getShowBounds().ToString()); break;

                case 10: field.Draw(spriteBatch, SettingsManager.getShowDepths().ToString()); break;

                default: field.Draw(spriteBatch, "No value"); break;
                }
            }
        }
Пример #2
0
        private void onFirstRun()
        {
            Network.Initialize();
            firstRun = false;

            // Create a new controllable player and add it to the list
            localPlayer = new Player(Vector2.Zero, SettingsManager.getUsername(), 100, true, Network.Client.UniqueIdentifier);
            players.TryAdd(localPlayer.uid, localPlayer);

            // Create a minimap
            minimap = new Minimap(true, players, spawner.stations);
        }
Пример #3
0
        internal static void Initialize()
        {
            // Clean out the player list
            Online.players.Clear();

            // Start Client and attempt connection to the MoboServer
            Config = new NetPeerConfiguration("Mobo");
            Client = new NetClient(Network.Config);
            Client.Start();
            Client.Connect(SettingsManager.getServerIP(), SettingsManager.getPort());
            Console.WriteLine(Client.UniqueIdentifier);

            System.Threading.Thread.Sleep(300);

            // Send a connection request
            out_message = Client.CreateMessage();
            out_message.Write(CONNECT);
            out_message.Write(Client.UniqueIdentifier);
            out_message.Write(SettingsManager.getUsername());
            out_message.Write(0);
            out_message.Write(0);
            Client.SendMessage(out_message, NetDeliveryMethod.ReliableOrdered);

            // Wait a little to ensure message sent
            System.Threading.Thread.Sleep(300);

            // Use client status to work out whether we are connected or not
            string status = Client.ConnectionStatus.ToString();

            if (status.Equals("None"))
            {
                status    = "Server ONLINE";
                connected = true;
            }
            if (status.Equals("Disconnected"))
            {
                status    = "Server OFFLINE";
                connected = false;
            }

            ScreenManager.messageList.Add(Client.Status.ToString(), MessageType.Network);
            ScreenManager.messageList.Add(status, MessageType.Network);
        }
Пример #4
0
        public void Initialize()
        {
            // Disconnect if we are connected online
            if (Network.connected)
            {
                Network.connected = false;
            }

            // Create Station Spawner
            spawner = new StationSpawner(false, 3);

            // Load background
            background = new Background(ContentStore.bg7);

            // Create a new controllable player
            localPlayer = new Player(Vector2.Zero, SettingsManager.getUsername(), 100, true, 0);
            players.TryAdd(localPlayer.uid, localPlayer);

            // Create a minimap
            minimap = new Minimap(false, players, spawner.stations);
        }