Beispiel #1
0
        public override GameFont LoadFont(string filename)
        {
            //Get font size from filename, format should be name_size.xnb or whatever
            var name = GameContentManager.RemoveExtension(filename)
                       .Replace(Path.Combine("resources", "fonts"), "")
                       .TrimStart(Path.DirectorySeparatorChar);

            var parts = name.Split('_');

            if (parts.Length >= 1)
            {
                if (int.TryParse(parts[parts.Length - 1], out var size))
                {
                    name = "";
                    for (var i = 0; i <= parts.Length - 2; i++)
                    {
                        name += parts[i];
                        if (i + 1 < parts.Length - 2)
                        {
                            name += "_";
                        }
                    }

                    return(new MonoFont(name, filename, size, mContentManager));
                }
            }

            return(null);
        }
Beispiel #2
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     this.Flash();
     spriteBatch.Begin();
     spriteBatch.Draw(GameContentManager.GetInstance().GetTexture("sprite_sheet"), position, rect, Color.White);
     spriteBatch.End();
 }
Beispiel #3
0
        private void rbCritter_CheckedChanged(object sender, EventArgs e)
        {
            cmbCritterAnimation.Items.Clear();
            cmbCritterAnimation.Items.Add(Strings.General.none);
            cmbCritterAnimation.Items.AddRange(AnimationBase.Names);
            cmbCritterAnimation.SelectedIndex = 0;

            cmbCritterSprite.Items.Clear();
            cmbCritterSprite.Items.Add(Strings.General.none);
            cmbCritterSprite.Items.AddRange(GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Entity));
            cmbCritterSprite.SelectedIndex = 0;

            if (nudCritterMoveFrequency.Value == 0)
            {
                nudCritterMoveFrequency.Value = 1000;
            }

            if (nudCritterMoveSpeed.Value == 0)
            {
                nudCritterMoveSpeed.Value = 400;
            }

            if (!rbCritter.Checked)
            {
                return;
            }

            HideAttributeMenus();
            grpCritter.Visible = true;
        }
Beispiel #4
0
        /// <summary>Get a new content manager which handles reading files from the game content folder with support for interception.</summary>
        /// <param name="name">A name for the mod manager. Not guaranteed to be unique.</param>
        public GameContentManager CreateGameContentManager(string name)
        {
            GameContentManager manager = new GameContentManager(name, this.MainContentManager.ServiceProvider, this.MainContentManager.RootDirectory, this.MainContentManager.CurrentCulture, this, this.Monitor, this.Reflection, this.OnDisposing);

            this.ContentManagers.Add(manager);
            return(manager);
        }
Beispiel #5
0
        private void PopulateExhaustedGraphicList()
        {
            cmbEndSprite.Items.Clear();
            cmbEndSprite.Items.Add(Strings.General.none);
            var resources = GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Resource);

            if (mEditorItem.Exhausted.GraphicFromTileset)
            {
                resources = GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Tileset);
            }

            for (var i = 0; i < resources.Length; i++)
            {
                cmbEndSprite.Items.Add(resources[i]);
            }

            if (mEditorItem != null)
            {
                if (mEditorItem.Exhausted.Graphic != null && cmbEndSprite.Items.Contains(mEditorItem.Exhausted.Graphic))
                {
                    cmbEndSprite.SelectedIndex = cmbEndSprite.FindString(
                        TextUtils.NullToNone(TextUtils.NullToNone(mEditorItem.Exhausted.Graphic))
                        );

                    return;
                }
            }

            cmbEndSprite.SelectedIndex = 0;
        }
        public EventCommandOptions(ShowOptionsCommand refCommand, EventPage refPage, FrmEvent editor)
        {
            InitializeComponent();
            mMyCommand   = refCommand;
            mEventEditor = editor;
            mCurrentPage = refPage;
            InitLocalization();
            txtShowOptions.Text     = mMyCommand.Text;
            txtShowOptionsOpt1.Text = mMyCommand.Options[0];
            txtShowOptionsOpt2.Text = mMyCommand.Options[1];
            txtShowOptionsOpt3.Text = mMyCommand.Options[2];
            txtShowOptionsOpt4.Text = mMyCommand.Options[3];
            cmbFace.Items.Clear();
            cmbFace.Items.Add(Strings.General.none);
            cmbFace.Items.AddRange(GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Face));
            if (cmbFace.Items.IndexOf(TextUtils.NullToNone(mMyCommand.Face)) > -1)
            {
                cmbFace.SelectedIndex = cmbFace.Items.IndexOf(TextUtils.NullToNone(mMyCommand.Face));
            }
            else
            {
                cmbFace.SelectedIndex = 0;
            }

            UpdateFacePreview();
        }
