IEnumerator rs() { ZSocketSignal s = new ZSocketSignal(SocketSignals.Recv); C_wait_game_start: do { s.Update(SocketSignals.Recv); yield return(s); if (s.Signal != SocketSignals.RecvSuccessful) { continue; } if (s.Value.Cmd != "GAMESTART") { continue; } meIsL = (s.Value.Args[0] == "L"); s.Update(SocketSignals.Send, new ProtocolCmd("HELO", "eycia")); yield return(s); } while (true); }
public IEnumerator Proxy() { while (true) { if (!ie.MoveNext()) { yield break; } object yielded = ie.Current; if (yielded != null && yielded.GetType() == typeof(Call)) { SwitchIEnumberableStackly(((Call)(yielded)).ie); yield return(null); } if (yielded != null && yielded.GetType() == typeof(Return)) { SwitchIEnumberableStacklyBack(); yield return(null); } if (yielded != null && yielded.GetType() == typeof(ZSocketSignal)) { ZSocketSignal Sig = (ZSocketSignal)yielded; //this should only use for heart beat if (Sig.Signal == SocketSignals.Send) { es.Send(Sig.ValueString); yield return(null); continue; } //else all method should check connection Connect(); do { yield return(null); } while (Connecting); switch (Sig.Signal) { //this should not be called. Connect should always blocked //case ZSocketSignal.Signals.Connect: // Connect (); // yield return null; // break; case SocketSignals.ConnectBlock: if (Connected) { Sig.Update(SocketSignals.ConnectSuccessful); } else { Sig.Update(SocketSignals.ConnectFailed); } break; case SocketSignals.SendBlock: if (!Connected) { Sig.Update(SocketSignals.RecvFailed); break; } es.SendCallback(Sig.ValueString, SendCallback); Sended = false; while (!Sended) { yield return(null); } Sig.Update(SocketSignals.SendSuccessful); break; case SocketSignals.Recv: if (!Connected) { Sig.Update(SocketSignals.RecvFailed); break; } while (true) { string recv = Recv(); if (recv != null) { Sig.Update(SocketSignals.RecvSuccessful, recv); break; } yield return(null); } break; case SocketSignals.SendAndRecv: if (!Connected) { Sig.Update(SocketSignals.RecvFailed); break; } es.SendCallback(Sig.ValueString, SendCallback); Sended = false; while (!Sended) { yield return(null); } while (true) { string recv = Recv(); if (recv != null) { Sig.Update(SocketSignals.SendAndRecvSuccessful, recv); break; } yield return(null); } break; } } else { yield return(yielded); } } }