working waiting for openent "spinner"
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
@ -30,8 +31,12 @@ class Client : TcpClient {
|
|||||||
writer = new StreamWriter(GetStream());
|
writer = new StreamWriter(GetStream());
|
||||||
|
|
||||||
string s;
|
string s;
|
||||||
|
Thread asyncer = null;
|
||||||
while(true){
|
while(true){
|
||||||
s = reader.ReadLine();
|
s = reader.ReadLine();
|
||||||
|
if(asyncer != null){
|
||||||
|
asyncer.Abort();
|
||||||
|
}
|
||||||
if(s[0] == "\x11"[0]){
|
if(s[0] == "\x11"[0]){
|
||||||
s = s.Substring(1);
|
s = s.Substring(1);
|
||||||
//Console.WriteLine("Esc: {0}", s);
|
//Console.WriteLine("Esc: {0}", s);
|
||||||
@ -43,8 +48,22 @@ class Client : TcpClient {
|
|||||||
break;
|
break;
|
||||||
case "spinner":
|
case "spinner":
|
||||||
Console.Write("Waiting for oponent");
|
Console.Write("Waiting for oponent");
|
||||||
Console.Write(". . .");
|
asyncer = new Thread(() => {
|
||||||
Console.WriteLine("");
|
const string dot = ". ";
|
||||||
|
const int rep = 3;
|
||||||
|
while(true){
|
||||||
|
for(int i = 0; i < rep; i++){
|
||||||
|
Console.Write(dot);
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
Console.CursorLeft -= dot.Length*rep;
|
||||||
|
for(int i = 0; i < (dot.Length*rep); i++){
|
||||||
|
Console.Write(" ");
|
||||||
|
}
|
||||||
|
Console.CursorLeft -= dot.Length*rep;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
asyncer.Start();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
Reference in New Issue
Block a user