コード例 #1
0
ファイル: MainForm.cs プロジェクト: JBeighel/MDLN.MGTools
		/// <summary>
		/// Load all external content files that are needed
		/// </summary>
		protected override void LoadContent() {
			TextureFont Font;

			Content.RootDirectory = INTERFACECONTENTDIR;

			Font = new TextureFont(Content.Load<Texture2D>("Font.png"));

			try {
				cDevConsole = new GameConsole(cGraphDevMgr.GraphicsDevice, Content, "Font.png", cGraphDevMgr.GraphicsDevice.Viewport.Width, cGraphDevMgr.GraphicsDevice.Viewport.Height / 2);
				cDevConsole.AccessKey = Keys.OemTilde;
				cDevConsole.UseAccessKey = true;
				cDevConsole.OpenEffect = DisplayEffect.SlideDown;
				cDevConsole.CloseEffect = DisplayEffect.SlideUp;
				cDevConsole.CommandSent += new CommandSentEventHandler(CommandEvent);
			} catch (Exception ExErr) {
				System.Windows.Forms.MessageBox.Show("Failed to initialize console: " + ExErr.GetType().ToString() + " - " + ExErr.Message);
				Exit();
				return;
			}

			cDevConsole.AddText(String.Format("Viewport Height={0} Width={1}", cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width));

			//Build card deck frames
			cAOFrame = new DeckFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width / 2);
			cAOFrame.Visible = true;
			cAOFrame.CloseEffect = DisplayEffect.SlideUp;
			cAOFrame.OpenEffect = DisplayEffect.SlideDown;
			cAOFrame.Font = Font;
			cAOFrame.MaxCardsShown = 1;

			cOLFrame = new DeckFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width / 2);
			cOLFrame.Left = cGraphDevMgr.GraphicsDevice.Viewport.Width / 2;
			cOLFrame.Visible = true;
			cOLFrame.CloseEffect = DisplayEffect.SlideUp;
			cOLFrame.OpenEffect = DisplayEffect.SlideDown;
			cOLFrame.Font = Font;
			cOLFrame.CardClick += OLCardClickedHandler;
			
			//build config frame
			cOpenConfig = new Button(cGraphDevMgr.GraphicsDevice, null, 0, 0, 100, 100);
			cOpenConfig.Font = Font;
			cOpenConfig.FontColor = new Color(0.1f, 0.1f, 0.1f, 1.0f);
			cOpenConfig.BackgroundColor = new Color(0.7f, 0.7f, 0.7f, 0.7f);
			cOpenConfig.Text = "Config";
			cOpenConfig.Visible = true;
			cOpenConfig.Click += ConfigClickHandler;

			cOLConfigFrame = new OverlordDecksFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width);
			cOLConfigFrame.Visible = false;
			cOLConfigFrame.OpenEffect = DisplayEffect.SlideUp;
			cOLConfigFrame.CloseEffect = DisplayEffect.SlideDown;
			cOLConfigFrame.Font = Font;

			//Load config files
			cDevConsole.AddText(LoadGameDecks(Content, INTERFACECONTENTDIR + Path.DirectorySeparatorChar + "AOCardsList.xml"));

			cAOFrame.ShuffleCompleteDeck(true, false);
			cAOFrame.SelectRandomCardBack();
			cOLFrame.ShuffleCompleteDeck(true, false);
			cOLFrame.SelectRandomCardBack();

			cOLConfigFrame.SetIconImageSet(cIconImages);
		}
コード例 #2
0
        /// <summary>
        /// Load all external content files that are needed
        /// </summary>
        protected override void LoadContent()
        {
            TextureFont Font;

            Content.RootDirectory = INTERFACECONTENTDIR;

            Font = new TextureFont(Content.Load <Texture2D>("Font.png"));

            try {
                cDevConsole              = new GameConsole(cGraphDevMgr.GraphicsDevice, Content, "Font.png", cGraphDevMgr.GraphicsDevice.Viewport.Width, cGraphDevMgr.GraphicsDevice.Viewport.Height / 2);
                cDevConsole.AccessKey    = Keys.OemTilde;
                cDevConsole.UseAccessKey = true;
                cDevConsole.OpenEffect   = DisplayEffect.SlideDown;
                cDevConsole.CloseEffect  = DisplayEffect.SlideUp;
                cDevConsole.CommandSent += new CommandSentEventHandler(CommandEvent);
            } catch (Exception ExErr) {
                System.Windows.Forms.MessageBox.Show("Failed to initialize console: " + ExErr.GetType().ToString() + " - " + ExErr.Message);
                Exit();
                return;
            }

            cDevConsole.AddText(String.Format("Viewport Height={0} Width={1}", cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width));

            //Build card deck frames
            cAOFrame               = new DeckFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width / 2);
            cAOFrame.Visible       = true;
            cAOFrame.CloseEffect   = DisplayEffect.SlideUp;
            cAOFrame.OpenEffect    = DisplayEffect.SlideDown;
            cAOFrame.Font          = Font;
            cAOFrame.MaxCardsShown = 1;

            cOLFrame             = new DeckFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width / 2);
            cOLFrame.Left        = cGraphDevMgr.GraphicsDevice.Viewport.Width / 2;
            cOLFrame.Visible     = true;
            cOLFrame.CloseEffect = DisplayEffect.SlideUp;
            cOLFrame.OpenEffect  = DisplayEffect.SlideDown;
            cOLFrame.Font        = Font;
            cOLFrame.CardClick  += OLCardClickedHandler;

            //build config frame
            cOpenConfig                 = new Button(cGraphDevMgr.GraphicsDevice, null, 0, 0, 100, 100);
            cOpenConfig.Font            = Font;
            cOpenConfig.FontColor       = new Color(0.1f, 0.1f, 0.1f, 1.0f);
            cOpenConfig.BackgroundColor = new Color(0.7f, 0.7f, 0.7f, 0.7f);
            cOpenConfig.Text            = "Config";
            cOpenConfig.Visible         = true;
            cOpenConfig.Click          += ConfigClickHandler;

            cOLConfigFrame             = new OverlordDecksFrame(cGraphDevMgr.GraphicsDevice, cGraphDevMgr.GraphicsDevice.Viewport.Height, cGraphDevMgr.GraphicsDevice.Viewport.Width);
            cOLConfigFrame.Visible     = false;
            cOLConfigFrame.OpenEffect  = DisplayEffect.SlideUp;
            cOLConfigFrame.CloseEffect = DisplayEffect.SlideDown;
            cOLConfigFrame.Font        = Font;

            //Load config files
            cDevConsole.AddText(LoadGameDecks(Content, INTERFACECONTENTDIR + Path.DirectorySeparatorChar + "AOCardsList.xml"));

            cAOFrame.ShuffleCompleteDeck(true, false);
            cAOFrame.SelectRandomCardBack();
            cOLFrame.ShuffleCompleteDeck(true, false);
            cOLFrame.SelectRandomCardBack();

            cOLConfigFrame.SetIconImageSet(cIconImages);
        }