Beispiel #7
0
 /// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     // TODO: Add your initialization code here
     this.Position = new Vector2(ScreenManager.GetInstance().ScreenSize.X / 8, ScreenManager.GetInstance().ScreenSize.Y - 96);
     this.Texture  = GameContentManager.GetInstance().GetTexture("sprite_sheet");
     base.Initialize();
 }
Beispiel #8
0
 public GameStateManager(SnakeGame game, GameContentManager gameContentManager)
 {
     MenuState = new MenuState(this, game, gameContentManager);
     PlayingGameState = new PlayingGameState(this, game, gameContentManager);
     EndGameState = new EndGameState(this, game, gameContentManager);
     _currentState = MenuState;
 }
Beispiel #9
0
        private void frmItem_Load(object sender, EventArgs e)
        {
            cmbPic.Items.Clear();
            cmbPic.Items.Add(Strings.General.none);

            var itemnames = GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Item);

            cmbPic.Items.AddRange(itemnames);

            cmbAttackAnimation.Items.Clear();
            cmbAttackAnimation.Items.Add(Strings.General.none);
            cmbAttackAnimation.Items.AddRange(AnimationBase.Names);
            cmbScalingStat.Items.Clear();
            for (var x = 0; x < Options.MaxStats; x++)
            {
                cmbScalingStat.Items.Add(Globals.GetStatName(x));
            }

            cmbAnimation.Items.Clear();
            cmbAnimation.Items.Add(Strings.General.none);
            cmbAnimation.Items.AddRange(AnimationBase.Names);
            cmbEquipmentAnimation.Items.Clear();
            cmbEquipmentAnimation.Items.Add(Strings.General.none);
            cmbEquipmentAnimation.Items.AddRange(AnimationBase.Names);
            cmbTeachSpell.Items.Clear();
            cmbTeachSpell.Items.Add(Strings.General.none);
            cmbTeachSpell.Items.AddRange(SpellBase.Names);
            cmbEvent.Items.Clear();
            cmbEvent.Items.Add(Strings.General.none);
            cmbEvent.Items.AddRange(EventBase.Names);
            cmbMalePaperdoll.Items.Clear();
            cmbMalePaperdoll.Items.Add(Strings.General.none);
            cmbFemalePaperdoll.Items.Clear();
            cmbFemalePaperdoll.Items.Add(Strings.General.none);
            var paperdollnames =
                GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Paperdoll);

            for (var i = 0; i < paperdollnames.Length; i++)
            {
                cmbMalePaperdoll.Items.Add(paperdollnames[i]);
                cmbFemalePaperdoll.Items.Add(paperdollnames[i]);
            }

            nudStr.Maximum = Options.MaxStatValue;
            nudMag.Maximum = Options.MaxStatValue;
            nudDef.Maximum = Options.MaxStatValue;
            nudMR.Maximum  = Options.MaxStatValue;
            nudSpd.Maximum = Options.MaxStatValue;

            nudStr.Minimum = -Options.MaxStatValue;
            nudMag.Minimum = -Options.MaxStatValue;
            nudDef.Minimum = -Options.MaxStatValue;
            nudMR.Minimum  = -Options.MaxStatValue;
            nudSpd.Minimum = -Options.MaxStatValue;

            InitLocalization();
            UpdateEditor();
        }
Beispiel #10
0
 private void frmUpdate_Load(object sender, EventArgs e)
 {
     AppDomain.CurrentDomain.UnhandledException += Program.CurrentDomain_UnhandledException;
     Strings.Load();
     GameContentManager.CheckForResources();
     Database.LoadOptions();
     InitLocalization();
     mUpdater = new Updater.Updater(ClientConfiguration.Instance.UpdateUrl, Path.Combine("version.json"), false, 5);
 }
