Esempio n. 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // Main Background
            mainBackground = Content.Load <Texture2D>("mainbg");
            // Loading Background
            loadingBackground = Content.Load <Texture2D>("loadingbg");
            // TODO: use this.Content to load your game content here
            // Initializing model bank which using for storing model file path
            modelBank = new GameModelBank(Content);
            // Initializing item bank which using for storing item data path
            itemBank = new GameItemBank(Content);
            // Load all model path here.
            Dictionary <short, GameModelConfig> modellist = config.getModelList();

            foreach (short id in modellist.Keys)
            {
                modelBank.Load(id, modellist[id]);
                // Cache
                GameModelNode cache = new GameModelNode(Content, modelBank);
                cache.Load(modelBank.getModelPath(id));
            }
            Dictionary <int, GameItemConfig> itemlist = config.getItemList();

            foreach (short id in itemlist.Keys)
            {
                itemBank.Load(id, itemlist[id]);
            }
            // Load all map
            Dictionary <short, GameMapConfig> maplist = config.getMapList();

            foreach (short id in maplist.Keys)
            {
                mapEntities.Add(id, new MapEntity(id, maplist[id], Content));
            }
            // Server configuration
            serverConfig = config.getServerList()[0];
            // Initializing game camera
            gameCamera = new GameCamera(graphics);
            // Particle system
            particle = new ParticlePreset(this, graphics, gameCamera);
            particle.LoadContent();
            // Game Event handler object
            gameHandler = new GameHandler(manager, network, this, Content, graphics, spriteBatch, modelBank, itemBank, classConfigs, gameCamera, audioSystem, particle);
            // Shadow map
            //shadow.LoadContent(spriteBatch, gameCamera);
            // Bloom post process
            bloom.Settings = BloomSettings.PresetSettings[0];
            // Way to go Effect
            wayToGoEffect = new GameModel(Content);
            wayToGoEffect.Load("waytogo");
            //Debug.WriteLine("LoadedContent");
        }
Esempio n. 2
0
        public GUILogin(Manager manager, Network network, GameMain game)
            : base(manager)
        {
            this.manager = manager;
            this.game    = game;
            this.network = network;

            // Define window property
            Init();
            Text   = "Login";
            Width  = 350;
            Height = 150;
            Center();
            Top = manager.ScreenHeight - 250;
            CloseButtonVisible = false;
            Resizable          = false;

            usernameLabel = new Label(manager);
            usernameLabel.Init();
            usernameLabel.Text   = "Username:"******"Password:"******"";
            username.Width  = 250;
            username.Height = 25;
            username.Top    = 10;
            username.Left   = 75;
            username.Parent = this;
            Add(username);

            password = new TextBox(manager);
            password.Init();
            password.Text     = "";
            password.Width    = 250;
            password.Height   = 25;
            password.Top      = 40;
            password.Left     = 75;
            password.Parent   = this;
            password.KeyDown += new KeyEventHandler(password_KeyDown);
            Add(password);

            loginButton = new Button(manager);
            loginButton.Init();
            loginButton.Text   = "Login";
            loginButton.Height = 25;
            loginButton.Top    = 80;
            loginButton.Left   = 170;
            loginButton.Parent = this;
            Add(loginButton);

            exitButton = new Button(manager);
            exitButton.Init();
            exitButton.Text   = "Exit";
            exitButton.Height = 25;
            exitButton.Top    = 80;
            exitButton.Left   = 250;
            exitButton.Parent = this;
            Add(exitButton);

            loginButton.Click += new TomShane.Neoforce.Controls.EventHandler(btnLogin_Click);
            exitButton.Click  += new TomShane.Neoforce.Controls.EventHandler(btnExit_Click);

            serverConfig = this.game.getServerConfig();
        }