mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
Allow to attach/detach keyboards to the screens
This commit is contained in:
parent
d72c666a9e
commit
fed823eefc
BIN
sprites/icons/Keyboard.png
Normal file
BIN
sprites/icons/Keyboard.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 169 B |
BIN
sprites/icons/KeyboardOff.png
Normal file
BIN
sprites/icons/KeyboardOff.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 210 B |
Binary file not shown.
|
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 145 KiB |
@ -63,113 +63,115 @@ icons/Guitar 640 655 16 16
|
||||
icons/HDD 657 655 16 16
|
||||
icons/Help 674 655 16 16
|
||||
icons/Home 197 707 22 22
|
||||
icons/Keyboard 691 655 16 16
|
||||
icons/KeyboardOff 708 655 16 16
|
||||
icons/LMB 218 616 11 14
|
||||
icons/Label 691 655 16 16
|
||||
icons/LinesHorizontal 708 655 16 16
|
||||
icons/Link 725 655 16 16
|
||||
icons/LinkSlash 742 655 16 16
|
||||
icons/Memory 759 655 16 16
|
||||
icons/Microchip 776 655 16 16
|
||||
icons/NA 793 655 16 16
|
||||
icons/Label 725 655 16 16
|
||||
icons/LinesHorizontal 742 655 16 16
|
||||
icons/Link 759 655 16 16
|
||||
icons/LinkSlash 776 655 16 16
|
||||
icons/Memory 793 655 16 16
|
||||
icons/Microchip 810 655 16 16
|
||||
icons/NA 827 655 16 16
|
||||
icons/NotificationError 242 616 11 11
|
||||
icons/NotificationInfo 254 616 11 11
|
||||
icons/NotificationWarning 266 616 11 11
|
||||
icons/Ocelot 810 655 16 16
|
||||
icons/Ocelot 844 655 16 16
|
||||
icons/Pin 173 616 14 14
|
||||
icons/Plus 827 655 16 16
|
||||
icons/Power 844 655 16 16
|
||||
icons/Plus 861 655 16 16
|
||||
icons/Power 878 655 16 16
|
||||
icons/RMB 230 616 11 14
|
||||
icons/Restart 861 655 16 16
|
||||
icons/Save 878 655 16 16
|
||||
icons/SaveAs 895 655 16 16
|
||||
icons/Server 912 655 16 16
|
||||
icons/Restart 895 655 16 16
|
||||
icons/Save 912 655 16 16
|
||||
icons/SaveAs 929 655 16 16
|
||||
icons/Server 946 655 16 16
|
||||
icons/SettingsSound 134 616 12 17
|
||||
icons/SettingsSystem 147 616 12 17
|
||||
icons/SettingsUI 160 616 12 17
|
||||
icons/Tier0 929 655 16 16
|
||||
icons/Tier1 946 655 16 16
|
||||
icons/Tier2 963 655 16 16
|
||||
icons/Tiers 980 655 16 16
|
||||
icons/Tier0 963 655 16 16
|
||||
icons/Tier1 980 655 16 16
|
||||
icons/Tier2 997 655 16 16
|
||||
icons/Tiers 201 540 16 16
|
||||
icons/Unpin 188 616 14 14
|
||||
icons/WaveLFSR 799 584 24 10
|
||||
icons/WaveNoise 824 584 24 10
|
||||
icons/WaveSawtooth 849 584 24 10
|
||||
icons/WaveSine 874 584 24 10
|
||||
icons/WaveSquare 899 584 24 10
|
||||
icons/WaveTriangle 924 584 24 10
|
||||
icons/Window 997 655 16 16
|
||||
icons/WaveLFSR 833 584 24 10
|
||||
icons/WaveNoise 858 584 24 10
|
||||
icons/WaveSawtooth 883 584 24 10
|
||||
icons/WaveSine 908 584 24 10
|
||||
icons/WaveSquare 933 584 24 10
|
||||
icons/WaveTriangle 958 584 24 10
|
||||
icons/Window 218 540 16 16
|
||||
icons/WireArrowLeft 281 305 4 8
|
||||
icons/WireArrowRight 286 305 4 8
|
||||
items/APU0 49 655 16 96
|
||||
items/APU1 66 655 16 96
|
||||
items/APU2 83 655 16 96
|
||||
items/CPU0 201 540 16 16
|
||||
items/CPU1 218 540 16 16
|
||||
items/CPU2 235 540 16 16
|
||||
items/CardBase 252 540 16 16
|
||||
items/CircuitBoard 269 540 16 16
|
||||
items/ComponentBus0 286 540 16 16
|
||||
items/ComponentBus1 303 540 16 16
|
||||
items/ComponentBus2 320 540 16 16
|
||||
items/ComponentBus3 337 540 16 16
|
||||
items/CPU0 235 540 16 16
|
||||
items/CPU1 252 540 16 16
|
||||
items/CPU2 269 540 16 16
|
||||
items/CardBase 286 540 16 16
|
||||
items/CircuitBoard 303 540 16 16
|
||||
items/ComponentBus0 320 540 16 16
|
||||
items/ComponentBus1 337 540 16 16
|
||||
items/ComponentBus2 354 540 16 16
|
||||
items/ComponentBus3 371 540 16 16
|
||||
items/DataCard0 49 526 16 128
|
||||
items/DataCard1 66 526 16 128
|
||||
items/DataCard2 83 526 16 128
|
||||
items/DebugCard 354 540 16 16
|
||||
items/DiskDriveMountable 371 540 16 16
|
||||
items/EEPROM 388 540 16 16
|
||||
items/FloppyDisk_dyeBlack 405 540 16 16
|
||||
items/FloppyDisk_dyeBlue 422 540 16 16
|
||||
items/FloppyDisk_dyeBrown 439 540 16 16
|
||||
items/FloppyDisk_dyeCyan 456 540 16 16
|
||||
items/FloppyDisk_dyeGray 473 540 16 16
|
||||
items/FloppyDisk_dyeGreen 490 540 16 16
|
||||
items/FloppyDisk_dyeLightBlue 507 540 16 16
|
||||
items/FloppyDisk_dyeLightGray 524 540 16 16
|
||||
items/FloppyDisk_dyeLime 541 540 16 16
|
||||
items/FloppyDisk_dyeMagenta 558 540 16 16
|
||||
items/FloppyDisk_dyeOrange 575 540 16 16
|
||||
items/FloppyDisk_dyePink 592 540 16 16
|
||||
items/FloppyDisk_dyePurple 609 540 16 16
|
||||
items/FloppyDisk_dyeRed 626 540 16 16
|
||||
items/FloppyDisk_dyeWhite 643 540 16 16
|
||||
items/FloppyDisk_dyeYellow 660 540 16 16
|
||||
items/GraphicsCard0 677 540 16 16
|
||||
items/GraphicsCard1 694 540 16 16
|
||||
items/GraphicsCard2 711 540 16 16
|
||||
items/HardDiskDrive0 728 540 16 16
|
||||
items/HardDiskDrive1 745 540 16 16
|
||||
items/HardDiskDrive2 762 540 16 16
|
||||
items/DebugCard 388 540 16 16
|
||||
items/DiskDriveMountable 405 540 16 16
|
||||
items/EEPROM 422 540 16 16
|
||||
items/FloppyDisk_dyeBlack 439 540 16 16
|
||||
items/FloppyDisk_dyeBlue 456 540 16 16
|
||||
items/FloppyDisk_dyeBrown 473 540 16 16
|
||||
items/FloppyDisk_dyeCyan 490 540 16 16
|
||||
items/FloppyDisk_dyeGray 507 540 16 16
|
||||
items/FloppyDisk_dyeGreen 524 540 16 16
|
||||
items/FloppyDisk_dyeLightBlue 541 540 16 16
|
||||
items/FloppyDisk_dyeLightGray 558 540 16 16
|
||||
items/FloppyDisk_dyeLime 575 540 16 16
|
||||
items/FloppyDisk_dyeMagenta 592 540 16 16
|
||||
items/FloppyDisk_dyeOrange 609 540 16 16
|
||||
items/FloppyDisk_dyePink 626 540 16 16
|
||||
items/FloppyDisk_dyePurple 643 540 16 16
|
||||
items/FloppyDisk_dyeRed 660 540 16 16
|
||||
items/FloppyDisk_dyeWhite 677 540 16 16
|
||||
items/FloppyDisk_dyeYellow 694 540 16 16
|
||||
items/GraphicsCard0 711 540 16 16
|
||||
items/GraphicsCard1 728 540 16 16
|
||||
items/GraphicsCard2 745 540 16 16
|
||||
items/HardDiskDrive0 762 540 16 16
|
||||
items/HardDiskDrive1 779 540 16 16
|
||||
items/HardDiskDrive2 796 540 16 16
|
||||
items/InternetCard 117 707 16 32
|
||||
items/LinkedCard 100 655 16 96
|
||||
items/Memory0 779 540 16 16
|
||||
items/Memory1 796 540 16 16
|
||||
items/Memory2 813 540 16 16
|
||||
items/Memory3 830 540 16 16
|
||||
items/Memory4 847 540 16 16
|
||||
items/Memory5 864 540 16 16
|
||||
items/Memory6 881 540 16 16
|
||||
items/NetworkCard 898 540 16 16
|
||||
items/Memory0 813 540 16 16
|
||||
items/Memory1 830 540 16 16
|
||||
items/Memory2 847 540 16 16
|
||||
items/Memory3 864 540 16 16
|
||||
items/Memory4 881 540 16 16
|
||||
items/Memory5 898 540 16 16
|
||||
items/Memory6 915 540 16 16
|
||||
items/NetworkCard 932 540 16 16
|
||||
items/OcelotCard 100 526 16 128
|
||||
items/RedstoneCard0 915 540 16 16
|
||||
items/RedstoneCard1 932 540 16 16
|
||||
items/RedstoneCard0 949 540 16 16
|
||||
items/RedstoneCard1 966 540 16 16
|
||||
items/SelfDestructingCard 134 707 16 32
|
||||
items/Server0 949 540 16 16
|
||||
items/Server1 966 540 16 16
|
||||
items/Server2 983 540 16 16
|
||||
items/Server3 1000 540 16 16
|
||||
items/Server0 983 540 16 16
|
||||
items/Server1 1000 540 16 16
|
||||
items/Server2 134 567 16 16
|
||||
items/Server3 151 567 16 16
|
||||
items/SoundCard 117 526 16 128
|
||||
items/TapeCopper 134 567 16 16
|
||||
items/TapeDiamond 151 567 16 16
|
||||
items/TapeGold 168 567 16 16
|
||||
items/TapeGreg 185 567 16 16
|
||||
items/TapeIg 202 567 16 16
|
||||
items/TapeIron 219 567 16 16
|
||||
items/TapeNetherStar 236 567 16 16
|
||||
items/TapeSteel 253 567 16 16
|
||||
items/WirelessNetworkCard0 270 567 16 16
|
||||
items/WirelessNetworkCard1 287 567 16 16
|
||||
light-panel/BookmarkLeft 780 584 18 14
|
||||
items/TapeCopper 168 567 16 16
|
||||
items/TapeDiamond 185 567 16 16
|
||||
items/TapeGold 202 567 16 16
|
||||
items/TapeGreg 219 567 16 16
|
||||
items/TapeIg 236 567 16 16
|
||||
items/TapeIron 253 567 16 16
|
||||
items/TapeNetherStar 270 567 16 16
|
||||
items/TapeSteel 287 567 16 16
|
||||
items/WirelessNetworkCard0 304 567 16 16
|
||||
items/WirelessNetworkCard1 321 567 16 16
|
||||
light-panel/BookmarkLeft 814 584 18 14
|
||||
light-panel/BookmarkRight 395 674 20 14
|
||||
light-panel/BorderB 292 314 4 4
|
||||
light-panel/BorderL 382 314 4 2
|
||||
@ -182,91 +184,91 @@ light-panel/CornerTR 322 314 4 4
|
||||
light-panel/Fill 285 325 2 2
|
||||
light-panel/Vent 356 434 2 38
|
||||
nodes/Cable 377 445 8 8
|
||||
nodes/Camera 304 567 16 16
|
||||
nodes/Camera 338 567 16 16
|
||||
nodes/Chest 203 616 14 14
|
||||
nodes/HologramProjector0 321 567 16 16
|
||||
nodes/HologramProjector1 338 567 16 16
|
||||
nodes/IronNoteBlock 355 567 16 16
|
||||
nodes/Lamp 372 567 16 16
|
||||
nodes/LampFrame 389 567 16 16
|
||||
nodes/HologramProjector0 355 567 16 16
|
||||
nodes/HologramProjector1 372 567 16 16
|
||||
nodes/IronNoteBlock 389 567 16 16
|
||||
nodes/Lamp 406 567 16 16
|
||||
nodes/LampFrame 423 567 16 16
|
||||
nodes/LampGlow 49 305 128 128
|
||||
nodes/NewNode 406 567 16 16
|
||||
nodes/NoteBlock 423 567 16 16
|
||||
nodes/OpenFMRadio 440 567 16 16
|
||||
nodes/Relay 457 567 16 16
|
||||
nodes/TapeDrive 474 567 16 16
|
||||
nodes/computer/Default 491 567 16 16
|
||||
nodes/computer/DiskActivity 508 567 16 16
|
||||
nodes/computer/Error 525 567 16 16
|
||||
nodes/computer/On 542 567 16 16
|
||||
nodes/disk-drive/Default 559 567 16 16
|
||||
nodes/disk-drive/DiskActivity 576 567 16 16
|
||||
nodes/disk-drive/Floppy 593 567 16 16
|
||||
nodes/NewNode 440 567 16 16
|
||||
nodes/NoteBlock 457 567 16 16
|
||||
nodes/OpenFMRadio 474 567 16 16
|
||||
nodes/Relay 491 567 16 16
|
||||
nodes/TapeDrive 508 567 16 16
|
||||
nodes/computer/Default 525 567 16 16
|
||||
nodes/computer/DiskActivity 542 567 16 16
|
||||
nodes/computer/Error 559 567 16 16
|
||||
nodes/computer/On 576 567 16 16
|
||||
nodes/disk-drive/Default 593 567 16 16
|
||||
nodes/disk-drive/DiskActivity 610 567 16 16
|
||||
nodes/disk-drive/Floppy 627 567 16 16
|
||||
nodes/holidays/Christmas 117 674 32 32
|
||||
nodes/holidays/Halloween 150 674 32 32
|
||||
nodes/holidays/Valentines 183 674 32 32
|
||||
nodes/microcontroller/Default 610 567 16 16
|
||||
nodes/microcontroller/Error 627 567 16 16
|
||||
nodes/microcontroller/On 644 567 16 16
|
||||
nodes/rack/Default 661 567 16 16
|
||||
nodes/rack/Empty 678 567 16 16
|
||||
nodes/rack/drive/0/Default 695 567 16 16
|
||||
nodes/rack/drive/0/DiskActivity 712 567 16 16
|
||||
nodes/rack/drive/0/Floppy 729 567 16 16
|
||||
nodes/rack/drive/1/Default 746 567 16 16
|
||||
nodes/rack/drive/1/DiskActivity 763 567 16 16
|
||||
nodes/rack/drive/1/Floppy 780 567 16 16
|
||||
nodes/rack/drive/2/Default 797 567 16 16
|
||||
nodes/rack/drive/2/DiskActivity 814 567 16 16
|
||||
nodes/rack/drive/2/Floppy 831 567 16 16
|
||||
nodes/rack/drive/3/Default 848 567 16 16
|
||||
nodes/rack/drive/3/DiskActivity 865 567 16 16
|
||||
nodes/rack/drive/3/Floppy 882 567 16 16
|
||||
nodes/rack/drive/Floppy 899 567 16 16
|
||||
nodes/rack/server/0/Default 916 567 16 16
|
||||
nodes/rack/server/0/DiskActivity 933 567 16 16
|
||||
nodes/rack/server/0/Error 950 567 16 16
|
||||
nodes/rack/server/0/NetworkActivity 967 567 16 16
|
||||
nodes/rack/server/0/On 984 567 16 16
|
||||
nodes/rack/server/1/Default 1001 567 16 16
|
||||
nodes/rack/server/1/DiskActivity 134 584 16 16
|
||||
nodes/rack/server/1/Error 151 584 16 16
|
||||
nodes/rack/server/1/NetworkActivity 168 584 16 16
|
||||
nodes/rack/server/1/On 185 584 16 16
|
||||
nodes/rack/server/2/Default 202 584 16 16
|
||||
nodes/rack/server/2/DiskActivity 219 584 16 16
|
||||
nodes/rack/server/2/Error 236 584 16 16
|
||||
nodes/rack/server/2/NetworkActivity 253 584 16 16
|
||||
nodes/rack/server/2/On 270 584 16 16
|
||||
nodes/rack/server/3/Default 287 584 16 16
|
||||
nodes/rack/server/3/DiskActivity 304 584 16 16
|
||||
nodes/rack/server/3/Error 321 584 16 16
|
||||
nodes/rack/server/3/NetworkActivity 338 584 16 16
|
||||
nodes/rack/server/3/On 355 584 16 16
|
||||
nodes/raid/0/DiskActivity 372 584 16 16
|
||||
nodes/raid/0/Error 389 584 16 16
|
||||
nodes/raid/1/DiskActivity 406 584 16 16
|
||||
nodes/raid/1/Error 423 584 16 16
|
||||
nodes/raid/2/DiskActivity 440 584 16 16
|
||||
nodes/raid/2/Error 457 584 16 16
|
||||
nodes/raid/Default 474 584 16 16
|
||||
nodes/screen/BottomLeft 491 584 16 16
|
||||
nodes/screen/BottomMiddle 508 584 16 16
|
||||
nodes/screen/BottomRight 525 584 16 16
|
||||
nodes/screen/ColumnBottom 542 584 16 16
|
||||
nodes/screen/ColumnMiddle 559 584 16 16
|
||||
nodes/screen/ColumnTop 576 584 16 16
|
||||
nodes/screen/Middle 593 584 16 16
|
||||
nodes/screen/MiddleLeft 610 584 16 16
|
||||
nodes/screen/MiddleRight 627 584 16 16
|
||||
nodes/screen/PowerOnOverlay 644 584 16 16
|
||||
nodes/screen/RowLeft 661 584 16 16
|
||||
nodes/screen/RowMiddle 678 584 16 16
|
||||
nodes/screen/RowRight 695 584 16 16
|
||||
nodes/screen/Standalone 712 584 16 16
|
||||
nodes/screen/TopLeft 729 584 16 16
|
||||
nodes/screen/TopMiddle 746 584 16 16
|
||||
nodes/screen/TopRight 763 584 16 16
|
||||
nodes/microcontroller/Default 644 567 16 16
|
||||
nodes/microcontroller/Error 661 567 16 16
|
||||
nodes/microcontroller/On 678 567 16 16
|
||||
nodes/rack/Default 695 567 16 16
|
||||
nodes/rack/Empty 712 567 16 16
|
||||
nodes/rack/drive/0/Default 729 567 16 16
|
||||
nodes/rack/drive/0/DiskActivity 746 567 16 16
|
||||
nodes/rack/drive/0/Floppy 763 567 16 16
|
||||
nodes/rack/drive/1/Default 780 567 16 16
|
||||
nodes/rack/drive/1/DiskActivity 797 567 16 16
|
||||
nodes/rack/drive/1/Floppy 814 567 16 16
|
||||
nodes/rack/drive/2/Default 831 567 16 16
|
||||
nodes/rack/drive/2/DiskActivity 848 567 16 16
|
||||
nodes/rack/drive/2/Floppy 865 567 16 16
|
||||
nodes/rack/drive/3/Default 882 567 16 16
|
||||
nodes/rack/drive/3/DiskActivity 899 567 16 16
|
||||
nodes/rack/drive/3/Floppy 916 567 16 16
|
||||
nodes/rack/drive/Floppy 933 567 16 16
|
||||
nodes/rack/server/0/Default 950 567 16 16
|
||||
nodes/rack/server/0/DiskActivity 967 567 16 16
|
||||
nodes/rack/server/0/Error 984 567 16 16
|
||||
nodes/rack/server/0/NetworkActivity 1001 567 16 16
|
||||
nodes/rack/server/0/On 134 584 16 16
|
||||
nodes/rack/server/1/Default 151 584 16 16
|
||||
nodes/rack/server/1/DiskActivity 168 584 16 16
|
||||
nodes/rack/server/1/Error 185 584 16 16
|
||||
nodes/rack/server/1/NetworkActivity 202 584 16 16
|
||||
nodes/rack/server/1/On 219 584 16 16
|
||||
nodes/rack/server/2/Default 236 584 16 16
|
||||
nodes/rack/server/2/DiskActivity 253 584 16 16
|
||||
nodes/rack/server/2/Error 270 584 16 16
|
||||
nodes/rack/server/2/NetworkActivity 287 584 16 16
|
||||
nodes/rack/server/2/On 304 584 16 16
|
||||
nodes/rack/server/3/Default 321 584 16 16
|
||||
nodes/rack/server/3/DiskActivity 338 584 16 16
|
||||
nodes/rack/server/3/Error 355 584 16 16
|
||||
nodes/rack/server/3/NetworkActivity 372 584 16 16
|
||||
nodes/rack/server/3/On 389 584 16 16
|
||||
nodes/raid/0/DiskActivity 406 584 16 16
|
||||
nodes/raid/0/Error 423 584 16 16
|
||||
nodes/raid/1/DiskActivity 440 584 16 16
|
||||
nodes/raid/1/Error 457 584 16 16
|
||||
nodes/raid/2/DiskActivity 474 584 16 16
|
||||
nodes/raid/2/Error 491 584 16 16
|
||||
nodes/raid/Default 508 584 16 16
|
||||
nodes/screen/BottomLeft 525 584 16 16
|
||||
nodes/screen/BottomMiddle 542 584 16 16
|
||||
nodes/screen/BottomRight 559 584 16 16
|
||||
nodes/screen/ColumnBottom 576 584 16 16
|
||||
nodes/screen/ColumnMiddle 593 584 16 16
|
||||
nodes/screen/ColumnTop 610 584 16 16
|
||||
nodes/screen/Middle 627 584 16 16
|
||||
nodes/screen/MiddleLeft 644 584 16 16
|
||||
nodes/screen/MiddleRight 661 584 16 16
|
||||
nodes/screen/PowerOnOverlay 678 584 16 16
|
||||
nodes/screen/RowLeft 695 584 16 16
|
||||
nodes/screen/RowMiddle 712 584 16 16
|
||||
nodes/screen/RowRight 729 584 16 16
|
||||
nodes/screen/Standalone 746 584 16 16
|
||||
nodes/screen/TopLeft 763 584 16 16
|
||||
nodes/screen/TopMiddle 780 584 16 16
|
||||
nodes/screen/TopRight 797 584 16 16
|
||||
panel/BorderB 327 314 4 4
|
||||
panel/BorderL 387 314 4 2
|
||||
panel/BorderR 332 314 4 4
|
||||
|
||||
@ -166,4 +166,6 @@ object IconSource {
|
||||
val Help: IconSource = IconSource("icons/Help")
|
||||
val Ocelot: IconSource = IconSource("icons/Ocelot")
|
||||
val Guitar: IconSource = IconSource("icons/Guitar")
|
||||
val Keyboard: IconSource = IconSource("icons/Keyboard")
|
||||
val KeyboardOff: IconSource = IconSource("icons/KeyboardOff")
|
||||
}
|
||||
|
||||
@ -27,12 +27,13 @@ class ScreenNode(val screen: Screen) extends EntityNode(screen) with LabeledEnti
|
||||
// -------------------------------
|
||||
|
||||
private var keyboard: Option[Keyboard] = None
|
||||
private val keyboardNBTKey: String = "keyboard"
|
||||
|
||||
override def load(nbt: NBTTagCompound): Unit = {
|
||||
super.load(nbt)
|
||||
|
||||
if (nbt.hasKey("string")) {
|
||||
keyboard = OcelotDesktop.workspace.entityByAddress(nbt.getString("string")).map(_.asInstanceOf[Keyboard])
|
||||
if (nbt.hasKey(keyboardNBTKey)) {
|
||||
keyboard = OcelotDesktop.workspace.entityByAddress(nbt.getString(keyboardNBTKey)).map(_.asInstanceOf[Keyboard])
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +41,7 @@ class ScreenNode(val screen: Screen) extends EntityNode(screen) with LabeledEnti
|
||||
super.save(nbt)
|
||||
|
||||
if (keyboard.isDefined) {
|
||||
nbt.setString("keyboard", keyboard.get.node.address)
|
||||
nbt.setString(keyboardNBTKey, keyboard.get.node.address)
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,12 +53,21 @@ class ScreenNode(val screen: Screen) extends EntityNode(screen) with LabeledEnti
|
||||
}
|
||||
|
||||
def attachKeyboard(): Unit = {
|
||||
detachKeyboard()
|
||||
val kbd = new Keyboard
|
||||
OcelotDesktop.workspace.add(kbd)
|
||||
screen.connect(kbd)
|
||||
keyboard = Some(kbd)
|
||||
}
|
||||
|
||||
def detachKeyboard(): Unit = {
|
||||
if (keyboard.isDefined) {
|
||||
screen.disconnect(keyboard.get)
|
||||
OcelotDesktop.workspace.remove(keyboard.get)
|
||||
keyboard = None
|
||||
}
|
||||
}
|
||||
|
||||
override def icon: String = "nodes/screen/Standalone"
|
||||
|
||||
override def iconColor: Color = TierColor.get(screen.tier)
|
||||
@ -76,6 +86,16 @@ class ScreenNode(val screen: Screen) extends EntityNode(screen) with LabeledEnti
|
||||
new ScreenAspectRatioDialog(this).show()
|
||||
})
|
||||
|
||||
if (keyboard.isDefined) {
|
||||
menu.addEntry(ContextMenuEntry("Remove keyboard", IconSource.KeyboardOff) {
|
||||
detachKeyboard()
|
||||
})
|
||||
} else {
|
||||
menu.addEntry(ContextMenuEntry("Add keyboard", IconSource.Keyboard) {
|
||||
attachKeyboard()
|
||||
})
|
||||
}
|
||||
|
||||
menu.addSeparator()
|
||||
|
||||
super.setupContextMenu(menu, event)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user