Beispiel #11
0
 /// <summary>Get a new content manager which handles reading files from the game content folder with support for interception.</summary>
 /// <param name="name">A name for the mod manager. Not guaranteed to be unique.</param>
 public GameContentManager CreateGameContentManager(string name)
 {
     return(this.ContentManagerLock.InWriteLock(() =>
     {
         GameContentManager manager = new GameContentManager(name, this.MainContentManager.ServiceProvider, this.MainContentManager.RootDirectory, this.MainContentManager.CurrentCulture, this, this.Monitor, this.Reflection, this.OnDisposing, this.OnLoadingFirstAsset);
         this.ContentManagers.Add(manager);
         return manager;
     }));
 }
        private void GraphicTypeUpdated()
        {
            mTmpGraphic.Filename = "";
            mTmpGraphic.Type     = EventGraphicType.None;
            mTmpGraphic.X        = 0;
            mTmpGraphic.Y        = 0;
            mTmpGraphic.Width    = -1;
            mTmpGraphic.Height   = -1;
            if (cmbGraphicType.SelectedIndex == 0) //No Graphic
            {
                cmbGraphic.Hide();
                lblGraphic.Hide();
                UpdatePreview();
            }
            else if (cmbGraphicType.SelectedIndex == 1) //Sprite
            {
                mTmpGraphic.Type = EventGraphicType.Sprite;
                cmbGraphic.Show();
                lblGraphic.Show();
                cmbGraphic.Items.Clear();
                cmbGraphic.Items.AddRange(
                    GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Entity)
                    );

                if (cmbGraphic.Items.Count > 0)
                {
                    cmbGraphic.SelectedIndex = 0;
                }
            }
            else if (cmbGraphicType.SelectedIndex == 2) //Tileset
            {
                mTmpGraphic.Type   = EventGraphicType.Tileset;
                mTmpGraphic.Width  = 0;
                mTmpGraphic.Height = 0;
                lblGraphic.Show();
                cmbGraphic.Show();
                cmbGraphic.Items.Clear();
                foreach (var filename in TilesetBase.Names)
                {
                    if (File.Exists("resources/tilesets/" + filename))
                    {
                        cmbGraphic.Items.Add(filename);
                    }
                    else
                    {
                    }
                }

                if (cmbGraphic.Items.Count > 0)
                {
                    cmbGraphic.SelectedIndex = 0;
                }
            }
        }
Beispiel #13
0
 //Init Functions
 public static void InitGraphics()
 {
     Renderer.Init();
     sContentManager = Globals.ContentManager;
     sContentManager.LoadAll();
     GameFont       = FindFont(ClientConfiguration.Instance.GameFont);
     UIFont         = FindFont(ClientConfiguration.Instance.UIFont);
     EntityNameFont = FindFont(ClientConfiguration.Instance.EntityNameFont);
     ChatBubbleFont = FindFont(ClientConfiguration.Instance.ChatBubbleFont);
     ActionMsgFont  = FindFont(ClientConfiguration.Instance.ActionMsgFont);
 }
Beispiel #14
0
        protected override void LoadContent()
        {
            base.LoadContent();

            // Replace contInitialLoad
            GameContentManager contentManager = CreateContentManager(this.Content.ServiceProvider, this.Content.RootDirectory);
            FieldInfo          f = typeof(Game1).GetField("contInitialLoad", BindingFlags.NonPublic | BindingFlags.Instance);

            f.SetValue(this, contentManager);
            RenderMaster.LoadingScreenAssets.txSplash = contentManager.Load <Texture2D>("Splash");

            this.OnContentLoaded();
        }
Beispiel #15
0
        public override void Draw(GameTime gameTime)
        {
            Vector2 logoPosition = new Vector2(
                (ScreenManager.Game.GraphicsDevice.Viewport.Width / 2) - (GameContentManager.GetInstance().GetTexture("main_menu_logo").Width / 2),
                ScreenManager.Game.GraphicsDevice.Viewport.Height / 6);

            spriteBatch = ScreenManager.GetInstance().SpriteBatch;
            spriteBatch.Begin();
            spriteBatch.Draw(GameContentManager.GetInstance().GetTexture("main_menu_logo"), logoPosition, Color.White);
            spriteBatch.End();
            tileManager.Draw(spriteBatch);
            base.Draw(gameTime);
        }
