public MultiplayerController(BotManager player, OnReciveCallBack onRcCallBack, OnDisconnect onDCCallBack, OnGameIsReady onGameIsReady, OnGameFinished onGameFinished, OnEnemyDCAccepted onEnemyDCAccepted, OnReconnectComplete onReconnectComplete, OnReconnectFailed onReconnectFailed, OnWeakConectionDetected onWeakConnection, bool isForExistingGame, OnRuleReady onRuleReady) { this.player = player; io = new SocketIOComponent(Constants.SOCKET_URL); reconnectMode = false; eventHandler = new EventHandler(); lastDataTime = 0f; this.onDCCallBack = onDCCallBack; this.onWeakConnection = onWeakConnection; if (!isForExistingGame) { eventHandler.initializeForFirstTime(this, io, onRcCallBack, onDCCallBack, onGameIsReady, onGameFinished, onEnemyDCAccepted, onReconnectComplete, onReconnectFailed); //Thread acceptGameThread = new Thread(new ThreadStart(acceptGame)); //acceptGameThread.Start(); } else { (new Thread(() => { requestGameRule(onRcCallBack, onDCCallBack, onGameIsReady, onGameFinished, onEnemyDCAccepted, onReconnectComplete, onReconnectFailed, onRuleReady); })).Start(); } }
public void onLoadForExistingGameComplete(MultiplayerController parent, OnReciveCallBack onRcCallBack, OnDisconnect onDCCallBack, OnGameIsReady onGameIsReady, OnGameFinished onGameFinished, OnEnemyDCAccepted onEnemyDCAccepted, OnReconnectComplete onReconnectComplete, OnReconnectFailed onReconnectFailed, OnRuleReady onRuleReady, OnWeakConectionDetected onWeakConnection, bool isExistingGame) { this.onDCCallBack = onDCCallBack; this.onWeakConnection = onWeakConnection; (new Thread(() => { requestGameRule(onRcCallBack, onDCCallBack, onGameIsReady, onGameFinished, onEnemyDCAccepted, onReconnectComplete, onReconnectFailed, onRuleReady); })).Start(); }