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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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