Beispiel #16
0
        private void frmSpell_Load(object sender, EventArgs e)
        {
            cmbProjectile.Items.Clear();
            cmbProjectile.Items.AddRange(ProjectileBase.Names);
            cmbCastAnimation.Items.Clear();
            cmbCastAnimation.Items.Add(Strings.General.none);
            cmbCastAnimation.Items.AddRange(AnimationBase.Names);
            cmbHitAnimation.Items.Clear();
            cmbHitAnimation.Items.Add(Strings.General.none);
            cmbHitAnimation.Items.AddRange(AnimationBase.Names);
            cmbEvent.Items.Clear();
            cmbEvent.Items.Add(Strings.General.none);
            cmbEvent.Items.AddRange(EventBase.Names);

            cmbSprite.Items.Clear();
            cmbSprite.Items.Add(Strings.General.none);
            var spellNames = GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Spell);

            cmbSprite.Items.AddRange(spellNames);

            cmbTransform.Items.Clear();
            cmbTransform.Items.Add(Strings.General.none);
            var spriteNames = GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Entity);

            cmbTransform.Items.AddRange(spriteNames);

            nudWarpX.Maximum = (int)Options.MapWidth;
            nudWarpY.Maximum = (int)Options.MapHeight;

            cmbWarpMap.Items.Clear();
            cmbWarpMap.Items.AddRange(MapList.OrderedMaps.Select(map => map?.Name).ToArray());
            cmbWarpMap.SelectedIndex = 0;

            nudStr.Maximum = Options.MaxStatValue;
            nudMag.Maximum = Options.MaxStatValue;
            nudDef.Maximum = Options.MaxStatValue;
            nudMR.Maximum  = Options.MaxStatValue;
            nudSpd.Maximum = Options.MaxStatValue;
            nudStr.Minimum = -Options.MaxStatValue;
            nudMag.Minimum = -Options.MaxStatValue;
            nudDef.Minimum = -Options.MaxStatValue;
            nudMR.Minimum  = -Options.MaxStatValue;
            nudSpd.Minimum = -Options.MaxStatValue;

            nudCastDuration.Maximum     = Int32.MaxValue;
            nudCooldownDuration.Maximum = Int32.MaxValue;

            InitLocalization();
            UpdateEditor();
        }
Beispiel #17
0
 public MonoFont(string fontName, string fileName, int fontSize, ContentManager contentManager) : base(
         fontName, fontSize
         )
 {
     try
     {
         fileName = GameContentManager.RemoveExtension(fileName);
         mFont    = contentManager.Load <SpriteFont>(fileName);
     }
     catch (Exception ex)
     {
         Log.Trace(ex);
     }
 }
Beispiel #18
0
        //GameDataPacket
        private static void HandlePacket(GameDataPacket packet)
        {
            foreach (var obj in packet.GameObjects)
            {
                HandlePacket((dynamic)obj);
            }

            Globals.HasGameData = true;
            if (!Globals.InEditor && Globals.HasGameData && Globals.CurrentMap != null)
            {
                Globals.LoginForm.BeginInvoke(Globals.LoginForm.EditorLoopDelegate);
            }

            GameContentManager.LoadTilesets();
        }
Beispiel #19
0
        public static void RunFrame()
        {
            //Shooting for 30fps
            var startTime = Globals.System.GetTimeMs();

            sMyForm.Update();

            if (sWaterfallTimer < Globals.System.GetTimeMs())
            {
                Globals.WaterfallFrame++;
                if (Globals.WaterfallFrame == 3)
                {
                    Globals.WaterfallFrame = 0;
                }

                sWaterfallTimer = Globals.System.GetTimeMs() + 500;
            }

            if (sAnimationTimer < Globals.System.GetTimeMs())
            {
                Globals.AutotileFrame++;
                if (Globals.AutotileFrame == 3)
                {
                    Globals.AutotileFrame = 0;
                }

                sAnimationTimer = Globals.System.GetTimeMs() + 600;
            }

            DrawFrame();

            GameContentManager.Update();
            Networking.Network.Update();
            Application.DoEvents(); // handle form events

            sFpsCount++;
            if (sFpsTime < Globals.System.GetTimeMs())
            {
                sFps = sFpsCount;
                sMyForm.toolStripLabelFPS.Text = Strings.MainForm.fps.ToString(sFps);
                sFpsCount = 0;
                sFpsTime  = Globals.System.GetTimeMs() + 1000;
            }

            Thread.Sleep(Math.Max(1, (int)(1000 / 60f - (Globals.System.GetTimeMs() - startTime))));
        }
