// ServerEvents static void ServerOnConnect(int remoteID, string remoteIP) { fm1.Chat_Add(string.Format("server:client{0}({1})からの接続を確立しました", remoteID, remoteIP)); if (svStat == SERVERSTAT.WAITP1) { sv.player1 = remoteID; if (sv.player2 == -1) { svStat = SERVERSTAT.WAITP2; } else { svStat = SERVERSTAT.PLAYING; } } else if (svStat == SERVERSTAT.WAITP2) { sv.player2 = remoteID; if (sv.player1 == -1) { svStat = SERVERSTAT.WAITP1; } else { svStat = SERVERSTAT.PLAYING; } } }
public static bool OpenServer(int port) { try { sv = new VisionServer(port, ServerOnConnect, ServerOnRecv, ServerOnDisconnect, 12288); } catch (Exception) { return false; } svStat = SERVERSTAT.WAITP1; return true; }
static public bool OpenServer(int port) { try { sv = new VisionServer(port, ServerOnConnect, ServerOnRecv, ServerOnDisconnect, 12288); } catch (Exception) { return(false); } svStat = SERVERSTAT.WAITP1; return(true); }