mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -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 ) {
|
protected override void TextButtonClick( Game game, Widget widget ) {
|
||||||
string file = ((ButtonWidget)widget).Text;
|
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 ) )
|
if( !File.Exists( path ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -19,9 +19,13 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Load() {
|
public bool Load() {
|
||||||
try {
|
|
||||||
string path = Path.Combine( Program.AppDirectory, folder );
|
string path = Path.Combine( Program.AppDirectory, folder );
|
||||||
using( Stream fs = File.OpenRead( Path.Combine( path, file ) ) )
|
path = Path.Combine( path, file );
|
||||||
|
if( !File.Exists( file ) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
using( Stream fs = File.OpenRead( path ) )
|
||||||
using( StreamReader reader = new StreamReader( fs, false ) )
|
using( StreamReader reader = new StreamReader( fs, false ) )
|
||||||
{
|
{
|
||||||
string line;
|
string line;
|
||||||
@ -31,8 +35,6 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch( FileNotFoundException ) {
|
|
||||||
return true;
|
|
||||||
} catch( IOException ex ) {
|
} catch( IOException ex ) {
|
||||||
ErrorHandler.LogError( "loading accepted urls", ex );
|
ErrorHandler.LogError( "loading accepted urls", ex );
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,7 +55,11 @@ namespace Launcher2 {
|
|||||||
} else if( e.Key == Key.Tab ) {
|
} else if( e.Key == Key.Tab ) {
|
||||||
HandleTab();
|
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() ) {
|
if( e.Key == Key.BackSpace && lastInput.BackspaceChar() ) {
|
||||||
RedrawLastInput();
|
RedrawLastInput();
|
||||||
@ -154,6 +158,18 @@ namespace Launcher2 {
|
|||||||
Dirty = true;
|
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,
|
protected void MakeInput( string text, int width, Anchor verAnchor, bool password,
|
||||||
int x, int y, int maxChars, string hint ) {
|
int x, int y, int maxChars, string hint ) {
|
||||||
MakeInput( text, width, Anchor.Centre, verAnchor, password, x, y, maxChars, hint );
|
MakeInput( text, width, Anchor.Centre, verAnchor, password, x, y, maxChars, hint );
|
||||||
|
@ -87,13 +87,18 @@ namespace Launcher2 {
|
|||||||
|
|
||||||
protected LauncherWidget lastClicked;
|
protected LauncherWidget lastClicked;
|
||||||
protected void MouseButtonDown( object sender, MouseButtonEventArgs e ) {
|
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 )
|
if( lastClicked != null && lastClicked != selectedWidget )
|
||||||
|
WidgetUnclicked( lastClicked );
|
||||||
|
if( selectedWidget != null && selectedWidget.OnClick != null )
|
||||||
selectedWidget.OnClick( e.X, e.Y );
|
selectedWidget.OnClick( e.X, e.Y );
|
||||||
lastClicked = selectedWidget;
|
lastClicked = selectedWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void WidgetUnclicked( LauncherWidget widget ) {
|
||||||
|
}
|
||||||
|
|
||||||
protected bool tabDown = false;
|
protected bool tabDown = false;
|
||||||
MouseMoveEventArgs moveArgs = new MouseMoveEventArgs();
|
MouseMoveEventArgs moveArgs = new MouseMoveEventArgs();
|
||||||
MouseButtonEventArgs pressArgs = new MouseButtonEventArgs();
|
MouseButtonEventArgs pressArgs = new MouseButtonEventArgs();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user