mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Fix select texture pack being broken. (Thanks ShadowMewssacre)
This commit is contained in:
parent
b0b1afc617
commit
db930bbd66
@ -25,7 +25,8 @@ namespace ClassicalSharp {
|
||||
|
||||
protected override void TextButtonClick( Game game, Widget widget ) {
|
||||
string file = ((ButtonWidget)widget).Text;
|
||||
string path = Path.Combine( Program.AppDirectory, file );
|
||||
string dir = Path.Combine( Program.AppDirectory, TexturePackExtractor.Dir );
|
||||
string path = Path.Combine( dir, file );
|
||||
if( !File.Exists( path ) )
|
||||
return;
|
||||
|
||||
|
@ -19,9 +19,13 @@ namespace ClassicalSharp {
|
||||
}
|
||||
|
||||
public bool Load() {
|
||||
string path = Path.Combine( Program.AppDirectory, folder );
|
||||
path = Path.Combine( path, file );
|
||||
if( !File.Exists( file ) )
|
||||
return true;
|
||||
|
||||
try {
|
||||
string path = Path.Combine( Program.AppDirectory, folder );
|
||||
using( Stream fs = File.OpenRead( Path.Combine( path, file ) ) )
|
||||
using( Stream fs = File.OpenRead( path ) )
|
||||
using( StreamReader reader = new StreamReader( fs, false ) )
|
||||
{
|
||||
string line;
|
||||
@ -31,8 +35,6 @@ namespace ClassicalSharp {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch( FileNotFoundException ) {
|
||||
return true;
|
||||
} catch( IOException ex ) {
|
||||
ErrorHandler.LogError( "loading accepted urls", ex );
|
||||
return false;
|
||||
|
@ -55,7 +55,11 @@ namespace Launcher2 {
|
||||
} else if( e.Key == Key.Tab ) {
|
||||
HandleTab();
|
||||
}
|
||||
if( lastInput == null ) return;
|
||||
if( lastInput == null ) {
|
||||
if( e.Key == Key.Escape )
|
||||
game.SetScreen( new MainScreen( game ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( e.Key == Key.BackSpace && lastInput.BackspaceChar() ) {
|
||||
RedrawLastInput();
|
||||
@ -154,6 +158,18 @@ namespace Launcher2 {
|
||||
Dirty = true;
|
||||
}
|
||||
|
||||
protected override void WidgetUnclicked( LauncherWidget widget ) {
|
||||
LauncherInputWidget input = widget as LauncherInputWidget;
|
||||
if( input == null ) return;
|
||||
using( drawer ) {
|
||||
drawer.SetBitmap( game.Framebuffer );
|
||||
input.Active = false;
|
||||
input.Redraw( drawer, lastInput.Text, inputFont, inputHintFont );
|
||||
}
|
||||
lastInput = null;
|
||||
Dirty = true;
|
||||
}
|
||||
|
||||
protected void MakeInput( string text, int width, Anchor verAnchor, bool password,
|
||||
int x, int y, int maxChars, string hint ) {
|
||||
MakeInput( text, width, Anchor.Centre, verAnchor, password, x, y, maxChars, hint );
|
||||
|
@ -87,13 +87,18 @@ namespace Launcher2 {
|
||||
|
||||
protected LauncherWidget lastClicked;
|
||||
protected void MouseButtonDown( object sender, MouseButtonEventArgs e ) {
|
||||
if( e.Button != MouseButton.Left || selectedWidget == null ) return;
|
||||
if( e.Button != MouseButton.Left ) return;
|
||||
|
||||
if( selectedWidget.OnClick != null )
|
||||
selectedWidget.OnClick( e.X, e.Y );
|
||||
if( lastClicked != null && lastClicked != selectedWidget )
|
||||
WidgetUnclicked( lastClicked );
|
||||
if( selectedWidget != null && selectedWidget.OnClick != null )
|
||||
selectedWidget.OnClick( e.X, e.Y );
|
||||
lastClicked = selectedWidget;
|
||||
}
|
||||
|
||||
protected virtual void WidgetUnclicked( LauncherWidget widget ) {
|
||||
}
|
||||
|
||||
protected bool tabDown = false;
|
||||
MouseMoveEventArgs moveArgs = new MouseMoveEventArgs();
|
||||
MouseButtonEventArgs pressArgs = new MouseButtonEventArgs();
|
||||
|
Loading…
x
Reference in New Issue
Block a user