public GameHandler(Manager manager, Network network, GameMain game, ContentManager content, GraphicsDeviceManager graphics, SpriteBatch spriteBatch, GameModelBank modelBank, GameItemBank itemBank, Dictionary <short, GameClassConfig> classConfigs, GameCamera camera, AudioSystem audioSystem, ParticlePreset particleManager)
 {
     this.manager     = manager;
     this.game        = game;
     this.content     = content;
     this.graphics    = graphics;
     this.spriteBatch = spriteBatch;
     // Bank & Config
     this.modelBank    = modelBank;
     this.itemBank     = itemBank;
     this.classConfigs = classConfigs;
     // System handler
     this.camera  = camera;
     this.network = network;
     // Entities
     this.monstersEntity = new Dictionary <String, UnitEntity>();
     this.npcsEntity     = new Dictionary <String, UnitEntity>();
     this.playersEntity  = new Dictionary <String, UnitEntity>();
     this.warpsEntity    = new Dictionary <String, WarpEntity>();
     this.itemsEntity    = new Dictionary <String, ItemEntity>();
     this.playerEntity   = null;
     // Effects
     this.audioSystem     = audioSystem;
     this.particleManager = particleManager;
     // Load font
     entityNameFont   = content.Load <SpriteFont>("Fonts/EntityName");
     entityDamageFont = content.Load <SpriteFont>("Fonts/EntityDamage");
     // White rect
     whiteRect = new Texture2D(graphics.GraphicsDevice, 1, 1);
     whiteRect.SetData(new[] { Color.White });
 }
Пример #2
0
 public GameModelNode(ContentManager content, GameModelBank bank) : base(content)
 {
     this.content = content;
     this.bank    = bank;
     Position     = new Vector3(0, 0, 0);
     _Position    = new Vector3(0, 0, 0);
     Rotation     = new Vector3(0, 0, 0);
     _Rotation    = new Vector3(0, 0, 0);
     Scale        = 1;
 }
Пример #3
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");
        }
Пример #4
0
        public UnitEntity(int id, String name, GameClassConfig classcfg, int modelHair, int modelFace, int maxHP, int maxSP, GameMain game, ContentManager content, GraphicsDeviceManager graphics, SpriteBatch spriteBatch, SpriteFont charNameFont, SpriteFont charDamageFont, Texture2D whiteRect, GameModelBank modelBank, GameItemBank itemBank, AudioSystem audioSystem, ParticlePreset particleManager)
        {
            this.id             = id;
            name                = name.Replace("'58'", ":");
            name                = name.Replace("'59'", ";");
            name                = name.Replace("'32'", " ");
            name                = name.Replace("'39'", "'");
            this.name           = name;
            this.game           = game;
            this.content        = content;
            this.graphics       = graphics;
            this.spriteBatch    = spriteBatch;
            this.classcfg       = classcfg;
            this.modelBank      = modelBank;
            this.itemBank       = itemBank;
            this.charNameFont   = charNameFont;
            this.charDamageFont = charDamageFont;
            this.whiteRect      = whiteRect;
            short modelKey = classcfg.modelID;

            model = new GameModelNode(content, modelBank);
            model.Load(modelKey);
            model.Rotation = modelBank.getModelRotation(modelKey);
            model.Position = modelBank.getModelPosition(modelKey);
            model.Scale    = modelBank.getModelScale(modelKey);
            model.playClip((short)state, true);
            this.maxHP           = this.curHP = maxHP;
            this.maxSP           = this.curSP = maxSP;
            this.audioEmitter    = new AudioEmitter();
            this.audioSystem     = audioSystem;
            this.particleManager = particleManager;
            for (int i = 0; i < listDamageSize; ++i)
            {
                listDamageValue[i] = -1;
                listDamageTime[i]  = -1;
            }
        }