Added RAIDs

This commit is contained in:
Igor Timofeev 2023-10-13 08:23:28 +00:00
parent 09d6a56658
commit 6e82da5d28
25 changed files with 565 additions and 300 deletions

@ -1 +1 @@
Subproject commit 2ad3601907c4ca40783be02607b5fa9575e28dc2
Subproject commit 560717349c73c16fbcd19facd2472dcb9eccff7f

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -12,6 +12,7 @@ Tier2 = #66ffff
Tier3 = #c354cd
Label = #333333
LabelError = #aa0000
Scrollbar = #e5e5e526
ScrollbarThumb = #cc3f72
@ -22,7 +23,7 @@ ConnectionDel = #7f3333
Connection = #909090
NodeSelectorRing = #4c7f66
NodeSelectorBackground = #00000066
NodeSelectorBackground = #000000BB
ContextMenuBackground = #222222ee
ContextMenuBorder = #444444

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 119 KiB

View File

@ -1,162 +1,162 @@
BackgroundPattern 0 0 304 304
BarSegment 29 499 16 4
Empty 278 324 16 16
EmptySlot 256 349 18 18
Empty 278 351 16 16
EmptySlot 256 376 18 18
Knob 692 0 50 50
KnobCenter 743 0 50 50
KnobLimits 794 0 50 50
ShadowBorder 0 538 1 24
ShadowCorner 153 324 24 24
ShadowCorner 153 351 24 24
TabArrow 0 484 8 14
blocks/Generic 295 324 16 16
blocks/Generic 295 351 16 16
blocks/HologramEffect 8 547 4 4
blocks/HologramProjector1Top 312 324 16 16
blocks/HologramProjector2Top 329 324 16 16
blocks/HologramProjectorSide 346 324 16 16
buttons/BottomDrawerClose 275 349 18 18
buttons/BottomDrawerOpen 294 349 18 18
blocks/HologramProjector1Top 312 351 16 16
blocks/HologramProjector2Top 329 351 16 16
blocks/HologramProjectorSide 346 351 16 16
buttons/BottomDrawerClose 275 376 18 18
buttons/BottomDrawerOpen 294 376 18 18
buttons/OpenFMRadioCloseOff 48 510 7 8
buttons/OpenFMRadioCloseOn 56 510 7 8
buttons/OpenFMRadioRedstoneOff 3 510 8 8
buttons/OpenFMRadioRedstoneOn 12 510 8 8
buttons/OpenFMRadioStartOff 178 324 24 24
buttons/OpenFMRadioStartOn 203 324 24 24
buttons/OpenFMRadioStopOff 228 324 24 24
buttons/OpenFMRadioStopOn 253 324 24 24
buttons/OpenFMRadioStartOff 178 351 24 24
buttons/OpenFMRadioStartOn 203 351 24 24
buttons/OpenFMRadioStopOff 228 351 24 24
buttons/OpenFMRadioStopOn 253 351 24 24
buttons/OpenFMRadioVolumeDownOff 9 484 10 10
buttons/OpenFMRadioVolumeDownOn 20 484 10 10
buttons/OpenFMRadioVolumeUpOff 31 484 10 10
buttons/OpenFMRadioVolumeUpOn 42 484 10 10
buttons/PowerOff 313 349 18 18
buttons/PowerOn 332 349 18 18
buttons/RackRelayOff 153 305 65 18
buttons/RackRelayOn 219 305 65 18
icons/Antenna 363 324 16 16
icons/ArrowRight 380 324 16 16
icons/AspectRatio 397 324 16 16
icons/ButtonCheck 153 382 17 17
icons/ButtonClipboard 171 382 17 17
icons/ButtonRandomize 189 382 17 17
icons/CPU 414 324 16 16
icons/Card 431 324 16 16
buttons/PowerOff 313 376 18 18
buttons/PowerOn 332 376 18 18
buttons/RackRelayOff 153 332 65 18
buttons/RackRelayOn 219 332 65 18
icons/Antenna 363 351 16 16
icons/ArrowRight 380 351 16 16
icons/AspectRatio 397 351 16 16
icons/ButtonCheck 153 409 17 17
icons/ButtonClipboard 171 409 17 17
icons/ButtonRandomize 189 409 17 17
icons/CPU 414 351 16 16
icons/Card 431 351 16 16
icons/Close 0 451 15 14
icons/Code 448 324 16 16
icons/ComponentBus 465 324 16 16
icons/Copy 482 324 16 16
icons/Cross 499 324 16 16
icons/Delete 516 324 16 16
icons/DragLMB 351 349 21 14
icons/DragRMB 373 349 21 14
icons/EEPROM 533 324 16 16
icons/Edit 550 324 16 16
icons/Eject 567 324 16 16
icons/File 584 324 16 16
icons/Floppy 601 324 16 16
icons/Folder 618 324 16 16
icons/FolderSlash 635 324 16 16
icons/Grid 187 349 22 22
icons/GridOff 210 349 22 22
icons/HDD 652 324 16 16
icons/Home 233 349 22 22
icons/Code 448 351 16 16
icons/ComponentBus 465 351 16 16
icons/Copy 482 351 16 16
icons/Cross 499 351 16 16
icons/Delete 516 351 16 16
icons/DragLMB 351 376 21 14
icons/DragRMB 373 376 21 14
icons/EEPROM 533 351 16 16
icons/Edit 550 351 16 16
icons/Eject 567 351 16 16
icons/File 584 351 16 16
icons/Floppy 601 351 16 16
icons/Folder 618 351 16 16
icons/FolderSlash 635 351 16 16
icons/Grid 187 376 22 22
icons/GridOff 210 376 22 22
icons/HDD 652 351 16 16
icons/Home 233 376 22 22
icons/LMB 84 466 11 14
icons/Label 669 324 16 16
icons/LinesHorizontal 686 324 16 16
icons/Link 703 324 16 16
icons/LinkSlash 720 324 16 16
icons/Memory 737 324 16 16
icons/Microchip 754 324 16 16
icons/NA 771 324 16 16
icons/Label 669 351 16 16
icons/LinesHorizontal 686 351 16 16
icons/Link 703 351 16 16
icons/LinkSlash 720 351 16 16
icons/Memory 737 351 16 16
icons/Microchip 754 351 16 16
icons/NA 771 351 16 16
icons/NotificationError 108 466 11 11
icons/NotificationInfo 120 466 11 11
icons/NotificationWarning 132 466 11 11
icons/Pin 39 466 14 14
icons/Plus 788 324 16 16
icons/Power 805 324 16 16
icons/Plus 788 351 16 16
icons/Power 805 351 16 16
icons/RMB 96 466 11 14
icons/Restart 822 324 16 16
icons/Save 839 324 16 16
icons/SaveAs 856 324 16 16
icons/Server 873 324 16 16
icons/Restart 822 351 16 16
icons/Save 839 351 16 16
icons/SaveAs 856 351 16 16
icons/Server 873 351 16 16
icons/SettingsSound 0 466 12 17
icons/SettingsSystem 13 466 12 17
icons/SettingsUI 26 466 12 17
icons/Tier0 890 324 16 16
icons/Tier1 907 324 16 16
icons/Tier2 924 324 16 16
icons/Tiers 941 324 16 16
icons/Tier0 890 351 16 16
icons/Tier1 907 351 16 16
icons/Tier2 924 351 16 16
icons/Tiers 941 351 16 16
icons/Unpin 54 466 14 14
icons/WaveLFSR 393 434 24 10
icons/WaveNoise 418 434 24 10
icons/WaveSawtooth 443 434 24 10
icons/WaveSine 468 434 24 10
icons/WaveSquare 493 434 24 10
icons/WaveTriangle 518 434 24 10
icons/Window 958 324 16 16
icons/WaveLFSR 580 434 24 10
icons/WaveNoise 605 434 24 10
icons/WaveSawtooth 630 434 24 10
icons/WaveSine 655 434 24 10
icons/WaveSquare 680 434 24 10
icons/WaveTriangle 705 434 24 10
icons/Window 958 351 16 16
icons/WireArrowLeft 2 538 4 8
icons/WireArrowRight 7 538 4 8
items/APU0 85 305 16 96
items/APU1 102 305 16 96
items/APU2 119 305 16 96
items/CPU0 975 324 16 16
items/CPU1 992 324 16 16
items/CPU2 285 305 16 16
items/CardBase 302 305 16 16
items/CircuitBoard 319 305 16 16
items/ComponentBus0 336 305 16 16
items/ComponentBus1 353 305 16 16
items/ComponentBus2 370 305 16 16
items/ComponentBus3 387 305 16 16
items/APU0 85 332 16 96
items/APU1 102 332 16 96
items/APU2 119 332 16 96
items/CPU0 975 351 16 16
items/CPU1 992 351 16 16
items/CPU2 285 332 16 16
items/CardBase 302 332 16 16
items/CircuitBoard 319 332 16 16
items/ComponentBus0 336 332 16 16
items/ComponentBus1 353 332 16 16
items/ComponentBus2 370 332 16 16
items/ComponentBus3 387 332 16 16
items/DataCard0 0 305 16 128
items/DataCard1 17 305 16 128
items/DataCard2 34 305 16 128
items/DebugCard 404 305 16 16
items/DiskDriveMountable 421 305 16 16
items/EEPROM 438 305 16 16
items/FloppyDisk_dyeBlack 455 305 16 16
items/FloppyDisk_dyeBlue 472 305 16 16
items/FloppyDisk_dyeBrown 489 305 16 16
items/FloppyDisk_dyeCyan 506 305 16 16
items/FloppyDisk_dyeGray 523 305 16 16
items/FloppyDisk_dyeGreen 540 305 16 16
items/FloppyDisk_dyeLightBlue 557 305 16 16
items/FloppyDisk_dyeLightGray 574 305 16 16
items/FloppyDisk_dyeLime 591 305 16 16
items/FloppyDisk_dyeMagenta 608 305 16 16
items/FloppyDisk_dyeOrange 625 305 16 16
items/FloppyDisk_dyePink 642 305 16 16
items/FloppyDisk_dyePurple 659 305 16 16
items/FloppyDisk_dyeRed 676 305 16 16
items/FloppyDisk_dyeWhite 693 305 16 16
items/FloppyDisk_dyeYellow 710 305 16 16
items/GraphicsCard0 727 305 16 16
items/GraphicsCard1 744 305 16 16
items/GraphicsCard2 761 305 16 16
items/HardDiskDrive0 778 305 16 16
items/HardDiskDrive1 795 305 16 16
items/HardDiskDrive2 812 305 16 16
items/InternetCard 153 349 16 32
items/LinkedCard 136 305 16 96
items/Memory0 829 305 16 16
items/Memory1 846 305 16 16
items/Memory2 863 305 16 16
items/Memory3 880 305 16 16
items/Memory4 897 305 16 16
items/Memory5 914 305 16 16
items/Memory6 931 305 16 16
items/NetworkCard 948 305 16 16
items/DebugCard 404 332 16 16
items/DiskDriveMountable 421 332 16 16
items/EEPROM 438 332 16 16
items/FloppyDisk_dyeBlack 455 332 16 16
items/FloppyDisk_dyeBlue 472 332 16 16
items/FloppyDisk_dyeBrown 489 332 16 16
items/FloppyDisk_dyeCyan 506 332 16 16
items/FloppyDisk_dyeGray 523 332 16 16
items/FloppyDisk_dyeGreen 540 332 16 16
items/FloppyDisk_dyeLightBlue 557 332 16 16
items/FloppyDisk_dyeLightGray 574 332 16 16
items/FloppyDisk_dyeLime 591 332 16 16
items/FloppyDisk_dyeMagenta 608 332 16 16
items/FloppyDisk_dyeOrange 625 332 16 16
items/FloppyDisk_dyePink 642 332 16 16
items/FloppyDisk_dyePurple 659 332 16 16
items/FloppyDisk_dyeRed 676 332 16 16
items/FloppyDisk_dyeWhite 693 332 16 16
items/FloppyDisk_dyeYellow 710 332 16 16
items/GraphicsCard0 727 332 16 16
items/GraphicsCard1 744 332 16 16
items/GraphicsCard2 761 332 16 16
items/HardDiskDrive0 778 332 16 16
items/HardDiskDrive1 795 332 16 16
items/HardDiskDrive2 812 332 16 16
items/InternetCard 153 376 16 32
items/LinkedCard 136 332 16 96
items/Memory0 829 332 16 16
items/Memory1 846 332 16 16
items/Memory2 863 332 16 16
items/Memory3 880 332 16 16
items/Memory4 897 332 16 16
items/Memory5 914 332 16 16
items/Memory6 931 332 16 16
items/NetworkCard 948 332 16 16
items/OcelotCard 51 305 16 128
items/RedstoneCard0 965 305 16 16
items/RedstoneCard1 982 305 16 16
items/SelfDestructingCard 170 349 16 32
items/Server0 999 305 16 16
items/Server1 85 402 16 16
items/Server2 102 402 16 16
items/Server3 119 402 16 16
items/RedstoneCard0 965 332 16 16
items/RedstoneCard1 982 332 16 16
items/SelfDestructingCard 170 376 16 32
items/Server0 999 332 16 16
items/Server1 152 305 16 16
items/Server2 169 305 16 16
items/Server3 186 305 16 16
items/SoundCard 68 305 16 128
items/WirelessNetworkCard0 136 402 16 16
items/WirelessNetworkCard1 153 402 16 16
light-panel/BookmarkLeft 374 434 18 14
light-panel/BookmarkRight 207 382 20 14
items/WirelessNetworkCard0 203 305 16 16
items/WirelessNetworkCard1 220 305 16 16
light-panel/BookmarkLeft 561 434 18 14
light-panel/BookmarkRight 207 409 20 14
light-panel/BorderB 13 547 4 4
light-panel/BorderL 103 547 4 2
light-panel/BorderR 18 547 4 4
@ -168,80 +168,87 @@ light-panel/CornerTR 43 547 4 4
light-panel/Fill 6 558 2 2
light-panel/Vent 0 499 2 38
nodes/Cable 21 510 8 8
nodes/Camera 170 402 16 16
nodes/Camera 237 305 16 16
nodes/Chest 69 466 14 14
nodes/HologramProjector0 187 402 16 16
nodes/HologramProjector1 204 402 16 16
nodes/IronNoteBlock 221 402 16 16
nodes/Lamp 238 402 16 16
nodes/LampFrame 255 402 16 16
nodes/HologramProjector0 254 305 16 16
nodes/HologramProjector1 271 305 16 16
nodes/IronNoteBlock 288 305 16 16
nodes/Lamp 305 305 16 16
nodes/LampFrame 322 305 16 16
nodes/LampGlow 305 106 128 128
nodes/NewNode 272 402 16 16
nodes/NoteBlock 289 402 16 16
nodes/OpenFMRadio 306 402 16 16
nodes/Relay 323 402 16 16
nodes/computer/Default 340 402 16 16
nodes/computer/DiskActivity 357 402 16 16
nodes/computer/Error 374 402 16 16
nodes/computer/On 391 402 16 16
nodes/disk-drive/Default 408 402 16 16
nodes/disk-drive/DiskActivity 425 402 16 16
nodes/disk-drive/Floppy 442 402 16 16
nodes/microcontroller/Default 459 402 16 16
nodes/microcontroller/Error 476 402 16 16
nodes/microcontroller/On 493 402 16 16
nodes/rack/Default 510 402 16 16
nodes/rack/Empty 527 402 16 16
nodes/rack/drive/0/Default 544 402 16 16
nodes/rack/drive/0/DiskActivity 561 402 16 16
nodes/rack/drive/0/Floppy 578 402 16 16
nodes/rack/drive/1/Default 595 402 16 16
nodes/rack/drive/1/DiskActivity 612 402 16 16
nodes/rack/drive/1/Floppy 629 402 16 16
nodes/rack/drive/2/Default 646 402 16 16
nodes/rack/drive/2/DiskActivity 663 402 16 16
nodes/rack/drive/2/Floppy 680 402 16 16
nodes/rack/drive/3/Default 697 402 16 16
nodes/rack/drive/3/DiskActivity 714 402 16 16
nodes/rack/drive/3/Floppy 731 402 16 16
nodes/rack/drive/Floppy 748 402 16 16
nodes/rack/server/0/Default 765 402 16 16
nodes/rack/server/0/DiskActivity 782 402 16 16
nodes/rack/server/0/Error 799 402 16 16
nodes/rack/server/0/NetworkActivity 816 402 16 16
nodes/rack/server/0/On 833 402 16 16
nodes/rack/server/1/Default 850 402 16 16
nodes/rack/server/1/DiskActivity 867 402 16 16
nodes/rack/server/1/Error 884 402 16 16
nodes/rack/server/1/NetworkActivity 901 402 16 16
nodes/rack/server/1/On 918 402 16 16
nodes/rack/server/2/Default 935 402 16 16
nodes/rack/server/2/DiskActivity 952 402 16 16
nodes/rack/server/2/Error 969 402 16 16
nodes/rack/server/2/NetworkActivity 986 402 16 16
nodes/rack/server/2/On 1003 402 16 16
nodes/rack/server/3/Default 0 434 16 16
nodes/rack/server/3/DiskActivity 17 434 16 16
nodes/rack/server/3/Error 34 434 16 16
nodes/rack/server/3/NetworkActivity 51 434 16 16
nodes/rack/server/3/On 68 434 16 16
nodes/screen/BottomLeft 85 434 16 16
nodes/screen/BottomMiddle 102 434 16 16
nodes/screen/BottomRight 119 434 16 16
nodes/screen/ColumnBottom 136 434 16 16
nodes/screen/ColumnMiddle 153 434 16 16
nodes/screen/ColumnTop 170 434 16 16
nodes/screen/Middle 187 434 16 16
nodes/screen/MiddleLeft 204 434 16 16
nodes/screen/MiddleRight 221 434 16 16
nodes/screen/PowerOnOverlay 238 434 16 16
nodes/screen/RowLeft 255 434 16 16
nodes/screen/RowMiddle 272 434 16 16
nodes/screen/RowRight 289 434 16 16
nodes/screen/Standalone 306 434 16 16
nodes/screen/TopLeft 323 434 16 16
nodes/screen/TopMiddle 340 434 16 16
nodes/screen/TopRight 357 434 16 16
nodes/NewNode 339 305 16 16
nodes/NoteBlock 356 305 16 16
nodes/OpenFMRadio 373 305 16 16
nodes/Relay 390 305 16 16
nodes/computer/Default 407 305 16 16
nodes/computer/DiskActivity 424 305 16 16
nodes/computer/Error 441 305 16 16
nodes/computer/On 458 305 16 16
nodes/disk-drive/Default 475 305 16 16
nodes/disk-drive/DiskActivity 492 305 16 16
nodes/disk-drive/Floppy 509 305 16 16
nodes/microcontroller/Default 526 305 16 16
nodes/microcontroller/Error 543 305 16 16
nodes/microcontroller/On 560 305 16 16
nodes/rack/Default 577 305 16 16
nodes/rack/Empty 594 305 16 16
nodes/rack/drive/0/Default 611 305 16 16
nodes/rack/drive/0/DiskActivity 628 305 16 16
nodes/rack/drive/0/Floppy 645 305 16 16
nodes/rack/drive/1/Default 662 305 16 16
nodes/rack/drive/1/DiskActivity 679 305 16 16
nodes/rack/drive/1/Floppy 696 305 16 16
nodes/rack/drive/2/Default 713 305 16 16
nodes/rack/drive/2/DiskActivity 730 305 16 16
nodes/rack/drive/2/Floppy 747 305 16 16
nodes/rack/drive/3/Default 764 305 16 16
nodes/rack/drive/3/DiskActivity 781 305 16 16
nodes/rack/drive/3/Floppy 798 305 16 16
nodes/rack/drive/Floppy 815 305 16 16
nodes/rack/server/0/Default 832 305 16 16
nodes/rack/server/0/DiskActivity 849 305 16 16
nodes/rack/server/0/Error 866 305 16 16
nodes/rack/server/0/NetworkActivity 883 305 16 16
nodes/rack/server/0/On 900 305 16 16
nodes/rack/server/1/Default 917 305 16 16
nodes/rack/server/1/DiskActivity 934 305 16 16
nodes/rack/server/1/Error 951 305 16 16
nodes/rack/server/1/NetworkActivity 968 305 16 16
nodes/rack/server/1/On 985 305 16 16
nodes/rack/server/2/Default 1002 305 16 16
nodes/rack/server/2/DiskActivity 0 434 16 16
nodes/rack/server/2/Error 17 434 16 16
nodes/rack/server/2/NetworkActivity 34 434 16 16
nodes/rack/server/2/On 51 434 16 16
nodes/rack/server/3/Default 68 434 16 16
nodes/rack/server/3/DiskActivity 85 434 16 16
nodes/rack/server/3/Error 102 434 16 16
nodes/rack/server/3/NetworkActivity 119 434 16 16
nodes/rack/server/3/On 136 434 16 16
nodes/raid/0/DiskActivity 153 434 16 16
nodes/raid/0/Error 170 434 16 16
nodes/raid/1/DiskActivity 187 434 16 16
nodes/raid/1/Error 204 434 16 16
nodes/raid/2/DiskActivity 221 434 16 16
nodes/raid/2/Error 238 434 16 16
nodes/raid/Default 255 434 16 16
nodes/screen/BottomLeft 272 434 16 16
nodes/screen/BottomMiddle 289 434 16 16
nodes/screen/BottomRight 306 434 16 16
nodes/screen/ColumnBottom 323 434 16 16
nodes/screen/ColumnMiddle 340 434 16 16
nodes/screen/ColumnTop 357 434 16 16
nodes/screen/Middle 374 434 16 16
nodes/screen/MiddleLeft 391 434 16 16
nodes/screen/MiddleRight 408 434 16 16
nodes/screen/PowerOnOverlay 425 434 16 16
nodes/screen/RowLeft 442 434 16 16
nodes/screen/RowMiddle 459 434 16 16
nodes/screen/RowRight 476 434 16 16
nodes/screen/Standalone 493 434 16 16
nodes/screen/TopLeft 510 434 16 16
nodes/screen/TopMiddle 527 434 16 16
nodes/screen/TopRight 544 434 16 16
panel/BorderB 48 547 4 4
panel/BorderL 108 547 4 2
panel/BorderR 53 547 4 4
@ -285,3 +292,4 @@ window/rack/SideConnector 12 552 1 3
window/rack/SideLeft 14 552 1 3
window/rack/SideRight 16 552 1 3
window/rack/SideTop 18 552 1 3
window/raid/Slots 85 305 66 26

