Added start/stop control to Unity process
This commit is contained in:
31
dist/Unity/UnityRunner.js
vendored
31
dist/Unity/UnityRunner.js
vendored
@@ -65,13 +65,16 @@ var UnityRunner = /** @class */ (function () {
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments[_i];
|
||||
}
|
||||
var callback = args[0];
|
||||
if (typeof callback !== 'function')
|
||||
return;
|
||||
switch (command) {
|
||||
case 'restart':
|
||||
var callback = args[0];
|
||||
if (typeof callback !== 'function')
|
||||
return;
|
||||
callback(this.requestRestart());
|
||||
break;
|
||||
return callback(this.requestRestart());
|
||||
case 'stop':
|
||||
return callback(this.requestStop());
|
||||
case 'start':
|
||||
return callback(this.requestStart());
|
||||
}
|
||||
};
|
||||
UnityRunner.prototype.startStatusClock = function () {
|
||||
@@ -90,6 +93,24 @@ var UnityRunner = /** @class */ (function () {
|
||||
this.restart(true);
|
||||
return { succeed: true };
|
||||
};
|
||||
UnityRunner.prototype.requestStop = function () {
|
||||
if (this.state !== 'RUNNING')
|
||||
return {
|
||||
succeed: false,
|
||||
message: 'Cannot stop when process is not running. It is probably restarting already.',
|
||||
};
|
||||
this.stop();
|
||||
return { succeed: true };
|
||||
};
|
||||
UnityRunner.prototype.requestStart = function () {
|
||||
if (this.state !== 'STOPPED')
|
||||
return {
|
||||
succeed: false,
|
||||
message: 'Cannot start when process is already running.',
|
||||
};
|
||||
this.start();
|
||||
return { succeed: true };
|
||||
};
|
||||
UnityRunner.prototype.broadcastState = function () {
|
||||
this._Main.WebServer.socket.emit('unityRunnerState', this.getStatus());
|
||||
};
|
||||
|
||||
2
dist/Unity/UnityRunner.js.map
vendored
2
dist/Unity/UnityRunner.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user