Beispiel #20
0
        public void Jump()
        {
            GameContentManager.GetInstance().GetSound("jump").Play();
            currentState = State.Jumping;

            float maxHeight = Position.Y;

            while (Position.Y > maxHeight - 20)
            {
                Position.Y--;
            }
            while (Position.Y < maxHeight)
            {
                Position.Y++;
            }

            currentState = State.Walking;
        }
        public EventCommandChangeHair(ChangeHairCommand refCommand, FrmEvent editor)
        {
            InitializeComponent();
            mMyCommand   = refCommand;
            mEventEditor = editor;
            cmbHair.Items.Clear();
            cmbHair.Items.AddRange(GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Hairs));
            if (cmbHair.Items.IndexOf(mMyCommand.Hair) > -1)
            {
                cmbHair.SelectedIndex = cmbHair.Items.IndexOf(mMyCommand.Hair);
            }
            else
            {
                cmbHair.SelectedIndex = 0;
            }

            UpdatePreview();
            InitLocalization();
        }
Beispiel #22
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            AppDomain.CurrentDomain.UnhandledException += Program.CurrentDomain_UnhandledException;
            Strings.Load();
            GameContentManager.CheckForResources();
            Database.LoadOptions();
            mOptionsLoaded     = true;
            EditorLoopDelegate = Main.StartLoop;
            if (Preferences.LoadPreference("username").Trim().Length > 0)
            {
                txtUsername.Text    = Preferences.LoadPreference("Username");
                txtPassword.Text    = "*****";
                mSavedPassword      = Preferences.LoadPreference("Password");
                chkRemember.Checked = true;
            }

            Database.InitMapCache();
            InitLocalization();
        }
        public EventCommand_ShowPicture(ShowPictureCommand refCommand, FrmEvent editor)
        {
            InitializeComponent();
            mMyCommand   = refCommand;
            mEventEditor = editor;
            cmbPicture.Items.Clear();
            cmbPicture.Items.AddRange(
                GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Image)
                );

            if (cmbPicture.Items.IndexOf(mMyCommand.File) > -1)
            {
                cmbPicture.SelectedIndex = cmbPicture.Items.IndexOf(mMyCommand.File);
            }
            else
            {
                if (cmbPicture.Items.Count > 0)
                {
                    cmbPicture.SelectedIndex = 0;
                }
            }

            cmbSize.Items.Clear();
            cmbSize.Items.Add(Strings.EventShowPicture.original);
            cmbSize.Items.Add(Strings.EventShowPicture.fullscreen);
            cmbSize.Items.Add(Strings.EventShowPicture.halfscreen);
            cmbSize.Items.Add(Strings.EventShowPicture.stretchtofit);
            if (mMyCommand.Size > -1)
            {
                cmbSize.SelectedIndex = mMyCommand.Size;
            }
            else
            {
                cmbSize.SelectedIndex = 0;
            }

            chkClick.Checked           = mMyCommand.Clickable;
            nudHideTime.Value          = mMyCommand.HideTime;
            chkWaitUntilClosed.Checked = mMyCommand.WaitUntilClosed;

            InitLocalization();
        }
        private void UpdateGraphicList()
        {
            cmbGraphic.Items.Clear();
            if (cmbGraphicType.SelectedIndex == 0) //No Graphic
            {
                cmbGraphic.Hide();
                lblGraphic.Hide();
            }
            else if (cmbGraphicType.SelectedIndex == 1) //Sprite
            {
                cmbGraphic.Show();
                lblGraphic.Show();
                cmbGraphic.Items.AddRange(
                    GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Entity)
                    );

                if (cmbGraphic.Items.Count > 0)
                {
                    cmbGraphic.SelectedIndex = 0;
                }
            }
            else if (cmbGraphicType.SelectedIndex == 2) //Tileset
            {
                lblGraphic.Show();
                cmbGraphic.Show();
                foreach (var filename in TilesetBase.Names)
                {
                    if (File.Exists("resources/tilesets/" + filename))
                    {
                        cmbGraphic.Items.Add(filename);
                    }
                    else
                    {
                    }
                }

                if (cmbGraphic.Items.Count > 0)
                {
                    cmbGraphic.SelectedIndex = 0;
                }
            }
        }
        //Music
        public static void PlayMusic(string filename, float fadeout = 0f, float fadein = 0f, bool loop = false)
        {
            if (string.IsNullOrWhiteSpace(filename))
            {
                //Entered a map with no music selected, fade out any music that's already playing.
                StopMusic(3f);

                return;
            }

            ClearQueue();

            filename = GameContentManager.RemoveExtension(filename);
            if (sMyMusic != null)
            {
                if (fadeout < 0.01 ||
                    sMyMusic.State == GameAudioInstance.AudioInstanceState.Stopped ||
                    sMyMusic.State == GameAudioInstance.AudioInstanceState.Paused ||
                    sMyMusic.GetVolume() == 0)
                {
                    StopMusic();
                    StartMusic(filename, fadein, loop);
                }
                else
                {
                    //Start fadeout
                    if (!string.Equals(sCurrentSong, filename, StringComparison.CurrentCultureIgnoreCase) || sFadingOut)
                    {
                        sFadeRate    = sMyMusic.GetVolume() / fadeout;
                        sFadeTimer   = Globals.System.GetTimeMs() + (long)(sFadeRate / 1000);
                        sFadingOut   = true;
                        sQueuedMusic = filename;
                        sQueuedFade  = fadein;
                        sQueuedLoop  = loop;
                    }
                }
            }
            else
            {
                StartMusic(filename, fadein, loop);
            }
        }
