public UIMessageBox( String message, String title, bool closeButton = true ) : base(new Vector2( 480, 64 )) { CanClose = closeButton; myCentreText = false; Title = title; myText = new UILabel( Client.Graphics.Font.Large ) { Text = message, Position = new Vector2( 4, 4 ) }; AddChild( myText ); }
public UIButton( Vector2 size, Vector2 position, float scale = 1.0f ) : base(size, position) { Colour = Color4.White; PaddingLeft = PaddingTop = PaddingRight = PaddingBottom = 4.0f * scale; myButtonSprite = new FrameSprite( Res.Get<Texture2D>( "images_gui_panels" ), scale ) { SubrectSize = new Vector2( 16, 16 ), SubrectOffset = new Vector2( 32, 16 ), FrameTopLeftOffet = new Vector2( 4, 4 ), FrameBottomRightOffet = new Vector2( 4, 4 ), Size = size }; myLabel = new UILabel( Font.Large, scale ); AddChild( myLabel ); }
public UIWindow( Vector2 size, Vector2 position, float scale = 1.0f ) : base(size, position) { myScale = scale; PaddingLeft = 4.0f * scale; PaddingTop = 20.0f * scale; PaddingRight = 4.0f * scale; PaddingBottom = 4.0f * scale; myFrameSprite = new FrameSprite( Res.Get<Texture2D>( "images_gui_panels" ), scale ) { SubrectSize = new Vector2( 32, 32 ), SubrectOffset = new Vector2( 0, 0 ), FrameTopLeftOffet = new Vector2( 4, 20 ), FrameBottomRightOffet = new Vector2( 4, 4 ), Size = size }; myTitleText = new UILabel( Font.Large, scale ) { Position = new Vector2( 6 * scale - PaddingLeft, 4 * scale - PaddingTop ), IsEnabled = false }; AddChild( myTitleText ); myCloseButton = new UIWindowCloseButton( new Vector2( size.X - 18.0f * scale - PaddingLeft, 2.0f * scale - PaddingTop ), scale ); myCloseButton.Click += delegate( object sender, OpenTK.Input.MouseButtonEventArgs e ) { Close(); }; AddChild( myCloseButton ); CanBringToFront = true; CanClose = true; CanDrag = true; }
protected override void OnLoad( System.EventArgs e ) { Plugin.Register( "MarsMiner.Shared.CorePlugin", true, true ); Plugin.Register( "MarsMiner.Shared.MarsMinerPlugin", true, true ); ServerBuilder sb = new ServerBuilder { Name = "Local Server", Password = null, SlotCount = 1 }; myLocalServer = new GameServer( sb ); myServerThread = new Thread( myLocalServer.Run ); myServerThread.Start(); myLocalClient = new GameClient(); myLocalClient.ConnectLocal(); myClientThread = new Thread( myLocalClient.Run ); myClientThread.Start(); mySpriteShader = new SpriteShader( Width, Height ); myUIRoot = new UIObject( new Vector2( Width, Height ) ); myFPSText = new UILabel( Font.Large, new Vector2( 4.0f, 4.0f ) ); myFPSText.Text = "FT: ??ms FPS: ?? MEM: ??"; myUIRoot.AddChild( myFPSText ); Mouse.Move += OnMouseMove; Mouse.ButtonUp += OnMouseButtonEvent; Mouse.ButtonDown += OnMouseButtonEvent; /* myTestWorld = new World(); myGeoShader = new GeometryShader( Width, Height ); myGeoShader.UpdateTileMap( 16 ); myGeoRenderers = new List<ChunkRenderer>(); myTestWorld.ChunkLoaded += OnChunkEvent; myTestWorld.ChunkUnloaded += OnChunkEvent; myTestWorld.ChunkChanged += OnChunkEvent; myTestWorld.Generate( 1024, 1024, 4 ); myGeoShader.CameraPosition = new Vector3( 0.0f, 1024.0f, 0.0f ); */ GL.ClearColor( new Color4( 223, 186, 168, 255 ) ); myFrameTimer.Start(); }