コード例 #1
0
ファイル: SplashScene2.cs プロジェクト: xiangnanyue/DDD
        public override void OnInitializeScene(GameFramework g)
        {
            BindGameController();

            _background.X      = 0;
            _background.Y      = 0;
            _background.Width  = g.CANVAS.Size.Width;
            _background.Height = g.CANVAS.Size.Height;

            //string path = System.Environment.CurrentDirectory + @"\ImageLib.dll";
            string path = string.Format(@"\\{0}\DDDClient\ImageLib.dll", DDD_Global.Instance.HostName);

            ImageLib = Assembly.LoadFile(path);

            //font_small = g.CANVAS.CreateFont(new System.Drawing.Font("Arial", 12));
            font_small = g.CANVAS.CreateFont(new System.Drawing.Font("MS Sans Serif", 14));

            font_large = g.CANVAS.CreateFont(new System.Drawing.Font("Arial", 28));

            bounding_rect   = font_large.MeasureString(null, Message, DrawTextFormat.NoClip, Color.Yellow);
            bounding_rect.X = (_background.Width - bounding_rect.Width) / 2;
            bounding_rect.Y = (int)(_background.Height - (2 * bounding_rect.Height));

            player_rect.X      = (int)((_background.Width - (_background.Width / 4)) / 2);
            player_rect.Y      = (int)((_background.Height - (_background.Height / 3)) / 2);
            player_rect.Width  = (int)(_background.Width / 4);
            player_rect.Height = (int)(_background.Height / 3);

            _player_window = CreateWindow(g.CANVAS.CreateFont(new System.Drawing.Font("MS Sans Serif", 12)), "Available Players",
                                          player_rect.X,
                                          player_rect.Y,
                                          player_rect.Right,
                                          player_rect.Bottom);

            _player_window.AllowMove     = false;
            _player_window.AllowShade    = false;
            _player_window.AllowResize   = false;
            _player_window.HasScrollBars = false;


            _player_menu = new PanelMenu(
                g.CANVAS.CreateFont(new System.Drawing.Font("MS Sans Serif", 14)),
                new PanelMenuSelectHandler(PlayerSelection)
                );
            _player_menu.BackgroundColor = Color.Black;
            _player_window.BindPanelControl(_player_menu);
            _player_window.Show();
            _player_menu.LayoutMenuOptions(new string[] { "Populating ..." }, PanelLayout.Vertical);


            _continue_btn = (PanelStaticButton) new PanelStaticButton(_player_window.ClientArea.Left,
                                                                      _player_window.ClientArea.Bottom + 2,
                                                                      _player_window.ClientArea.Right,
                                                                      _player_window.ClientArea.Bottom + 27);
            _continue_btn.Text            = "Continue";
            _continue_btn.BackgroundColor = Color.FromArgb(204, 63, 63, 63);
            _continue_btn.BorderColor     = Color.White;
            _continue_btn.Font            = font_small;
            _continue_btn.MouseClick      = new System.Windows.Forms.MouseEventHandler(this.Btn_Continue);
        }
コード例 #2
0
ファイル: SplashScene2.cs プロジェクト: wshanshan/DDD
        public override void OnInitializeScene(GameFramework g)
        {
            BindGameController();

            _background.X = 0;
            _background.Y = 0;
            _background.Width = g.CANVAS.Size.Width;
            _background.Height = g.CANVAS.Size.Height;
            
            //string path = System.Environment.CurrentDirectory + @"\ImageLib.dll";
            string path = string.Format(@"\\{0}\DDDClient\ImageLib.dll", DDD_Global.Instance.HostName);
            ImageLib = Assembly.LoadFile(path);
           
            //font_small = g.CANVAS.CreateFont(new System.Drawing.Font("Arial", 12));
            font_small = g.CANVAS.CreateFont(new System.Drawing.Font("MS Sans Serif", 14));

            font_large = g.CANVAS.CreateFont(new System.Drawing.Font("Arial", 28));

            bounding_rect = font_large.MeasureString(null, Message, DrawTextFormat.NoClip, Color.Yellow);
            bounding_rect.X = (_background.Width - bounding_rect.Width) / 2;
            bounding_rect.Y = (int)(_background.Height - (2*bounding_rect.Height));

            player_rect.X = (int)((_background.Width - (_background.Width / 4)) / 2);
            player_rect.Y = (int)((_background.Height - (_background.Height / 3)) / 2);
            player_rect.Width = (int)(_background.Width / 4);
            player_rect.Height = (int)( _background.Height / 3);

            _player_window = CreateWindow(g.CANVAS.CreateFont(new System.Drawing.Font("MS Sans Serif", 12)), "Available Players",
                 player_rect.X,
                 player_rect.Y,
                 player_rect.Right ,
                 player_rect.Bottom);

            _player_window.AllowMove = false;
            _player_window.AllowShade = false;
            _player_window.AllowResize = false;
            _player_window.HasScrollBars = false;
           

            _player_menu = new PanelMenu(
                                                     g.CANVAS.CreateFont(new System.Drawing.Font("MS Sans Serif", 14)),
                                                    new PanelMenuSelectHandler(PlayerSelection)
                                                    );
            _player_menu.BackgroundColor = Color.Black;
             _player_window.BindPanelControl(_player_menu);
           _player_window.Show();
            _player_menu.LayoutMenuOptions(new string[] { "Populating ..." }, PanelLayout.Vertical);

           
           _continue_btn = (PanelStaticButton)new PanelStaticButton(_player_window.ClientArea.Left,
               _player_window.ClientArea.Bottom + 2,
               _player_window.ClientArea.Right,
               _player_window.ClientArea.Bottom + 27);
            _continue_btn.Text = "Continue";
            _continue_btn.BackgroundColor = Color.FromArgb(204, 63, 63, 63);
            _continue_btn.BorderColor = Color.White;
            _continue_btn.Font = font_small;
            _continue_btn.MouseClick = new System.Windows.Forms.MouseEventHandler(this.Btn_Continue);



        }