mirror of
https://gitlab.com/cc-ru/ocelot/ocelot-desktop.git
synced 2025-12-20 02:59:19 +01:00
Rename iconSource properties to icon
This commit is contained in:
parent
d28572124f
commit
4edfd8fff2
@ -119,7 +119,7 @@ abstract class Node extends Widget with MouseHandler with HoverHandler with Pers
|
|||||||
super.dispose()
|
super.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
def iconSource: IconSource = IconSource.Icons.NA
|
def icon: IconSource = IconSource.Icons.NA
|
||||||
|
|
||||||
def iconColor: Color = RGBAColor(255, 255, 255)
|
def iconColor: Color = RGBAColor(255, 255, 255)
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ abstract class Node extends Widget with MouseHandler with HoverHandler with Pers
|
|||||||
drawHighlight(g)
|
drawHighlight(g)
|
||||||
|
|
||||||
g.sprite(
|
g.sprite(
|
||||||
iconSource,
|
icon,
|
||||||
position.x + HighlightThickness,
|
position.x + HighlightThickness,
|
||||||
position.y + HighlightThickness,
|
position.y + HighlightThickness,
|
||||||
size.width - HighlightThickness * 2,
|
size.width - HighlightThickness * 2,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import ocelot.desktop.node.EntityNode
|
|||||||
import totoro.ocelot.brain.entity.Cable
|
import totoro.ocelot.brain.entity.Cable
|
||||||
|
|
||||||
class CableNode(val cable: Cable) extends EntityNode(cable) {
|
class CableNode(val cable: Cable) extends EntityNode(cable) {
|
||||||
override def iconSource: IconSource = IconSource.Nodes.Cable
|
override def icon: IconSource = IconSource.Nodes.Cable
|
||||||
|
|
||||||
override def rotatable: Boolean = false
|
override def rotatable: Boolean = false
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import ocelot.desktop.node.{EntityNode, LabeledEntityNode, WindowedNode}
|
|||||||
import ocelot.desktop.windows.CameraWindow
|
import ocelot.desktop.windows.CameraWindow
|
||||||
|
|
||||||
class CameraNode(val camera: Camera) extends EntityNode(camera) with LabeledEntityNode with WindowedNode[CameraWindow] {
|
class CameraNode(val camera: Camera) extends EntityNode(camera) with LabeledEntityNode with WindowedNode[CameraWindow] {
|
||||||
override def iconSource: IconSource = IconSource.Nodes.Camera
|
override def icon: IconSource = IconSource.Nodes.Camera
|
||||||
|
|
||||||
override def rotatable: Boolean = true
|
override def rotatable: Boolean = true
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import ocelot.desktop.windows.ChestWindow
|
|||||||
class ChestNode extends LabeledNode with WindowedNode[ChestWindow] with PersistedInventory {
|
class ChestNode extends LabeledNode with WindowedNode[ChestWindow] with PersistedInventory {
|
||||||
override type I = Item with PersistableItem
|
override type I = Item with PersistableItem
|
||||||
|
|
||||||
override def iconSource: IconSource = IconSource.Nodes.Chest
|
override def icon: IconSource = IconSource.Nodes.Chest
|
||||||
|
|
||||||
override def rotatable: Boolean = false
|
override def rotatable: Boolean = false
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ class ComputerNode(val computerCase: Case)
|
|||||||
with AudibleComputerAware
|
with AudibleComputerAware
|
||||||
with WindowedNode[ComputerWindow] {
|
with WindowedNode[ComputerWindow] {
|
||||||
|
|
||||||
override val iconSource: IconSource = IconSource.Nodes.Computer.Default
|
override val icon: IconSource = IconSource.Nodes.Computer.Default
|
||||||
override def iconColor: Color = TierColor.get(computerCase.tier)
|
override def iconColor: Color = TierColor.get(computerCase.tier)
|
||||||
|
|
||||||
override def rotatable: Boolean = true
|
override def rotatable: Boolean = true
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class DiskDriveNode(entity: FloppyDiskDrive)
|
|||||||
with ShiftClickNode
|
with ShiftClickNode
|
||||||
with WindowedNode[DiskDriveWindow] {
|
with WindowedNode[DiskDriveWindow] {
|
||||||
|
|
||||||
override def iconSource: IconSource = IconSource.Nodes.DiskDrive.Default
|
override def icon: IconSource = IconSource.Nodes.DiskDrive.Default
|
||||||
|
|
||||||
override def rotatable: Boolean = true
|
override def rotatable: Boolean = true
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import totoro.ocelot.brain.entity.HologramProjector
|
|||||||
class HologramProjectorNode(val hologramProjector: HologramProjector)
|
class HologramProjectorNode(val hologramProjector: HologramProjector)
|
||||||
extends EntityNode(hologramProjector) with LabeledEntityNode with WindowedNode[HologramProjectorWindow] {
|
extends EntityNode(hologramProjector) with LabeledEntityNode with WindowedNode[HologramProjectorWindow] {
|
||||||
|
|
||||||
override def iconSource: IconSource = IconSource.Nodes.HologramProjector(hologramProjector.tier)
|
override def icon: IconSource = IconSource.Nodes.HologramProjector(hologramProjector.tier)
|
||||||
|
|
||||||
override def rotatable: Boolean = false
|
override def rotatable: Boolean = false
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import totoro.ocelot.brain.event.{EventBus, NoteBlockTriggerEvent}
|
|||||||
import scala.util.Random
|
import scala.util.Random
|
||||||
|
|
||||||
class IronNoteBlockNode(val ironNoteBlock: IronNoteBlock) extends NoteBlockNodeBase(ironNoteBlock) {
|
class IronNoteBlockNode(val ironNoteBlock: IronNoteBlock) extends NoteBlockNodeBase(ironNoteBlock) {
|
||||||
override def iconSource: IconSource = IconSource.Nodes.IronNoteBlock
|
override def icon: IconSource = IconSource.Nodes.IronNoteBlock
|
||||||
|
|
||||||
override def rotatable: Boolean = false
|
override def rotatable: Boolean = false
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class MicrocontrollerNode(val microcontroller: Microcontroller)
|
|||||||
with DefaultSlotItemsFillable
|
with DefaultSlotItemsFillable
|
||||||
with WindowedNode[ComputerWindow] {
|
with WindowedNode[ComputerWindow] {
|
||||||
|
|
||||||
override val iconSource: IconSource = IconSource.Nodes.Microcontroller.Default
|
override val icon: IconSource = IconSource.Nodes.Microcontroller.Default
|
||||||
|
|
||||||
override def setupContextMenu(menu: ContextMenu, event: ClickEvent): Unit = {
|
override def setupContextMenu(menu: ContextMenu, event: ClickEvent): Unit = {
|
||||||
addPowerContextMenuEntries(menu)
|
addPowerContextMenuEntries(menu)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import totoro.ocelot.brain.entity.NoteBlock
|
|||||||
import totoro.ocelot.brain.event.{EventBus, NoteBlockTriggerEvent}
|
import totoro.ocelot.brain.event.{EventBus, NoteBlockTriggerEvent}
|
||||||
|
|
||||||
class NoteBlockNode(val noteBlock: NoteBlock) extends NoteBlockNodeBase(noteBlock) {
|
class NoteBlockNode(val noteBlock: NoteBlock) extends NoteBlockNodeBase(noteBlock) {
|
||||||
override def iconSource: IconSource = IconSource.Nodes.NoteBlock
|
override def icon: IconSource = IconSource.Nodes.NoteBlock
|
||||||
|
|
||||||
override def rotatable: Boolean = false
|
override def rotatable: Boolean = false
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class OcelotBlockNode(val ocelot: OcelotBlock)
|
|||||||
|
|
||||||
override def name: String = "Ocelot Block"
|
override def name: String = "Ocelot Block"
|
||||||
|
|
||||||
override def iconSource: IconSource = IconSource.Nodes.OcelotBlock.Default
|
override def icon: IconSource = IconSource.Nodes.OcelotBlock.Default
|
||||||
|
|
||||||
override def rotatable: Boolean = false
|
override def rotatable: Boolean = false
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import ocelot.desktop.windows.OpenFMRadioWindow
|
|||||||
|
|
||||||
class OpenFMRadioNode(val openFMRadio: OpenFMRadio)
|
class OpenFMRadioNode(val openFMRadio: OpenFMRadio)
|
||||||
extends EntityNode(openFMRadio) with LabeledEntityNode with WindowedNode[OpenFMRadioWindow] {
|
extends EntityNode(openFMRadio) with LabeledEntityNode with WindowedNode[OpenFMRadioWindow] {
|
||||||
override def iconSource: IconSource = IconSource.Nodes.OpenFMRadio
|
override def icon: IconSource = IconSource.Nodes.OpenFMRadio
|
||||||
|
|
||||||
override def rotatable: Boolean = true
|
override def rotatable: Boolean = true
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import totoro.ocelot.brain.network
|
|||||||
import totoro.ocelot.brain.util.Direction
|
import totoro.ocelot.brain.util.Direction
|
||||||
|
|
||||||
class RackNode(val rack: Rack) extends ComputerAwareNode(rack) with WindowedNode[RackWindow] {
|
class RackNode(val rack: Rack) extends ComputerAwareNode(rack) with WindowedNode[RackWindow] {
|
||||||
override val iconSource: IconSource = IconSource.Nodes.Rack.Empty
|
override val icon: IconSource = IconSource.Nodes.Rack.Empty
|
||||||
override def exposeAddress = false
|
override def exposeAddress = false
|
||||||
|
|
||||||
override def ports: Array[NodePort] = Array(
|
override def ports: Array[NodePort] = Array(
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class RaidNode(val raid: Raid)
|
|||||||
with WindowedNode[RaidWindow] {
|
with WindowedNode[RaidWindow] {
|
||||||
var diskSlots: Array[HddSlotWidget] = Array.tabulate(3)(index => new HddSlotWidget(Slot(index), Tier.Three))
|
var diskSlots: Array[HddSlotWidget] = Array.tabulate(3)(index => new HddSlotWidget(Slot(index), Tier.Three))
|
||||||
|
|
||||||
override val iconSource: IconSource = IconSource.Nodes.Raid.Default
|
override val icon: IconSource = IconSource.Nodes.Raid.Default
|
||||||
|
|
||||||
override def rotatable: Boolean = true
|
override def rotatable: Boolean = true
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import totoro.ocelot.brain.util.Direction
|
|||||||
class RelayNode(val relay: Relay)
|
class RelayNode(val relay: Relay)
|
||||||
extends EntityNode(relay) with SyncedInventory with LabeledNode with WindowedNode[RelayWindow] {
|
extends EntityNode(relay) with SyncedInventory with LabeledNode with WindowedNode[RelayWindow] {
|
||||||
|
|
||||||
override val iconSource: IconSource = IconSource.Nodes.Relay
|
override val icon: IconSource = IconSource.Nodes.Relay
|
||||||
|
|
||||||
override def ports: Array[NodePort] = Array(
|
override def ports: Array[NodePort] = Array(
|
||||||
NodePort(Some(Direction.North)),
|
NodePort(Some(Direction.North)),
|
||||||
|
|||||||
@ -91,7 +91,7 @@ class ScreenNode(val screen: Screen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override def iconSource: IconSource = IconSource.Nodes.Screen.Standalone
|
override def icon: IconSource = IconSource.Nodes.Screen.Standalone
|
||||||
|
|
||||||
override def iconColor: Color = TierColor.get(screen.tier)
|
override def iconColor: Color = TierColor.get(screen.tier)
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class TapeDriveNode(val tapeDrive: TapeDrive)
|
|||||||
with PositionalSoundSourcesNode
|
with PositionalSoundSourcesNode
|
||||||
with WindowedNode[TapeDriveWindow] {
|
with WindowedNode[TapeDriveWindow] {
|
||||||
|
|
||||||
override def iconSource: IconSource = IconSource.Nodes.TapeDrive
|
override def icon: IconSource = IconSource.Nodes.TapeDrive
|
||||||
|
|
||||||
override def rotatable: Boolean = true
|
override def rotatable: Boolean = true
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package ocelot.desktop.util
|
package ocelot.desktop.util
|
||||||
|
|
||||||
import ocelot.desktop.geometry.{Rect2D, Size2D, Vector2D}
|
import ocelot.desktop.geometry.{Rect2D, Size2D}
|
||||||
import ocelot.desktop.graphics.{IconSource, Texture}
|
import ocelot.desktop.graphics.{IconSource, Texture}
|
||||||
|
|
||||||
import javax.imageio.ImageIO
|
import javax.imageio.ImageIO
|
||||||
@ -15,18 +15,18 @@ object Spritesheet extends Resource with Logging {
|
|||||||
|
|
||||||
def spriteSize(sprite: String): Size2D = sprites(sprite).size * resolution
|
def spriteSize(sprite: String): Size2D = sprites(sprite).size * resolution
|
||||||
|
|
||||||
def spriteSize(iconSource: IconSource): Size2D = iconSource.animation match {
|
def spriteSize(icon: IconSource): Size2D = icon.animation match {
|
||||||
case Some(animation) =>
|
case Some(animation) =>
|
||||||
animation.frameSize match {
|
animation.frameSize match {
|
||||||
case Some(size) => size
|
case Some(size) => size
|
||||||
|
|
||||||
case None =>
|
case None =>
|
||||||
val size = spriteSize(iconSource.path)
|
val size = spriteSize(icon.path)
|
||||||
|
|
||||||
Size2D(size.width, size.width)
|
Size2D(size.width, size.width)
|
||||||
}
|
}
|
||||||
|
|
||||||
case None => spriteSize(iconSource.path)
|
case None => spriteSize(icon.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
def load(): Unit = {
|
def load(): Unit = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user