Die Potato (or music), locken beim Zeichnen, Threads von Parse, Receiver und Sender laufen nun im Hintergrund

This commit is contained in:
2014-05-13 19:15:41 +02:00
parent c3088bb36a
commit f8c1993c9f
8 changed files with 22 additions and 10 deletions

View File

@@ -10,7 +10,7 @@ namespace WorldOfPeacecraft
private Font MessageFont; private Font MessageFont;
private Font SenderFont; private Font SenderFont;
private Font IregularSenderFont; private Font IregularSenderFont;
private Music m = new Music(); //private Music m = new Music();
public ChatOutputBox (IBackend backend) public ChatOutputBox (IBackend backend)
{ {
@@ -43,7 +43,7 @@ namespace WorldOfPeacecraft
this.SelectionFont = MessageFont; this.SelectionFont = MessageFont;
this.AppendText (message.GetMessage ()); this.AppendText (message.GetMessage ());
if (message.GetMessage().Contains("nyancat")) { if (message.GetMessage().Contains("nyancat")) {
m.Playmusic ("poptart"); //m.Playmusic ("poptart");
} }
} }
} }

View File

@@ -16,7 +16,7 @@ namespace WorldOfPeacecraft
private ChatPanel ChatPanel; private ChatPanel ChatPanel;
private OnlinePlayerList OnlinePlayerList; private OnlinePlayerList OnlinePlayerList;
private Music m = new Music(); //private Music m = new Music();
public Gui () public Gui ()
{ {
@@ -40,6 +40,13 @@ namespace WorldOfPeacecraft
Backend.StartThreads (); Backend.StartThreads ();
} }
protected override void OnPaint (PaintEventArgs e)
{
lock (Backend) {
base.OnPaint(e);
}
}
public void InitializeComponents () public void InitializeComponents ()
{ {
MapPanel.InitializeComponents (); MapPanel.InitializeComponents ();
@@ -65,7 +72,7 @@ namespace WorldOfPeacecraft
this.ResumeLayout(); this.ResumeLayout();
m.Playmusic ("overworld"); //m.Playmusic ("overworld");
} }
protected override void OnClosing (System.ComponentModel.CancelEventArgs e) protected override void OnClosing (System.ComponentModel.CancelEventArgs e)

View File

@@ -17,8 +17,10 @@ namespace WorldOfPeacecraft
Application.Run (splash); Application.Run (splash);
} }
private static void OnGuiLoaded(SplashScreen screen, Gui gui){ private static void OnGuiLoaded(SplashScreen screen, Gui gui){
screen.Hide (); screen.BeginInvoke(new MethodInvoker(delegate {
gui.Show (); screen.Hide ();
gui.Show ();
}));
} }
} }
} }

View File

@@ -10,7 +10,7 @@ namespace WorldOfPeacecraft
{ {
private string ImagesFolder = "textures/"; private string ImagesFolder = "textures/";
private Image Logo; private Image Logo;
private Music m = new Music(); //private Music m = new Music();
private Gui gui; private Gui gui;
private IBackend backend; private IBackend backend;
@@ -25,7 +25,7 @@ namespace WorldOfPeacecraft
t.Start (); t.Start ();
this.SetClientSizeCore (450, 150); this.SetClientSizeCore (450, 150);
Logo = Image.FromFile (ImagesFolder + "splashscreen.png"); Logo = Image.FromFile (ImagesFolder + "splashscreen.png");
m.Playmusic ("splashscreen"); //m.Playmusic ("splashscreen");
} }
protected override void OnPaint (PaintEventArgs e) protected override void OnPaint (PaintEventArgs e)

View File

@@ -3,7 +3,7 @@ using System.Media;
namespace WorldOfPeacecraft namespace WorldOfPeacecraft
{ {
public class Music /*public class Music
{ {
private static string musicpath = "./music/"; private static string musicpath = "./music/";
private static string soundpath = "./sounds/"; private static string soundpath = "./sounds/";
@@ -31,6 +31,6 @@ namespace WorldOfPeacecraft
poptartplayer.Play (); poptartplayer.Play ();
//TODO: Monalisa //TODO: Monalisa
} }
} }*/
} }

View File

@@ -61,6 +61,7 @@ namespace WorldOfPeacecraft
Message = new LinkedList<string> (); Message = new LinkedList<string> ();
LastLineRegex = new Regex ("^end:[0-9]+$"); LastLineRegex = new Regex ("^end:[0-9]+$");
ParserThread = new Thread (new ThreadStart (this.RunParser)); ParserThread = new Thread (new ThreadStart (this.RunParser));
ParserThread.IsBackground = true;
} }
private void RunParser () private void RunParser ()

View File

@@ -17,6 +17,7 @@ namespace WorldOfPeacecraft
this.Client = client; this.Client = client;
this.ReceiverBuffer = buffer; this.ReceiverBuffer = buffer;
ReceiverThread = new Thread(new ThreadStart(this.doReceive)); ReceiverThread = new Thread(new ThreadStart(this.doReceive));
ReceiverThread.IsBackground = true;
} }
public string Receive () public string Receive ()

View File

@@ -17,6 +17,7 @@ namespace WorldOfPeacecraft
this.Client = client; this.Client = client;
this.Buffer = buffer; this.Buffer = buffer;
this.SenderThread = new Thread(new ThreadStart(this.threadStart)); this.SenderThread = new Thread(new ThreadStart(this.threadStart));
this.SenderThread.IsBackground = true;
} }
public void Send (String message) public void Send (String message)