Пример #1
0
    public void requestNewInstance()
    {
        RequestNewInstanceMessage message = new RequestNewInstanceMessage();

        message.onResponse += (QTResponsableMessage message) => {
            InstanceMessage instanceMessage = (InstanceMessage)message;
            setupWorkerClient(instanceMessage.room.ip, instanceMessage.room.port);
        };

        masterClient.sendMessage(message);
    }
Пример #2
0
    public override void handleMessage(QTMessage message)
    {
        switch (message.messageType)
        {
        case QTMessage.type.REQUEST_NEW_INSTANCE:
            MasterServerQTClient      qtRemoteClient = (MasterServerQTClient)client;
            RequestNewInstanceMessage requestMessage = (RequestNewInstanceMessage)message;

            MasterServerWorker worker = MasterServerManager.instance.workersManager.spawnWorker(Guid.NewGuid().ToString());

            InstanceMessage instanceMessage = new InstanceMessage(requestMessage);
            instanceMessage.room  = worker.room;
            worker.onWorkerReady += () => {
                sendRequestInstanceResponse(qtRemoteClient, instanceMessage);
            };
            break;
        }
    }