Adds support for syncing GameControllerInputMappings
This commit is contained in:
parent
557529b1e7
commit
a3108e6c3a
@ -96,6 +96,7 @@
|
|||||||
<entry key="attributeValueClassName" value="GameType"/>
|
<entry key="attributeValueClassName" value="GameType"/>
|
||||||
</userInfo>
|
</userInfo>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="identifier" attributeType="String" syncable="YES"/>
|
||||||
<attribute name="playerIndex" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
|
<attribute name="playerIndex" attributeType="Integer 16" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
|
||||||
<uniquenessConstraints>
|
<uniquenessConstraints>
|
||||||
<uniquenessConstraint>
|
<uniquenessConstraint>
|
||||||
@ -103,6 +104,9 @@
|
|||||||
<constraint value="gameType"/>
|
<constraint value="gameType"/>
|
||||||
<constraint value="playerIndex"/>
|
<constraint value="playerIndex"/>
|
||||||
</uniquenessConstraint>
|
</uniquenessConstraint>
|
||||||
|
<uniquenessConstraint>
|
||||||
|
<constraint value="identifier"/>
|
||||||
|
</uniquenessConstraint>
|
||||||
</uniquenessConstraints>
|
</uniquenessConstraints>
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="SaveState" representedClassName="SaveState" versionHashModifier="quick" syncable="YES">
|
<entity name="SaveState" representedClassName="SaveState" versionHashModifier="quick" syncable="YES">
|
||||||
@ -133,7 +137,7 @@
|
|||||||
<element name="ControllerSkin" positionX="-387" positionY="90" width="128" height="135"/>
|
<element name="ControllerSkin" positionX="-387" positionY="90" width="128" height="135"/>
|
||||||
<element name="Game" positionX="-378" positionY="-54" width="128" height="195"/>
|
<element name="Game" positionX="-378" positionY="-54" width="128" height="195"/>
|
||||||
<element name="GameCollection" positionX="-585" positionY="-27" width="128" height="90"/>
|
<element name="GameCollection" positionX="-585" positionY="-27" width="128" height="90"/>
|
||||||
<element name="GameControllerInputMapping" positionX="-387" positionY="90" width="128" height="105"/>
|
<element name="GameControllerInputMapping" positionX="-387" positionY="90" width="128" height="120"/>
|
||||||
<element name="SaveState" positionX="-198" positionY="113" width="128" height="165"/>
|
<element name="SaveState" positionX="-198" positionY="113" width="128" height="165"/>
|
||||||
</elements>
|
</elements>
|
||||||
</model>
|
</model>
|
||||||
@ -9,6 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import DeltaCore
|
import DeltaCore
|
||||||
|
import Harmony
|
||||||
|
|
||||||
@objc(GameControllerInputMapping)
|
@objc(GameControllerInputMapping)
|
||||||
public class GameControllerInputMapping: _GameControllerInputMapping
|
public class GameControllerInputMapping: _GameControllerInputMapping
|
||||||
@ -24,6 +25,13 @@ public class GameControllerInputMapping: _GameControllerInputMapping
|
|||||||
|
|
||||||
self.inputMapping = inputMapping
|
self.inputMapping = inputMapping
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func awakeFromInsert()
|
||||||
|
{
|
||||||
|
super.awakeFromInsert()
|
||||||
|
|
||||||
|
self.identifier = UUID().uuidString
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension GameControllerInputMapping
|
extension GameControllerInputMapping
|
||||||
@ -75,3 +83,17 @@ extension GameControllerInputMapping: GameControllerInputMappingProtocol
|
|||||||
self.inputMapping.set(input, forControllerInput: controllerInput)
|
self.inputMapping.set(input, forControllerInput: controllerInput)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension GameControllerInputMapping: Syncable
|
||||||
|
{
|
||||||
|
public static var syncablePrimaryKey: AnyKeyPath {
|
||||||
|
return \GameControllerInputMapping.identifier
|
||||||
|
}
|
||||||
|
|
||||||
|
public var syncableKeys: Set<AnyKeyPath> {
|
||||||
|
return [\GameControllerInputMapping.deltaCoreInputMapping,
|
||||||
|
\GameControllerInputMapping.gameControllerInputType,
|
||||||
|
\GameControllerInputMapping.gameType,
|
||||||
|
\GameControllerInputMapping.playerIndex]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -20,6 +20,8 @@ public class _GameControllerInputMapping: NSManagedObject
|
|||||||
|
|
||||||
@NSManaged public var gameType: GameType
|
@NSManaged public var gameType: GameType
|
||||||
|
|
||||||
|
@NSManaged public var identifier: String
|
||||||
|
|
||||||
@NSManaged public var playerIndex: Int16
|
@NSManaged public var playerIndex: Int16
|
||||||
|
|
||||||
// MARK: - Relationships
|
// MARK: - Relationships
|
||||||
|
|||||||
2
External/Harmony
vendored
2
External/Harmony
vendored
@ -1 +1 @@
|
|||||||
Subproject commit ee45cd9ff3ff6c50c29e85cd466c4031108c3fde
|
Subproject commit 2c8aed14f6287e45eb3c32017de590ec4323e64f
|
||||||
Loading…
Reference in New Issue
Block a user