kernel events handle in own func
This commit is contained in:
parent
639392c6de
commit
2402eb1a44
@ -138,78 +138,82 @@ class KernelEvents {
|
|||||||
|
|
||||||
var eventName:String = event[1];
|
var eventName:String = event[1];
|
||||||
|
|
||||||
switch eventName {
|
fireSignal(eventName,event);
|
||||||
case "alarm":
|
}
|
||||||
this.onAlarmTrigger.trigger(event[2]);
|
}
|
||||||
case "char":
|
|
||||||
this.onCharTrigger.trigger(event[2]);
|
private function fireSignal(eventName: String,event:Table<Int, Dynamic> ) {
|
||||||
case "disk":
|
switch eventName {
|
||||||
this.onDiskTrigger.trigger(event[2]);
|
case "alarm":
|
||||||
case "disk_eject":
|
this.onAlarmTrigger.trigger(event[2]);
|
||||||
this.onDiskEjectTrigger.trigger(event[2]);
|
case "char":
|
||||||
case "http_check":
|
this.onCharTrigger.trigger(event[2]);
|
||||||
this.onHttpCheckTrigger.trigger({url: event[2], success: event[3], failReason: event[4]});
|
case "disk":
|
||||||
case "http_failure":
|
this.onDiskTrigger.trigger(event[2]);
|
||||||
this.onHttpFailureTrigger.trigger({url: event[2], failReason: event[3], handle: event[4]});
|
case "disk_eject":
|
||||||
case "http_success":
|
this.onDiskEjectTrigger.trigger(event[2]);
|
||||||
this.onHttpSuccessTrigger.trigger({url: event[2], handle: event[3]});
|
case "http_check":
|
||||||
case "key":
|
this.onHttpCheckTrigger.trigger({url: event[2], success: event[3], failReason: event[4]});
|
||||||
this.onKeyTrigger.trigger({keyCode: event[2], isHeld: event[3]});
|
case "http_failure":
|
||||||
case "key_up":
|
this.onHttpFailureTrigger.trigger({url: event[2], failReason: event[3], handle: event[4]});
|
||||||
this.onKeyUpTrigger.trigger(event[2]);
|
case "http_success":
|
||||||
case "modem_message":
|
this.onHttpSuccessTrigger.trigger({url: event[2], handle: event[3]});
|
||||||
this.onModemMessageTrigger.trigger({
|
case "key":
|
||||||
addr: event[2],
|
this.onKeyTrigger.trigger({keyCode: event[2], isHeld: event[3]});
|
||||||
channel: event[3],
|
case "key_up":
|
||||||
replyChannel: event[4],
|
this.onKeyUpTrigger.trigger(event[2]);
|
||||||
message: event[5],
|
case "modem_message":
|
||||||
distance: event[6]
|
this.onModemMessageTrigger.trigger({
|
||||||
});
|
addr: event[2],
|
||||||
case "monitor_resize":
|
channel: event[3],
|
||||||
this.onMonitorResizeTrigger.trigger(event[2]);
|
replyChannel: event[4],
|
||||||
case "monitor_touch":
|
message: event[5],
|
||||||
this.onMonitorTouchTrigger.trigger({addr: event[2], pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
distance: event[6]
|
||||||
case "mouse_click":
|
});
|
||||||
this.onMouseClickTrigger.trigger({button: ccButtonToEnum(event[2]), pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
case "monitor_resize":
|
||||||
case "mouse_drag":
|
this.onMonitorResizeTrigger.trigger(event[2]);
|
||||||
this.onMouseDragTrigger.trigger({button: ccButtonToEnum(event[2]), pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
case "monitor_touch":
|
||||||
case "mouse_scroll":
|
this.onMonitorTouchTrigger.trigger({addr: event[2], pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
||||||
this.onMouseScrollTrigger.trigger({dir: event[2], pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
case "mouse_click":
|
||||||
case "mouse_up":
|
this.onMouseClickTrigger.trigger({button: ccButtonToEnum(event[2]), pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
||||||
this.onMouseUpTrigger.trigger({button: ccButtonToEnum(event[2]), pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
case "mouse_drag":
|
||||||
case "paste":
|
this.onMouseDragTrigger.trigger({button: ccButtonToEnum(event[2]), pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
||||||
this.onPasteTrigger.trigger(event[2]);
|
case "mouse_scroll":
|
||||||
case "peripheral":
|
this.onMouseScrollTrigger.trigger({dir: event[2], pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
||||||
this.onPeripheralTrigger.trigger(event[2]);
|
case "mouse_up":
|
||||||
case "peripheral_detach":
|
this.onMouseUpTrigger.trigger({button: ccButtonToEnum(event[2]), pos: {x: (event[3] : Int) - 1, y: (event[4] : Int) - 1}});
|
||||||
this.onPeripheralDetachTrigger.trigger(event[2]);
|
case "paste":
|
||||||
case "rednet_message":
|
this.onPasteTrigger.trigger(event[2]);
|
||||||
this.onRednetMessageTrigger.trigger({sender: event[2], message: event[3], protocol: event[4]});
|
case "peripheral":
|
||||||
case "redstone":
|
this.onPeripheralTrigger.trigger(event[2]);
|
||||||
this.onRedstoneTrigger.trigger(null);
|
case "peripheral_detach":
|
||||||
case "speaker_audio_empty":
|
this.onPeripheralDetachTrigger.trigger(event[2]);
|
||||||
this.onSpeakerAudioEmptyTrigger.trigger(event[2]);
|
case "rednet_message":
|
||||||
case "task_complete":
|
this.onRednetMessageTrigger.trigger({sender: event[2], message: event[3], protocol: event[4]});
|
||||||
this.onTaskCompleteTrigger.trigger({id: event[2], success: event[3], failedReason: event[4]});
|
case "redstone":
|
||||||
case "term_resize":
|
this.onRedstoneTrigger.trigger(null);
|
||||||
this.onTermResizeTrigger.trigger(null);
|
case "speaker_audio_empty":
|
||||||
case "terminate":
|
this.onSpeakerAudioEmptyTrigger.trigger(event[2]);
|
||||||
this.onTerminateTrigger.trigger(null);
|
case "task_complete":
|
||||||
case "timer":
|
this.onTaskCompleteTrigger.trigger({id: event[2], success: event[3], failedReason: event[4]});
|
||||||
this.onTimerTrigger.trigger(event[2]);
|
case "term_resize":
|
||||||
case "turtle_inventory":
|
this.onTermResizeTrigger.trigger(null);
|
||||||
this.onTurtleInventoryTrigger.trigger(null);
|
case "terminate":
|
||||||
case "websocket_closed":
|
this.onTerminateTrigger.trigger(null);
|
||||||
this.onWebsocketCloseTrigger.trigger(event[2]);
|
case "timer":
|
||||||
case "websocket_failure":
|
this.onTimerTrigger.trigger(event[2]);
|
||||||
this.onWebsocketFailureTrigger.trigger({url: event[2], failReason: event[3]});
|
case "turtle_inventory":
|
||||||
case "websocket_message":
|
this.onTurtleInventoryTrigger.trigger(null);
|
||||||
this.onWebsocketMessageTrigger.trigger({url: event[2], message: event[3], isBinary: event[4]});
|
case "websocket_closed":
|
||||||
case "websocket_success":
|
this.onWebsocketCloseTrigger.trigger(event[2]);
|
||||||
this.onWebsocketSuccessTrigger.trigger({url: event[2], handle: event[3]});
|
case "websocket_failure":
|
||||||
default:
|
this.onWebsocketFailureTrigger.trigger({url: event[2], failReason: event[3]});
|
||||||
Log.error("Unknown cc event: " + eventName);
|
case "websocket_message":
|
||||||
}
|
this.onWebsocketMessageTrigger.trigger({url: event[2], message: event[3], isBinary: event[4]});
|
||||||
|
case "websocket_success":
|
||||||
|
this.onWebsocketSuccessTrigger.trigger({url: event[2], handle: event[3]});
|
||||||
|
default:
|
||||||
|
Log.error("Unknown cc event: " + eventName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user