상속: Sprite
예제 #1
0
        public override void Initialize()
        {
            FileStream bgstream;
            if (isBeginning)
            {
                bgstream = new FileStream(@"Content\rescontbegin.png", FileMode.Open, FileAccess.Read);
            }
            else
            {
                bgstream = new FileStream(@"Content\rescontainer.png", FileMode.Open, FileAccess.Read);
            }

            FileStream restream = new FileStream(string.Format(@"Content\{0}.png", Type.ToString()), FileMode.Open, FileAccess.Read);
            Texture2D restexture = Texture2D.FromStream(GraphicsDevice, restream);
            this.Texture = Texture2D.FromStream(GraphicsDevice, bgstream);
            this.Width = 134;
            this.Height = 34;
            this.Color = Color.White;
            TypeSprite = new Control()
            {
                Texture=restexture,
                Color=Color.White,
                Width=(int)(restexture.Width / 2),
                Height = (int)(restexture.Height / 2),
                Left = 12,
                Top = 8,
                Margin=Origins.TopLeft,
                Parent=this,
            };

            LabelText = new Label()
            {
                Font = new Font("msyh.ttc", 20),
                Color = Color.White,
                Left = this.Width / 3,
                Margin = Origins.CenterLeft,
            };
            Value = 61616;
            LabelText.Text = Value.ToString();
            Controls.Add(TypeSprite);
            Controls.Add(LabelText);
            base.Initialize();
        }
예제 #2
0
 public void AddTab(Control Panel, string tabTitle, bool SwitchTo = false)
 {
     if(Panel !=null)
     {
         if (!Panel.Initialized)
             Panel.Initialize();
         Panel.Parent = this;
         _pagelist.Add(Panel);
     }
     var bar = new TabBar(fnt,fntNoShadow)
     {
         Parent=this,
         Top=0,
         Left = _tablist.Count * 120,
         Right= _tablist.Count * 120,
         Margin = TabMargin,
     };
     bar.Initialize();
     bar.Parent = this;
     bar.TabID = _tablist.Count;
     bar.Title = tabTitle;
     bar.Click += SwitchTab;
     foreach (TabBar t in _tablist)
     {
         t.Selected = false;
     }
     _tablist.Add(bar);
     SwitchTab(_tablist.Count - 1);
 }
예제 #3
0
 public override void Initialize()
 {
     Surface = new Control()
     {
         Width = this.Width,
         Height = this.Height,
     };
     Surface.Texture = new Texture2D(GraphicsDevice, Decoder.width, Decoder.height, false, SurfaceFormat.Bgr32);
     Controls.Add(Surface);
     base.Initialize();
 }
예제 #4
0
        public override void Initialize()
        {
            this.Texture = Sprite.CreateTextureFromFile(@"Content\menu-button-background.png");
            this.Width = Texture.Width;
            this.Height = Texture.Height;

            TextFont = new Font(DefaultFontFileName, 20);
            TextFontsm = new Font(DefaultFontFileName, 15);

            SeaTitle = new Label()
            {
                Font = TextFont,
                Color = Color.Black,
                Left = 163,
                Top = 9,
            };
            CreatorInfo = new Label()
            {
                Font = TextFontsm,
                Color = Color.Black,
                Left = 163,
                Top = 32,
            };
            MapTitle = new Label()
            {
                Font = TextFontsm,
                Color = Color.Black,
                Left = 163,
                Top = 50,
            };
            float scale = (float)1.0 * 85 / 298;
            MapSprite = new Control()
            {
                Texture=Sprite.CreateTextureFromFile(Map.PreviewImagePath),
                Width = (int)(530 * scale),
                Height = (int)(298 * scale) + 1,
                Margin = Origins.CenterLeft,
                Left = 8,
                Color = Color.White,
            };

            Controls.Add(SeaTitle);
            Controls.Add(CreatorInfo);
            Controls.Add(MapTitle);
            Controls.Add(MapSprite);
            base.Initialize();
            SeaTitle.Text = Map.MapName;
            CreatorInfo.Text = Map.Creator;
            MapTitle.Text = Map.Title;
        }