View File

@ -3,7 +3,6 @@ package ocelot.desktop.inventory.item
import ocelot.desktop.graphics.IconSource
import ocelot.desktop.inventory.traits.{ComponentItem, DiskItem, PersistableItem}
import ocelot.desktop.inventory.{Item, ItemFactory, ItemRecoverer}
import ocelot.desktop.ui.widget.contextmenu.ContextMenu
import ocelot.desktop.ui.widget.tooltip.ItemTooltip
import totoro.ocelot.brain.entity.fs.ReadWriteLabel
import totoro.ocelot.brain.entity.traits.{Disk, Entity, Floppy}
@ -63,15 +62,6 @@ class FloppyItem(var floppy: Floppy) extends Item with ComponentItem with Persis
addManagedTooltip(tooltip, floppy)
}
override def fillRmbMenu(menu: ContextMenu): Unit = {
floppy match {
case floppy: FloppyManaged => addRealPathContextMenuEntries(menu, floppy)
case _ => // unmanaged floppies don't need any special entries
}
super.fillRmbMenu(menu)
}
override def factory: FloppyItem.Factory = floppy match {
case floppy: LootFloppy =>
new FloppyItem.Factory.Loot(new LootFloppyFactory(floppy.name.get, floppy.color, floppy.path))

View File

@ -4,7 +4,6 @@ import ocelot.desktop.graphics.IconSource
import ocelot.desktop.inventory.item.HddItem.Hdd
import ocelot.desktop.inventory.traits.{ComponentItem, DiskItem, PersistableItem}
import ocelot.desktop.inventory.{Item, ItemFactory, ItemRecoverer}
import ocelot.desktop.ui.widget.contextmenu.ContextMenu
import ocelot.desktop.ui.widget.tooltip.ItemTooltip
import totoro.ocelot.brain.entity.fs.{Label, ReadWriteLabel}
import totoro.ocelot.brain.entity.traits.{Disk, Entity}
@ -61,17 +60,6 @@ class HddItem(var hdd: Hdd) extends Item with ComponentItem with PersistableItem
addManagedTooltip(tooltip, hdd.hdd)
}
override def fillRmbMenu(menu: ContextMenu): Unit = {
hdd match {
case Hdd.Managed(hdd) =>
addRealPathContextMenuEntries(menu, hdd)
case _ => // unmanaged HDDs don't need any special entries
}
super.fillRmbMenu(menu)
}
override def factory: HddItem.Factory = hdd match {
case Hdd.Managed(hdd) => new HddItem.Factory(true, hdd.tier)
case Hdd.Unmanaged(hdd) => new HddItem.Factory(false, hdd.tier)

View File

@ -2,11 +2,12 @@ package ocelot.desktop.inventory.traits
import ocelot.desktop.OcelotDesktop
import ocelot.desktop.graphics.IconSource
import ocelot.desktop.node.nodes.RaidNode
import ocelot.desktop.ui.widget.DiskEditWindow
import ocelot.desktop.ui.widget.contextmenu.{ContextMenu, ContextMenuEntry}
import ocelot.desktop.ui.widget.tooltip.ItemTooltip
import ocelot.desktop.ui.widget.window.Windowed
import totoro.ocelot.brain.entity.traits.{Disk, DiskManaged, DiskUnmanaged, Entity}
import ocelot.desktop.ui.widget.window.{Window, Windowed}
import totoro.ocelot.brain.entity.traits.{Disk, DiskManaged, DiskRealPathAware, DiskUnmanaged, Entity}
import totoro.ocelot.brain.util.DyeColor
import javax.swing.JFileChooser
@ -36,41 +37,33 @@ trait DiskItem extends ComponentItem with Windowed[DiskEditWindow] {
component.setLocked(OcelotDesktop.player.nickname)
}
protected def addRealPathContextMenuEntries(menu: ContextMenu, disk: DiskManaged): Unit = {
menu.addEntry(ContextMenuEntry(
if (disk.customRealPath.isDefined) "Change directory" else "Set directory",
IconSource.Folder
) {
OcelotDesktop.showFileChooserDialog(JFileChooser.OPEN_DIALOG, JFileChooser.DIRECTORIES_ONLY) { dir =>
Try {
for (dir <- dir) {
reinserting {
// trigger component_removed / component_added signals
disk.customRealPath = Some(dir.toPath.toAbsolutePath)
}
}
}
}
})
if (disk.customRealPath.isDefined) {
menu.addEntry( ContextMenuEntry("Reset directory", IconSource.FolderSlash) {
reinserting {
// trigger component_removed / component_added signals
disk.customRealPath = None
}
})
}
}
override def createWindow(): DiskEditWindow = new DiskEditWindow(DiskItem.this)
override def fillRmbMenu(menu: ContextMenu): Unit = {
menu.addEntry(ContextMenuEntry("Edit disk", IconSource.Edit) {
window.open()
def isEditingAllowed: Boolean = {
slot.fold(false)(_.inventory match {
case _: RaidNode => false
case _ => true
})
}
menu.addSeparator()
override def fillRmbMenu(menu: ContextMenu): Unit = {
if (isEditingAllowed) {
// Real path
component match {
case diskManaged: DiskManaged =>
DiskItem.addRealPathContextMenuEntries(menu, diskManaged, realPathSetter => {
reinserting {
realPathSetter()
}
})
case _ =>
}
// Edit disk
DiskItem.addEditDiskContextMenuEntries(menu, this)
menu.addSeparator()
}
super.fillRmbMenu(menu)
}
@ -92,3 +85,38 @@ trait DiskItem extends ComponentItem with Windowed[DiskEditWindow] {
})
}
}
object DiskItem {
def addRealPathContextMenuEntries(menu: ContextMenu, diskRealPathAware: DiskRealPathAware, realPathSetter: (() => Unit) => Unit): Unit = {
menu.addEntry(ContextMenuEntry(
if (diskRealPathAware.customRealPath.isDefined) "Change directory" else "Set directory",
IconSource.Folder
) {
OcelotDesktop.showFileChooserDialog(JFileChooser.OPEN_DIALOG, JFileChooser.DIRECTORIES_ONLY) { dir =>
Try {
for (dir <- dir) {
realPathSetter(() => {
// trigger component_removed / component_added signals
diskRealPathAware.customRealPath = Some(dir.toPath.toAbsolutePath)
})
}
}
}
})
if (diskRealPathAware.customRealPath.isDefined) {
menu.addEntry(ContextMenuEntry("Reset directory", IconSource.FolderSlash) {
realPathSetter(() => {
// trigger component_removed / component_added signals
diskRealPathAware.customRealPath = None
})
})
}
}
def addEditDiskContextMenuEntries[T <: Window](menu: ContextMenu, windowed: Windowed[T]): Unit = {
menu.addEntry(ContextMenuEntry("Edit disk", IconSource.Edit) {
windowed.window.open()
})
}
}

View File

@ -2,7 +2,7 @@ package ocelot.desktop.node
import ocelot.desktop.entity.{Camera, OpenFMRadio}
import ocelot.desktop.node.nodes._
import totoro.ocelot.brain.entity.{Cable, Case, ColorfulLamp, FloppyDiskDrive, HologramProjector, IronNoteBlock, Microcontroller, NoteBlock, Rack, Relay, Screen}
import totoro.ocelot.brain.entity.{Cable, Case, ColorfulLamp, FloppyDiskDrive, HologramProjector, IronNoteBlock, Microcontroller, NoteBlock, Rack, Raid, Relay, Screen}
import totoro.ocelot.brain.util.Tier
import scala.collection.mutable
@ -25,6 +25,16 @@ object NodeRegistry {
nextGroup("Original")
for (tier <- Tier.One to Tier.Creative) {
addType(NodeType(s"Computer Case (${tier.label})", "nodes/computer/Default", tier) {
new ComputerNode(new Case(tier))
})
}
addType(NodeType("Rack", "nodes/rack/Default", None) {
new RackNode(new Rack)
})
for (tier <- Tier.One to Tier.Three) {
addType(NodeType(s"Screen (${tier.label})", "nodes/screen/Standalone", tier) {
val node = new ScreenNode(new Screen(tier))
@ -34,39 +44,11 @@ object NodeRegistry {
}
addType(NodeType("Disk Drive", "nodes/disk-drive/Default", None) {
val node = new DiskDriveNode(new FloppyDiskDrive())
node.fillSlotsWithDefaultItems()
node
new DiskDriveNode(new FloppyDiskDrive())
})
for (tier <- Tier.One to Tier.Creative) {
addType(NodeType(s"Computer Case (${tier.label})", "nodes/computer/Default", tier) {
val node = new ComputerNode(new Case(tier))
node.fillSlotsWithDefaultItems()
node
})
}
addType(NodeType("Rack", "nodes/rack/Default", None) {
new RackNode(new Rack)
})
addType(NodeType("Microcontroller", "nodes/microcontroller/Default", None) {
val node = new MicrocontrollerNode(new Microcontroller(Tier.Two))
node.fillSlotsWithDefaultItems()
node
})
addType(NodeType("Relay", "nodes/Relay", None) {
new RelayNode(new Relay)
})
addType(NodeType("Cable", "nodes/Cable", None) {
new CableNode(new Cable)
})
addType(NodeType("Chest", "nodes/Chest", None) {
new ChestNode
addType(NodeType("Raid", "nodes/raid/Default", None) {
new RaidNode(new Raid)
})
for (tier <- Tier.One to Tier.Two) {
@ -79,6 +61,22 @@ object NodeRegistry {
new NoteBlockNode(new NoteBlock)
})
addType(NodeType("Microcontroller", "nodes/microcontroller/Default", None) {
new MicrocontrollerNode(new Microcontroller(Tier.Two))
})
addType(NodeType("Relay", "nodes/Relay", None) {
new RelayNode(new Relay)
})
addType(NodeType("Chest", "nodes/Chest", None) {
new ChestNode
})
addType(NodeType("Cable", "nodes/Cable", None) {
new CableNode(new Cable)
})
// ------------------------------ Addons nodes ------------------------------
nextGroup("Addons")

View File

@ -8,7 +8,7 @@ import ocelot.desktop.ui.event.ClickEvent
import ocelot.desktop.ui.widget.contextmenu.ContextMenu
import ocelot.desktop.ui.widget.slot._
import ocelot.desktop.util.ComputerType.ComputerType
import ocelot.desktop.util.{ComputerAware, ComputerType, DrawUtils}
import ocelot.desktop.util.{ComputerAware, ComputerType, DefaultSlotItemsFillable, DrawUtils}
import ocelot.desktop.windows.ComputerWindow
import totoro.ocelot.brain.entity.Microcontroller
import totoro.ocelot.brain.entity.traits.Inventory
@ -18,6 +18,7 @@ import totoro.ocelot.brain.util.{Direction, Tier}
class MicrocontrollerNode(val microcontroller: Microcontroller)
extends ComputerAwareNode(microcontroller)
with ComputerAware
with DefaultSlotItemsFillable
with WindowedNode[ComputerWindow]
{
override val icon: String = "nodes/microcontroller/Default"
@ -116,6 +117,8 @@ class MicrocontrollerNode(val microcontroller: Microcontroller)
}
}
// ---------------------------- DefaultSlotItemsFillable ----------------------------
override def fillSlotsWithDefaultItems(): Unit = {
cardSlots(0).item =
if (microcontroller.tier == Tier.Two)

View File

@ -0,0 +1,95 @@
package ocelot.desktop.node.nodes
import ocelot.desktop.graphics.Graphics
import ocelot.desktop.inventory.item.HddItem
import ocelot.desktop.inventory.traits.DiskItem
import ocelot.desktop.inventory.{Item, SyncedInventory}
import ocelot.desktop.node.Node.{HighlightThickness, NoHighlightSize}
import ocelot.desktop.node.{EntityNode, WindowedNode}
import ocelot.desktop.ui.event.ClickEvent
import ocelot.desktop.ui.event.handlers.DiskActivityHandler
import ocelot.desktop.ui.widget.contextmenu.ContextMenu
import ocelot.desktop.ui.widget.slot.HddSlotWidget
import ocelot.desktop.util.{DefaultSlotItemsFillable, DrawUtils}
import ocelot.desktop.windows.RaidWindow
import totoro.ocelot.brain.entity.Raid
import totoro.ocelot.brain.entity.traits.Inventory
import totoro.ocelot.brain.util.Tier
import scala.util.Random
class RaidNode(val raid: Raid) extends
EntityNode(raid)
with SyncedInventory
with DiskActivityHandler
with DefaultSlotItemsFillable
with WindowedNode[RaidWindow]
{
var diskSlots: Array[HddSlotWidget] = Array.tabulate(3)(index => new HddSlotWidget(Slot(index), Tier.Three))
override val icon: String = "nodes/raid/Default"
override def draw(g: Graphics): Unit = {
super.draw(g)
val x = position.x + HighlightThickness
val y = position.y + HighlightThickness
val activityIndex = Random.between(0, raid.getSizeInventory)
var prefix: String = null
for (i <- 0 until raid.getSizeInventory) {
prefix = s"nodes/raid/$i/"
// Missing disks overlay
if (Slot(i).isEmpty)
g.sprite(s"${prefix}Error", x, y, NoHighlightSize, NoHighlightSize)
// Disk activity overlay
if (raid.shouldVisualizeDiskActivity && Random.nextDouble() > 0.1 && i == raid.lastDiskAccess % raid.getSizeInventory) {
DrawUtils.drawFilesystemActivity(
g,
x,
y,
prefix
)
}
}
}
override def setupContextMenu(menu: ContextMenu, event: ClickEvent): Unit = {
DiskItem.addRealPathContextMenuEntries(menu, raid, realPathSetter => {
realPathSetter()
})
// TODO: Implement DiskDriveWindow later, because at this moment every
// TODO: instance of 'Windowed' trait can have only 1 persistable window
// TODO: Perhaps we should rework this system with List[Window] and
// TODO: registerWindow(...) or something similar
// menu.addEntry(ContextMenuEntry("Edit disk", IconSource.Edit) {
// window.open()
// })
menu.addSeparator()
super.setupContextMenu(menu, event)
}
// -------------------------------- Inventory --------------------------------
override type I = Item with HddItem
override def brainInventory: Inventory = raid.inventory.owner
// ---------------------------- DefaultSlotItemsFillable ----------------------------
override def fillSlotsWithDefaultItems(): Unit = {
for (i <- diskSlots.indices)
diskSlots(i).setItem(new HddItem.Factory(true, Tier.Three).build())
}
// -------------------------------- Window --------------------------------
override def createWindow(): RaidWindow = new RaidWindow(this)
}

View File

@ -250,6 +250,23 @@ class WorkspaceView extends Widget with Persistable with DragHandler with ClickH
nodeSelector.close()
}
// TODO: to be discussed
// case event@DragEvent(DragEvent.State.Drag, MouseEvent.Button.Left | MouseEvent.Button.Middle, _) =>
// cameraOffset += event.delta
//
// for (node <- nodes)
// node.position += event.delta
//
// windowPool.movePinnedWindows(event.delta)
//
// case event@ClickEvent(MouseEvent.Button.Left | MouseEvent.Button.Right, pos) =>
// if (nodeSelector.isClosed & event.button == MouseEvent.Button.Right) {
// openSelector(pos)
// }
// else {
// nodeSelector.close()
// }
case KeyEvent(KeyEvent.State.Press, Keyboard.KEY_F4, _) =>
profilerWindow.open()
}

View File

@ -10,11 +10,13 @@ import ocelot.desktop.ui.UiHandler
import ocelot.desktop.ui.layout.{AlignItems, JustifyContent, LinearLayout}
import ocelot.desktop.ui.widget._
import ocelot.desktop.util.animation.{ColorAnimation, UnitAnimation}
import ocelot.desktop.util.{DrawUtils, Logging, Orientation}
import ocelot.desktop.util.{DefaultSlotItemsFillable, DrawUtils, Logging, Orientation}
import scala.collection.immutable.ArraySeq
class NodeSelector extends Window with Logging {
private val nodesPerRow = 5
override protected val layout = new LinearLayout(this)
private val rowsWidget: Widget = new Widget {
@ -46,7 +48,7 @@ class NodeSelector extends Window with Logging {
private def addNodeWidget(widget: Widget): Unit = {
val row =
if (rows.lastOption.exists(row => row.isInstanceOf[Row] && row.children.length < 4)) {
if (rows.lastOption.exists(row => row.isInstanceOf[Row] && row.children.length < nodesPerRow)) {
rows.last
}
else {
@ -70,7 +72,7 @@ class NodeSelector extends Window with Logging {
}
// TODO: replace this with PaddingBox when layout will be fixed
override def minimumSize: Size2D = Size2D(Size * 4, nodeGroupTitleHeight)
override def minimumSize: Size2D = Size2D(Size * nodesPerRow, nodeGroupTitleHeight)
override def maximumSize: Size2D = minimumSize
}
}
@ -83,7 +85,14 @@ class NodeSelector extends Window with Logging {
// Nodes from group
group.types.foreach(nodeType => addNodeWidget(new NodeTypeWidget(nodeType) {
override def onClick(): Unit = {
workspaceView.addNode(nodeType.make())
val node = nodeType.make()
node match {
case fillable: DefaultSlotItemsFillable => fillable.fillSlotsWithDefaultItems()
case _ =>
}
workspaceView.addNode(node)
close()
}
}))
@ -92,7 +101,7 @@ class NodeSelector extends Window with Logging {
size = maximumSize
def finalHeight: Float = (rowCount * Size + NodeRegistry.groups.length * nodeGroupTitleHeight + 16).min(450)
def finalHeight: Float = (rowCount * Size + NodeRegistry.groups.length * nodeGroupTitleHeight + 16).min(500)
def ringColor: Color = colorAnimation.color
@ -166,7 +175,7 @@ class NodeSelector extends Window with Logging {
override protected def drawChildren(g: Graphics): Unit = {
for ((child, i) <- children.zipWithIndex) {
val idx = rowIdx * 4 + i
val idx = rowIdx * nodesPerRow + i
val timeOffset = idx.toFloat * 0.016f
g.save()

View File

@ -20,6 +20,7 @@ import scala.reflect.ClassTag
trait ComputerAware
extends Logging
with SyncedInventory
with DefaultSlotItemsFillable
with Windowed[ComputerWindow]
{
override type I = Item with ComponentItem
@ -147,7 +148,9 @@ trait ComputerAware
addSlotsBasedOnTier()
}
def fillSlotsWithDefaultItems(): Unit = {
// ---------------------------- DefaultSlotItemsFillable ----------------------------
override def fillSlotsWithDefaultItems(): Unit = {
cardSlots(0).item = new GraphicsCardItem.Factory(computer.tier min Tier.Three).build()
diskSlots(0).item = new HddItem.Factory(true, computer.tier min Tier.Three).build()

View File

@ -0,0 +1,8 @@
package ocelot.desktop.util
import ocelot.desktop.inventory.Inventory
trait DefaultSlotItemsFillable extends Inventory {
def fillSlotsWithDefaultItems(): Unit
}

View File

@ -19,6 +19,7 @@ import totoro.ocelot.brain.util.DyeColor
trait DiskDriveAware
extends Logging
with SyncedInventory
with DefaultSlotItemsFillable
with Windowed[DiskDriveWindow]
{
override type I = FloppyItem
@ -29,10 +30,6 @@ trait DiskDriveAware
val floppySlotWidget: FloppySlotWidget = new FloppySlotWidget(Slot(0))
def fillSlotsWithDefaultItems(): Unit = {
floppySlotWidget.item = new FloppyItem.Factory.Loot(Loot.OpenOsFloppy).build()
}
def drawActivityAndFloppy(g: Graphics, bounds: Rect2D, prefix: String): Unit = {
DrawUtils.drawFilesystemActivity(
g,
@ -69,6 +66,14 @@ trait DiskDriveAware
})
}
// ---------------------------- DefaultSlotItemsFillable ----------------------------
override def fillSlotsWithDefaultItems(): Unit = {
floppySlotWidget.item = new FloppyItem.Factory.Loot(Loot.OpenOsFloppy).build()
}
// ---------------------------- WindowedNode ----------------------------
override def createWindow(): DiskDriveWindow = new DiskDriveWindow(this)
}

View File

@ -190,6 +190,15 @@ object DrawUtils {
tryDraw("Error", !machine.isRunning && hasErred)
}
def drawFilesystemActivity(
g: Graphics,
x: Float,
y: Float,
prefix: String
): Unit = {
g.sprite(s"${prefix}DiskActivity", x, y, NoHighlightSize, NoHighlightSize)
}
def drawFilesystemActivity(
g: Graphics,
x: Float,
@ -197,8 +206,14 @@ object DrawUtils {
diskActivityAware: DiskActivityAware,
prefix: String
): Unit = {
if (diskActivityAware.shouldVisualizeDiskActivity)
g.sprite(s"${prefix}DiskActivity", x, y, NoHighlightSize, NoHighlightSize)
if (diskActivityAware.shouldVisualizeDiskActivity) {
drawFilesystemActivity(
g,
x,
y,
prefix
)
}
}
def drawNetworkActivity(

View File

@ -0,0 +1,97 @@
package ocelot.desktop.windows
import ocelot.desktop.ColorScheme
import ocelot.desktop.color.Color
import ocelot.desktop.geometry.{Padding2D, Size2D}
import ocelot.desktop.graphics.Graphics
import ocelot.desktop.node.nodes.RaidNode
import ocelot.desktop.ui.layout.{AlignItems, Layout, LinearLayout}
import ocelot.desktop.ui.widget._
import ocelot.desktop.ui.widget.slot.HddSlotWidget
import ocelot.desktop.ui.widget.window.PanelWindow
import ocelot.desktop.util.Orientation
import totoro.ocelot.brain.util.Tier
class RaidWindow(raidNode: RaidNode) extends PanelWindow {
override protected def title: String = s"Raid ${raidNode.raid.filesystem.map(_.node.address).getOrElse("")}"
override def minimumSize: Size2D = Size2D(350, 147)
override def maximumSize: Size2D = minimumSize
private val hddSlotWidgets: Array[HddSlotWidget] = new Array[HddSlotWidget](raidNode.raid.getSizeInventory)
setInner(
new Widget {
override protected val layout: Layout = new LinearLayout(
this,
orientation = Orientation.Vertical,
gap = 10,
alignItems = AlignItems.Start
)
// HDD slots & background border
children :+= new PaddingBox(
new Widget {
override def minimumSize: Size2D = Size2D(132, 52)
override def maximumSize: Size2D = minimumSize
override def draw(g: Graphics): Unit = {
// Background border
g.sprite(
"window/raid/Slots",
position.x,
position.y,
size.width,
size.height
)
super.draw(g)
}
// Slots
children :+= new PaddingBox(
new Widget {
override protected val layout: Layout = new LinearLayout(
this,
orientation = Orientation.Horizontal,
gap = 4
)
var hddSlotWidget: HddSlotWidget = _
for (i <- hddSlotWidgets.indices) {
hddSlotWidget = new HddSlotWidget(raidNode.Slot(i), Tier.Three)
hddSlotWidgets(i) = hddSlotWidget
children :+= hddSlotWidget
}
},
Padding2D(left = 8, top = 8)
)
},
Padding2D(left = 94, top = 10)
)
// Text under HDDs
children :+= new PaddingBox(
new Widget {
override protected val layout: Layout = new LinearLayout(
this,
orientation = Orientation.Vertical,
gap = 2
)
def addLabel(data: String): Unit = {
children :+= new Label {
override def text: String = data
override def color: Color = ColorScheme("LabelError")
}
}
addLabel("Adding a disk wipes it.")
addLabel("Removing a disk wipes the raid.")
},
Padding2D(left = 5)
)
}
)
}