void OnDestroy() { _logDbgMsg("Destroy"); if (_mInstance == this) { _mGameSenseWrkShouldRun = false; _mInstance = null; } }
static void csClient_OnConnectionStateChanged(object sender, KDF.ClientEventArgs.ConnectionStateChangedEventArgs e) { GSClient client = (GSClient)sender; if (e.Connected && !e.LoggedIn) { client.Login(); } else if (e.Connected && e.LoggedIn) { client.JoinRoom(); } }
public PokerGame(GSClient CardClient) { _client = CardClient.Client; GameServerClient = CardClient; GameServerClient.OnConnectionStateChanged += CardserverClient_OnConnectionStateChanged; GameServerClient.OnModuleReceived += CardserverClient_OnModuleReceived; GameServerClient.Connect(GameServerClient.ServerHost, GameServerClient.ServerPort, _client.ProxyHost, _client.ProxyPort); Hand = new List <PokerCard>(); HoleCards = new List <PokerCard>(); Players = new List <PokerPlayer>(); ClientPlayer = new PokerPlayer(); }
void _cardClient_OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e) { GSClient client = (GSClient)sender; tbxLog.AppendText(string.Format("The connectionstate of CardServer-Client changed, the client is {0} connected and {1} logged in\r\n", client.Connected ? "" : "not", client.LoggedIn ? "" : "not")); if (e.Connected && !e.LoggedIn) { client.Login(); } else if (e.Connected && e.LoggedIn) { client.JoinRoom(); } }
public HandlerTest() { redBlue = new GSGradientColor() { From = red, To = blue }; blueGreen = new GSGradientColor() { From = blue, To = green }; gSClient = new GSClient(programName); //gSClient.SendCommand(builder => builder.Program.Unregister()); _gSHandler = new GSHandler() { Mode = mode, Zone = zone }; }
// Initialization void Awake() { #if (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && !SS_GAMESENSE_DISABLED if (_mInstance == null) { // update the static reference _mInstance = this; } else { // no other instances should exist _logWarning("Another GameSense client script is getting instantiated. Only a single instance should exist at any time"); Destroy(this.gameObject); return; } // need to survive scene loading DontDestroyOnLoad(this.gameObject); // initialize _mSerializer = new FullSerializer.fsSerializer(); _mMsgQueue = new LocklessQueue <QueueMsg>(_MsgQueueSize); _mGameSenseWrk = new System.Threading.Thread(_gamesenseWrk); // check for exceptions _mGameSenseWrkShouldRun = true; _setClientState(ClientState.Probing); try { _mGameSenseWrk.Start(); // add events if the script is attached to GameSenseManager prefab if (gameObject.name.Equals(_GameSenseObjName)) { _addGUIDefinedEvents(); } } catch (System.Exception e) { _logException("Could not start the client thread", e); _setClientState(ClientState.Inactive); } #endif // (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && !SS_GAMESENSE_DISABLED }
/// <summary> /// Initialisiert eine neue Instanz der GameServerConnectionStateChangedEventArg-Klasse. /// </summary> /// <param name="csClient">Instanz des GameServer Clients</param> public GameServerConnectionEventArgs(GSClient csClient) { _csClient = csClient; }
public GSClientTest() { _client = new GSClient(_programName); }
public GSCommandTest() { gSClient = new GSClient(programName); }