Beispiel #26
0
 /// <summary>Get a new content manager which handles reading files from the game content folder with support for interception.</summary>
 /// <param name="name">A name for the mod manager. Not guaranteed to be unique.</param>
 public GameContentManager CreateGameContentManager(string name)
 {
     return(this.ContentManagerLock.InWriteLock(() =>
     {
         GameContentManager manager = new GameContentManager(
             name: name,
             serviceProvider: this.MainContentManager.ServiceProvider,
             rootDirectory: this.MainContentManager.RootDirectory,
             currentCulture: this.MainContentManager.CurrentCulture,
             coordinator: this,
             monitor: this.Monitor,
             reflection: this.Reflection,
             onDisposing: this.OnDisposing,
             onLoadingFirstAsset: this.OnLoadingFirstAsset,
             aggressiveMemoryOptimizations: this.AggressiveMemoryOptimizations
             );
         this.ContentManagers.Add(manager);
         return manager;
     }));
 }
Beispiel #27
0
        public Sound(string filename, bool loop)
        {
            if (String.IsNullOrEmpty(filename))
            {
                return;
            }

            mFilename = GameContentManager.RemoveExtension(filename).ToLower();
            mLoop     = loop;
            var sound = Globals.ContentManager.GetSound(mFilename);

            if (sound != null)
            {
                mSound           = sound.CreateInstance();
                mSound.IsLooping = mLoop;
                mSound.SetVolume(Globals.Database.SoundVolume);
                mSound.Play();
                Loaded = true;
            }
        }
Beispiel #28
0
        public void SetTileset(string name)
        {
            TilesetBase tSet     = null;
            var         tilesets = TilesetBase.Lookup;
            var         id       = Guid.Empty;

            foreach (var tileset in tilesets.Pairs)
            {
                if (tileset.Value.Name.ToLower() == name.ToLower())
                {
                    id = tileset.Key;

                    break;
                }
            }

            if (id != Guid.Empty)
            {
                tSet = TilesetBase.Get(id);
            }

            if (tSet != null)
            {
                if (File.Exists("resources/tilesets/" + tSet.Name))
                {
                    picTileset.Show();
                    Globals.CurrentTileset = tSet;
                    Globals.CurSelX        = 0;
                    Globals.CurSelY        = 0;
                    var tilesetTex = GameContentManager.GetTexture(GameContentManager.TextureType.Tileset, tSet.Name);
                    if (tilesetTex != null)
                    {
                        picTileset.Width  = tilesetTex.Width;
                        picTileset.Height = tilesetTex.Height;
                    }

                    cmbTilesets.SelectedItem = name;
                    CreateSwapChain();
                }
            }
        }
        public EventCommandText(ShowTextCommand refCommand, FrmEvent editor)
        {
            InitializeComponent();
            mMyCommand   = refCommand;
            mEventEditor = editor;
            InitLocalization();
            txtShowText.Text = mMyCommand.Text;
            cmbFace.Items.Clear();
            cmbFace.Items.Add(Strings.General.none);
            cmbFace.Items.AddRange(GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Face));
            if (cmbFace.Items.IndexOf(TextUtils.NullToNone(mMyCommand.Face)) > -1)
            {
                cmbFace.SelectedIndex = cmbFace.Items.IndexOf(TextUtils.NullToNone(mMyCommand.Face));
            }
            else
            {
                cmbFace.SelectedIndex = 0;
            }

            UpdateFacePreview();
        }
