mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2026-01-06 19:22:38 +01:00
Some save/load fixes
This commit is contained in:
parent
ccee51bef0
commit
7c5f084710
@ -1 +1 @@
|
||||
Subproject commit 7064d123b1b6d17ee93f355acdb3978b850513e4
|
||||
Subproject commit 8c979af4b6597b3f3ce8f40d8bcf3089cbbe2731
|
||||
@ -30,10 +30,12 @@ class ComputerNode(val computer: Case, setup: Boolean = true) extends Node {
|
||||
computer.add(new GraphicsCard(computer.tier.min(1)))
|
||||
computer.add(Loot.OpenOsFloppy.create())
|
||||
computer.add(Loot.OpenOsEEPROM.create())
|
||||
refitSlots()
|
||||
// refitSlots()
|
||||
OcelotDesktop.workspace.add(computer)
|
||||
}
|
||||
|
||||
refitSlots()
|
||||
|
||||
def this(nbt: NBTTagCompound) {
|
||||
this({
|
||||
val address = nbt.getString("address")
|
||||
@ -95,7 +97,7 @@ class ComputerNode(val computer: Case, setup: Boolean = true) extends Node {
|
||||
else
|
||||
computer.remove(item)
|
||||
case mem: Memory => memorySlots
|
||||
.find(slot => slot._item.isEmpty && slot.tier >= (mem.tier + 1) / 2)
|
||||
.find(slot => slot._item.isEmpty && slot.tier >= (mem.tier + 1) / 2 - 1)
|
||||
.get._item = Some(mem)
|
||||
case hdd: HDDManaged => diskSlots
|
||||
.find(slot => slot._item.isEmpty && slot.tier >= hdd.tier)
|
||||
|
||||
@ -48,6 +48,7 @@ class RootWidget extends Widget {
|
||||
val frontendNBT = new NBTTagCompound
|
||||
OcelotDesktop.workspace.save(backendNBT)
|
||||
UiHandler.root.workspaceView.save(frontendNBT)
|
||||
UiHandler.root.workspaceView.windowPool.closeAll()
|
||||
OcelotDesktop.workspace.load(backendNBT)
|
||||
UiHandler.root.workspaceView.load(frontendNBT)
|
||||
}
|
||||
|
||||
@ -26,6 +26,10 @@ class WindowPool extends Widget with DragHandler {
|
||||
windows.lastOption.foreach(_.focus())
|
||||
}
|
||||
|
||||
def closeAll(): Unit = {
|
||||
for (window <- windows) closeWindow(window)
|
||||
}
|
||||
|
||||
def changeFocus(window: Window): Unit = {
|
||||
windows.lastOption.foreach(_.unfocus())
|
||||
window.focus()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user