Beispiel #30
0
        private void frmNpc_Load(object sender, EventArgs e)
        {
            cmbSprite.Items.Clear();
            cmbSprite.Items.Add(Strings.General.none);
            cmbSprite.Items.AddRange(
                GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Entity)
                );

            cmbSpell.Items.Clear();
            cmbSpell.Items.AddRange(SpellBase.Names);
            cmbHostileNPC.Items.Clear();
            cmbHostileNPC.Items.AddRange(NpcBase.Names);
            cmbDropItem.Items.Clear();
            cmbDropItem.Items.Add(Strings.General.none);
            cmbDropItem.Items.AddRange(ItemBase.Names);
            cmbAttackAnimation.Items.Clear();
            cmbAttackAnimation.Items.Add(Strings.General.none);
            cmbAttackAnimation.Items.AddRange(AnimationBase.Names);
            cmbOnDeathEventKiller.Items.Clear();
            cmbOnDeathEventKiller.Items.Add(Strings.General.none);
            cmbOnDeathEventKiller.Items.AddRange(EventBase.Names);
            cmbOnDeathEventParty.Items.Clear();
            cmbOnDeathEventParty.Items.Add(Strings.General.none);
            cmbOnDeathEventParty.Items.AddRange(EventBase.Names);
            cmbScalingStat.Items.Clear();
            for (var x = 0; x < Options.MaxStats; x++)
            {
                cmbScalingStat.Items.Add(Globals.GetStatName(x));
            }

            nudStr.Maximum = Options.MaxStatValue;
            nudMag.Maximum = Options.MaxStatValue;
            nudDef.Maximum = Options.MaxStatValue;
            nudMR.Maximum  = Options.MaxStatValue;
            nudSpd.Maximum = Options.MaxStatValue;
            InitLocalization();
            UpdateEditor();
        }
Beispiel #31
0
        private void frmAnimation_Load(object sender, EventArgs e)
        {
            //Animation Sound
            cmbSound.Items.Clear();
            cmbSound.Items.Add(Strings.General.none);
            cmbSound.Items.AddRange(GameContentManager.SmartSortedSoundNames);

            //Lower Animation Graphic
            cmbLowerGraphic.Items.Clear();
            cmbLowerGraphic.Items.Add(Strings.General.none);
            cmbLowerGraphic.Items.AddRange(
                GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Animation)
                );

            //Upper Animation Graphic
            cmbUpperGraphic.Items.Clear();
            cmbUpperGraphic.Items.Add(Strings.General.none);
            cmbUpperGraphic.Items.AddRange(
                GameContentManager.GetSmartSortedTextureNames(GameContentManager.TextureType.Animation)
                );

            mLowerWindow = new SwapChainRenderTarget(
                Core.Graphics.GetGraphicsDevice(), picLowerAnimation.Handle, picLowerAnimation.Width,
                picLowerAnimation.Height
                );

            mUpperWindow = new SwapChainRenderTarget(
                Core.Graphics.GetGraphicsDevice(), picUpperAnimation.Handle, picUpperAnimation.Width,
                picUpperAnimation.Height
                );

            mLowerDarkness = Core.Graphics.CreateRenderTexture(picLowerAnimation.Width, picLowerAnimation.Height);
            mUpperDarkness = Core.Graphics.CreateRenderTexture(picUpperAnimation.Width, picUpperAnimation.Height);

            InitLocalization();
            UpdateEditor();
        }
Beispiel #32
0
 protected BaseGameState(GameStateManager stateManager, SnakeGame game, GameContentManager contentManager)
 {
     StateManager = stateManager;
     Game = game;
     ContentManager = contentManager;
 }
Beispiel #33
0
 public PlayingGameState(GameStateManager stateManager, SnakeGame game, GameContentManager contentManager)
     : base(stateManager, game, contentManager)
 {
 }