diff --git a/Assets/-DungeonAssets/Prefabs/Dungeons/Vamps'Den.prefab b/Assets/-DungeonAssets/Prefabs/Dungeons/Vamps'Den.prefab index c487de74..197d1430 100644 --- a/Assets/-DungeonAssets/Prefabs/Dungeons/Vamps'Den.prefab +++ b/Assets/-DungeonAssets/Prefabs/Dungeons/Vamps'Den.prefab @@ -126,6 +126,7 @@ Transform: - {fileID: 7905129169632705295} - {fileID: 393348378991366053} - {fileID: 5548604508934756379} + - {fileID: 8134253324369185374} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -931,6 +932,68 @@ Transform: m_CorrespondingSourceObject: {fileID: 515906044951634681, guid: cc97c8024fc67b34b97ef2c2c33759ae, type: 3} m_PrefabInstance: {fileID: 1091181985279667039} m_PrefabAsset: {fileID: 0} +--- !u!1001 &2535084482381170967 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 7905129168961567760} + m_Modifications: + - target: {fileID: 6038414138835698504, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_Name + value: Vendor_Template_ShadowDancer_Variant + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalPosition.x + value: -48.14 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalPosition.y + value: 0.06000042 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalPosition.z + value: 6.21 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalRotation.w + value: 0.6685632 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalRotation.y + value: 0.7436554 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 96.087 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} +--- !u!4 &8134253324369185374 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + m_PrefabInstance: {fileID: 2535084482381170967} + m_PrefabAsset: {fileID: 0} --- !u!1001 &3382963486604227117 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items.meta new file mode 100644 index 00000000..6835792f --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f3f239a203bcc8c4bbc3d13d92199710 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset index b0688386..564ac0cb 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Faithfull-Spirit Hood Icon: {fileID: 21300000, guid: ff4e71a19e8221842b58b8a6da94d42b, type: 3} - sellPricePlayer: 20 + sellPricePlayer: 100 sellPriceVendor: 2000 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 2 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Hood.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset index 80a2e579..ebbd1c84 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Faithfull-Spirit Orb Icon: {fileID: 21300000, guid: fa0cbac5b06e92b4887a48ab97c80f32, type: 3} - sellPricePlayer: 20 + sellPricePlayer: 100 sellPriceVendor: 2000 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 4 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Orb.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset index 4afe96a2..7a489e0c 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Faithfull-Spirit Ring Icon: {fileID: 21300000, guid: 4ae6889de55196243bf426e115d2aa12, type: 3} - sellPricePlayer: 20 + sellPricePlayer: 100 sellPriceVendor: 2000 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Ring.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset index d3d83290..ec9586ef 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Faithfull-Spirit Talisman Icon: {fileID: 21300000, guid: 543b60ad22fa37a48a0a3129ebefe8c9, type: 3} - sellPricePlayer: 20 + sellPricePlayer: 100 sellPriceVendor: 2000 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Talisman.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset index b037163f..1a97385f 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Faithfull-Spirit Vest Icon: {fileID: 21300000, guid: 3d12865ac7778ee4e921d66702b5d1a2, type: 3} - sellPricePlayer: 20 + sellPricePlayer: 100 sellPriceVendor: 2000 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 2 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Vest.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset index 4ab63a0b..40642668 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Faithfull-Spirit Wand Icon: {fileID: 21300000, guid: c630323c00f822e4ca9a96a45ceb82bc, type: 3} - sellPricePlayer: 20 + sellPricePlayer: 100 sellPriceVendor: 2000 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 4 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Faithfull-Spirit Set/Faithfull-Spirit Wand.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset index b5589306..1175cf7d 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Frenzy Hunter's Hood Icon: {fileID: 21300000, guid: fa1534fcea2a752429f831550d02ae49, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Hood.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset index 52b84c84..eb4081eb 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Frenzy Hunter's Main Axe Icon: {fileID: 21300000, guid: 11afa5cbe2051d84a83f7d4081110324, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 2 AgilityBonus: 0 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Main Axe.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset index b8205698..6258969b 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Frenzy Hunter's Off Axe Icon: {fileID: 21300000, guid: d22803422e064e146b5ff7abf08d7683, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 0 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Off Axe.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset index 4998903f..a2312be9 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Frenzy Hunter's Ring Icon: {fileID: 21300000, guid: 47fe99f4b4bbc6244aaa45422598c431, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Ring.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset index c2d46002..686e43fd 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Frenzy Hunter's Talisman Icon: {fileID: 21300000, guid: 80444ca05aebbeb46af32e6fe938b13a, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Talisman.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset index 7426978c..35d798e1 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Frenzy Hunter's Vest Icon: {fileID: 21300000, guid: ab0226cd28d392f419078c390d24f898, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Frenzy Hunter's Set/Frenzy Hunter's Vest.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Crown.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Crown.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Crown.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Crown.asset index 2ae759b2..5cf5b3ae 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Crown.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Crown.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Mana-Starved Crown Icon: {fileID: 21300000, guid: 87630f81fe8754d49bab3fa66b0481cd, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 1 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Crown.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Crown.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Crown.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Crown.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 1.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 1.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 1.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 1.asset index 51d9e96a..300409ad 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 1.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 1.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Mana-Starved Ring Icon: {fileID: 21300000, guid: fc4789f021f02264385fab7ff3625027, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 1 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 1.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 1.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 1.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 1.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 2.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 2.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 2.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 2.asset index 4ffffbb0..918eab25 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 2.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 2.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Mana-Starved Ring Icon: {fileID: 21300000, guid: fc4789f021f02264385fab7ff3625027, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 2.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 2.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Ring 2.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Ring 2.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Robe.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Robe.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Robe.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Robe.asset index 1df09c80..c539029c 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Robe.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Robe.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Mana-Starved Robe Icon: {fileID: 21300000, guid: 5abb4c8a678915f479a3ff6fb14c5ca0, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 0 IntelligenceBonus: 2 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Robe.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Robe.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Robe.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Robe.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Tome.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Tome.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Tome.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Tome.asset index e8fe8cc6..188b0eea 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Tome.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Tome.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Mana-Starved Tome Icon: {fileID: 21300000, guid: 8655e96e29978a04e93c2d845a440741, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 1 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Tome.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Tome.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Tome.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Tome.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Wand.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Wand.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Wand.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Wand.asset index 9c24d1fa..1c86176a 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Wand.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Wand.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Mana-Starved Wand Icon: {fileID: 21300000, guid: 4f386cb3ef79074499816dfbdf3532ad, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 0 AgilityBonus: 0 IntelligenceBonus: 1 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Wand.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Wand.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Mana-Starved Set/Mana-Starved Wand.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Mana-Starved Set/Mana-Starved Wand.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset index a759a7dd..82f600f3 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Resourceful Explorer's Amulet Icon: {fileID: 21300000, guid: 9a0cc92a2c2b2ff4fa19e7dfc3976467, type: 3} - sellPricePlayer: 100 + sellPricePlayer: 300 sellPriceVendor: 6000 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 10 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Amulet.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Chest.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Chest.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Chest.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Chest.asset index 9ee9e667..a1bd78a9 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Chest.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Chest.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Resourceful Explorer's Chest Icon: {fileID: 21300000, guid: 5231dd8869ec7ab49b81f5153c853c2c, type: 3} - sellPricePlayer: 100 + sellPricePlayer: 300 sellPriceVendor: 6000 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 10 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Chest.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Chest.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Chest.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Chest.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Hood.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Hood.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Hood.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Hood.asset index 0386d9e3..84da524f 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Hood.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Hood.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Resourceful Explorer's Hood Icon: {fileID: 21300000, guid: cf8b9da964e416a41affefa7bfedd56c, type: 3} - sellPricePlayer: 100 + sellPricePlayer: 300 sellPriceVendor: 6000 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 10 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Hood.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Hood.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Hood.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Hood.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Knife.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Knife.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Knife.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Knife.asset index 2ce67271..5f4a4a15 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Knife.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Knife.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Resourceful Explorer's Knife Icon: {fileID: 21300000, guid: 7e7088d3c74ded84690f4dc1ff8ed67e, type: 3} - sellPricePlayer: 100 + sellPricePlayer: 300 sellPriceVendor: 6000 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 10 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Knife.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Knife.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Knife.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Knife.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Relic.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Relic.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Relic.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Relic.asset index 52529930..acab9bc5 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Relic.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Relic.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Resourceful Explorer's Relic Icon: {fileID: 21300000, guid: 84dfc4c1dbe6de24aaef55325db511ad, type: 3} - sellPricePlayer: 100 + sellPricePlayer: 300 sellPriceVendor: 6000 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 10 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Relic.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Relic.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Relic.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Relic.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Ring.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Ring.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Ring.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Ring.asset index 6e4c332b..ffb16fbb 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Ring.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Ring.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Resourceful Explorer's Ring Icon: {fileID: 21300000, guid: e01b869f5805f2748af9e927e330ad30, type: 3} - sellPricePlayer: 100 + sellPricePlayer: 300 sellPriceVendor: 6000 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 10 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Ring.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Ring.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Resourceful Explorer Set/Resourceful Explorer's Ring.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Resourceful Explorer Set/Resourceful Explorer's Ring.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Amulet.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Amulet.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Amulet.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Amulet.asset index 72ae0663..1e36326b 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Amulet.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Amulet.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Steelbourne Amulet Icon: {fileID: 21300000, guid: 80c43aab2ebe98b4ba6771eedc17dfda, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Amulet.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Amulet.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Amulet.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Amulet.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Blade.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Blade.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Blade.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Blade.asset index 39f418cf..328be215 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Blade.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Blade.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Steelbourne Blade Icon: {fileID: 21300000, guid: 481da5ef38cc474468d8edbfd1a3a49f, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 3 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Blade.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Blade.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Blade.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Blade.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Chestplate.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Chestplate.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Chestplate.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Chestplate.asset index a539426a..42a14579 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Chestplate.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Chestplate.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Steelbourne Chestplate Icon: {fileID: 21300000, guid: 9ee9d78d195bbef41a7b8821baa80f81, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Chestplate.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Chestplate.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Chestplate.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Chestplate.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Helmet.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Helmet.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Helmet.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Helmet.asset index ce8ed665..4d815994 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Helmet.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Helmet.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Steelbourne Helmet Icon: {fileID: 21300000, guid: 4f4652de6e88fb043a724c10b5ded774, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Helmet.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Helmet.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Helmet.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Helmet.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Ring.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Ring.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Ring.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Ring.asset index e318be7d..3e68be0c 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Ring.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Ring.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Steelbourne Ring Icon: {fileID: 21300000, guid: 7b5448fc8cda5604b8e3984d97189a32, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Ring.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Ring.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Ring.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Ring.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Shield.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Shield.asset similarity index 95% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Shield.asset rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Shield.asset index 41aa33cb..86541153 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Shield.asset +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Shield.asset @@ -14,8 +14,9 @@ MonoBehaviour: m_EditorClassIdentifier: ItemName: Steelbourne Shield Icon: {fileID: 21300000, guid: b13290e41028f474eb5eff231b8617b3, type: 3} - sellPricePlayer: 10 + sellPricePlayer: 75 sellPriceVendor: 1500 + description: StrengthBonus: 1 AgilityBonus: 1 IntelligenceBonus: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Shield.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Shield.asset.meta similarity index 100% rename from Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/Steelbourne Set/Steelboune Shield.asset.meta rename to Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/0-Early-Items/Steelbourne Set/Steelboune Shield.asset.meta diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items.meta new file mode 100644 index 00000000..38d38a3a --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 48043884f33032d4d93594bfc00779b9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise.meta new file mode 100644 index 00000000..d13fd641 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 00bcbfddda94eb44dbd3f1779083a1c0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Dusk Cowl.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Dusk Cowl.asset new file mode 100644 index 00000000..40364c33 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Dusk Cowl.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e7a67ee28b6adf441814e60bcb404307, type: 3} + m_Name: Shadowdancer's Dusk Cowl + m_EditorClassIdentifier: + ItemName: Shadowdancer's Dusk Cowl + Icon: {fileID: 21300000, guid: 09c9648301d36ad489dd1eb4d17c2601, type: 3} + sellPricePlayer: 1000 + sellPriceVendor: 20000 + description: + StrengthBonus: 10 + AgilityBonus: 12 + IntelligenceBonus: 0 + SpiritBonus: 0 + VitalityBonus: 20 + StrengthPercentBonus: 0 + AgilityPercentBonus: 0 + IntelligencePercentBonus: 0 + SpiritPercentBonus: 0 + VitalityPercentBonus: 0.1 + EquipmentType: 0 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Dusk Cowl.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Dusk Cowl.asset.meta new file mode 100644 index 00000000..79b4ab7f --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Dusk Cowl.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a240cac70c0c094d8f6007217d69375 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Nightshade Band.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Nightshade Band.asset new file mode 100644 index 00000000..e9247e5c --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Nightshade Band.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e7a67ee28b6adf441814e60bcb404307, type: 3} + m_Name: Shadowdancer's Nightshade Band + m_EditorClassIdentifier: + ItemName: Shadowdancer's Nightshade Band + Icon: {fileID: 21300000, guid: c81430b8387182b4d982af254c032952, type: 3} + sellPricePlayer: 1000 + sellPriceVendor: 20000 + description: + StrengthBonus: 10 + AgilityBonus: 15 + IntelligenceBonus: 0 + SpiritBonus: 0 + VitalityBonus: 5 + StrengthPercentBonus: 0.05 + AgilityPercentBonus: 0.15 + IntelligencePercentBonus: 0 + SpiritPercentBonus: 0 + VitalityPercentBonus: 0 + EquipmentType: 6 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Nightshade Band.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Nightshade Band.asset.meta new file mode 100644 index 00000000..77919213 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Nightshade Band.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 401d2aad3ed8f084bbdb8ffd68d76586 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Twilight Dagger.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Twilight Dagger.asset new file mode 100644 index 00000000..1859de3d --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Twilight Dagger.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e7a67ee28b6adf441814e60bcb404307, type: 3} + m_Name: Shadowdancer's Twilight Dagger + m_EditorClassIdentifier: + ItemName: Shadowdancer's Twilight Dagger + Icon: {fileID: 21300000, guid: 5ae1fb17bcb8c79479575a668fa6e858, type: 3} + sellPricePlayer: 1000 + sellPriceVendor: 20000 + description: + StrengthBonus: 12 + AgilityBonus: 22 + IntelligenceBonus: 0 + SpiritBonus: 0 + VitalityBonus: 0 + StrengthPercentBonus: 0 + AgilityPercentBonus: 0.2 + IntelligencePercentBonus: 0 + SpiritPercentBonus: 0 + VitalityPercentBonus: 0 + EquipmentType: 4 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Twilight Dagger.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Twilight Dagger.asset.meta new file mode 100644 index 00000000..21844ee4 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Twilight Dagger.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cb6346f6b4ec6db4badc66102423cfa5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Umbral Pendant.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Umbral Pendant.asset new file mode 100644 index 00000000..2e53a181 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Umbral Pendant.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e7a67ee28b6adf441814e60bcb404307, type: 3} + m_Name: Shadowdancer's Umbral Pendant + m_EditorClassIdentifier: + ItemName: Shadowdancer's Umbral Pendant + Icon: {fileID: 21300000, guid: 88a0a5d939e67904ab2e7b28734883ba, type: 3} + sellPricePlayer: 1000 + sellPriceVendor: 20000 + description: + StrengthBonus: 10 + AgilityBonus: 15 + IntelligenceBonus: 0 + SpiritBonus: 0 + VitalityBonus: 5 + StrengthPercentBonus: 0.05 + AgilityPercentBonus: 0.1 + IntelligencePercentBonus: 0 + SpiritPercentBonus: 0 + VitalityPercentBonus: 0 + EquipmentType: 7 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Umbral Pendant.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Umbral Pendant.asset.meta new file mode 100644 index 00000000..ed2ee001 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Umbral Pendant.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d50aed42782ec0c488ef7894b1d098a5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Veil of Secrets.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Veil of Secrets.asset new file mode 100644 index 00000000..84b43c8a --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Veil of Secrets.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e7a67ee28b6adf441814e60bcb404307, type: 3} + m_Name: Shadowdancer's Veil of Secrets + m_EditorClassIdentifier: + ItemName: Shadowdancer's Veil of Secrets + Icon: {fileID: 21300000, guid: 52e58b9e98ac21a43abbb7745cab379a, type: 3} + sellPricePlayer: 1000 + sellPriceVendor: 20000 + description: + StrengthBonus: 10 + AgilityBonus: 20 + IntelligenceBonus: 0 + SpiritBonus: 0 + VitalityBonus: 0 + StrengthPercentBonus: 0 + AgilityPercentBonus: 0.2 + IntelligencePercentBonus: 0 + SpiritPercentBonus: 0 + VitalityPercentBonus: 0 + EquipmentType: 5 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Veil of Secrets.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Veil of Secrets.asset.meta new file mode 100644 index 00000000..e729fa21 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Veil of Secrets.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a23e689a08611f744a06f523e099e951 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Whisper-Silk Vest.asset b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Whisper-Silk Vest.asset new file mode 100644 index 00000000..793778e3 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Whisper-Silk Vest.asset @@ -0,0 +1,30 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e7a67ee28b6adf441814e60bcb404307, type: 3} + m_Name: Shadowdancer's Whisper-Silk Vest + m_EditorClassIdentifier: + ItemName: Shadowdancer's Whisper-Silk Vest + Icon: {fileID: 21300000, guid: 144f0c9292eeafa4fa7af0e0f6034ba5, type: 3} + sellPricePlayer: 1000 + sellPriceVendor: 20000 + description: + StrengthBonus: 10 + AgilityBonus: 12 + IntelligenceBonus: 0 + SpiritBonus: 0 + VitalityBonus: 20 + StrengthPercentBonus: 0 + AgilityPercentBonus: 0 + IntelligencePercentBonus: 0 + SpiritPercentBonus: 0 + VitalityPercentBonus: 0.1 + EquipmentType: 1 diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Whisper-Silk Vest.asset.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Whisper-Silk Vest.asset.meta new file mode 100644 index 00000000..0286e404 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/1-Mid-Items/Shadowdancer's Guise/Shadowdancer's Whisper-Silk Vest.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f62bde05c15c9047bdd0528ef43c019 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/2-Late-Items.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/2-Late-Items.meta new file mode 100644 index 00000000..ab4a7463 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/2-Late-Items.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4881d87a0c8dfb64aa20df725bb06452 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/3-End-Items.meta b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/3-End-Items.meta new file mode 100644 index 00000000..9fcdcc63 --- /dev/null +++ b/Assets/Character Stats/Examples/Items & Inventory/Items/RevampedItems/3-End-Items.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fce61db6a005bd74a8f0884ade87f2b0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Character Stats/Examples/Items & Inventory/Scripts/EquipmentPanel.cs b/Assets/Character Stats/Examples/Items & Inventory/Scripts/EquipmentPanel.cs index 82c3bd2b..0008ee7f 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Scripts/EquipmentPanel.cs +++ b/Assets/Character Stats/Examples/Items & Inventory/Scripts/EquipmentPanel.cs @@ -92,7 +92,16 @@ namespace Kryz.CharacterStats.Examples } } else + { + for (int i = 0; i < equipmentSlots.Length; i++) + { + equipmentSlots[i].Item = null; + } + equipmentData = new EquipmentData(); + + PlayerDataHandler.Instance.SaveCharacterEquipmentData(PlayerDataHandler.Instance.currentPlayerName.Value, PlayerDataHandler.Instance.currentCharacterName.Value, equipmentData); + } } } diff --git a/Assets/Character Stats/Examples/Items & Inventory/Scripts/Inventory.cs b/Assets/Character Stats/Examples/Items & Inventory/Scripts/Inventory.cs index 3f1fab66..a4a5e296 100644 --- a/Assets/Character Stats/Examples/Items & Inventory/Scripts/Inventory.cs +++ b/Assets/Character Stats/Examples/Items & Inventory/Scripts/Inventory.cs @@ -147,7 +147,13 @@ namespace Kryz.CharacterStats.Examples RefreshUI(false); } else + { inventoryData = new InventoryData(); + + items.Clear(); + + PlayerDataHandler.Instance.SaveCharacterInventoryData(PlayerDataHandler.Instance.currentPlayerName.Value, PlayerDataHandler.Instance.currentCharacterName.Value, inventoryData); + } } public void OpenInventory() diff --git a/Assets/Developer/Images.meta b/Assets/Developer/Images.meta new file mode 100644 index 00000000..09eb7521 --- /dev/null +++ b/Assets/Developer/Images.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d78cbe35d82738240afa2f17f2c25b18 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Developer/Images/Splash.png b/Assets/Developer/Images/Splash.png new file mode 100644 index 00000000..7539789e --- /dev/null +++ b/Assets/Developer/Images/Splash.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:178413615e9212cf1bea34e00046532457dc441266dbdf195cba27709938238c +size 19448566 diff --git a/Assets/Developer/Images/Splash.png.meta b/Assets/Developer/Images/Splash.png.meta new file mode 100644 index 00000000..b1504575 --- /dev/null +++ b/Assets/Developer/Images/Splash.png.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: 742f86ea32fdf21408e12cc88fd4b26d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 4096 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Developer/Images/q4gJ2n6AuTexxHfuM4BJ--1--suqcz-transformed.jpeg b/Assets/Developer/Images/q4gJ2n6AuTexxHfuM4BJ--1--suqcz-transformed.jpeg new file mode 100644 index 00000000..e3835ba2 Binary files /dev/null and b/Assets/Developer/Images/q4gJ2n6AuTexxHfuM4BJ--1--suqcz-transformed.jpeg differ diff --git a/Assets/Developer/Images/q4gJ2n6AuTexxHfuM4BJ--1--suqcz-transformed.jpeg.meta b/Assets/Developer/Images/q4gJ2n6AuTexxHfuM4BJ--1--suqcz-transformed.jpeg.meta new file mode 100644 index 00000000..e20a57ec --- /dev/null +++ b/Assets/Developer/Images/q4gJ2n6AuTexxHfuM4BJ--1--suqcz-transformed.jpeg.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: 3d4e3c8516977aa4da53e7d0042265be +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 8192 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Developer/Prefabs/Persistent Objects.prefab b/Assets/Developer/Prefabs/Persistent Objects.prefab index 7b268e9e..04c2e1b6 100644 --- a/Assets/Developer/Prefabs/Persistent Objects.prefab +++ b/Assets/Developer/Prefabs/Persistent Objects.prefab @@ -5046,6 +5046,12 @@ MonoBehaviour: - {fileID: 11400000, guid: dc830387b5da4a94384aa2f697dceeb8, type: 2} - {fileID: 11400000, guid: 372ed32d1f98681468acb677d9fa727e, type: 2} - {fileID: 11400000, guid: e13615b0e101d6b47aa4e7b3ce678672, type: 2} + - {fileID: 11400000, guid: 4a240cac70c0c094d8f6007217d69375, type: 2} + - {fileID: 11400000, guid: 401d2aad3ed8f084bbdb8ffd68d76586, type: 2} + - {fileID: 11400000, guid: cb6346f6b4ec6db4badc66102423cfa5, type: 2} + - {fileID: 11400000, guid: d50aed42782ec0c488ef7894b1d098a5, type: 2} + - {fileID: 11400000, guid: a23e689a08611f744a06f523e099e951, type: 2} + - {fileID: 11400000, guid: 0f62bde05c15c9047bdd0528ef43c019, type: 2} --- !u!1 &6229054688875263704 GameObject: m_ObjectHideFlags: 0 @@ -15102,7 +15108,7 @@ PrefabInstance: objectReference: {fileID: 12800000, guid: b3797d5d853d86945b0da6c9793549c9, type: 3} - target: {fileID: 22405792, guid: 98484fbd97870af4d8569162460a89bb, type: 3} propertyPath: m_Pivot.x - value: 1 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 22405792, guid: 98484fbd97870af4d8569162460a89bb, type: 3} propertyPath: m_Pivot.y @@ -15114,7 +15120,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 22405792, guid: 98484fbd97870af4d8569162460a89bb, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 22405792, guid: 98484fbd97870af4d8569162460a89bb, type: 3} propertyPath: m_AnchorMax.y @@ -15122,7 +15128,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 22405792, guid: 98484fbd97870af4d8569162460a89bb, type: 3} propertyPath: m_AnchorMin.x - value: 1 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 22405792, guid: 98484fbd97870af4d8569162460a89bb, type: 3} propertyPath: m_AnchorMin.y @@ -15182,7 +15188,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 22405792, guid: 98484fbd97870af4d8569162460a89bb, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: 150 objectReference: {fileID: 0} - target: {fileID: 22405792, guid: 98484fbd97870af4d8569162460a89bb, type: 3} propertyPath: m_LocalEulerAnglesHint.x diff --git a/Assets/Holy Assets Games.meta b/Assets/Holy Assets Games.meta new file mode 100644 index 00000000..e4f1b07f --- /dev/null +++ b/Assets/Holy Assets Games.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9a01d13cd911d0947b3514f6f8fad400 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House.meta b/Assets/Holy Assets Games/3D The Blacksmith's House.meta new file mode 100644 index 00000000..cc42b194 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 15e555f082fa8b642a9fc7ea4e7a5d2f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Material.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Material.meta new file mode 100644 index 00000000..a7c3a9bf --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Material.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a9ab8505707c04347931e951c80a66f3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Material/Smithy_Material_2K.mat b/Assets/Holy Assets Games/3D The Blacksmith's House/Material/Smithy_Material_2K.mat new file mode 100644 index 00000000..3689ab81 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Material/Smithy_Material_2K.mat @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Smithy_Material_2K + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ValidKeywords: + - _EMISSION + - _METALLICGLOSSMAP + - _NORMALMAP + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 2800000, guid: 9c8c5c1215da5fc4f945dc9179668319, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 2800000, guid: eee8f75eb95ddcf438978fe52fae8b5b, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: b647b1f8c4658be4daee6063f95939bf, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 2800000, guid: e67525fcfd98efc4ab602f853e64fc96, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 2800000, guid: 0e6dbe4bdb219ed43b836c2ff8e3e5e3, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 0 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Material/Smithy_Material_2K.mat.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Material/Smithy_Material_2K.mat.meta new file mode 100644 index 00000000..8671691c --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Material/Smithy_Material_2K.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 393172b9ecb4f644296ad3e28a60112b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab.meta new file mode 100644 index 00000000..c8fe6372 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 03bde94525571e141a891bd3c67616de +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab/Smithy.prefab b/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab/Smithy.prefab new file mode 100644 index 00000000..dc22c731 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab/Smithy.prefab @@ -0,0 +1,337 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1733350709616557346 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1388738049783752600} + - component: {fileID: 2659958805271603261} + - component: {fileID: 220365466163617015} + m_Layer: 0 + m_Name: Smithy + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1388738049783752600 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1733350709616557346} + m_LocalRotation: {x: 0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2236692867222010477} + - {fileID: 7259658727652224137} + - {fileID: 3896237513388441968} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &2659958805271603261 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1733350709616557346} + m_Mesh: {fileID: 4087520850070706273, guid: dd6a351acc2491446a00759faf0ee278, type: 3} +--- !u!23 &220365466163617015 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1733350709616557346} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 393172b9ecb4f644296ad3e28a60112b, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1750596504982121060 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3896237513388441968} + - component: {fileID: 7690596893282791737} + - component: {fileID: 1310887737938159943} + m_Layer: 0 + m_Name: Wheel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3896237513388441968 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1750596504982121060} + m_LocalRotation: {x: -0.00000009685755, y: 0, z: -0, w: 1} + m_LocalPosition: {x: -0.45796168, y: 0.76214445, z: -4.36617} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1388738049783752600} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7690596893282791737 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1750596504982121060} + m_Mesh: {fileID: -2309305249758762421, guid: dd6a351acc2491446a00759faf0ee278, type: 3} +--- !u!23 &1310887737938159943 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1750596504982121060} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 393172b9ecb4f644296ad3e28a60112b, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &7795331791830197962 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7259658727652224137} + - component: {fileID: 8522730345707316718} + - component: {fileID: 5294164504080657135} + m_Layer: 0 + m_Name: Casket + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7259658727652224137 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7795331791830197962} + m_LocalRotation: {x: 0.000000059604645, y: 0, z: -0, w: 1} + m_LocalPosition: {x: 6.2638307, y: 0, z: -2.6371045} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1388738049783752600} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &8522730345707316718 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7795331791830197962} + m_Mesh: {fileID: 966565398117491865, guid: dd6a351acc2491446a00759faf0ee278, type: 3} +--- !u!23 &5294164504080657135 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7795331791830197962} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 393172b9ecb4f644296ad3e28a60112b, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &8491779341069832804 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2236692867222010477} + - component: {fileID: 3347191134125855767} + - component: {fileID: 1703262471519536717} + m_Layer: 0 + m_Name: Anvil + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2236692867222010477 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8491779341069832804} + m_LocalRotation: {x: 0.000000050352014, y: -0.33265436, z: 0.000000017761346, w: 0.94304883} + m_LocalPosition: {x: 2.8250916, y: -0.00000047683716, z: 2.9140077} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1388738049783752600} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &3347191134125855767 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8491779341069832804} + m_Mesh: {fileID: 2274984026153331234, guid: dd6a351acc2491446a00759faf0ee278, type: 3} +--- !u!23 &1703262471519536717 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8491779341069832804} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 393172b9ecb4f644296ad3e28a60112b, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab/Smithy.prefab.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab/Smithy.prefab.meta new file mode 100644 index 00000000..556dc486 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Prefab/Smithy.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4d027cd71b53a234aa91cb080bbc60c2 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Readme.txt b/Assets/Holy Assets Games/3D The Blacksmith's House/Readme.txt new file mode 100644 index 00000000..9c875abd --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Readme.txt @@ -0,0 +1,16 @@ +The Blacksmith's House + +House - 3221 tris + +Anvil - 34 tris + +Casket - 24 tris + +Wheel - 188 trip + +Textures - 2048 + + +This models are in FBX, have textures in TIFF + +Is part of 3D Lowpoly Houses Set - https://assetstore.unity.com/packages/3d/environments/fantasy/3d-lowpoly-houses-set-256268 \ No newline at end of file diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Readme.txt.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Readme.txt.meta new file mode 100644 index 00000000..bdf2ff6f --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Readme.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c05bc53fead944845a0963c3b156104d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes.meta new file mode 100644 index 00000000..0fa76543 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 28c36ced496f0a444bf77d00330691cf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes/Scene_3D The Blacksmith's House.unity b/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes/Scene_3D The Blacksmith's House.unity new file mode 100644 index 00000000..e0715c47 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes/Scene_3D The Blacksmith's House.unity @@ -0,0 +1,360 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 705507994} + m_IndirectSpecularColor: {r: 0.18301778, g: 0.22870243, b: 0.306764, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &705507993 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 705507995} + - component: {fileID: 705507994} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &705507994 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 1 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &705507995 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_LocalRotation: {x: -0.0499014, y: 0.9233421, z: -0.32192957, w: -0.20325015} + m_LocalPosition: {x: 0, y: 12.17, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 37.936, y: 205.796, z: 2.813} +--- !u!1 &963194225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 963194228} + - component: {fileID: 963194227} + - component: {fileID: 963194226} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &963194226 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 +--- !u!20 &963194227 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &963194228 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1806601589 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1388738049783752600, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1733350709616557346, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} + propertyPath: m_Name + value: Smithy + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 4d027cd71b53a234aa91cb080bbc60c2, type: 3} diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes/Scene_3D The Blacksmith's House.unity.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes/Scene_3D The Blacksmith's House.unity.meta new file mode 100644 index 00000000..518d8799 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Scenes/Scene_3D The Blacksmith's House.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3a3a9d862a4f4f3449d1617c18987420 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model.meta new file mode 100644 index 00000000..aa1a380e --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eb036ee7f9308ac428d77c320b92f7aa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model/Smithy.fbx b/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model/Smithy.fbx new file mode 100644 index 00000000..0b1f668b --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model/Smithy.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efdc8c36eb79c8410bad369ac2a3f144bbaa29813543ad5fa824026b3c078f68 +size 131808 diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model/Smithy.fbx.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model/Smithy.fbx.meta new file mode 100644 index 00000000..565bdbda --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Smithy_3D_Model/Smithy.fbx.meta @@ -0,0 +1,106 @@ +fileFormatVersion: 2 +guid: dd6a351acc2491446a00759faf0ee278 +ModelImporter: + serializedVersion: 21300 + internalIDToNameTable: [] + externalObjects: {} + materials: + materialImportMode: 2 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + removeConstantScaleCurves: 1 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + nodeNameCollisionStrategy: 1 + fileIdsGeneration: 2 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + bakeAxisConversion: 0 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + optimizeBones: 1 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVMarginMethod: 1 + secondaryUVMinLightmapResolution: 40 + secondaryUVMinObjectScale: 1 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 2 + humanoidOversampling: 1 + avatarSetup: 0 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + remapMaterialsIfMaterialImportModeIsNone: 0 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures.meta new file mode 100644 index 00000000..afed5a31 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5af6231eab46df742b64d027838aac10 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_AO_2K.tif b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_AO_2K.tif new file mode 100644 index 00000000..afdc51cc Binary files /dev/null and b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_AO_2K.tif differ diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_AO_2K.tif.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_AO_2K.tif.meta new file mode 100644 index 00000000..89500570 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_AO_2K.tif.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: 0e6dbe4bdb219ed43b836c2ff8e3e5e3 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Base_color_2K.tif b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Base_color_2K.tif new file mode 100644 index 00000000..3763e223 Binary files /dev/null and b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Base_color_2K.tif differ diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Base_color_2K.tif.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Base_color_2K.tif.meta new file mode 100644 index 00000000..9e0517a9 --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Base_color_2K.tif.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: b647b1f8c4658be4daee6063f95939bf +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Emissive_2K.tif b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Emissive_2K.tif new file mode 100644 index 00000000..106563b7 Binary files /dev/null and b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Emissive_2K.tif differ diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Emissive_2K.tif.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Emissive_2K.tif.meta new file mode 100644 index 00000000..5025800a --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Emissive_2K.tif.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: eee8f75eb95ddcf438978fe52fae8b5b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Metallic_2K.tif b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Metallic_2K.tif new file mode 100644 index 00000000..462002d6 Binary files /dev/null and b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Metallic_2K.tif differ diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Metallic_2K.tif.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Metallic_2K.tif.meta new file mode 100644 index 00000000..3c5ad99d --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Metallic_2K.tif.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: e67525fcfd98efc4ab602f853e64fc96 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Normal_OpenGL_2K.tif b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Normal_OpenGL_2K.tif new file mode 100644 index 00000000..9d4f81d9 Binary files /dev/null and b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Normal_OpenGL_2K.tif differ diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Normal_OpenGL_2K.tif.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Normal_OpenGL_2K.tif.meta new file mode 100644 index 00000000..af35480d --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Normal_OpenGL_2K.tif.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: 9c8c5c1215da5fc4f945dc9179668319 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 1 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Roughness_2K.tif b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Roughness_2K.tif new file mode 100644 index 00000000..535d57a2 Binary files /dev/null and b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Roughness_2K.tif differ diff --git a/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Roughness_2K.tif.meta b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Roughness_2K.tif.meta new file mode 100644 index 00000000..578d89de --- /dev/null +++ b/Assets/Holy Assets Games/3D The Blacksmith's House/Textures/Smithy_Roughness_2K.tif.meta @@ -0,0 +1,135 @@ +fileFormatVersion: 2 +guid: 2cb4aad537929934384fcc7f88eebacf +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Server + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 00000000..5756f8bd --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f39c3927b44c8d947ba7b14fe9f143ab +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx.meta b/Assets/Plugins/UniRx.meta new file mode 100644 index 00000000..b54039cf --- /dev/null +++ b/Assets/Plugins/UniRx.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b4cf0d83e016a734a95a981e6f95ea84 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples.meta b/Assets/Plugins/UniRx/Examples.meta new file mode 100644 index 00000000..f534230a --- /dev/null +++ b/Assets/Plugins/UniRx/Examples.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 978ae90fe3a2bba4f8dd7ab0f7c029dc +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs b/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs new file mode 100644 index 00000000..0c629da1 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs @@ -0,0 +1,90 @@ +#if !(UNITY_METRO || UNITY_WP8) + +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + +using UnityEngine; + +namespace UniRx.Examples +{ + // sample script, attach your object. + public class Sample01_ObservableWWW : MonoBehaviour + { + void Start() + { + // Basic: Download from google. + { + ObservableWWW.Get("http://google.co.jp/") + .Subscribe( + x => Debug.Log(x.Substring(0, 100)), // onSuccess + ex => Debug.LogException(ex)); // onError + } + + // Linear Pattern with LINQ Query Expressions + // download after google, start bing download + { + var query = from google in ObservableWWW.Get("http://google.com/") + from bing in ObservableWWW.Get("http://bing.com/") + select new { google, bing }; + + var cancel = query.Subscribe(x => Debug.Log(x.google.Substring(0, 100) + ":" + x.bing.Substring(0, 100))); + + // Call Dispose is cancel downloading. + cancel.Dispose(); + } + + // Observable.WhenAll is for parallel asynchronous operation + // (It's like Observable.Zip but specialized for single async operations like Task.WhenAll of .NET 4) + { + var parallel = Observable.WhenAll( + ObservableWWW.Get("http://google.com/"), + ObservableWWW.Get("http://bing.com/"), + ObservableWWW.Get("http://unity3d.com/")); + + parallel.Subscribe(xs => + { + Debug.Log(xs[0].Substring(0, 100)); // google + Debug.Log(xs[1].Substring(0, 100)); // bing + Debug.Log(xs[2].Substring(0, 100)); // unity + }); + } + + // with Progress + { + // notifier for progress + var progressNotifier = new ScheduledNotifier(); + progressNotifier.Subscribe(x => Debug.Log(x)); // write www.progress + + // pass notifier to WWW.Get/Post + ObservableWWW.Get("http://google.com/", progress: progressNotifier).Subscribe(); + } + + // with Error + { + // If WWW has .error, ObservableWWW throws WWWErrorException to onError pipeline. + // WWWErrorException has RawErrorMessage, HasResponse, StatusCode, ResponseHeaders + ObservableWWW.Get("http://www.google.com/404") + .CatchIgnore((WWWErrorException ex) => + { + Debug.Log(ex.RawErrorMessage); + if (ex.HasResponse) + { + Debug.Log(ex.StatusCode); + } + foreach (var item in ex.ResponseHeaders) + { + Debug.Log(item.Key + ":" + item.Value); + } + }) + .Subscribe(); + } + } + } +} + +#endif + +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs.meta b/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs.meta new file mode 100644 index 00000000..7d6e6628 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample01_ObservableWWW.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bf3770fc51ac89f45987dbde37ae81bd +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs b/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs new file mode 100644 index 00000000..c054aedb --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs @@ -0,0 +1,24 @@ +using UnityEngine; +using UniRx.Triggers; // Triggers Namepsace +using System; + +namespace UniRx.Examples +{ + public class Sample02_ObservableTriggers : MonoBehaviour + { + void Start() + { + // Get the plain object + var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); + + // Add ObservableXxxTrigger for handle MonoBehaviour's event as Observable + cube.AddComponent() + .UpdateAsObservable() + .SampleFrame(30) + .Subscribe(x => Debug.Log("cube"), () => Debug.Log("destroy")); + + // destroy after 3 second:) + GameObject.Destroy(cube, 3f); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs.meta b/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs.meta new file mode 100644 index 00000000..af1e4296 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample02_ObservableTriggers.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cb5e978d683e94f4d9c2c81be80f93a7 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs b/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs new file mode 100644 index 00000000..2c0d0e44 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs @@ -0,0 +1,23 @@ +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) + +using UnityEngine; +using UniRx.Triggers; // for enable gameObject.EventAsObservbale() + +namespace UniRx.Examples +{ + public class Sample03_GameObjectAsObservable : MonoBehaviour + { + void Start() + { + // All events can subscribe by ***AsObservable if enables UniRx.Triggers + this.OnMouseDownAsObservable() + .SelectMany(_ => this.gameObject.UpdateAsObservable()) + .TakeUntil(this.gameObject.OnMouseUpAsObservable()) + .Select(_ => Input.mousePosition) + .RepeatUntilDestroy(this) + .Subscribe(x => Debug.Log(x), ()=> Debug.Log("!!!" + "complete")); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs.meta b/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs.meta new file mode 100644 index 00000000..e6cd393f --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample03_GameObjectAsObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 005e349e5ccdd2b47bddc813b81afe40 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs b/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs new file mode 100644 index 00000000..549d8c22 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs @@ -0,0 +1,66 @@ +using System; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample04_ConvertFromUnityCallback : MonoBehaviour + { + // This is about log but more reliable log sample => Sample11_Logger + + private class LogCallback + { + public string Condition; + public string StackTrace; + public UnityEngine.LogType LogType; + } + + static class LogHelper + { + // If static register callback, use Subject for event branching. + +#if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7) + static Subject subject; + + public static IObservable LogCallbackAsObservable() + { + if (subject == null) + { + subject = new Subject(); + + // Publish to Subject in callback + + + UnityEngine.Application.RegisterLogCallback((condition, stackTrace, type) => + { + subject.OnNext(new LogCallback { Condition = condition, StackTrace = stackTrace, LogType = type }); + }); + } + + return subject.AsObservable(); + } + +#else + // If standard evetns, you can use Observable.FromEvent. + + public static IObservable LogCallbackAsObservable() + { + return Observable.FromEvent( + h => (condition, stackTrace, type) => h(new LogCallback { Condition = condition, StackTrace = stackTrace, LogType = type }), + h => Application.logMessageReceived += h, h => Application.logMessageReceived -= h); + } +#endif + } + + void Awake() + { + // method is separatable and composable + LogHelper.LogCallbackAsObservable() + .Where(x => x.LogType == LogType.Warning) + .Subscribe(x => Debug.Log(x)); + + LogHelper.LogCallbackAsObservable() + .Where(x => x.LogType == LogType.Error) + .Subscribe(x => Debug.Log(x)); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs.meta b/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs.meta new file mode 100644 index 00000000..939ce3f8 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample04_ConvertFromUnityCallback.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 73e69fd4bbb724045a4e06050fbc5af3 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs b/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs new file mode 100644 index 00000000..8c5a37a3 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections; +using System.Threading; +using UnityEngine; +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + +namespace UniRx.Examples +{ + public class Sample05_ConvertFromCoroutine + { + // public method + public static IObservable GetWWW(string url) + { + // convert coroutine to IObservable + return Observable.FromCoroutine((observer, cancellationToken) => GetWWWCore(url, observer, cancellationToken)); + } + + // IEnumerator with callback + static IEnumerator GetWWWCore(string url, IObserver observer, CancellationToken cancellationToken) + { + var www = new UnityEngine.WWW(url); + while (!www.isDone && !cancellationToken.IsCancellationRequested) + { + yield return null; + } + + if (cancellationToken.IsCancellationRequested) yield break; + + if (www.error != null) + { + observer.OnError(new Exception(www.error)); + } + else + { + observer.OnNext(www.text); + observer.OnCompleted(); + } + } + } +} +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs.meta b/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs.meta new file mode 100644 index 00000000..4814acae --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample05_ConvertFromCoroutine.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 41f3df73f7da66b4980f6d9a86927796 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs b/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs new file mode 100644 index 00000000..e7ec1da9 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample06_ConvertToCoroutine : MonoBehaviour + { + // convert IObservable to Coroutine + void Start() + { + StartCoroutine(ComplexCoroutineTest()); + } + + IEnumerator ComplexCoroutineTest() + { + yield return new WaitForSeconds(1); + + var v = default(int); + yield return Observable.Range(1, 10).StartAsCoroutine(x => v = x); + + Debug.Log(v); // 10(callback is last value) + yield return new WaitForSeconds(3); + + yield return Observable.Return(100).StartAsCoroutine(x => v = x); + + Debug.Log(v); // 100 + } + + // Note:ToAwaitableEnumerator/StartAsCoroutine/LazyTask are obsolete way on Unity 5.3 + // You can use ToYieldInstruction. + +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + + IEnumerator TestNewCustomYieldInstruction() + { + // wait Rx Observable. + yield return Observable.Timer(TimeSpan.FromSeconds(1)).ToYieldInstruction(); + + // you can change the scheduler(this is ignore Time.scale) + yield return Observable.Timer(TimeSpan.FromSeconds(1), Scheduler.MainThreadIgnoreTimeScale).ToYieldInstruction(); + + // get return value from ObservableYieldInstruction + var o = ObservableWWW.Get("http://unity3d.com/").ToYieldInstruction(throwOnError: false); + yield return o; + + if (o.HasError) { Debug.Log(o.Error.ToString()); } + if (o.HasResult) { Debug.Log(o.Result); } + + // other sample(wait until transform.position.y >= 100) + yield return this.ObserveEveryValueChanged(x => x.transform).FirstOrDefault(x => x.position.y >= 100).ToYieldInstruction(); + } +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif +#endif + + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs.meta b/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs.meta new file mode 100644 index 00000000..70a1bb72 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample06_ConvertToCoroutine.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5da8247fbc4a4c84e96a727b44903214 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs b/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs new file mode 100644 index 00000000..fa0fcdc2 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs @@ -0,0 +1,45 @@ +#pragma warning disable 0168 +#pragma warning disable 0219 + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample07_OrchestratIEnumerator : MonoBehaviour + { + // two coroutines + IEnumerator AsyncA() + { + Debug.Log("a start"); + yield return new WaitForSeconds(3); + Debug.Log("a end"); + } + + IEnumerator AsyncB() + { + Debug.Log("b start"); + yield return new WaitForEndOfFrame(); + Debug.Log("b end"); + } + + void Start() + { + // after completed AsyncA, run AsyncB as continuous routine. + // UniRx expands SelectMany(IEnumerator) as SelectMany(IEnumerator.ToObservable()) + var cancel = Observable.FromCoroutine(AsyncA) + .SelectMany(AsyncB) + .Subscribe(); + + // If you want to stop Coroutine(as cancel), call subscription.Dispose() + // cancel.Dispose(); + } + } +} + +#pragma warning restore 0219 +#pragma warning restore 0168 \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs.meta b/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs.meta new file mode 100644 index 00000000..8ed09860 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample07_OrchestratIEnumerator.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d437607dfffa8ff428bda3366354078d +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs b/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs new file mode 100644 index 00000000..1c880ed4 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample08_DetectDoubleClick : MonoBehaviour + { + void Start() + { + // Global event handling is very useful. + // UniRx can handle there events. + // Observable.EveryUpdate/EveryFixedUpdate/EveryEndOfFrame + // Observable.EveryApplicationFocus/EveryApplicationPause + // Observable.OnceApplicationQuit + + // This DoubleCLick Sample is from + // The introduction to Reactive Programming you've been missing + // https://gist.github.com/staltz/868e7e9bc2a7b8c1f754 + + var clickStream = Observable.EveryUpdate() + .Where(_ => Input.GetMouseButtonDown(0)); + + clickStream.Buffer(clickStream.Throttle(TimeSpan.FromMilliseconds(250))) + .Where(xs => xs.Count >= 2) + .Subscribe(xs => Debug.Log("DoubleClick Detected! Count:" + xs.Count)); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs.meta b/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs.meta new file mode 100644 index 00000000..84cf0d13 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample08_DetectDoubleClick.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: eb801bbfb1ffcd64389e90c8f2435b79 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs b/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs new file mode 100644 index 00000000..8ccd1dba --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs @@ -0,0 +1,69 @@ +#pragma warning disable 0067 + +using System; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample09_EventHandling : MonoBehaviour + { + public class MyEventArgs : EventArgs + { + public int MyProperty { get; set; } + } + + public event EventHandler FooBar; + public event Action FooFoo; + + CompositeDisposable disposables = new CompositeDisposable(); + + // Subject is Rx's native event expression and recommend way for use Rx as event. + // Subject.OnNext as fire event, + // expose IObserver is subscibable for external source, it's no need convert. + Subject onBarBar = new Subject(); + public IObservable OnBarBar { get { return onBarBar; } } + + void Start() + { + // convert to IO as (sender, eventArgs) + Observable.FromEventPattern, MyEventArgs>( + h => h.Invoke, h => FooBar += h, h => FooBar -= h) + .Subscribe() + .AddTo(disposables); // IDisposable can add to collection easily by AddTo + + // convert to IO, many situation this is useful than FromEventPattern + Observable.FromEvent, MyEventArgs>( + h => (sender, e) => h(e), h => FooBar += h, h => FooBar -= h) + .Subscribe() + .AddTo(disposables); + + // You can convert Action like event. + Observable.FromEvent( + h => FooFoo += h, h => FooFoo -= h) + .Subscribe() + .AddTo(disposables); + + // AOT Safe EventHandling, use dummy capture, see:https://github.com/neuecc/UniRx/wiki/AOT-Exception-Patterns-and-Hacks + var capture = 0; + Observable.FromEventPattern, MyEventArgs>(h => + { + capture.GetHashCode(); // dummy for AOT + return new EventHandler(h); + }, h => FooBar += h, h => FooBar -= h) + .Subscribe() + .AddTo(disposables); + + // Subject as like event. + OnBarBar.Subscribe().AddTo(disposables); + onBarBar.OnNext(1); // fire event + } + + void OnDestroy() + { + // manage subscription lifecycle + disposables.Dispose(); + } + } +} + +#pragma warning restore 0067 \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs.meta b/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs.meta new file mode 100644 index 00000000..5da8ac74 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample09_EventHandling.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 95140e49213aa6f49a470a81873b87c0 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs b/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs new file mode 100644 index 00000000..b2cafef4 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample10_MainThreadDispatcher + { + public void Run() + { + // MainThreadDispatcher is heart of Rx and Unity integration + + // StartCoroutine can start coroutine besides MonoBehaviour. + MainThreadDispatcher.StartCoroutine(TestAsync()); + + // We have two way of run coroutine, FromCoroutine or StartCoroutine. + // StartCoroutine is Unity primitive way and it's awaitable by yield return. + // FromCoroutine is Rx, it's composable and cancellable by subscription's IDisposable. + // FromCoroutine's overload can have return value, see:Sample05_ConvertFromCoroutine + Observable.FromCoroutine(TestAsync).Subscribe(); + + // Add Action to MainThreadDispatcher. Action is saved queue, run on next update. + MainThreadDispatcher.Post(_ => Debug.Log("test"), null); + + // Timebased operations is run on MainThread(as default) + // All timebased operation(Interval, Timer, Delay, Buffer, etc...)is single thread, thread safe! + Observable.Interval(TimeSpan.FromSeconds(1)) + .Subscribe(x => Debug.Log(x)); + + // Observable.Start use ThreadPool Scheduler as default. + // ObserveOnMainThread return to mainthread + Observable.Start(() => Unit.Default) // asynchronous work + .ObserveOnMainThread() + .Subscribe(x => Debug.Log(x)); + } + + IEnumerator TestAsync() + { + Debug.Log("a"); + yield return new WaitForSeconds(1); + Debug.Log("b"); + yield return new WaitForSeconds(1); + Debug.Log("c"); + yield return new WaitForSeconds(1); + Debug.Log("d"); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs.meta b/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs.meta new file mode 100644 index 00000000..fbbee224 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample10_MainThreadDispatcher.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6a0b959735346af48b772254afc8afdd +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs b/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs new file mode 100644 index 00000000..8de54d56 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections; +using UniRx.Diagnostics; +using UnityEngine; + +namespace UniRx.Examples +{ + public class Sample11_Logger + { + // UniRx.Diagnostics.Logger + // logger is threadsafe, define per class with name. + static readonly UniRx.Diagnostics.Logger logger = new UniRx.Diagnostics.Logger("Sample11"); + + // call once at applicationinit + public void ApplicationInitialize() + { + // Log as Stream, UniRx.Diagnostics.ObservableLogger.Listener is IObservable + // You can subscribe and output to any place. + ObservableLogger.Listener.LogToUnityDebug(); + + // for example, filter only Exception and upload to web. + // (make custom sink(IObserver) is better to use) + ObservableLogger.Listener + .Where(x => x.LogType == LogType.Exception) + .Subscribe(x => + { + // ObservableWWW.Post("", null).Subscribe(); + }); + } + + public void Run() + { + // Debug is write only DebugBuild. + logger.Debug("Debug Message"); + + // or other logging methods + logger.Log("Message"); + logger.Exception(new Exception("test exception")); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs.meta b/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs.meta new file mode 100644 index 00000000..0e5f69fa --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample11_Logger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f5aa72c61e2548a4bac4d65f93c63bf1 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample12Scene.unity b/Assets/Plugins/UniRx/Examples/Sample12Scene.unity new file mode 100644 index 00000000..dd99029c --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample12Scene.unity @@ -0,0 +1,1535 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_GIWorkflowMode: 0 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: 0.16666667 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &33721919 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 33721920} + - 223: {fileID: 33721924} + - 114: {fileID: 33721923} + - 114: {fileID: 33721922} + - 114: {fileID: 33721921} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &33721920 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 921642174} + - {fileID: 530746210} + - {fileID: 46704896} + - {fileID: 579875960} + - {fileID: 1891604357} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &33721921 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 18e34490a83a27e44adf93dd4ffd1f22, type: 3} + m_Name: + m_EditorClassIdentifier: + MyButton: {fileID: 921642175} + MyToggle: {fileID: 530746211} + MyInput: {fileID: 46704897} + MyText: {fileID: 579875961} + MySlider: {fileID: 1891604358} + IntRxProp: + value: 0 +--- !u!114 &33721922 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &33721923 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &33721924 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 33721919} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!1 &46704895 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 46704896} + - 222: {fileID: 46704899} + - 114: {fileID: 46704898} + - 114: {fileID: 46704897} + m_Layer: 5 + m_Name: InputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &46704896 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46704895} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 835857415} + - {fileID: 710358450} + m_Father: {fileID: 33721920} + m_RootOrder: 2 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 277} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &46704897 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46704895} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 46704898} + m_TextComponent: {fileID: 710358451} + m_Placeholder: {fileID: 835857416} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 1.7 + m_CaretWidth: 1 + m_ReadOnly: 0 +--- !u!114 &46704898 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46704895} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &46704899 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 46704895} +--- !u!1 &163238468 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 163238469} + - 222: {fileID: 163238471} + - 114: {fileID: 163238470} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &163238469 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 163238468} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1018308463} + m_RootOrder: 0 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &163238470 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 163238468} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &163238471 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 163238468} +--- !u!1 &530746209 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 530746210} + - 114: {fileID: 530746211} + m_Layer: 5 + m_Name: Toggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &530746210 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 530746209} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1018308463} + - {fileID: 1527674668} + m_Father: {fileID: 33721920} + m_RootOrder: 1 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -160, y: 294} + m_SizeDelta: {x: 160, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &530746211 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 530746209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 2109663825, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1018308464} + toggleTransition: 1 + graphic: {fileID: 163238470} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_IsOn: 0 +--- !u!1 &579875959 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 579875960} + - 222: {fileID: 579875962} + - 114: {fileID: 579875961} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &579875960 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 579875959} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 33721920} + m_RootOrder: 3 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 178} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &579875961 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 579875959} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: New Text +--- !u!222 &579875962 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 579875959} +--- !u!1 &605953354 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 605953355} + m_Layer: 5 + m_Name: Handle Slide Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &605953355 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 605953354} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1022847601} + m_Father: {fileID: 1891604357} + m_RootOrder: 2 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &710358449 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 710358450} + - 222: {fileID: 710358452} + - 114: {fileID: 710358451} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &710358450 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 710358449} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 46704896} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &710358451 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 710358449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!222 &710358452 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 710358449} +--- !u!1 &801653541 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 801653542} + - 222: {fileID: 801653544} + - 114: {fileID: 801653543} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &801653542 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 801653541} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1891604357} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &801653543 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 801653541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &801653544 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 801653541} +--- !u!1 &835857414 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 835857415} + - 222: {fileID: 835857417} + - 114: {fileID: 835857416} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &835857415 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 835857414} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 46704896} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &835857416 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 835857414} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 2 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enter text... +--- !u!222 &835857417 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 835857414} +--- !u!1 &921642173 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 921642174} + - 222: {fileID: 921642177} + - 114: {fileID: 921642176} + - 114: {fileID: 921642175} + m_Layer: 5 + m_Name: Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &921642174 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 921642173} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1781955689} + m_Father: {fileID: 33721920} + m_RootOrder: 0 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -171, y: 218} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &921642175 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 921642173} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 921642176} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &921642176 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 921642173} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &921642177 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 921642173} +--- !u!1 &930565829 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 930565830} + - 222: {fileID: 930565832} + - 114: {fileID: 930565831} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &930565830 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 930565829} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1807094062} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 10, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &930565831 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 930565829} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &930565832 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 930565829} +--- !u!1 &1018308462 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1018308463} + - 222: {fileID: 1018308465} + - 114: {fileID: 1018308464} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1018308463 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1018308462} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 163238469} + m_Father: {fileID: 530746210} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1018308464 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1018308462} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1018308465 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1018308462} +--- !u!1 &1022847600 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1022847601} + - 222: {fileID: 1022847603} + - 114: {fileID: 1022847602} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1022847601 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1022847600} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 605953355} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1022847602 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1022847600} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1022847603 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1022847600} +--- !u!1 &1184379970 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1184379974} + - 114: {fileID: 1184379973} + - 114: {fileID: 1184379972} + - 114: {fileID: 1184379971} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1184379971 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1184379970} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ForceModuleActive: 0 +--- !u!114 &1184379972 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1184379970} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1184379973 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1184379970} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &1184379974 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1184379970} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!1 &1527674667 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1527674668} + - 222: {fileID: 1527674670} + - 114: {fileID: 1527674669} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1527674668 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1527674667} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 530746210} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1527674669 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1527674667} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Toggle +--- !u!222 &1527674670 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1527674667} +--- !u!1 &1781955688 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1781955689} + - 222: {fileID: 1781955691} + - 114: {fileID: 1781955690} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1781955689 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1781955688} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 921642174} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1781955690 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1781955688} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Button +--- !u!222 &1781955691 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1781955688} +--- !u!1 &1807094061 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1807094062} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1807094062 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1807094061} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 930565830} + m_Father: {fileID: 1891604357} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: -5, y: 0} + m_SizeDelta: {x: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1838497716 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1838497721} + - 20: {fileID: 1838497720} + - 92: {fileID: 1838497719} + - 124: {fileID: 1838497718} + - 81: {fileID: 1838497717} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1838497717 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_Enabled: 1 +--- !u!124 &1838497718 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_Enabled: 1 +--- !u!92 &1838497719 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_Enabled: 1 +--- !u!20 &1838497720 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &1838497721 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1838497716} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &1891604356 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1891604357} + - 114: {fileID: 1891604358} + m_Layer: 5 + m_Name: Slider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1891604357 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1891604356} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 801653542} + - {fileID: 1807094062} + - {fileID: 605953355} + m_Father: {fileID: 33721920} + m_RootOrder: 4 + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 102} + m_SizeDelta: {x: 160, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1891604358 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1891604356} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -113659843, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1022847602} + m_FillRect: {fileID: 930565830} + m_HandleRect: {fileID: 1022847601} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 1 + m_WholeNumbers: 0 + m_Value: 1 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Slider+SliderEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null diff --git a/Assets/Plugins/UniRx/Examples/Sample12Scene.unity.meta b/Assets/Plugins/UniRx/Examples/Sample12Scene.unity.meta new file mode 100644 index 00000000..31b9df75 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample12Scene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a4aea8df1ad11c47a1db84432dd30f8 +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs b/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs new file mode 100644 index 00000000..e1e7d565 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs @@ -0,0 +1,77 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; +using UnityEngine; +using UnityEngine.UI; + +namespace UniRx.Examples +{ + public class Sample12_ReactiveProperty : MonoBehaviour + { + // Open Sample12Scene. Set from canvas + public Button MyButton; + public Toggle MyToggle; + public InputField MyInput; + public Text MyText; + public Slider MySlider; + + // You can monitor/modifie in inspector by SpecializedReactiveProperty + public IntReactiveProperty IntRxProp = new IntReactiveProperty(); + + Enemy enemy = new Enemy(1000); + + void Start() + { + // UnityEvent as Observable + // (shortcut, MyButton.OnClickAsObservable()) + MyButton.onClick.AsObservable().Subscribe(_ => enemy.CurrentHp.Value -= 99); + + // Toggle, Input etc as Observable(OnValueChangedAsObservable is helper for provide isOn value on subscribe) + // SubscribeToInteractable is UniRx.UI Extension Method, same as .interactable = x) + MyToggle.OnValueChangedAsObservable().SubscribeToInteractable(MyButton); + + // input shows delay after 1 second +#if !(UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) + MyInput.OnValueChangedAsObservable() +#else + MyInput.OnValueChangeAsObservable() +#endif + .Where(x => x != null) + .Delay(TimeSpan.FromSeconds(1)) + .SubscribeToText(MyText); // SubscribeToText is UniRx.UI Extension Method + + // converting for human visibility + MySlider.OnValueChangedAsObservable() + .SubscribeToText(MyText, x => Math.Round(x, 2).ToString()); + + // from RxProp, CurrentHp changing(Button Click) is observable + enemy.CurrentHp.SubscribeToText(MyText); + enemy.IsDead.Where(isDead => isDead == true) + .Subscribe(_ => + { + MyToggle.interactable = MyButton.interactable = false; + }); + + // initial text:) + IntRxProp.SubscribeToText(MyText); + } + } + + // Reactive Notification Model + public class Enemy + { + public IReactiveProperty CurrentHp { get; private set; } + + public IReadOnlyReactiveProperty IsDead { get; private set; } + + public Enemy(int initialHp) + { + // Declarative Property + CurrentHp = new ReactiveProperty(initialHp); + IsDead = CurrentHp.Select(x => x <= 0).ToReactiveProperty(); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs.meta b/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs.meta new file mode 100644 index 00000000..a56cee3d --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample12_ReactiveProperty.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 18e34490a83a27e44adf93dd4ffd1f22 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample13Scene.unity b/Assets/Plugins/UniRx/Examples/Sample13Scene.unity new file mode 100644 index 00000000..169248ed --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13Scene.unity @@ -0,0 +1,1300 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +SceneSettings: + m_ObjectHideFlags: 0 + m_PVSData: + m_PVSObjectsArray: [] + m_PVSPortalsArray: [] + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} +--- !u!157 &4 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 6 + m_GIWorkflowMode: 0 + m_LightmapsMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 3 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AOMaxDistance: 1 + m_Padding: 2 + m_CompAOExponent: 0 + m_LightmapParameters: {fileID: 0} + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherRayCount: 1024 + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &5 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + accuratePlacement: 0 + minRegionArea: 2 + cellSize: 0.16666667 + manualCellSize: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &48390799 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 48390800} + - 222: {fileID: 48390802} + - 114: {fileID: 48390801} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &48390800 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 48390799} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2136645852} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &48390801 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 48390799} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Clear Checked +--- !u!222 &48390802 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 48390799} +--- !u!1 &80191139 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 80191140} + - 114: {fileID: 80191141} + m_Layer: 5 + m_Name: TodoList + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &80191140 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 80191139} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 625561981} + m_RootOrder: 2 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0.000030517578, y: -864} + m_SizeDelta: {x: 0, y: 744} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &80191141 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 80191139} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 +--- !u!1 &300470760 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 300470761} + - 114: {fileID: 300470762} + m_Layer: 0 + m_Name: ToDoScene + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &300470761 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 300470760} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 895588078} + m_Father: {fileID: 0} + m_RootOrder: 1 +--- !u!114 &300470762 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 300470760} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 022ecfa555367154c8cf87d61465f7e2, type: 3} + m_Name: + m_EditorClassIdentifier: + Title: {fileID: 852345258} + ToDoInput: {fileID: 566049662} + AddButton: {fileID: 611575448} + ClearButton: {fileID: 2136645853} + TodoList: {fileID: 80191139} + SampleItemPrefab: {fileID: 182208, guid: 173222196f3e1f0448b383f260df7d44, type: 2} +--- !u!1 &448872075 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 448872079} + - 114: {fileID: 448872078} + - 114: {fileID: 448872077} + - 114: {fileID: 448872076} + - 114: {fileID: 448872080} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &448872076 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ForceModuleActive: 0 +--- !u!114 &448872077 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &448872078 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &448872079 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 +--- !u!114 &448872080 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 448872075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!1 &566049660 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 566049661} + - 222: {fileID: 566049664} + - 114: {fileID: 566049663} + - 114: {fileID: 566049662} + m_Layer: 5 + m_Name: ToDoInput + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &566049661 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 566049660} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2102338788} + - {fileID: 1368145207} + m_Father: {fileID: 650625965} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &566049662 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 566049660} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 575553740, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 566049663} + m_TextComponent: {fileID: 1368145205} + m_Placeholder: {fileID: 2102338789} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 1.7 + m_CaretWidth: 1 + m_ReadOnly: 0 +--- !u!114 &566049663 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 566049660} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &566049664 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 566049660} +--- !u!1 &611575446 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 611575447} + - 222: {fileID: 611575450} + - 114: {fileID: 611575449} + - 114: {fileID: 611575448} + m_Layer: 5 + m_Name: AddButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &611575447 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 611575446} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 721405894} + m_Father: {fileID: 650625965} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &611575448 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 611575446} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 611575449} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &611575449 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 611575446} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &611575450 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 611575446} +--- !u!1 &625561980 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 625561981} + - 222: {fileID: 625561983} + - 114: {fileID: 625561982} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &625561981 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 625561980} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 852345257} + - {fileID: 650625965} + - {fileID: 80191140} + m_Father: {fileID: 895588078} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &625561982 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 625561980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &625561983 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 625561980} +--- !u!1 &650625964 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 650625965} + - 114: {fileID: 650625966} + m_Layer: 5 + m_Name: InputArea + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &650625965 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650625964} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 566049661} + - {fileID: 611575447} + - {fileID: 2136645852} + m_Father: {fileID: 625561981} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 50} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &650625966 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650625964} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -405508275, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 +--- !u!1 &721405893 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 721405894} + - 222: {fileID: 721405896} + - 114: {fileID: 721405895} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &721405894 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 721405893} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 611575447} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &721405895 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 721405893} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Add +--- !u!222 &721405896 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 721405893} +--- !u!1 &852345256 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 852345257} + - 222: {fileID: 852345259} + - 114: {fileID: 852345258} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &852345257 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 852345256} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 625561981} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 120} + m_Pivot: {x: 0, y: 1} +--- !u!114 &852345258 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 852345256} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: TODO App:) +--- !u!222 &852345259 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 852345256} +--- !u!1 &895588077 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 895588078} + - 223: {fileID: 895588081} + - 114: {fileID: 895588080} + - 114: {fileID: 895588079} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &895588078 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 895588077} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 625561981} + m_Father: {fileID: 300470761} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &895588079 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 895588077} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &895588080 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 895588077} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &895588081 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 895588077} + m_Enabled: 1 + serializedVersion: 2 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!1 &1368145204 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 1368145207} + - 222: {fileID: 1368145206} + - 114: {fileID: 1368145205} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1368145205 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1368145204} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!222 &1368145206 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1368145204} +--- !u!224 &1368145207 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1368145204} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 566049661} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &2074703090 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2074703095} + - 20: {fileID: 2074703094} + - 92: {fileID: 2074703093} + - 124: {fileID: 2074703092} + - 81: {fileID: 2074703091} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &2074703091 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_Enabled: 1 +--- !u!124 &2074703092 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_Enabled: 1 +--- !u!92 &2074703093 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_Enabled: 1 +--- !u!20 &2074703094 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &2074703095 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2074703090} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!1 &2102338787 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 2102338788} + - 222: {fileID: 2102338790} + - 114: {fileID: 2102338789} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2102338788 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2102338787} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 566049661} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2102338789 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2102338787} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 2 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: What needs to be done? +--- !u!222 &2102338790 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2102338787} +--- !u!1 &2136645851 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 224: {fileID: 2136645852} + - 222: {fileID: 2136645855} + - 114: {fileID: 2136645854} + - 114: {fileID: 2136645853} + m_Layer: 5 + m_Name: ClearButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2136645852 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2136645851} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 48390800} + m_Father: {fileID: 650625965} + m_RootOrder: 2 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2136645853 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2136645851} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2136645854} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &2136645854 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2136645851} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &2136645855 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2136645851} diff --git a/Assets/Plugins/UniRx/Examples/Sample13Scene.unity.meta b/Assets/Plugins/UniRx/Examples/Sample13Scene.unity.meta new file mode 100644 index 00000000..21bef33d --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13Scene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b879645f640b02b43a8e78e210c1da1f +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs b/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs new file mode 100644 index 00000000..159e9327 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs @@ -0,0 +1,68 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System.Linq; +using UnityEngine; +using UnityEngine.UI; +using System.Collections; +using UnityEngine.EventSystems; + +namespace UniRx.Examples +{ + public class Sample13_ToDoApp : MonoBehaviour + { + // Open Sample13Scene. Set from canvas + public Text Title; + public InputField ToDoInput; + public Button AddButton; + public Button ClearButton; + public GameObject TodoList; + + // prefab:) + public GameObject SampleItemPrefab; + + ReactiveCollection toDos = new ReactiveCollection(); + + void Start() + { + // merge Button click and push enter key on input field. + var submit = Observable.Merge( + AddButton.OnClickAsObservable().Select(_ => ToDoInput.text), + ToDoInput.OnEndEditAsObservable().Where(_ => Input.GetKeyDown(KeyCode.Return))); + + // add to reactive collection + submit.Where(x => x != "") + .Subscribe(x => + { + ToDoInput.text = ""; // clear input field + var item = Instantiate(SampleItemPrefab) as GameObject; + (item.GetComponentInChildren(typeof(Text)) as Text).text = x; + toDos.Add(item); + }); + + // Collection Change Handling + toDos.ObserveCountChanged().Subscribe(x => Title.text = "TODO App, ItemCount:" + x); + toDos.ObserveAdd().Subscribe(x => + { + x.Value.transform.SetParent(TodoList.transform, false); + }); + toDos.ObserveRemove().Subscribe(x => + { + GameObject.Destroy(x.Value); + }); + + // Clear + ClearButton.OnClickAsObservable() + .Subscribe(_ => + { + var removeTargets = toDos.Where(x => x.GetComponent().isOn).ToArray(); + foreach (var item in removeTargets) + { + toDos.Remove(item); + } + }); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs.meta b/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs.meta new file mode 100644 index 00000000..aaef6265 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13_ToDoApp.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 022ecfa555367154c8cf87d61465f7e2 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/Sample13_ToDoItem.prefab b/Assets/Plugins/UniRx/Examples/Sample13_ToDoItem.prefab new file mode 100644 index 00000000..1a976a17 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13_ToDoItem.prefab @@ -0,0 +1,284 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &152834 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22461494} + - 222: {fileID: 22298102} + - 114: {fileID: 11434412} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &172388 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22491898} + - 222: {fileID: 22251748} + - 114: {fileID: 11438756} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &174974 +GameObject: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22463654} + - 222: {fileID: 22278786} + - 114: {fileID: 11497312} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &182208 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 224: {fileID: 22478562} + - 114: {fileID: 11479148} + m_Layer: 5 + m_Name: Sample13_ToDoItem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &11434412 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152834} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!114 &11438756 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172388} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'TODOITEM + +' +--- !u!114 &11479148 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 182208} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 2109663825, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1} + m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} + m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} + m_ColorMultiplier: 1 + m_FadeDuration: .100000001 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 11434412} + toggleTransition: 1 + graphic: {fileID: 11497312} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Toggle+ToggleEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null + m_IsOn: 1 +--- !u!114 &11497312 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 174974} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &22251748 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172388} +--- !u!222 &22278786 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 174974} +--- !u!222 &22298102 +CanvasRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152834} +--- !u!224 &22461494 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 152834} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 22463654} + m_Father: {fileID: 22478562} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 30} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22463654 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 174974} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 22461494} + m_RootOrder: 0 + m_AnchorMin: {x: .5, y: .5} + m_AnchorMax: {x: .5, y: .5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 30} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22478562 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 182208} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 22461494} + - {fileID: 22491898} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: .5, y: .5} +--- !u!224 &22491898 +RectTransform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172388} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 22478562} + m_RootOrder: 1 + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: .5, y: .5} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 182208} + m_IsPrefabParent: 1 diff --git a/Assets/Plugins/UniRx/Examples/Sample13_ToDoItem.prefab.meta b/Assets/Plugins/UniRx/Examples/Sample13_ToDoItem.prefab.meta new file mode 100644 index 00000000..a80d47b9 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/Sample13_ToDoItem.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 173222196f3e1f0448b383f260df7d44 +timeCreated: 1455373909 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef b/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef new file mode 100644 index 00000000..04b178bf --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef @@ -0,0 +1,12 @@ +{ + "name": "UniRx.Examples", + "references": [ + "UniRx" + ], + "optionalUnityReferences": [ + "TestAssemblies" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef.meta b/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef.meta new file mode 100644 index 00000000..0380f9f9 --- /dev/null +++ b/Assets/Plugins/UniRx/Examples/UniRx.Examples.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 71799519d12379b49b6b53aea974bea5 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/ReadMe.txt b/Assets/Plugins/UniRx/ReadMe.txt new file mode 100644 index 00000000..3057658d --- /dev/null +++ b/Assets/Plugins/UniRx/ReadMe.txt @@ -0,0 +1,29 @@ +UniRx - Reactive Extensions for Unity / Ver 6.2.2 +=== +Created by Yoshifumi Kawai(neuecc) + +UniRx (Reactive Extensions for Unity) is a reimplementation of the .NET Reactive Extensions. +UniRx is Core Library (Port of Rx) + Platform Adaptor (MainThreadScheduler/FromCoroutine/etc) + Framework (ObservableTriggers/ReactiveProeperty/etc) + async/await integration(UniRx.Async) + +Please read Official Site's ReadMe(Manual) - https://github.com/neuecc/UniRx/ + +UniRx is available on the Unity Asset Store (FREE) - http://u3d.as/content/neuecc/uni-rx-reactive-extensions-for-unity/7tT +Blog for update info - https://medium.com/@neuecc + +Support thread on the Unity Forums: Ask me any question - http://forum.unity3d.com/threads/248535-UniRx-Reactive-Extensions-for-Unity +Release Notes, see [UniRx/releases](https://github.com/neuecc/UniRx/releases) + +Author Info +--- +Yoshifumi Kawai(a.k.a. neuecc) is a software developer in Japan. +He is awarding Microsoft MVP for Visual C# since 2011. + +Blog: https://medium.com/@neuecc (English) +Blog: http://neue.cc/ (Japanese) +Twitter: https://twitter.com/neuecc (Japanese) + +License +--- +This library is under the [MIT License](https://github.com/neuecc/UniRx/blob/master/LICENSE). + +Some code is borrowed from [Rx.NET](https://rx.codeplex.com/) and [mono/mcs](https://github.com/mono/mono). diff --git a/Assets/Plugins/UniRx/ReadMe.txt.meta b/Assets/Plugins/UniRx/ReadMe.txt.meta new file mode 100644 index 00000000..cc7c5166 --- /dev/null +++ b/Assets/Plugins/UniRx/ReadMe.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 52d665ea30c2a3a49a6fa4b3b5a0349a +timeCreated: 1455373909 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts.meta b/Assets/Plugins/UniRx/Scripts.meta new file mode 100644 index 00000000..31d66f2a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: eaf9ac9937118834c86197511fd5317f +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Asynchronous.meta b/Assets/Plugins/UniRx/Scripts/Asynchronous.meta new file mode 100644 index 00000000..41660a7e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Asynchronous.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c490b3110ff2a524ea963382652a378f +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs b/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs new file mode 100644 index 00000000..b493bc3b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading; + +namespace UniRx +{ + public static class WebRequestExtensions + { + static IObservable AbortableDeferredAsyncRequest(Func begin, Func end, WebRequest request) + { + var result = Observable.Create(observer => + { + var isCompleted = -1; + var subscription = Observable.FromAsyncPattern(begin, + ar => + { + try + { + Interlocked.Increment(ref isCompleted); + return end(ar); + } + catch (WebException ex) + { + if (ex.Status == WebExceptionStatus.RequestCanceled) return default(TResult); + throw; + } + })() + .Subscribe(observer); + return Disposable.Create(() => + { + if (Interlocked.Increment(ref isCompleted) == 0) + { + subscription.Dispose(); + request.Abort(); + } + }); + }); + + return result; + } + + public static IObservable GetResponseAsObservable(this WebRequest request) + { + return AbortableDeferredAsyncRequest(request.BeginGetResponse, request.EndGetResponse, request); + } + + public static IObservable GetResponseAsObservable(this HttpWebRequest request) + { + return AbortableDeferredAsyncRequest(request.BeginGetResponse, ar => (HttpWebResponse)request.EndGetResponse(ar), request); + } + + public static IObservable GetRequestStreamAsObservable(this WebRequest request) + { + return AbortableDeferredAsyncRequest(request.BeginGetRequestStream, request.EndGetRequestStream, request); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs.meta new file mode 100644 index 00000000..58d87188 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Asynchronous/WebRequestExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 457f0007b2c70e34e9929ec8f0e2c4e6 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables.meta b/Assets/Plugins/UniRx/Scripts/Disposables.meta new file mode 100644 index 00000000..4070ff20 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d061218ef48281148bb1a996d971bdbe +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs new file mode 100644 index 00000000..4069a842 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections; + +namespace UniRx +{ + public sealed class BooleanDisposable : IDisposable, ICancelable + { + public bool IsDisposed { get; private set; } + + public BooleanDisposable() + { + + } + + internal BooleanDisposable(bool isDisposed) + { + IsDisposed = isDisposed; + } + + public void Dispose() + { + if (!IsDisposed) IsDisposed = true; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs.meta new file mode 100644 index 00000000..77fe320b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/BooleanDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4ff95c6eb380ca248984d8c27c1244d0 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs new file mode 100644 index 00000000..abf2189c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs @@ -0,0 +1,67 @@ +// original code from GitHub Reactive-Extensions/Rx.NET +// some modified. + +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +#if (NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0) + +using System; +using System.Threading; + +namespace UniRx +{ + /// + /// Represents a disposable resource that has an associated that will be set to the cancellation requested state upon disposal. + /// + public sealed class CancellationDisposable : ICancelable + { + private readonly CancellationTokenSource _cts; + + /// + /// Initializes a new instance of the class that uses an existing . + /// + /// used for cancellation. + /// is null. + public CancellationDisposable(CancellationTokenSource cts) + { + if (cts == null) + throw new ArgumentNullException("cts"); + + _cts = cts; + } + + /// + /// Initializes a new instance of the class that uses a new . + /// + public CancellationDisposable() + : this(new CancellationTokenSource()) + { + } + + /// + /// Gets the used by this CancellationDisposable. + /// + public CancellationToken Token + { + get { return _cts.Token; } + } + + /// + /// Cancels the underlying . + /// + public void Dispose() + { + _cts.Cancel(); + } + + /// + /// Gets a value that indicates whether the object is disposed. + /// + public bool IsDisposed + { + get { return _cts.IsCancellationRequested; } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs.meta new file mode 100644 index 00000000..5750e923 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/CancellationDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6c675907554bfa24d8bd411f386e410d +timeCreated: 1475137543 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs new file mode 100644 index 00000000..8b0841e3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs @@ -0,0 +1,283 @@ +using System; +using System.Collections.Generic; +// using System.Linq; do not use LINQ +using System.Text; + +namespace UniRx +{ + // copy, modified from Rx Official + + public sealed class CompositeDisposable : ICollection, IDisposable, ICancelable + { + private readonly object _gate = new object(); + + private bool _disposed; + private List _disposables; + private int _count; + private const int SHRINK_THRESHOLD = 64; + + /// + /// Initializes a new instance of the class with no disposables contained by it initially. + /// + public CompositeDisposable() + { + _disposables = new List(); + } + + /// + /// Initializes a new instance of the class with the specified number of disposables. + /// + /// The number of disposables that the new CompositeDisposable can initially store. + /// is less than zero. + public CompositeDisposable(int capacity) + { + if (capacity < 0) + throw new ArgumentOutOfRangeException("capacity"); + + _disposables = new List(capacity); + } + + /// + /// Initializes a new instance of the class from a group of disposables. + /// + /// Disposables that will be disposed together. + /// is null. + public CompositeDisposable(params IDisposable[] disposables) + { + if (disposables == null) + throw new ArgumentNullException("disposables"); + + _disposables = new List(disposables); + _count = _disposables.Count; + } + + /// + /// Initializes a new instance of the class from a group of disposables. + /// + /// Disposables that will be disposed together. + /// is null. + public CompositeDisposable(IEnumerable disposables) + { + if (disposables == null) + throw new ArgumentNullException("disposables"); + + _disposables = new List(disposables); + _count = _disposables.Count; + } + + /// + /// Gets the number of disposables contained in the CompositeDisposable. + /// + public int Count + { + get + { + return _count; + } + } + + /// + /// Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. + /// + /// Disposable to add. + /// is null. + public void Add(IDisposable item) + { + if (item == null) + throw new ArgumentNullException("item"); + + var shouldDispose = false; + lock (_gate) + { + shouldDispose = _disposed; + if (!_disposed) + { + _disposables.Add(item); + _count++; + } + } + if (shouldDispose) + item.Dispose(); + } + + /// + /// Removes and disposes the first occurrence of a disposable from the CompositeDisposable. + /// + /// Disposable to remove. + /// true if found; false otherwise. + /// is null. + public bool Remove(IDisposable item) + { + if (item == null) + throw new ArgumentNullException("item"); + + var shouldDispose = false; + + lock (_gate) + { + if (!_disposed) + { + // + // List doesn't shrink the size of the underlying array but does collapse the array + // by copying the tail one position to the left of the removal index. We don't need + // index-based lookup but only ordering for sequential disposal. So, instead of spending + // cycles on the Array.Copy imposed by Remove, we use a null sentinel value. We also + // do manual Swiss cheese detection to shrink the list if there's a lot of holes in it. + // + var i = _disposables.IndexOf(item); + if (i >= 0) + { + shouldDispose = true; + _disposables[i] = null; + _count--; + + if (_disposables.Capacity > SHRINK_THRESHOLD && _count < _disposables.Capacity / 2) + { + var old = _disposables; + _disposables = new List(_disposables.Capacity / 2); + + foreach (var d in old) + if (d != null) + _disposables.Add(d); + } + } + } + } + + if (shouldDispose) + item.Dispose(); + + return shouldDispose; + } + + /// + /// Disposes all disposables in the group and removes them from the group. + /// + public void Dispose() + { + var currentDisposables = default(IDisposable[]); + lock (_gate) + { + if (!_disposed) + { + _disposed = true; + currentDisposables = _disposables.ToArray(); + _disposables.Clear(); + _count = 0; + } + } + + if (currentDisposables != null) + { + foreach (var d in currentDisposables) + if (d != null) + d.Dispose(); + } + } + + /// + /// Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable. + /// + public void Clear() + { + var currentDisposables = default(IDisposable[]); + lock (_gate) + { + currentDisposables = _disposables.ToArray(); + _disposables.Clear(); + _count = 0; + } + + foreach (var d in currentDisposables) + if (d != null) + d.Dispose(); + } + + /// + /// Determines whether the CompositeDisposable contains a specific disposable. + /// + /// Disposable to search for. + /// true if the disposable was found; otherwise, false. + /// is null. + public bool Contains(IDisposable item) + { + if (item == null) + throw new ArgumentNullException("item"); + + lock (_gate) + { + return _disposables.Contains(item); + } + } + + /// + /// Copies the disposables contained in the CompositeDisposable to an array, starting at a particular array index. + /// + /// Array to copy the contained disposables to. + /// Target index at which to copy the first disposable of the group. + /// is null. + /// is less than zero. -or - is larger than or equal to the array length. + public void CopyTo(IDisposable[] array, int arrayIndex) + { + if (array == null) + throw new ArgumentNullException("array"); + if (arrayIndex < 0 || arrayIndex >= array.Length) + throw new ArgumentOutOfRangeException("arrayIndex"); + + lock (_gate) + { + var disArray = new List(); + foreach (var item in _disposables) + { + if (item != null) disArray.Add(item); + } + + Array.Copy(disArray.ToArray(), 0, array, arrayIndex, array.Length - arrayIndex); + } + } + + /// + /// Always returns false. + /// + public bool IsReadOnly + { + get { return false; } + } + + /// + /// Returns an enumerator that iterates through the CompositeDisposable. + /// + /// An enumerator to iterate over the disposables. + public IEnumerator GetEnumerator() + { + var res = new List(); + + lock (_gate) + { + foreach (var d in _disposables) + { + if (d != null) res.Add(d); + } + } + + return res.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the CompositeDisposable. + /// + /// An enumerator to iterate over the disposables. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// Gets a value that indicates whether the object is disposed. + /// + public bool IsDisposed + { + get { return _disposed; } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs.meta new file mode 100644 index 00000000..ca51226c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/CompositeDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a0f9d923bd5f4cd47b39bdd83125de27 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs new file mode 100644 index 00000000..48d0d549 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs @@ -0,0 +1,255 @@ +using System; +using System.Collections.Generic; + +namespace UniRx +{ + public sealed class DictionaryDisposable : IDisposable, IDictionary + where TValue : IDisposable + { + bool isDisposed = false; + readonly Dictionary inner; + + public DictionaryDisposable() + { + inner = new Dictionary(); + } + + public DictionaryDisposable(IEqualityComparer comparer) + { + inner = new Dictionary(comparer); + } + + public TValue this[TKey key] + { + get + { + lock (inner) + { + return inner[key]; + } + } + + set + { + lock (inner) + { + if (isDisposed) value.Dispose(); + + TValue oldValue; + if (TryGetValue(key, out oldValue)) + { + oldValue.Dispose(); + inner[key] = value; + } + else + { + inner[key] = value; + } + } + } + } + + public int Count + { + get + { + lock (inner) + { + return inner.Count; + } + } + } + + public Dictionary.KeyCollection Keys + { + get + { + throw new NotSupportedException("please use .Select(x => x.Key).ToArray()"); + } + } + + public Dictionary.ValueCollection Values + { + get + { + throw new NotSupportedException("please use .Select(x => x.Value).ToArray()"); + } + } + + public void Add(TKey key, TValue value) + { + lock (inner) + { + if (isDisposed) + { + value.Dispose(); + return; + } + + inner.Add(key, value); + } + } + + public void Clear() + { + lock (inner) + { + foreach (var item in inner) + { + item.Value.Dispose(); + } + inner.Clear(); + } + } + + public bool Remove(TKey key) + { + lock (inner) + { + TValue oldValue; + if (inner.TryGetValue(key, out oldValue)) + { + var isSuccessRemove = inner.Remove(key); + if (isSuccessRemove) + { + oldValue.Dispose(); + } + return isSuccessRemove; + } + else + { + return false; + } + } + } + + public bool ContainsKey(TKey key) + { + lock (inner) + { + return inner.ContainsKey(key); + } + } + + public bool TryGetValue(TKey key, out TValue value) + { + lock (inner) + { + return inner.TryGetValue(key, out value); + } + } + + public Dictionary.Enumerator GetEnumerator() + { + lock (inner) + { + return new Dictionary(inner).GetEnumerator(); + } + } + + bool ICollection>.IsReadOnly + { + get + { + return ((ICollection>)inner).IsReadOnly; + } + } + + ICollection IDictionary.Keys + { + get + { + lock (inner) + { + return new List(inner.Keys); + } + } + } + + ICollection IDictionary.Values + { + get + { + lock (inner) + { + return new List(inner.Values); + } + } + } + + +#if !UNITY_METRO + + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) + { + lock (inner) + { + ((System.Runtime.Serialization.ISerializable)inner).GetObjectData(info, context); + } + } + + public void OnDeserialization(object sender) + { + lock (inner) + { + ((System.Runtime.Serialization.IDeserializationCallback)inner).OnDeserialization(sender); + } + } + +#endif + + void ICollection>.Add(KeyValuePair item) + { + Add((TKey)item.Key, (TValue)item.Value); + } + + bool ICollection>.Contains(KeyValuePair item) + { + lock (inner) + { + return ((ICollection>)inner).Contains(item); + } + } + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) + { + lock (inner) + { + ((ICollection>)inner).CopyTo(array, arrayIndex); + } + } + + IEnumerator> IEnumerable>.GetEnumerator() + { + lock (inner) + { + return new List>((ICollection>)inner).GetEnumerator(); + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + bool ICollection>.Remove(KeyValuePair item) + { + throw new NotSupportedException(); + } + + public void Dispose() + { + lock (inner) + { + if (isDisposed) return; + isDisposed = true; + + foreach (var item in inner) + { + item.Value.Dispose(); + } + inner.Clear(); + } + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs.meta new file mode 100644 index 00000000..2f6e4bca --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/DictionaryDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 702939929fc84d544b12076b76aa73b5 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs new file mode 100644 index 00000000..7999ca29 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections; + +namespace UniRx +{ + public static class Disposable + { + public static readonly IDisposable Empty = EmptyDisposable.Singleton; + + public static IDisposable Create(Action disposeAction) + { + return new AnonymousDisposable(disposeAction); + } + + public static IDisposable CreateWithState(TState state, Action disposeAction) + { + return new AnonymousDisposable(state, disposeAction); + } + + class EmptyDisposable : IDisposable + { + public static EmptyDisposable Singleton = new EmptyDisposable(); + + private EmptyDisposable() + { + + } + + public void Dispose() + { + } + } + + class AnonymousDisposable : IDisposable + { + bool isDisposed = false; + readonly Action dispose; + + public AnonymousDisposable(Action dispose) + { + this.dispose = dispose; + } + + public void Dispose() + { + if (!isDisposed) + { + isDisposed = true; + dispose(); + } + } + } + + class AnonymousDisposable : IDisposable + { + bool isDisposed = false; + readonly T state; + readonly Action dispose; + + public AnonymousDisposable(T state, Action dispose) + { + this.state = state; + this.dispose = dispose; + } + + public void Dispose() + { + if (!isDisposed) + { + isDisposed = true; + dispose(state); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs.meta new file mode 100644 index 00000000..2549165d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/Disposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 958f291bb8f434740a6d2c08ad5182a0 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs b/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs new file mode 100644 index 00000000..24b96912 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; + +namespace UniRx +{ + public static partial class DisposableExtensions + { + /// Add disposable(self) to CompositeDisposable(or other ICollection). Return value is self disposable. + public static T AddTo(this T disposable, ICollection container) + where T : IDisposable + { + if (disposable == null) throw new ArgumentNullException("disposable"); + if (container == null) throw new ArgumentNullException("container"); + + container.Add(disposable); + + return disposable; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs.meta new file mode 100644 index 00000000..be386f72 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/DisposableExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9c4757265ae105441bae71007cbd0184 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs new file mode 100644 index 00000000..fd7fce5f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace UniRx +{ + public interface ICancelable : IDisposable + { + bool IsDisposed { get; } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs.meta new file mode 100644 index 00000000..c9ddc40c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/ICancelable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b5cd5b0b304c78345a49757b1f6f8ba8 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs new file mode 100644 index 00000000..499805f2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections; + +namespace UniRx +{ + public sealed class MultipleAssignmentDisposable : IDisposable, ICancelable + { + static readonly BooleanDisposable True = new BooleanDisposable(true); + + object gate = new object(); + IDisposable current; + + public bool IsDisposed + { + get + { + lock (gate) + { + return current == True; + } + } + } + + public IDisposable Disposable + { + get + { + lock (gate) + { + return (current == True) + ? UniRx.Disposable.Empty + : current; + } + } + set + { + var shouldDispose = false; + lock (gate) + { + shouldDispose = (current == True); + if (!shouldDispose) + { + current = value; + } + } + if (shouldDispose && value != null) + { + value.Dispose(); + } + } + } + + public void Dispose() + { + IDisposable old = null; + + lock (gate) + { + if (current != True) + { + old = current; + current = True; + } + } + + if (old != null) old.Dispose(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs.meta new file mode 100644 index 00000000..4e71cbfe --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/MultipleAssignmentDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bb959083576ace749afd55c1e54b02d9 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs new file mode 100644 index 00000000..354627a9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs @@ -0,0 +1,152 @@ +// This code is borrwed from Rx Official and some modified. + +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; + +namespace UniRx +{ + /// + /// Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. + /// + public sealed class RefCountDisposable : ICancelable + { + private readonly object _gate = new object(); + private IDisposable _disposable; + private bool _isPrimaryDisposed; + private int _count; + + /// + /// Initializes a new instance of the class with the specified disposable. + /// + /// Underlying disposable. + /// is null. + public RefCountDisposable(IDisposable disposable) + { + if (disposable == null) + throw new ArgumentNullException("disposable"); + + _disposable = disposable; + _isPrimaryDisposed = false; + _count = 0; + } + + /// + /// Gets a value that indicates whether the object is disposed. + /// + public bool IsDisposed + { + get { return _disposable == null; } + } + + /// + /// Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable. + /// + /// A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Backward compat + non-trivial work for a property getter.")] + public IDisposable GetDisposable() + { + lock (_gate) + { + if (_disposable == null) + { + return Disposable.Empty; + } + else + { + _count++; + return new InnerDisposable(this); + } + } + } + + /// + /// Disposes the underlying disposable only when all dependent disposables have been disposed. + /// + public void Dispose() + { + var disposable = default(IDisposable); + lock (_gate) + { + if (_disposable != null) + { + if (!_isPrimaryDisposed) + { + _isPrimaryDisposed = true; + + if (_count == 0) + { + disposable = _disposable; + _disposable = null; + } + } + } + } + + if (disposable != null) + disposable.Dispose(); + } + + private void Release() + { + var disposable = default(IDisposable); + lock (_gate) + { + if (_disposable != null) + { + _count--; + + if (_isPrimaryDisposed) + { + if (_count == 0) + { + disposable = _disposable; + _disposable = null; + } + } + } + } + + if (disposable != null) + disposable.Dispose(); + } + + sealed class InnerDisposable : IDisposable + { + private RefCountDisposable _parent; + object parentLock = new object(); + + public InnerDisposable(RefCountDisposable parent) + { + _parent = parent; + } + + public void Dispose() + { + RefCountDisposable parent; + lock (parentLock) + { + parent = _parent; + _parent = null; + } + if (parent != null) + parent.Release(); + } + } + } + + public partial class Observable + { + static IObservable AddRef(IObservable xs, RefCountDisposable r) + { + return Observable.Create((IObserver observer) => new CompositeDisposable(new IDisposable[] + { + r.GetDisposable(), + xs.Subscribe(observer) + })); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs.meta new file mode 100644 index 00000000..c388fe24 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/RefCountDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2fb5a2cdb138579498eb20d8b7818ad8 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs new file mode 100644 index 00000000..1232493b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs @@ -0,0 +1,46 @@ +using System; +using System.Threading; + +namespace UniRx +{ + public sealed class ScheduledDisposable : ICancelable + { + private readonly IScheduler scheduler; + private volatile IDisposable disposable; + private int isDisposed = 0; + + public ScheduledDisposable(IScheduler scheduler, IDisposable disposable) + { + this.scheduler = scheduler; + this.disposable = disposable; + } + + public IScheduler Scheduler + { + get { return scheduler; } + } + + public IDisposable Disposable + { + get { return disposable; } + } + + public bool IsDisposed + { + get { return isDisposed != 0; } + } + + public void Dispose() + { + Scheduler.Schedule(DisposeInner); + } + + private void DisposeInner() + { + if (Interlocked.Increment(ref isDisposed) == 1) + { + disposable.Dispose(); + } + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs.meta new file mode 100644 index 00000000..5b873ad4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/ScheduledDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: db98ce742e859bd4e81db434c3ca3663 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs new file mode 100644 index 00000000..cb19e6e4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections; + +namespace UniRx +{ + public sealed class SerialDisposable : IDisposable, ICancelable + { + readonly object gate = new object(); + IDisposable current; + bool disposed; + + public bool IsDisposed { get { lock (gate) { return disposed; } } } + + public IDisposable Disposable + { + get + { + return current; + } + set + { + var shouldDispose = false; + var old = default(IDisposable); + lock (gate) + { + shouldDispose = disposed; + if (!shouldDispose) + { + old = current; + current = value; + } + } + if (old != null) + { + old.Dispose(); + } + if (shouldDispose && value != null) + { + value.Dispose(); + } + } + } + + public void Dispose() + { + var old = default(IDisposable); + + lock (gate) + { + if (!disposed) + { + disposed = true; + old = current; + current = null; + } + } + + if (old != null) + { + old.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs.meta new file mode 100644 index 00000000..3b6e5443 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/SerialDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 06fb064ad9e4d354ab15ff89f6343243 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs new file mode 100644 index 00000000..53c9216a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections; + +namespace UniRx +{ + // should be use Interlocked.CompareExchange for Threadsafe? + // but CompareExchange cause ExecutionEngineException on iOS. + // AOT... + // use lock instead + + public sealed class SingleAssignmentDisposable : IDisposable, ICancelable + { + readonly object gate = new object(); + IDisposable current; + bool disposed; + + public bool IsDisposed { get { lock (gate) { return disposed; } } } + + public IDisposable Disposable + { + get + { + return current; + } + set + { + var old = default(IDisposable); + bool alreadyDisposed; + lock (gate) + { + alreadyDisposed = disposed; + old = current; + if (!alreadyDisposed) + { + if (value == null) return; + current = value; + } + } + + if (alreadyDisposed && value != null) + { + value.Dispose(); + return; + } + + if (old != null) throw new InvalidOperationException("Disposable is already set"); + } + } + + + public void Dispose() + { + IDisposable old = null; + + lock (gate) + { + if (!disposed) + { + disposed = true; + old = current; + current = null; + } + } + + if (old != null) old.Dispose(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs.meta new file mode 100644 index 00000000..6beb6746 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/SingleAssignmentDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7ec869f7548c62748ad57a5c86b2f6ba +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs b/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs new file mode 100644 index 00000000..58633b1a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs @@ -0,0 +1,277 @@ +using System; +using System.Collections.Generic; +using System.Threading; + +namespace UniRx +{ + /// + /// Represents a group of disposable resources that are disposed together. + /// + public abstract class StableCompositeDisposable : ICancelable + { + /// + /// Creates a new group containing two disposable resources that are disposed together. + /// + /// The first disposable resoruce to add to the group. + /// The second disposable resoruce to add to the group. + /// Group of disposable resources that are disposed together. + public static ICancelable Create(IDisposable disposable1, IDisposable disposable2) + { + if (disposable1 == null) throw new ArgumentNullException("disposable1"); + if (disposable2 == null) throw new ArgumentNullException("disposable2"); + + return new Binary(disposable1, disposable2); + } + + /// + /// Creates a new group containing three disposable resources that are disposed together. + /// + /// The first disposable resoruce to add to the group. + /// The second disposable resoruce to add to the group. + /// The third disposable resoruce to add to the group. + /// Group of disposable resources that are disposed together. + public static ICancelable Create(IDisposable disposable1, IDisposable disposable2, IDisposable disposable3) + { + if (disposable1 == null) throw new ArgumentNullException("disposable1"); + if (disposable2 == null) throw new ArgumentNullException("disposable2"); + if (disposable3 == null) throw new ArgumentNullException("disposable3"); + + return new Trinary(disposable1, disposable2, disposable3); + } + + /// + /// Creates a new group containing four disposable resources that are disposed together. + /// + /// The first disposable resoruce to add to the group. + /// The second disposable resoruce to add to the group. + /// The three disposable resoruce to add to the group. + /// The four disposable resoruce to add to the group. + /// Group of disposable resources that are disposed together. + public static ICancelable Create(IDisposable disposable1, IDisposable disposable2, IDisposable disposable3, IDisposable disposable4) + { + if (disposable1 == null) throw new ArgumentNullException("disposable1"); + if (disposable2 == null) throw new ArgumentNullException("disposable2"); + if (disposable3 == null) throw new ArgumentNullException("disposable3"); + if (disposable4 == null) throw new ArgumentNullException("disposable4"); + + return new Quaternary(disposable1, disposable2, disposable3, disposable4); + } + + /// + /// Creates a new group of disposable resources that are disposed together. + /// + /// Disposable resources to add to the group. + /// Group of disposable resources that are disposed together. + public static ICancelable Create(params IDisposable[] disposables) + { + if (disposables == null) throw new ArgumentNullException("disposables"); + + return new NAry(disposables); + } + + /// + /// Creates a new group of disposable resources that are disposed together. Array is not copied, it's unsafe but optimized. + /// + /// Disposable resources to add to the group. + /// Group of disposable resources that are disposed together. + public static ICancelable CreateUnsafe(IDisposable[] disposables) + { + return new NAryUnsafe(disposables); + } + + /// + /// Creates a new group of disposable resources that are disposed together. + /// + /// Disposable resources to add to the group. + /// Group of disposable resources that are disposed together. + public static ICancelable Create(IEnumerable disposables) + { + if (disposables == null) throw new ArgumentNullException("disposables"); + + return new NAry(disposables); + } + + /// + /// Disposes all disposables in the group. + /// + public abstract void Dispose(); + + /// + /// Gets a value that indicates whether the object is disposed. + /// + public abstract bool IsDisposed + { + get; + } + + class Binary : StableCompositeDisposable + { + int disposedCallCount = -1; + private volatile IDisposable _disposable1; + private volatile IDisposable _disposable2; + + public Binary(IDisposable disposable1, IDisposable disposable2) + { + _disposable1 = disposable1; + _disposable2 = disposable2; + } + + public override bool IsDisposed + { + get + { + return disposedCallCount != -1; + } + } + + public override void Dispose() + { + if (Interlocked.Increment(ref disposedCallCount) == 0) + { + _disposable1.Dispose(); + _disposable2.Dispose(); + } + } + } + + class Trinary : StableCompositeDisposable + { + int disposedCallCount = -1; + private volatile IDisposable _disposable1; + private volatile IDisposable _disposable2; + private volatile IDisposable _disposable3; + + public Trinary(IDisposable disposable1, IDisposable disposable2, IDisposable disposable3) + { + _disposable1 = disposable1; + _disposable2 = disposable2; + _disposable3 = disposable3; + } + + public override bool IsDisposed + { + get + { + return disposedCallCount != -1; + } + } + + public override void Dispose() + { + if (Interlocked.Increment(ref disposedCallCount) == 0) + { + _disposable1.Dispose(); + _disposable2.Dispose(); + _disposable3.Dispose(); + } + } + } + + class Quaternary : StableCompositeDisposable + { + int disposedCallCount = -1; + private volatile IDisposable _disposable1; + private volatile IDisposable _disposable2; + private volatile IDisposable _disposable3; + private volatile IDisposable _disposable4; + + public Quaternary(IDisposable disposable1, IDisposable disposable2, IDisposable disposable3, IDisposable disposable4) + { + _disposable1 = disposable1; + _disposable2 = disposable2; + _disposable3 = disposable3; + _disposable4 = disposable4; + } + + public override bool IsDisposed + { + get + { + return disposedCallCount != -1; + } + } + + public override void Dispose() + { + if (Interlocked.Increment(ref disposedCallCount) == 0) + { + _disposable1.Dispose(); + _disposable2.Dispose(); + _disposable3.Dispose(); + _disposable4.Dispose(); + } + } + } + + class NAry : StableCompositeDisposable + { + int disposedCallCount = -1; + private volatile List _disposables; + + public NAry(IDisposable[] disposables) + : this((IEnumerable)disposables) + { + } + + public NAry(IEnumerable disposables) + { + _disposables = new List(disposables); + + // + // Doing this on the list to avoid duplicate enumeration of disposables. + // + if (_disposables.Contains(null)) throw new ArgumentException("Disposables can't contains null", "disposables"); + } + + public override bool IsDisposed + { + get + { + return disposedCallCount != -1; + } + } + + public override void Dispose() + { + if (Interlocked.Increment(ref disposedCallCount) == 0) + { + foreach (var d in _disposables) + { + d.Dispose(); + } + } + } + } + + class NAryUnsafe : StableCompositeDisposable + { + int disposedCallCount = -1; + private volatile IDisposable[] _disposables; + + public NAryUnsafe(IDisposable[] disposables) + { + _disposables = disposables; + } + + public override bool IsDisposed + { + get + { + return disposedCallCount != -1; + } + } + + public override void Dispose() + { + if (Interlocked.Increment(ref disposedCallCount) == 0) + { + var len = _disposables.Length; + for (int i = 0; i < len; i++) + { + _disposables[i].Dispose(); + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs.meta b/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs.meta new file mode 100644 index 00000000..0c29a6b2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Disposables/StableCompositeDisposable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3a9cd9fa22bc6a5439484581f5049cf8 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/EventPattern.cs b/Assets/Plugins/UniRx/Scripts/EventPattern.cs new file mode 100644 index 00000000..b5eeaddf --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/EventPattern.cs @@ -0,0 +1,140 @@ +// original code from rx.codeplex.com +// some modified. + +/* ------------------ */ + +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; + +namespace UniRx +{ + /// + /// Represents a .NET event invocation consisting of the strongly typed object that raised the event and the data that was generated by the event. + /// + /// + /// The type of the sender that raised the event. + /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. + /// + /// + /// The type of the event data generated by the event. + /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. + /// + public interface IEventPattern + { + /// + /// Gets the sender object that raised the event. + /// + TSender Sender { get; } + + /// + /// Gets the event data that was generated by the event. + /// + TEventArgs EventArgs { get; } + } + + /// + /// Represents a .NET event invocation consisting of the weakly typed object that raised the event and the data that was generated by the event. + /// + /// The type of the event data generated by the event. + public class EventPattern : EventPattern + { + /// + /// Creates a new data representation instance of a .NET event invocation with the given sender and event data. + /// + /// The sender object that raised the event. + /// The event data that was generated by the event. + public EventPattern(object sender, TEventArgs e) + : base(sender, e) + { + } + } + + /// + /// Represents a .NET event invocation consisting of the strongly typed object that raised the event and the data that was generated by the event. + /// + /// The type of the sender that raised the event. + /// The type of the event data generated by the event. + public class EventPattern : IEquatable>, IEventPattern + { + /// + /// Creates a new data representation instance of a .NET event invocation with the given sender and event data. + /// + /// The sender object that raised the event. + /// The event data that was generated by the event. + public EventPattern(TSender sender, TEventArgs e) + { + Sender = sender; + EventArgs = e; + } + + /// + /// Gets the sender object that raised the event. + /// + public TSender Sender { get; private set; } + + /// + /// Gets the event data that was generated by the event. + /// + public TEventArgs EventArgs { get; private set; } + + /// + /// Determines whether the current EventPattern<TSender, TEventArgs> object represents the same event as a specified EventPattern<TSender, TEventArgs> object. + /// + /// An object to compare to the current EventPattern<TSender, TEventArgs> object. + /// true if both EventPattern<TSender, TEventArgs> objects represent the same event; otherwise, false. + public bool Equals(EventPattern other) + { + if (object.ReferenceEquals(null, other)) + return false; + if (object.ReferenceEquals(this, other)) + return true; + + return EqualityComparer.Default.Equals(Sender, other.Sender) && EqualityComparer.Default.Equals(EventArgs, other.EventArgs); + } + + /// + /// Determines whether the specified System.Object is equal to the current EventPattern<TSender, TEventArgs>. + /// + /// The System.Object to compare with the current EventPattern<TSender, TEventArgs>. + /// true if the specified System.Object is equal to the current EventPattern<TSender, TEventArgs>; otherwise, false. + public override bool Equals(object obj) + { + return Equals(obj as EventPattern); + } + + /// + /// Returns the hash code for the current EventPattern<TSender, TEventArgs> instance. + /// + /// A hash code for the current EventPattern<TSender, TEventArgs> instance. + public override int GetHashCode() + { + var x = EqualityComparer.Default.GetHashCode(Sender); + var y = EqualityComparer.Default.GetHashCode(EventArgs); + return (x << 5) + (x ^ y); + } + + /// + /// Determines whether two specified EventPattern<TSender, TEventArgs> objects represent the same event. + /// + /// The first EventPattern<TSender, TEventArgs> to compare, or null. + /// The second EventPattern<TSender, TEventArgs> to compare, or null. + /// true if both EventPattern<TSender, TEventArgs> objects represent the same event; otherwise, false. + public static bool operator ==(EventPattern first, EventPattern second) + { + return object.Equals(first, second); + } + + /// + /// Determines whether two specified EventPattern<TSender, TEventArgs> objects represent a different event. + /// + /// The first EventPattern<TSender, TEventArgs> to compare, or null. + /// The second EventPattern<TSender, TEventArgs> to compare, or null. + /// true if both EventPattern<TSender, TEventArgs> objects don't represent the same event; otherwise, false. + public static bool operator !=(EventPattern first, EventPattern second) + { + return !object.Equals(first, second); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/EventPattern.cs.meta b/Assets/Plugins/UniRx/Scripts/EventPattern.cs.meta new file mode 100644 index 00000000..01992d15 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/EventPattern.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e4b797bfea1999a499309068b7d7a97e +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil.meta new file mode 100644 index 00000000..c363e39b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7147cf40e45d9b7468957f2d28b1f2f0 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs new file mode 100644 index 00000000..31564fbe --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs @@ -0,0 +1,85 @@ +// this code is borrowed from RxOfficial(rx.codeplex.com) and modified + +using System; +using System.Collections.Generic; + +namespace UniRx.InternalUtil +{ + /// + /// Asynchronous lock. + /// + internal sealed class AsyncLock : IDisposable + { + private readonly Queue queue = new Queue(); + private bool isAcquired = false; + private bool hasFaulted = false; + + /// + /// Queues the action for execution. If the caller acquires the lock and becomes the owner, + /// the queue is processed. If the lock is already owned, the action is queued and will get + /// processed by the owner. + /// + /// Action to queue for execution. + /// is null. + public void Wait(Action action) + { + if (action == null) + throw new ArgumentNullException("action"); + + var isOwner = false; + lock (queue) + { + if (!hasFaulted) + { + queue.Enqueue(action); + isOwner = !isAcquired; + isAcquired = true; + } + } + + if (isOwner) + { + while (true) + { + var work = default(Action); + lock (queue) + { + if (queue.Count > 0) + work = queue.Dequeue(); + else + { + isAcquired = false; + break; + } + } + + try + { + work(); + } + catch + { + lock (queue) + { + queue.Clear(); + hasFaulted = true; + } + throw; + } + } + } + } + + /// + /// Clears the work items in the queue and drops further work being queued. + /// + public void Dispose() + { + lock (queue) + { + queue.Clear(); + hasFaulted = true; + } + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs.meta new file mode 100644 index 00000000..fe6cc8b6 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/AscynLock.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 23dbd656cfe9c5e47b02c3c263e476aa +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs new file mode 100644 index 00000000..7e1e6862 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs @@ -0,0 +1,23 @@ +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace UniRx.InternalUtil +{ + internal interface ICancellableTaskCompletionSource + { + bool TrySetException(Exception exception); + bool TrySetCanceled(); + } + + internal class CancellableTaskCompletionSource : TaskCompletionSource, ICancellableTaskCompletionSource + { + + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs.meta new file mode 100644 index 00000000..a856963a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/CancellableTaskCompletionSource.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 622c7ba8630c25b4c911cd1612ee0887 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs new file mode 100644 index 00000000..39a7a4c9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs @@ -0,0 +1,15 @@ +namespace UniRx.InternalUtil +{ + using System; + + internal static class ExceptionExtensions + { + public static void Throw(this Exception exception) + { +#if (NET_4_6 || NET_STANDARD_2_0) + System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(exception).Throw(); +#endif + throw exception; + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs.meta new file mode 100644 index 00000000..33c402cc --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ExceptionExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 94d5d10805124b34c8b488ebf3f893eb +timeCreated: 1509016318 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs new file mode 100644 index 00000000..ef6998f3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs @@ -0,0 +1,61 @@ +using System; + +namespace UniRx.InternalUtil +{ + // ImmutableList is sometimes useful, use for public. + public class ImmutableList + { + public static readonly ImmutableList Empty = new ImmutableList(); + + T[] data; + + public T[] Data + { + get { return data; } + } + + ImmutableList() + { + data = new T[0]; + } + + public ImmutableList(T[] data) + { + this.data = data; + } + + public ImmutableList Add(T value) + { + var newData = new T[data.Length + 1]; + Array.Copy(data, newData, data.Length); + newData[data.Length] = value; + return new ImmutableList(newData); + } + + public ImmutableList Remove(T value) + { + var i = IndexOf(value); + if (i < 0) return this; + + var length = data.Length; + if (length == 1) return Empty; + + var newData = new T[length - 1]; + + Array.Copy(data, 0, newData, 0, i); + Array.Copy(data, i + 1, newData, i, length - i - 1); + + return new ImmutableList(newData); + } + + public int IndexOf(T value) + { + for (var i = 0; i < data.Length; ++i) + { + // ImmutableList only use for IObserver(no worry for boxed) + if (object.Equals(data[i], value)) return i; + } + return -1; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs.meta new file mode 100644 index 00000000..05403703 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ImmutableList.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dbafd8a41f556ec40b4bbd46fca2e85c +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs new file mode 100644 index 00000000..5ad1afc5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace UniRx.InternalUtil +{ + public class ListObserver : IObserver + { + private readonly ImmutableList> _observers; + + public ListObserver(ImmutableList> observers) + { + _observers = observers; + } + + public void OnCompleted() + { + var targetObservers = _observers.Data; + for (int i = 0; i < targetObservers.Length; i++) + { + targetObservers[i].OnCompleted(); + } + } + + public void OnError(Exception error) + { + var targetObservers = _observers.Data; + for (int i = 0; i < targetObservers.Length; i++) + { + targetObservers[i].OnError(error); + } + } + + public void OnNext(T value) + { + var targetObservers = _observers.Data; + for (int i = 0; i < targetObservers.Length; i++) + { + targetObservers[i].OnNext(value); + } + } + + internal IObserver Add(IObserver observer) + { + return new ListObserver(_observers.Add(observer)); + } + + internal IObserver Remove(IObserver observer) + { + var i = Array.IndexOf(_observers.Data, observer); + if (i < 0) + return this; + + if (_observers.Data.Length == 2) + { + return _observers.Data[1 - i]; + } + else + { + return new ListObserver(_observers.Remove(observer)); + } + } + } + + public class EmptyObserver : IObserver + { + public static readonly EmptyObserver Instance = new EmptyObserver(); + + EmptyObserver() + { + + } + + public void OnCompleted() + { + } + + public void OnError(Exception error) + { + } + + public void OnNext(T value) + { + } + } + + public class ThrowObserver : IObserver + { + public static readonly ThrowObserver Instance = new ThrowObserver(); + + ThrowObserver() + { + + } + + public void OnCompleted() + { + } + + public void OnError(Exception error) + { + error.Throw(); + } + + public void OnNext(T value) + { + } + } + + public class DisposedObserver : IObserver + { + public static readonly DisposedObserver Instance = new DisposedObserver(); + + DisposedObserver() + { + + } + + public void OnCompleted() + { + throw new ObjectDisposedException(""); + } + + public void OnError(Exception error) + { + throw new ObjectDisposedException(""); + } + + public void OnNext(T value) + { + throw new ObjectDisposedException(""); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs.meta new file mode 100644 index 00000000..1eeeef05 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 889dc2f3c5f44d24a98a2c25510b4346 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs new file mode 100644 index 00000000..8b780978 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace UniRx.InternalUtil +{ + /// + /// Simple supports(only yield return null) lightweight, threadsafe coroutine dispatcher. + /// + public class MicroCoroutine + { + const int InitialSize = 16; + + readonly object runningAndQueueLock = new object(); + readonly object arrayLock = new object(); + readonly Action unhandledExceptionCallback; + + int tail = 0; + bool running = false; + IEnumerator[] coroutines = new IEnumerator[InitialSize]; + Queue waitQueue = new Queue(); + + public MicroCoroutine(Action unhandledExceptionCallback) + { + this.unhandledExceptionCallback = unhandledExceptionCallback; + } + + public void AddCoroutine(IEnumerator enumerator) + { + lock (runningAndQueueLock) + { + if (running) + { + waitQueue.Enqueue(enumerator); + return; + } + } + + // worst case at multi threading, wait lock until finish Run() but it is super rarely. + lock (arrayLock) + { + // Ensure Capacity + if (coroutines.Length == tail) + { + Array.Resize(ref coroutines, checked(tail * 2)); + } + coroutines[tail++] = enumerator; + } + } + + public void Run() + { + lock (runningAndQueueLock) + { + running = true; + } + + lock (arrayLock) + { + var j = tail - 1; + + // eliminate array-bound check for i + for (int i = 0; i < coroutines.Length; i++) + { + var coroutine = coroutines[i]; + if (coroutine != null) + { + try + { + if (!coroutine.MoveNext()) + { + coroutines[i] = null; + } + else + { +#if UNITY_EDITOR + // validation only on Editor. + if (coroutine.Current != null) + { + UnityEngine.Debug.LogWarning("MicroCoroutine supports only yield return null. return value = " + coroutine.Current); + } +#endif + + continue; // next i + } + } + catch (Exception ex) + { + coroutines[i] = null; + try + { + unhandledExceptionCallback(ex); + } + catch { } + } + } + + // find null, loop from tail + while (i < j) + { + var fromTail = coroutines[j]; + if (fromTail != null) + { + try + { + if (!fromTail.MoveNext()) + { + coroutines[j] = null; + j--; + continue; // next j + } + else + { +#if UNITY_EDITOR + // validation only on Editor. + if (fromTail.Current != null) + { + UnityEngine.Debug.LogWarning("MicroCoroutine supports only yield return null. return value = " + coroutine.Current); + } +#endif + + // swap + coroutines[i] = fromTail; + coroutines[j] = null; + j--; + goto NEXT_LOOP; // next i + } + } + catch (Exception ex) + { + coroutines[j] = null; + j--; + try + { + unhandledExceptionCallback(ex); + } + catch { } + continue; // next j + } + } + else + { + j--; + } + } + + tail = i; // loop end + break; // LOOP END + + NEXT_LOOP: + continue; + } + + + lock (runningAndQueueLock) + { + running = false; + while (waitQueue.Count != 0) + { + if (coroutines.Length == tail) + { + Array.Resize(ref coroutines, checked(tail * 2)); + } + coroutines[tail++] = waitQueue.Dequeue(); + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs.meta new file mode 100644 index 00000000..938793bc --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/MicroCoroutine.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 108be6d634275c94a95eeb2a39de0792 +timeCreated: 1462599042 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs new file mode 100644 index 00000000..0f16eeae --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs @@ -0,0 +1,149 @@ +// this code is borrowed from RxOfficial(rx.codeplex.com) and modified + +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; + +namespace UniRx.InternalUtil +{ + internal class PriorityQueue where T : IComparable + { + private static long _count = long.MinValue; + + private IndexedItem[] _items; + private int _size; + + public PriorityQueue() + : this(16) + { + } + + public PriorityQueue(int capacity) + { + _items = new IndexedItem[capacity]; + _size = 0; + } + + private bool IsHigherPriority(int left, int right) + { + return _items[left].CompareTo(_items[right]) < 0; + } + + private void Percolate(int index) + { + if (index >= _size || index < 0) + return; + var parent = (index - 1) / 2; + if (parent < 0 || parent == index) + return; + + if (IsHigherPriority(index, parent)) + { + var temp = _items[index]; + _items[index] = _items[parent]; + _items[parent] = temp; + Percolate(parent); + } + } + + private void Heapify() + { + Heapify(0); + } + + private void Heapify(int index) + { + if (index >= _size || index < 0) + return; + + var left = 2 * index + 1; + var right = 2 * index + 2; + var first = index; + + if (left < _size && IsHigherPriority(left, first)) + first = left; + if (right < _size && IsHigherPriority(right, first)) + first = right; + if (first != index) + { + var temp = _items[index]; + _items[index] = _items[first]; + _items[first] = temp; + Heapify(first); + } + } + + public int Count { get { return _size; } } + + public T Peek() + { + if (_size == 0) + throw new InvalidOperationException("HEAP is Empty"); + + return _items[0].Value; + } + + private void RemoveAt(int index) + { + _items[index] = _items[--_size]; + _items[_size] = default(IndexedItem); + Heapify(); + if (_size < _items.Length / 4) + { + var temp = _items; + _items = new IndexedItem[_items.Length / 2]; + Array.Copy(temp, 0, _items, 0, _size); + } + } + + public T Dequeue() + { + var result = Peek(); + RemoveAt(0); + return result; + } + + public void Enqueue(T item) + { + if (_size >= _items.Length) + { + var temp = _items; + _items = new IndexedItem[_items.Length * 2]; + Array.Copy(temp, _items, temp.Length); + } + + var index = _size++; + _items[index] = new IndexedItem { Value = item, Id = Interlocked.Increment(ref _count) }; + Percolate(index); + } + + public bool Remove(T item) + { + for (var i = 0; i < _size; ++i) + { + if (EqualityComparer.Default.Equals(_items[i].Value, item)) + { + RemoveAt(i); + return true; + } + } + + return false; + } + + struct IndexedItem : IComparable + { + public T Value; + public long Id; + + public int CompareTo(IndexedItem other) + { + var c = Value.CompareTo(other.Value); + if (c == 0) + c = Id.CompareTo(other.Id); + return c; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs.meta new file mode 100644 index 00000000..fc78ce6d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/PriorityQueue.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7956b408e24dc5a4884fe4f5a3d7c858 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs new file mode 100644 index 00000000..9662f29d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs @@ -0,0 +1,26 @@ +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace UniRx.InternalUtil +{ + internal static class PromiseHelper + { + internal static void TrySetResultAll(IEnumerable> source, T value) + { + var rentArray = source.ToArray(); // better to use Arraypool. + var array = rentArray; + var len = rentArray.Length; + for (int i = 0; i < len; i++) + { + array[i].TrySetResult(value); + array[i] = null; + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs.meta new file mode 100644 index 00000000..6d7ba4f2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/PromiseHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: daa7aa90cece0fe40920a35e79f526dd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs new file mode 100644 index 00000000..1717fff3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs @@ -0,0 +1,257 @@ +// this code is borrowed from RxOfficial(rx.codeplex.com) and modified + +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; + +namespace UniRx.InternalUtil +{ + /// + /// Abstract base class for scheduled work items. + /// + internal class ScheduledItem : IComparable + { + private readonly BooleanDisposable _disposable = new BooleanDisposable(); + private readonly TimeSpan _dueTime; + private readonly Action _action; + + /// + /// Creates a new scheduled work item to run at the specified time. + /// + /// Absolute time at which the work item has to be executed. + public ScheduledItem(Action action, TimeSpan dueTime) + { + _dueTime = dueTime; + _action = action; + } + + /// + /// Gets the absolute time at which the item is due for invocation. + /// + public TimeSpan DueTime + { + get { return _dueTime; } + } + + /// + /// Invokes the work item. + /// + public void Invoke() + { + if (!_disposable.IsDisposed) + { + _action(); + } + } + + #region Inequality + + /// + /// Compares the work item with another work item based on absolute time values. + /// + /// Work item to compare the current work item to. + /// Relative ordering between this and the specified work item. + /// The inequality operators are overloaded to provide results consistent with the IComparable implementation. Equality operators implement traditional reference equality semantics. + public int CompareTo(ScheduledItem other) + { + // MSDN: By definition, any object compares greater than null, and two null references compare equal to each other. + if (object.ReferenceEquals(other, null)) + return 1; + + return DueTime.CompareTo(other.DueTime); + } + + /// + /// Determines whether one specified ScheduledItem<TAbsolute> object is due before a second specified ScheduledItem<TAbsolute> object. + /// + /// The first object to compare. + /// The second object to compare. + /// true if the DueTime value of left is earlier than the DueTime value of right; otherwise, false. + /// This operator provides results consistent with the IComparable implementation. + public static bool operator <(ScheduledItem left, ScheduledItem right) + { + return left.CompareTo(right) < 0; + } + + /// + /// Determines whether one specified ScheduledItem<TAbsolute> object is due before or at the same of a second specified ScheduledItem<TAbsolute> object. + /// + /// The first object to compare. + /// The second object to compare. + /// true if the DueTime value of left is earlier than or simultaneous with the DueTime value of right; otherwise, false. + /// This operator provides results consistent with the IComparable implementation. + public static bool operator <=(ScheduledItem left, ScheduledItem right) + { + return left.CompareTo(right) <= 0; + } + + /// + /// Determines whether one specified ScheduledItem<TAbsolute> object is due after a second specified ScheduledItem<TAbsolute> object. + /// + /// The first object to compare. + /// The second object to compare. + /// true if the DueTime value of left is later than the DueTime value of right; otherwise, false. + /// This operator provides results consistent with the IComparable implementation. + public static bool operator >(ScheduledItem left, ScheduledItem right) + { + return left.CompareTo(right) > 0; + } + + /// + /// Determines whether one specified ScheduledItem<TAbsolute> object is due after or at the same time of a second specified ScheduledItem<TAbsolute> object. + /// + /// The first object to compare. + /// The second object to compare. + /// true if the DueTime value of left is later than or simultaneous with the DueTime value of right; otherwise, false. + /// This operator provides results consistent with the IComparable implementation. + public static bool operator >=(ScheduledItem left, ScheduledItem right) + { + return left.CompareTo(right) >= 0; + } + + #endregion + + #region Equality + + /// + /// Determines whether two specified ScheduledItem<TAbsolute, TValue> objects are equal. + /// + /// The first object to compare. + /// The second object to compare. + /// true if both ScheduledItem<TAbsolute, TValue> are equal; otherwise, false. + /// This operator does not provide results consistent with the IComparable implementation. Instead, it implements reference equality. + public static bool operator ==(ScheduledItem left, ScheduledItem right) + { + return object.ReferenceEquals(left, right); + } + + /// + /// Determines whether two specified ScheduledItem<TAbsolute, TValue> objects are inequal. + /// + /// The first object to compare. + /// The second object to compare. + /// true if both ScheduledItem<TAbsolute, TValue> are inequal; otherwise, false. + /// This operator does not provide results consistent with the IComparable implementation. Instead, it implements reference equality. + public static bool operator !=(ScheduledItem left, ScheduledItem right) + { + return !(left == right); + } + + /// + /// Determines whether a ScheduledItem<TAbsolute> object is equal to the specified object. + /// + /// The object to compare to the current ScheduledItem<TAbsolute> object. + /// true if the obj parameter is a ScheduledItem<TAbsolute> object and is equal to the current ScheduledItem<TAbsolute> object; otherwise, false. + public override bool Equals(object obj) + { + return object.ReferenceEquals(this, obj); + } + + /// + /// Returns the hash code for the current ScheduledItem<TAbsolute> object. + /// + /// A 32-bit signed integer hash code. + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion + + public IDisposable Cancellation + { + get + { + return _disposable; + } + } + + /// + /// Gets whether the work item has received a cancellation request. + /// + public bool IsCanceled + { + get { return _disposable.IsDisposed; } + } + } + + /// + /// Efficient scheduler queue that maintains scheduled items sorted by absolute time. + /// + /// This type is not thread safe; users should ensure proper synchronization. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "But it *is* a queue!")] + internal class SchedulerQueue + { + private readonly PriorityQueue _queue; + + /// + /// Creates a new scheduler queue with a default initial capacity. + /// + public SchedulerQueue() + : this(1024) + { + } + + /// + /// Creats a new scheduler queue with the specified initial capacity. + /// + /// Initial capacity of the scheduler queue. + /// is less than zero. + public SchedulerQueue(int capacity) + { + if (capacity < 0) + throw new ArgumentOutOfRangeException("capacity"); + + _queue = new PriorityQueue(capacity); + } + + /// + /// Gets the number of scheduled items in the scheduler queue. + /// + public int Count + { + get + { + return _queue.Count; + } + } + + /// + /// Enqueues the specified work item to be scheduled. + /// + /// Work item to be scheduled. + public void Enqueue(ScheduledItem scheduledItem) + { + _queue.Enqueue(scheduledItem); + } + + /// + /// Removes the specified work item from the scheduler queue. + /// + /// Work item to be removed from the scheduler queue. + /// true if the item was found; false otherwise. + public bool Remove(ScheduledItem scheduledItem) + { + return _queue.Remove(scheduledItem); + } + + /// + /// Dequeues the next work item from the scheduler queue. + /// + /// Next work item in the scheduler queue (removed). + public ScheduledItem Dequeue() + { + return _queue.Dequeue(); + } + + /// + /// Peeks the next work item in the scheduler queue. + /// + /// Next work item in the scheduler queue (not removed). + public ScheduledItem Peek() + { + return _queue.Peek(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs.meta new file mode 100644 index 00000000..a15fa437 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ScheduledItem.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 45457ee4a77967347828238b7a52b851 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs new file mode 100644 index 00000000..3d1243b3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs @@ -0,0 +1,112 @@ +using System; + +namespace UniRx.InternalUtil +{ + public class ThreadSafeQueueWorker + { + const int MaxArrayLength = 0X7FEFFFFF; + const int InitialSize = 16; + + object gate = new object(); + bool dequing = false; + + int actionListCount = 0; + Action[] actionList = new Action[InitialSize]; + object[] actionStates = new object[InitialSize]; + + int waitingListCount = 0; + Action[] waitingList = new Action[InitialSize]; + object[] waitingStates = new object[InitialSize]; + + public void Enqueue(Action action, object state) + { + lock (gate) + { + if (dequing) + { + // Ensure Capacity + if (waitingList.Length == waitingListCount) + { + var newLength = waitingListCount * 2; + if ((uint)newLength > MaxArrayLength) newLength = MaxArrayLength; + + var newArray = new Action[newLength]; + var newArrayState = new object[newLength]; + Array.Copy(waitingList, newArray, waitingListCount); + Array.Copy(waitingStates, newArrayState, waitingListCount); + waitingList = newArray; + waitingStates = newArrayState; + } + waitingList[waitingListCount] = action; + waitingStates[waitingListCount] = state; + waitingListCount++; + } + else + { + // Ensure Capacity + if (actionList.Length == actionListCount) + { + var newLength = actionListCount * 2; + if ((uint)newLength > MaxArrayLength) newLength = MaxArrayLength; + + var newArray = new Action[newLength]; + var newArrayState = new object[newLength]; + Array.Copy(actionList, newArray, actionListCount); + Array.Copy(actionStates, newArrayState, actionListCount); + actionList = newArray; + actionStates = newArrayState; + } + actionList[actionListCount] = action; + actionStates[actionListCount] = state; + actionListCount++; + } + } + } + + public void ExecuteAll(Action unhandledExceptionCallback) + { + lock (gate) + { + if (actionListCount == 0) return; + + dequing = true; + } + + for (int i = 0; i < actionListCount; i++) + { + var action = actionList[i]; + var state = actionStates[i]; + try + { + action(state); + } + catch (Exception ex) + { + unhandledExceptionCallback(ex); + } + finally + { + // Clear + actionList[i] = null; + actionStates[i] = null; + } + } + + lock (gate) + { + dequing = false; + + var swapTempActionList = actionList; + var swapTempActionStates = actionStates; + + actionListCount = waitingListCount; + actionList = waitingList; + actionStates = waitingStates; + + waitingListCount = 0; + waitingList = swapTempActionList; + waitingStates = swapTempActionStates; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs.meta new file mode 100644 index 00000000..f430ea0b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/ThreadSafeQueueWorker.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 768cbfcbe2a8e704a8953eea28cd33df +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs b/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs new file mode 100644 index 00000000..98abdf11 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs @@ -0,0 +1,271 @@ +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#endif + +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace UniRx.InternalUtil +{ + internal static class UnityEqualityComparer + { + public static readonly IEqualityComparer Vector2 = new Vector2EqualityComparer(); + public static readonly IEqualityComparer Vector3 = new Vector3EqualityComparer(); + public static readonly IEqualityComparer Vector4 = new Vector4EqualityComparer(); + public static readonly IEqualityComparer Color = new ColorEqualityComparer(); + public static readonly IEqualityComparer Color32 = new Color32EqualityComparer(); + public static readonly IEqualityComparer Rect = new RectEqualityComparer(); + public static readonly IEqualityComparer Bounds = new BoundsEqualityComparer(); + public static readonly IEqualityComparer Quaternion = new QuaternionEqualityComparer(); + + static readonly RuntimeTypeHandle vector2Type = typeof(Vector2).TypeHandle; + static readonly RuntimeTypeHandle vector3Type = typeof(Vector3).TypeHandle; + static readonly RuntimeTypeHandle vector4Type = typeof(Vector4).TypeHandle; + static readonly RuntimeTypeHandle colorType = typeof(Color).TypeHandle; + static readonly RuntimeTypeHandle color32Type = typeof(Color32).TypeHandle; + static readonly RuntimeTypeHandle rectType = typeof(Rect).TypeHandle; + static readonly RuntimeTypeHandle boundsType = typeof(Bounds).TypeHandle; + static readonly RuntimeTypeHandle quaternionType = typeof(Quaternion).TypeHandle; + +#if UNITY_2017_2_OR_NEWER + + public static readonly IEqualityComparer Vector2Int = new Vector2IntEqualityComparer(); + public static readonly IEqualityComparer Vector3Int = new Vector3IntEqualityComparer(); + public static readonly IEqualityComparer RangeInt = new RangeIntEqualityComparer(); + public static readonly IEqualityComparer RectInt = new RectIntEqualityComparer(); + public static readonly IEqualityComparer BoundsInt = new BoundsIntEqualityComparer(); + + static readonly RuntimeTypeHandle vector2IntType = typeof(Vector2Int).TypeHandle; + static readonly RuntimeTypeHandle vector3IntType = typeof(Vector3Int).TypeHandle; + static readonly RuntimeTypeHandle rangeIntType = typeof(RangeInt).TypeHandle; + static readonly RuntimeTypeHandle rectIntType = typeof(RectInt).TypeHandle; + static readonly RuntimeTypeHandle boundsIntType = typeof(BoundsInt).TypeHandle; + +#endif + + static class Cache + { + public static readonly IEqualityComparer Comparer; + + static Cache() + { + var comparer = GetDefaultHelper(typeof(T)); + if (comparer == null) + { + Comparer = EqualityComparer.Default; + } + else + { + Comparer = (IEqualityComparer)comparer; + } + } + } + + public static IEqualityComparer GetDefault() + { + return Cache.Comparer; + } + + static object GetDefaultHelper(Type type) + { + var t = type.TypeHandle; + + if (t.Equals(vector2Type)) return (object)UnityEqualityComparer.Vector2; + if (t.Equals(vector3Type)) return (object)UnityEqualityComparer.Vector3; + if (t.Equals(vector4Type)) return (object)UnityEqualityComparer.Vector4; + if (t.Equals(colorType)) return (object)UnityEqualityComparer.Color; + if (t.Equals(color32Type)) return (object)UnityEqualityComparer.Color32; + if (t.Equals(rectType)) return (object)UnityEqualityComparer.Rect; + if (t.Equals(boundsType)) return (object)UnityEqualityComparer.Bounds; + if (t.Equals(quaternionType)) return (object)UnityEqualityComparer.Quaternion; + +#if UNITY_2017_2_OR_NEWER + + if (t.Equals(vector2IntType)) return (object)UnityEqualityComparer.Vector2Int; + if (t.Equals(vector3IntType)) return (object)UnityEqualityComparer.Vector3Int; + if (t.Equals(rangeIntType)) return (object)UnityEqualityComparer.RangeInt; + if (t.Equals(rectIntType)) return (object)UnityEqualityComparer.RectInt; + if (t.Equals(boundsIntType)) return (object)UnityEqualityComparer.BoundsInt; +#endif + + return null; + } + + sealed class Vector2EqualityComparer : IEqualityComparer + { + public bool Equals(Vector2 self, Vector2 vector) + { + return self.x.Equals(vector.x) && self.y.Equals(vector.y); + } + + public int GetHashCode(Vector2 obj) + { + return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2; + } + } + + sealed class Vector3EqualityComparer : IEqualityComparer + { + public bool Equals(Vector3 self, Vector3 vector) + { + return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z); + } + + public int GetHashCode(Vector3 obj) + { + return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2; + } + } + + sealed class Vector4EqualityComparer : IEqualityComparer + { + public bool Equals(Vector4 self, Vector4 vector) + { + return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z) && self.w.Equals(vector.w); + } + + public int GetHashCode(Vector4 obj) + { + return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2 ^ obj.w.GetHashCode() >> 1; + } + } + + sealed class ColorEqualityComparer : IEqualityComparer + { + public bool Equals(Color self, Color other) + { + return self.r.Equals(other.r) && self.g.Equals(other.g) && self.b.Equals(other.b) && self.a.Equals(other.a); + } + + public int GetHashCode(Color obj) + { + return obj.r.GetHashCode() ^ obj.g.GetHashCode() << 2 ^ obj.b.GetHashCode() >> 2 ^ obj.a.GetHashCode() >> 1; + } + } + + sealed class RectEqualityComparer : IEqualityComparer + { + public bool Equals(Rect self, Rect other) + { + return self.x.Equals(other.x) && self.width.Equals(other.width) && self.y.Equals(other.y) && self.height.Equals(other.height); + } + + public int GetHashCode(Rect obj) + { + return obj.x.GetHashCode() ^ obj.width.GetHashCode() << 2 ^ obj.y.GetHashCode() >> 2 ^ obj.height.GetHashCode() >> 1; + } + } + + sealed class BoundsEqualityComparer : IEqualityComparer + { + public bool Equals(Bounds self, Bounds vector) + { + return self.center.Equals(vector.center) && self.extents.Equals(vector.extents); + } + + public int GetHashCode(Bounds obj) + { + return obj.center.GetHashCode() ^ obj.extents.GetHashCode() << 2; + } + } + + sealed class QuaternionEqualityComparer : IEqualityComparer + { + public bool Equals(Quaternion self, Quaternion vector) + { + return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z) && self.w.Equals(vector.w); + } + + public int GetHashCode(Quaternion obj) + { + return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2 ^ obj.w.GetHashCode() >> 1; + } + } + + sealed class Color32EqualityComparer : IEqualityComparer + { + public bool Equals(Color32 self, Color32 vector) + { + return self.a.Equals(vector.a) && self.r.Equals(vector.r) && self.g.Equals(vector.g) && self.b.Equals(vector.b); + } + + public int GetHashCode(Color32 obj) + { + return obj.a.GetHashCode() ^ obj.r.GetHashCode() << 2 ^ obj.g.GetHashCode() >> 2 ^ obj.b.GetHashCode() >> 1; + } + } + +#if UNITY_2017_2_OR_NEWER + + sealed class Vector2IntEqualityComparer : IEqualityComparer + { + public bool Equals(Vector2Int self, Vector2Int vector) + { + return self.x.Equals(vector.x) && self.y.Equals(vector.y); + } + + public int GetHashCode(Vector2Int obj) + { + return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2; + } + } + + sealed class Vector3IntEqualityComparer : IEqualityComparer + { + public static readonly Vector3IntEqualityComparer Default = new Vector3IntEqualityComparer(); + + public bool Equals(Vector3Int self, Vector3Int vector) + { + return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z); + } + + public int GetHashCode(Vector3Int obj) + { + return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2; + } + } + + sealed class RangeIntEqualityComparer : IEqualityComparer + { + public bool Equals(RangeInt self, RangeInt vector) + { + return self.start.Equals(vector.start) && self.length.Equals(vector.length); + } + + public int GetHashCode(RangeInt obj) + { + return obj.start.GetHashCode() ^ obj.length.GetHashCode() << 2; + } + } + + sealed class RectIntEqualityComparer : IEqualityComparer + { + public bool Equals(RectInt self, RectInt other) + { + return self.x.Equals(other.x) && self.width.Equals(other.width) && self.y.Equals(other.y) && self.height.Equals(other.height); + } + + public int GetHashCode(RectInt obj) + { + return obj.x.GetHashCode() ^ obj.width.GetHashCode() << 2 ^ obj.y.GetHashCode() >> 2 ^ obj.height.GetHashCode() >> 1; + } + } + + sealed class BoundsIntEqualityComparer : IEqualityComparer + { + public bool Equals(BoundsInt self, BoundsInt vector) + { + return Vector3IntEqualityComparer.Default.Equals(self.position, vector.position) + && Vector3IntEqualityComparer.Default.Equals(self.size, vector.size); + } + + public int GetHashCode(BoundsInt obj) + { + return Vector3IntEqualityComparer.Default.GetHashCode(obj.position) ^ Vector3IntEqualityComparer.Default.GetHashCode(obj.size) << 2; + } + } + +#endif + } +} diff --git a/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs.meta b/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs.meta new file mode 100644 index 00000000..3550ec52 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/InternalUtil/UnityEqualityComparer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 626a410137515ac45bb59d1ca91d8f3f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Notification.cs b/Assets/Plugins/UniRx/Scripts/Notification.cs new file mode 100644 index 00000000..25f8f1a3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notification.cs @@ -0,0 +1,678 @@ +// original code from rx.codeplex.com +// some modified. + +/* ------------------ */ + +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +using System.Diagnostics; +using System.Globalization; +using System.Collections.Generic; +using System; +using UniRx.InternalUtil; + +#pragma warning disable 0659 +#pragma warning disable 0661 + +namespace UniRx +{ + /// + /// Provides a mechanism for receiving push-based notifications and returning a response. + /// + /// + /// The type of the elements received by the observer. + /// This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. + /// + /// + /// The type of the result returned from the observer's notification handlers. + /// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. + /// + public interface IObserver + { + /// + /// Notifies the observer of a new element in the sequence. + /// + /// The new element in the sequence. + /// Result returned upon observation of a new element. + TResult OnNext(TValue value); + + /// + /// Notifies the observer that an exception has occurred. + /// + /// The exception that occurred. + /// Result returned upon observation of an error. + TResult OnError(Exception exception); + + /// + /// Notifies the observer of the end of the sequence. + /// + /// Result returned upon observation of the sequence completion. + TResult OnCompleted(); + } + + /// + /// Indicates the type of a notification. + /// + public enum NotificationKind + { + /// + /// Represents an OnNext notification. + /// + OnNext, + + /// + /// Represents an OnError notification. + /// + OnError, + + /// + /// Represents an OnCompleted notification. + /// + OnCompleted + } + + /// + /// Represents a notification to an observer. + /// + /// The type of the elements received by the observer. + [Serializable] + public abstract class Notification : IEquatable> + { + /// + /// Default constructor used by derived types. + /// + protected internal Notification() + { + } + + /// + /// Returns the value of an OnNext notification or throws an exception. + /// + public abstract T Value + { + get; + } + + /// + /// Returns a value that indicates whether the notification has a value. + /// + public abstract bool HasValue + { + get; + } + + /// + /// Returns the exception of an OnError notification or returns null. + /// + public abstract Exception Exception + { + get; + } + + /// + /// Gets the kind of notification that is represented. + /// + public abstract NotificationKind Kind + { + get; + } + + /// + /// Represents an OnNext notification to an observer. + /// + [DebuggerDisplay("OnNext({Value})")] + [Serializable] + internal sealed class OnNextNotification : Notification + { + T value; + + /// + /// Constructs a notification of a new value. + /// + public OnNextNotification(T value) + { + this.value = value; + } + + /// + /// Returns the value of an OnNext notification. + /// + public override T Value { get { return value; } } + + /// + /// Returns null. + /// + public override Exception Exception { get { return null; } } + + /// + /// Returns true. + /// + public override bool HasValue { get { return true; } } + + /// + /// Returns NotificationKind.OnNext. + /// + public override NotificationKind Kind { get { return NotificationKind.OnNext; } } + + /// + /// Returns the hash code for this instance. + /// + public override int GetHashCode() + { + return EqualityComparer.Default.GetHashCode(Value); + } + + /// + /// Indicates whether this instance and a specified object are equal. + /// + public override bool Equals(Notification other) + { + if (Object.ReferenceEquals(this, other)) + return true; + if (Object.ReferenceEquals(other, null)) + return false; + if (other.Kind != NotificationKind.OnNext) + return false; + return EqualityComparer.Default.Equals(Value, other.Value); + } + + /// + /// Returns a string representation of this instance. + /// + public override string ToString() + { + return String.Format(CultureInfo.CurrentCulture, "OnNext({0})", Value); + } + + /// + /// Invokes the observer's method corresponding to the notification. + /// + /// Observer to invoke the notification on. + public override void Accept(IObserver observer) + { + if (observer == null) + throw new ArgumentNullException("observer"); + + observer.OnNext(Value); + } + + /// + /// Invokes the observer's method corresponding to the notification and returns the produced result. + /// + /// Observer to invoke the notification on. + /// Result produced by the observation. + public override TResult Accept(IObserver observer) + { + if (observer == null) + throw new ArgumentNullException("observer"); + + return observer.OnNext(Value); + } + + /// + /// Invokes the delegate corresponding to the notification. + /// + /// Delegate to invoke for an OnNext notification. + /// Delegate to invoke for an OnError notification. + /// Delegate to invoke for an OnCompleted notification. + public override void Accept(Action onNext, Action onError, Action onCompleted) + { + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + onNext(Value); + } + + /// + /// Invokes the delegate corresponding to the notification and returns the produced result. + /// + /// Delegate to invoke for an OnNext notification. + /// Delegate to invoke for an OnError notification. + /// Delegate to invoke for an OnCompleted notification. + /// Result produced by the observation. + public override TResult Accept(Func onNext, Func onError, Func onCompleted) + { + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return onNext(Value); + } + } + + /// + /// Represents an OnError notification to an observer. + /// +#if !NO_DEBUGGER_ATTRIBUTES + [DebuggerDisplay("OnError({Exception})")] +#endif +#if !NO_SERIALIZABLE + [Serializable] +#endif + internal sealed class OnErrorNotification : Notification + { + Exception exception; + + /// + /// Constructs a notification of an exception. + /// + public OnErrorNotification(Exception exception) + { + this.exception = exception; + } + + /// + /// Throws the exception. + /// + public override T Value { get { exception.Throw(); throw exception; } } + + /// + /// Returns the exception. + /// + public override Exception Exception { get { return exception; } } + + /// + /// Returns false. + /// + public override bool HasValue { get { return false; } } + + /// + /// Returns NotificationKind.OnError. + /// + public override NotificationKind Kind { get { return NotificationKind.OnError; } } + + /// + /// Returns the hash code for this instance. + /// + public override int GetHashCode() + { + return Exception.GetHashCode(); + } + + /// + /// Indicates whether this instance and other are equal. + /// + public override bool Equals(Notification other) + { + if (Object.ReferenceEquals(this, other)) + return true; + if (Object.ReferenceEquals(other, null)) + return false; + if (other.Kind != NotificationKind.OnError) + return false; + return Object.Equals(Exception, other.Exception); + } + + /// + /// Returns a string representation of this instance. + /// + public override string ToString() + { + return String.Format(CultureInfo.CurrentCulture, "OnError({0})", Exception.GetType().FullName); + } + + /// + /// Invokes the observer's method corresponding to the notification. + /// + /// Observer to invoke the notification on. + public override void Accept(IObserver observer) + { + if (observer == null) + throw new ArgumentNullException("observer"); + + observer.OnError(Exception); + } + + /// + /// Invokes the observer's method corresponding to the notification and returns the produced result. + /// + /// Observer to invoke the notification on. + /// Result produced by the observation. + public override TResult Accept(IObserver observer) + { + if (observer == null) + throw new ArgumentNullException("observer"); + + return observer.OnError(Exception); + } + + /// + /// Invokes the delegate corresponding to the notification. + /// + /// Delegate to invoke for an OnNext notification. + /// Delegate to invoke for an OnError notification. + /// Delegate to invoke for an OnCompleted notification. + public override void Accept(Action onNext, Action onError, Action onCompleted) + { + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + onError(Exception); + } + + /// + /// Invokes the delegate corresponding to the notification and returns the produced result. + /// + /// Delegate to invoke for an OnNext notification. + /// Delegate to invoke for an OnError notification. + /// Delegate to invoke for an OnCompleted notification. + /// Result produced by the observation. + public override TResult Accept(Func onNext, Func onError, Func onCompleted) + { + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return onError(Exception); + } + } + + /// + /// Represents an OnCompleted notification to an observer. + /// + [DebuggerDisplay("OnCompleted()")] + [Serializable] + internal sealed class OnCompletedNotification : Notification + { + /// + /// Constructs a notification of the end of a sequence. + /// + public OnCompletedNotification() + { + } + + /// + /// Throws an InvalidOperationException. + /// + public override T Value { get { throw new InvalidOperationException("No Value"); } } + + /// + /// Returns null. + /// + public override Exception Exception { get { return null; } } + + /// + /// Returns false. + /// + public override bool HasValue { get { return false; } } + + /// + /// Returns NotificationKind.OnCompleted. + /// + public override NotificationKind Kind { get { return NotificationKind.OnCompleted; } } + + /// + /// Returns the hash code for this instance. + /// + public override int GetHashCode() + { + return typeof(T).GetHashCode() ^ 8510; + } + + /// + /// Indicates whether this instance and other are equal. + /// + public override bool Equals(Notification other) + { + if (Object.ReferenceEquals(this, other)) + return true; + if (Object.ReferenceEquals(other, null)) + return false; + return other.Kind == NotificationKind.OnCompleted; + } + + /// + /// Returns a string representation of this instance. + /// + public override string ToString() + { + return "OnCompleted()"; + } + + /// + /// Invokes the observer's method corresponding to the notification. + /// + /// Observer to invoke the notification on. + public override void Accept(IObserver observer) + { + if (observer == null) + throw new ArgumentNullException("observer"); + + observer.OnCompleted(); + } + + /// + /// Invokes the observer's method corresponding to the notification and returns the produced result. + /// + /// Observer to invoke the notification on. + /// Result produced by the observation. + public override TResult Accept(IObserver observer) + { + if (observer == null) + throw new ArgumentNullException("observer"); + + return observer.OnCompleted(); + } + + /// + /// Invokes the delegate corresponding to the notification. + /// + /// Delegate to invoke for an OnNext notification. + /// Delegate to invoke for an OnError notification. + /// Delegate to invoke for an OnCompleted notification. + public override void Accept(Action onNext, Action onError, Action onCompleted) + { + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + onCompleted(); + } + + /// + /// Invokes the delegate corresponding to the notification and returns the produced result. + /// + /// Delegate to invoke for an OnNext notification. + /// Delegate to invoke for an OnError notification. + /// Delegate to invoke for an OnCompleted notification. + /// Result produced by the observation. + public override TResult Accept(Func onNext, Func onError, Func onCompleted) + { + if (onNext == null) + throw new ArgumentNullException("onNext"); + if (onError == null) + throw new ArgumentNullException("onError"); + if (onCompleted == null) + throw new ArgumentNullException("onCompleted"); + + return onCompleted(); + } + } + + /// + /// Determines whether the current Notification<T> object has the same observer message payload as a specified Notification<T> value. + /// + /// An object to compare to the current Notification<T> object. + /// true if both Notification<T> objects have the same observer message payload; otherwise, false. + /// + /// Equality of Notification<T> objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any). + /// This means two Notification<T> objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method. + /// In case one wants to determine whether two Notification<T> objects represent the same observer method call, use Object.ReferenceEquals identity equality instead. + /// + public abstract bool Equals(Notification other); + + /// + /// Determines whether the two specified Notification<T> objects have the same observer message payload. + /// + /// The first Notification<T> to compare, or null. + /// The second Notification<T> to compare, or null. + /// true if the first Notification<T> value has the same observer message payload as the second Notification<T> value; otherwise, false. + /// + /// Equality of Notification<T> objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any). + /// This means two Notification<T> objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method. + /// In case one wants to determine whether two Notification<T> objects represent the same observer method call, use Object.ReferenceEquals identity equality instead. + /// + public static bool operator ==(Notification left, Notification right) + { + if (object.ReferenceEquals(left, right)) + return true; + + if ((object)left == null || (object)right == null) + return false; + + return left.Equals(right); + } + + /// + /// Determines whether the two specified Notification<T> objects have a different observer message payload. + /// + /// The first Notification<T> to compare, or null. + /// The second Notification<T> to compare, or null. + /// true if the first Notification<T> value has a different observer message payload as the second Notification<T> value; otherwise, false. + /// + /// Equality of Notification<T> objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any). + /// This means two Notification<T> objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method. + /// In case one wants to determine whether two Notification<T> objects represent a different observer method call, use Object.ReferenceEquals identity equality instead. + /// + public static bool operator !=(Notification left, Notification right) + { + return !(left == right); + } + + /// + /// Determines whether the specified System.Object is equal to the current Notification<T>. + /// + /// The System.Object to compare with the current Notification<T>. + /// true if the specified System.Object is equal to the current Notification<T>; otherwise, false. + /// + /// Equality of Notification<T> objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any). + /// This means two Notification<T> objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method. + /// In case one wants to determine whether two Notification<T> objects represent the same observer method call, use Object.ReferenceEquals identity equality instead. + /// + public override bool Equals(object obj) + { + return Equals(obj as Notification); + } + + /// + /// Invokes the observer's method corresponding to the notification. + /// + /// Observer to invoke the notification on. + public abstract void Accept(IObserver observer); + + /// + /// Invokes the observer's method corresponding to the notification and returns the produced result. + /// + /// The type of the result returned from the observer's notification handlers. + /// Observer to invoke the notification on. + /// Result produced by the observation. + public abstract TResult Accept(IObserver observer); + + /// + /// Invokes the delegate corresponding to the notification. + /// + /// Delegate to invoke for an OnNext notification. + /// Delegate to invoke for an OnError notification. + /// Delegate to invoke for an OnCompleted notification. + public abstract void Accept(Action onNext, Action onError, Action onCompleted); + + /// + /// Invokes the delegate corresponding to the notification and returns the produced result. + /// + /// The type of the result returned from the notification handler delegates. + /// Delegate to invoke for an OnNext notification. + /// Delegate to invoke for an OnError notification. + /// Delegate to invoke for an OnCompleted notification. + /// Result produced by the observation. + public abstract TResult Accept(Func onNext, Func onError, Func onCompleted); + + /// + /// Returns an observable sequence with a single notification, using the immediate scheduler. + /// + /// The observable sequence that surfaces the behavior of the notification upon subscription. + public IObservable ToObservable() + { + return this.ToObservable(Scheduler.Immediate); + } + + /// + /// Returns an observable sequence with a single notification. + /// + /// Scheduler to send out the notification calls on. + /// The observable sequence that surfaces the behavior of the notification upon subscription. + public IObservable ToObservable(IScheduler scheduler) + { + if (scheduler == null) + throw new ArgumentNullException("scheduler"); + + return Observable.Create(observer => scheduler.Schedule(() => + { + this.Accept(observer); + if (this.Kind == NotificationKind.OnNext) + observer.OnCompleted(); + })); + } + } + + /// + /// Provides a set of static methods for constructing notifications. + /// + public static class Notification + { + /// + /// Creates an object that represents an OnNext notification to an observer. + /// + /// The type of the elements received by the observer. Upon dematerialization of the notifications into an observable sequence, this type is used as the element type for the sequence. + /// The value contained in the notification. + /// The OnNext notification containing the value. + public static Notification CreateOnNext(T value) + { + return new Notification.OnNextNotification(value); + } + + /// + /// Creates an object that represents an OnError notification to an observer. + /// + /// The type of the elements received by the observer. Upon dematerialization of the notifications into an observable sequence, this type is used as the element type for the sequence. + /// The exception contained in the notification. + /// The OnError notification containing the exception. + /// is null. + public static Notification CreateOnError(Exception error) + { + if (error == null) + throw new ArgumentNullException("error"); + + return new Notification.OnErrorNotification(error); + } + + /// + /// Creates an object that represents an OnCompleted notification to an observer. + /// + /// The type of the elements received by the observer. Upon dematerialization of the notifications into an observable sequence, this type is used as the element type for the sequence. + /// The OnCompleted notification. + public static Notification CreateOnCompleted() + { + return new Notification.OnCompletedNotification(); + } + } +} + +#pragma warning restore 0659 +#pragma warning restore 0661 \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Notification.cs.meta b/Assets/Plugins/UniRx/Scripts/Notification.cs.meta new file mode 100644 index 00000000..e4addd29 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notification.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 169d02559aa6b3e459fbae10f2acecd8 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers.meta b/Assets/Plugins/UniRx/Scripts/Notifiers.meta new file mode 100644 index 00000000..0202f532 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 63388f4f94a67e34590e2167d45e4046 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs b/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs new file mode 100644 index 00000000..bc238971 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace UniRx +{ + /// + /// Notify boolean flag. + /// + public class BooleanNotifier : IObservable + { + readonly Subject boolTrigger = new Subject(); + + bool boolValue; + /// Current flag value + public bool Value + { + get { return boolValue; } + set + { + boolValue = value; + boolTrigger.OnNext(value); + } + } + + /// + /// Setup initial flag. + /// + public BooleanNotifier(bool initialValue = false) + { + this.Value = initialValue; + } + + /// + /// Set and raise true if current value isn't true. + /// + public void TurnOn() + { + if (Value != true) + { + Value = true; + } + } + + /// + /// Set and raise false if current value isn't false. + /// + public void TurnOff() + { + if (Value != false) + { + Value = false; + } + } + + /// + /// Set and raise reverse value. + /// + public void SwitchValue() + { + Value = !Value; + } + + + /// + /// Subscribe observer. + /// + public IDisposable Subscribe(IObserver observer) + { + return boolTrigger.Subscribe(observer); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs.meta b/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs.meta new file mode 100644 index 00000000..ce547726 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/BooleanNotifier.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5ee30c0abdddd7241acbe24df0637678 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs b/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs new file mode 100644 index 00000000..8b4a0062 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace UniRx +{ + /// Event kind of CountNotifier. + public enum CountChangedStatus + { + /// Count incremented. + Increment, + /// Count decremented. + Decrement, + /// Count is zero. + Empty, + /// Count arrived max. + Max + } + + /// + /// Notify event of count flag. + /// + public class CountNotifier : IObservable + { + readonly object lockObject = new object(); + readonly Subject statusChanged = new Subject(); + readonly int max; + + public int Max { get { return max; } } + public int Count { get; private set; } + + /// + /// Setup max count of signal. + /// + public CountNotifier(int max = int.MaxValue) + { + if (max <= 0) + { + throw new ArgumentException("max"); + } + + this.max = max; + } + + /// + /// Increment count and notify status. + /// + public IDisposable Increment(int incrementCount = 1) + { + if (incrementCount < 0) + { + throw new ArgumentException("incrementCount"); + } + + lock (lockObject) + { + if (Count == Max) return Disposable.Empty; + else if (incrementCount + Count > Max) Count = Max; + else Count += incrementCount; + + statusChanged.OnNext(CountChangedStatus.Increment); + if (Count == Max) statusChanged.OnNext(CountChangedStatus.Max); + + return Disposable.Create(() => this.Decrement(incrementCount)); + } + } + + /// + /// Decrement count and notify status. + /// + public void Decrement(int decrementCount = 1) + { + if (decrementCount < 0) + { + throw new ArgumentException("decrementCount"); + } + + lock (lockObject) + { + if (Count == 0) return; + else if (Count - decrementCount < 0) Count = 0; + else Count -= decrementCount; + + statusChanged.OnNext(CountChangedStatus.Decrement); + if (Count == 0) statusChanged.OnNext(CountChangedStatus.Empty); + } + } + + /// + /// Subscribe observer. + /// + public IDisposable Subscribe(IObserver observer) + { + return statusChanged.Subscribe(observer); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs.meta b/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs.meta new file mode 100644 index 00000000..6f0d3346 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/CountNotifier.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 503af1c1dc279164e83011be5110633e +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs b/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs new file mode 100644 index 00000000..a951831d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using UniRx.InternalUtil; + +namespace UniRx +{ + public interface IMessagePublisher + { + /// + /// Send Message to all receiver. + /// + void Publish(T message); + } + + public interface IMessageReceiver + { + /// + /// Subscribe typed message. + /// + IObservable Receive(); + } + + public interface IMessageBroker : IMessagePublisher, IMessageReceiver + { + } + + public interface IAsyncMessagePublisher + { + /// + /// Send Message to all receiver and await complete. + /// + IObservable PublishAsync(T message); + } + + public interface IAsyncMessageReceiver + { + /// + /// Subscribe typed message. + /// + IDisposable Subscribe(Func> asyncMessageReceiver); + } + + public interface IAsyncMessageBroker : IAsyncMessagePublisher, IAsyncMessageReceiver + { + } + + /// + /// In-Memory PubSub filtered by Type. + /// + public class MessageBroker : IMessageBroker, IDisposable + { + /// + /// MessageBroker in Global scope. + /// + public static readonly IMessageBroker Default = new MessageBroker(); + + bool isDisposed = false; + readonly Dictionary notifiers = new Dictionary(); + + public void Publish(T message) + { + object notifier; + lock (notifiers) + { + if (isDisposed) return; + + if (!notifiers.TryGetValue(typeof(T), out notifier)) + { + return; + } + } + ((ISubject)notifier).OnNext(message); + } + + public IObservable Receive() + { + object notifier; + lock (notifiers) + { + if (isDisposed) throw new ObjectDisposedException("MessageBroker"); + + if (!notifiers.TryGetValue(typeof(T), out notifier)) + { + ISubject n = new Subject().Synchronize(); + notifier = n; + notifiers.Add(typeof(T), notifier); + } + } + + return ((IObservable)notifier).AsObservable(); + } + + public void Dispose() + { + lock (notifiers) + { + if (!isDisposed) + { + isDisposed = true; + notifiers.Clear(); + } + } + } + } + + /// + /// In-Memory PubSub filtered by Type. + /// + public class AsyncMessageBroker : IAsyncMessageBroker, IDisposable + { + /// + /// AsyncMessageBroker in Global scope. + /// + public static readonly IAsyncMessageBroker Default = new AsyncMessageBroker(); + + bool isDisposed = false; + readonly Dictionary notifiers = new Dictionary(); + + public IObservable PublishAsync(T message) + { + UniRx.InternalUtil.ImmutableList>> notifier; + lock (notifiers) + { + if (isDisposed) throw new ObjectDisposedException("AsyncMessageBroker"); + + object _notifier; + if (notifiers.TryGetValue(typeof(T), out _notifier)) + { + notifier = (UniRx.InternalUtil.ImmutableList>>)_notifier; + } + else + { + return Observable.ReturnUnit(); + } + } + + var data = notifier.Data; + var awaiter = new IObservable[data.Length]; + for (int i = 0; i < data.Length; i++) + { + awaiter[i] = data[i].Invoke(message); + } + return Observable.WhenAll(awaiter); + } + + public IDisposable Subscribe(Func> asyncMessageReceiver) + { + lock (notifiers) + { + if (isDisposed) throw new ObjectDisposedException("AsyncMessageBroker"); + + object _notifier; + if (!notifiers.TryGetValue(typeof(T), out _notifier)) + { + var notifier = UniRx.InternalUtil.ImmutableList>>.Empty; + notifier = notifier.Add(asyncMessageReceiver); + notifiers.Add(typeof(T), notifier); + } + else + { + var notifier = (ImmutableList>>)_notifier; + notifier = notifier.Add(asyncMessageReceiver); + notifiers[typeof(T)] = notifier; + } + } + + return new Subscription(this, asyncMessageReceiver); + } + + public void Dispose() + { + lock (notifiers) + { + if (!isDisposed) + { + isDisposed = true; + notifiers.Clear(); + } + } + } + + class Subscription : IDisposable + { + readonly AsyncMessageBroker parent; + readonly Func> asyncMessageReceiver; + + public Subscription(AsyncMessageBroker parent, Func> asyncMessageReceiver) + { + this.parent = parent; + this.asyncMessageReceiver = asyncMessageReceiver; + } + + public void Dispose() + { + lock (parent.notifiers) + { + object _notifier; + if (parent.notifiers.TryGetValue(typeof(T), out _notifier)) + { + var notifier = (ImmutableList>>)_notifier; + notifier = notifier.Remove(asyncMessageReceiver); + + parent.notifiers[typeof(T)] = notifier; + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs.meta b/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs.meta new file mode 100644 index 00000000..9b5001e1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/MessageBroker.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9dc5e3c48d083d4418ab67287f050267 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs b/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs new file mode 100644 index 00000000..649dcbc7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs @@ -0,0 +1,72 @@ +using System; + +namespace UniRx +{ + /// + /// Notify value on setuped scheduler. + /// + public class ScheduledNotifier : IObservable, IProgress + { + readonly IScheduler scheduler; + readonly Subject trigger = new Subject(); + + /// + /// Use scheduler is Scheduler.DefaultSchedulers.ConstantTimeOperations. + /// + public ScheduledNotifier() + { + this.scheduler = Scheduler.DefaultSchedulers.ConstantTimeOperations; + } + /// + /// Use scheduler is argument's scheduler. + /// + public ScheduledNotifier(IScheduler scheduler) + { + if (scheduler == null) + { + throw new ArgumentNullException("scheduler"); + } + + this.scheduler = scheduler; + } + + /// + /// Push value to subscribers on setuped scheduler. + /// + public void Report(T value) + { + scheduler.Schedule(() => trigger.OnNext(value)); + } + + /// + /// Push value to subscribers on setuped scheduler. + /// + public IDisposable Report(T value, TimeSpan dueTime) + { + var cancel = scheduler.Schedule(dueTime, () => trigger.OnNext(value)); + return cancel; + } + + /// + /// Push value to subscribers on setuped scheduler. + /// + public IDisposable Report(T value, DateTimeOffset dueTime) + { + var cancel = scheduler.Schedule(dueTime, () => trigger.OnNext(value)); + return cancel; + } + + /// + /// Subscribe observer. + /// + public IDisposable Subscribe(IObserver observer) + { + if (observer == null) + { + throw new ArgumentNullException("observer"); + } + + return trigger.Subscribe(observer); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs.meta b/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs.meta new file mode 100644 index 00000000..4fb6aa38 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Notifiers/ScheduledNotifier.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e6f53242e655cbe4e889538216dc9e17 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs b/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs new file mode 100644 index 00000000..da0dff2a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UniRx.Operators; + +namespace UniRx +{ + public static partial class Observable + { + public static IObservable Scan(this IObservable source, Func accumulator) + { + return new ScanObservable(source, accumulator); + } + + public static IObservable Scan(this IObservable source, TAccumulate seed, Func accumulator) + { + return new ScanObservable(source, seed, accumulator); + } + + public static IObservable Aggregate(this IObservable source, Func accumulator) + { + return new AggregateObservable(source, accumulator); + } + + public static IObservable Aggregate(this IObservable source, TAccumulate seed, Func accumulator) + { + return new AggregateObservable(source, seed, accumulator); + } + + public static IObservable Aggregate(this IObservable source, TAccumulate seed, Func accumulator, Func resultSelector) + { + return new AggregateObservable(source, seed, accumulator, resultSelector); + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs.meta new file mode 100644 index 00000000..cb3a93d8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Aggregate.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 82339dddb2a9f944785f1555b83d667c +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs b/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs new file mode 100644 index 00000000..1040e0af --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs @@ -0,0 +1,133 @@ +#if (NET_4_6 || NET_STANDARD_2_0) + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace UniRx +{ + public static partial class Observable + { + /// + /// Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty. + /// This operation subscribes to the observable sequence, making it hot. + /// + /// Source sequence to await. + public static AsyncSubject GetAwaiter(this IObservable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return RunAsync(source, CancellationToken.None); + } + + /// + /// Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty. + /// This operation subscribes to the observable sequence, making it hot. + /// + /// Source sequence to await. + public static AsyncSubject GetAwaiter(this IConnectableObservable source) + { + if (source == null) throw new ArgumentNullException("source"); + + return RunAsync(source, CancellationToken.None); + } + + /// + /// Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty. + /// This operation subscribes to the observable sequence, making it hot. + /// + /// Source sequence to await. + /// Cancellation token. + public static AsyncSubject GetAwaiter(this IObservable source, CancellationToken cancellationToken) + { + if (source == null) throw new ArgumentNullException("source"); + + return RunAsync(source, cancellationToken); + } + + /// + /// Gets an awaiter that returns the last value of the observable sequence or throws an exception if the sequence is empty. + /// This operation subscribes to the observable sequence, making it hot. + /// + /// Source sequence to await. + /// Cancellation token. + public static AsyncSubject GetAwaiter(this IConnectableObservable source, CancellationToken cancellationToken) + { + if (source == null) throw new ArgumentNullException("source"); + + return RunAsync(source, cancellationToken); + } + + static AsyncSubject RunAsync(IObservable source, CancellationToken cancellationToken) + { + var s = new AsyncSubject(); + + if (cancellationToken.IsCancellationRequested) + { + return Cancel(s, cancellationToken); + } + + var d = source.Subscribe(s); + + if (cancellationToken.CanBeCanceled) + { + RegisterCancelation(s, d, cancellationToken); + } + + return s; + } + + static AsyncSubject RunAsync(IConnectableObservable source, CancellationToken cancellationToken) + { + var s = new AsyncSubject(); + + if (cancellationToken.IsCancellationRequested) + { + return Cancel(s, cancellationToken); + } + + var d = source.Subscribe(s); + var c = source.Connect(); + + if (cancellationToken.CanBeCanceled) + { + RegisterCancelation(s, StableCompositeDisposable.Create(d, c), cancellationToken); + } + + return s; + } + + static AsyncSubject Cancel(AsyncSubject subject, CancellationToken cancellationToken) + { + subject.OnError(new OperationCanceledException(cancellationToken)); + return subject; + } + + static void RegisterCancelation(AsyncSubject subject, IDisposable subscription, CancellationToken token) + { + // + // Separate method used to avoid heap allocation of closure when no cancellation is needed, + // e.g. when CancellationToken.None is provided to the RunAsync overloads. + // + + var ctr = token.Register(() => + { + subscription.Dispose(); + Cancel(subject, token); + }); + + // + // No null-check for ctr is needed: + // + // - CancellationTokenRegistration is a struct + // - Registration will succeed 99% of the time, no warranting an attempt to avoid spurious Subscribe calls + // + subject.Subscribe(Stubs.Ignore, _ => ctr.Dispose(), ctr.Dispose); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs.meta new file mode 100644 index 00000000..b987ebf4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Awaiter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ec3ea3f22d061964c8f06eb9ea78ec42 +timeCreated: 1475137543 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs b/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs new file mode 100644 index 00000000..7b75ed8a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs @@ -0,0 +1,76 @@ +using System; +using UniRx.Operators; + +namespace UniRx +{ + public static partial class Observable + { + public static IConnectableObservable Multicast(this IObservable source, ISubject subject) + { + return new ConnectableObservable(source, subject); + } + + public static IConnectableObservable Publish(this IObservable source) + { + return source.Multicast(new Subject()); + } + + public static IConnectableObservable Publish(this IObservable source, T initialValue) + { + return source.Multicast(new BehaviorSubject(initialValue)); + } + + public static IConnectableObservable PublishLast(this IObservable source) + { + return source.Multicast(new AsyncSubject()); + } + + public static IConnectableObservable Replay(this IObservable source) + { + return source.Multicast(new ReplaySubject()); + } + + public static IConnectableObservable Replay(this IObservable source, IScheduler scheduler) + { + return source.Multicast(new ReplaySubject(scheduler)); + } + + public static IConnectableObservable Replay(this IObservable source, int bufferSize) + { + return source.Multicast(new ReplaySubject(bufferSize)); + } + + public static IConnectableObservable Replay(this IObservable source, int bufferSize, IScheduler scheduler) + { + return source.Multicast(new ReplaySubject(bufferSize, scheduler)); + } + + public static IConnectableObservable Replay(this IObservable source, TimeSpan window) + { + return source.Multicast(new ReplaySubject(window)); + } + + public static IConnectableObservable Replay(this IObservable source, TimeSpan window, IScheduler scheduler) + { + return source.Multicast(new ReplaySubject(window, scheduler)); + } + + public static IConnectableObservable Replay(this IObservable source, int bufferSize, TimeSpan window, IScheduler scheduler) + { + return source.Multicast(new ReplaySubject(bufferSize, window, scheduler)); + } + + public static IObservable RefCount(this IConnectableObservable source) + { + return new RefCountObservable(source); + } + + /// + /// same as Publish().RefCount() + /// + public static IObservable Share(this IObservable source) + { + return source.Publish().RefCount(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs.meta new file mode 100644 index 00000000..f530f86c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Binding.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bb11a562e64264645b76ad3a8d15d966 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs b/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs new file mode 100644 index 00000000..ebaa4025 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs @@ -0,0 +1,17 @@ +using System; + +namespace UniRx +{ + public static partial class Observable + { + public static T Wait(this IObservable source) + { + return new UniRx.Operators.Wait(source, InfiniteTimeSpan).Run(); + } + + public static T Wait(this IObservable source, TimeSpan timeout) + { + return new UniRx.Operators.Wait(source, timeout).Run(); + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs.meta new file mode 100644 index 00000000..a6e51538 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Blocking.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4a05ec8aabbdba24388b7b2ae6c4a474 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs b/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs new file mode 100644 index 00000000..cdf5f6d4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs @@ -0,0 +1,320 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Linq; +using UniRx.Operators; + +namespace UniRx +{ + // concatenate multiple observable + // merge, concat, zip... + public static partial class Observable + { + static IEnumerable> CombineSources(IObservable first, IObservable[] seconds) + { + yield return first; + for (int i = 0; i < seconds.Length; i++) + { + yield return seconds[i]; + } + } + + public static IObservable Concat(params IObservable[] sources) + { + if (sources == null) throw new ArgumentNullException("sources"); + + return new ConcatObservable(sources); + } + + public static IObservable Concat(this IEnumerable> sources) + { + if (sources == null) throw new ArgumentNullException("sources"); + + return new ConcatObservable(sources); + } + + public static IObservable Concat(this IObservable> sources) + { + return sources.Merge(maxConcurrent: 1); + } + + public static IObservable Concat(this IObservable first, params IObservable[] seconds) + { + if (first == null) throw new ArgumentNullException("first"); + if (seconds == null) throw new ArgumentNullException("seconds"); + + var concat = first as ConcatObservable; + if (concat != null) + { + return concat.Combine(seconds); + } + + return Concat(CombineSources(first, seconds)); + } + + public static IObservable Merge(this IEnumerable> sources) + { + return Merge(sources, Scheduler.DefaultSchedulers.ConstantTimeOperations); + } + + public static IObservable Merge(this IEnumerable> sources, IScheduler scheduler) + { + return new MergeObservable(sources.ToObservable(scheduler), scheduler == Scheduler.CurrentThread); + } + + public static IObservable Merge(this IEnumerable> sources, int maxConcurrent) + { + return Merge(sources, maxConcurrent, Scheduler.DefaultSchedulers.ConstantTimeOperations); + } + + public static IObservable Merge(this IEnumerable> sources, int maxConcurrent, IScheduler scheduler) + { + return new MergeObservable(sources.ToObservable(scheduler), maxConcurrent, scheduler == Scheduler.CurrentThread); + } + + public static IObservable Merge(params IObservable[] sources) + { + return Merge(Scheduler.DefaultSchedulers.ConstantTimeOperations, sources); + } + + public static IObservable Merge(IScheduler scheduler, params IObservable[] sources) + { + return new MergeObservable(sources.ToObservable(scheduler), scheduler == Scheduler.CurrentThread); + } + + public static IObservable Merge(this IObservable first, params IObservable[] seconds) + { + return Merge(CombineSources(first, seconds)); + } + + public static IObservable Merge(this IObservable first, IObservable second, IScheduler scheduler) + { + return Merge(scheduler, new[] { first, second }); + } + + public static IObservable Merge(this IObservable> sources) + { + return new MergeObservable(sources, false); + } + + public static IObservable Merge(this IObservable> sources, int maxConcurrent) + { + return new MergeObservable(sources, maxConcurrent, false); + } + + public static IObservable Zip(this IObservable left, IObservable right, Func selector) + { + return new ZipObservable(left, right, selector); + } + + public static IObservable> Zip(this IEnumerable> sources) + { + return Zip(sources.ToArray()); + } + + public static IObservable> Zip(params IObservable[] sources) + { + return new ZipObservable(sources); + } + + public static IObservable Zip(this IObservable source1, IObservable source2, IObservable source3, ZipFunc resultSelector) + { + return new ZipObservable(source1, source2, source3, resultSelector); + } + + public static IObservable Zip(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, ZipFunc resultSelector) + { + return new ZipObservable(source1, source2, source3, source4, resultSelector); + } + + public static IObservable Zip(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, ZipFunc resultSelector) + { + return new ZipObservable(source1, source2, source3, source4, source5, resultSelector); + } + + public static IObservable Zip(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, IObservable source6, ZipFunc resultSelector) + { + return new ZipObservable(source1, source2, source3, source4, source5, source6, resultSelector); + } + + public static IObservable Zip(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, IObservable source6, IObservable source7, ZipFunc resultSelector) + { + return new ZipObservable(source1, source2, source3, source4, source5, source6, source7, resultSelector); + } + + public static IObservable CombineLatest(this IObservable left, IObservable right, Func selector) + { + return new CombineLatestObservable(left, right, selector); + } + + public static IObservable> CombineLatest(this IEnumerable> sources) + { + return CombineLatest(sources.ToArray()); + } + + public static IObservable> CombineLatest(params IObservable[] sources) + { + return new CombineLatestObservable(sources); + } + + public static IObservable CombineLatest(this IObservable source1, IObservable source2, IObservable source3, CombineLatestFunc resultSelector) + { + return new CombineLatestObservable(source1, source2, source3, resultSelector); + } + + public static IObservable CombineLatest(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, CombineLatestFunc resultSelector) + { + return new CombineLatestObservable(source1, source2, source3, source4, resultSelector); + } + + public static IObservable CombineLatest(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, CombineLatestFunc resultSelector) + { + return new CombineLatestObservable(source1, source2, source3, source4, source5, resultSelector); + } + + public static IObservable CombineLatest(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, IObservable source6, CombineLatestFunc resultSelector) + { + return new CombineLatestObservable(source1, source2, source3, source4, source5, source6, resultSelector); + } + + public static IObservable CombineLatest(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, IObservable source6, IObservable source7, CombineLatestFunc resultSelector) + { + return new CombineLatestObservable(source1, source2, source3, source4, source5, source6, source7, resultSelector); + } + + public static IObservable ZipLatest(this IObservable left, IObservable right, Func selector) + { + return new ZipLatestObservable(left, right, selector); + } + + public static IObservable> ZipLatest(this IEnumerable> sources) + { + return ZipLatest(sources.ToArray()); + } + + public static IObservable> ZipLatest(params IObservable[] sources) + { + return new ZipLatestObservable(sources); + } + + public static IObservable ZipLatest(this IObservable source1, IObservable source2, IObservable source3, ZipLatestFunc resultSelector) + { + return new ZipLatestObservable(source1, source2, source3, resultSelector); + } + + public static IObservable ZipLatest(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, ZipLatestFunc resultSelector) + { + return new ZipLatestObservable(source1, source2, source3, source4, resultSelector); + } + + public static IObservable ZipLatest(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, ZipLatestFunc resultSelector) + { + return new ZipLatestObservable(source1, source2, source3, source4, source5, resultSelector); + } + + public static IObservable ZipLatest(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, IObservable source6, ZipLatestFunc resultSelector) + { + return new ZipLatestObservable(source1, source2, source3, source4, source5, source6, resultSelector); + } + + public static IObservable ZipLatest(this IObservable source1, IObservable source2, IObservable source3, IObservable source4, IObservable source5, IObservable source6, IObservable source7, ZipLatestFunc resultSelector) + { + return new ZipLatestObservable(source1, source2, source3, source4, source5, source6, source7, resultSelector); + } + + public static IObservable Switch(this IObservable> sources) + { + return new SwitchObservable(sources); + } + + public static IObservable WithLatestFrom(this IObservable left, IObservable right, Func selector) + { + return new WithLatestFromObservable(left, right, selector); + } + + /// + /// Specialized for single async operations like Task.WhenAll, Zip.Take(1). + /// If sequence is empty, return T[0] array. + /// + public static IObservable WhenAll(params IObservable[] sources) + { + if (sources.Length == 0) return Observable.Return(new T[0]); + + return new WhenAllObservable(sources); + } + + /// + /// Specialized for single async operations like Task.WhenAll, Zip.Take(1). + /// + public static IObservable WhenAll(params IObservable[] sources) + { + if (sources.Length == 0) return Observable.ReturnUnit(); + + return new WhenAllObservable(sources); + } + + /// + /// Specialized for single async operations like Task.WhenAll, Zip.Take(1). + /// If sequence is empty, return T[0] array. + /// + public static IObservable WhenAll(this IEnumerable> sources) + { + var array = sources as IObservable[]; + if (array != null) return WhenAll(array); + + return new WhenAllObservable(sources); + } + + /// + /// Specialized for single async operations like Task.WhenAll, Zip.Take(1). + /// + public static IObservable WhenAll(this IEnumerable> sources) + { + var array = sources as IObservable[]; + if (array != null) return WhenAll(array); + + return new WhenAllObservable(sources); + } + + public static IObservable StartWith(this IObservable source, T value) + { + return new StartWithObservable(source, value); + } + + public static IObservable StartWith(this IObservable source, Func valueFactory) + { + return new StartWithObservable(source, valueFactory); + } + + public static IObservable StartWith(this IObservable source, params T[] values) + { + return StartWith(source, Scheduler.DefaultSchedulers.ConstantTimeOperations, values); + } + + public static IObservable StartWith(this IObservable source, IEnumerable values) + { + return StartWith(source, Scheduler.DefaultSchedulers.ConstantTimeOperations, values); + } + + public static IObservable StartWith(this IObservable source, IScheduler scheduler, T value) + { + return Observable.Return(value, scheduler).Concat(source); + } + + public static IObservable StartWith(this IObservable source, IScheduler scheduler, IEnumerable values) + { + var array = values as T[]; + if (array == null) + { + array = values.ToArray(); + } + + return StartWith(source, scheduler, array); + } + + public static IObservable StartWith(this IObservable source, IScheduler scheduler, params T[] values) + { + return values.ToObservable(scheduler).Concat(source); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs.meta new file mode 100644 index 00000000..dc7265e7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Concatenate.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 18c56bbfaaeedf445874f4246d42b509 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs b/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs new file mode 100644 index 00000000..89bd971e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UniRx.Operators; + +namespace UniRx +{ + public static partial class Observable + { + public static IObservable Synchronize(this IObservable source) + { + return new SynchronizeObservable(source, new object()); + } + + public static IObservable Synchronize(this IObservable source, object gate) + { + return new SynchronizeObservable(source, gate); + } + + public static IObservable ObserveOn(this IObservable source, IScheduler scheduler) + { + return new ObserveOnObservable(source, scheduler); + } + + public static IObservable SubscribeOn(this IObservable source, IScheduler scheduler) + { + return new SubscribeOnObservable(source, scheduler); + } + + public static IObservable DelaySubscription(this IObservable source, TimeSpan dueTime) + { + return new DelaySubscriptionObservable(source, dueTime, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable DelaySubscription(this IObservable source, TimeSpan dueTime, IScheduler scheduler) + { + return new DelaySubscriptionObservable(source, dueTime, scheduler); + } + + public static IObservable DelaySubscription(this IObservable source, DateTimeOffset dueTime) + { + return new DelaySubscriptionObservable(source, dueTime, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable DelaySubscription(this IObservable source, DateTimeOffset dueTime, IScheduler scheduler) + { + return new DelaySubscriptionObservable(source, dueTime, scheduler); + } + + public static IObservable Amb(params IObservable[] sources) + { + return Amb((IEnumerable>)sources); + } + + public static IObservable Amb(IEnumerable> sources) + { + var result = Observable.Never(); + foreach (var item in sources) + { + var second = item; + result = result.Amb(second); + } + return result; + } + + public static IObservable Amb(this IObservable source, IObservable second) + { + return new AmbObservable(source, second); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs.meta new file mode 100644 index 00000000..3b10a558 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Concurrency.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a31d38ad13dc4644180647afc28c6045 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs b/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs new file mode 100644 index 00000000..461d523a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using UniRx.Operators; + +namespace UniRx +{ + public static partial class Observable + { + public static IObservable AsObservable(this IObservable source) + { + if (source == null) throw new ArgumentNullException("source"); + + // optimize, don't double wrap + if (source is UniRx.Operators.AsObservableObservable) + { + return source; + } + + return new AsObservableObservable(source); + } + + public static IObservable ToObservable(this IEnumerable source) + { + return ToObservable(source, Scheduler.DefaultSchedulers.Iteration); + } + + public static IObservable ToObservable(this IEnumerable source, IScheduler scheduler) + { + return new ToObservableObservable(source, scheduler); + } + + public static IObservable Cast(this IObservable source) + { + return new CastObservable(source); + } + + /// + /// witness is for type inference. + /// + public static IObservable Cast(this IObservable source, TResult witness) + { + return new CastObservable(source); + } + + public static IObservable OfType(this IObservable source) + { + return new OfTypeObservable(source); + } + + /// + /// witness is for type inference. + /// + public static IObservable OfType(this IObservable source, TResult witness) + { + return new OfTypeObservable(source); + } + + /// + /// Converting .Select(_ => Unit.Default) sequence. + /// + public static IObservable AsUnitObservable(this IObservable source) + { + return new AsUnitObservableObservable(source); + } + + /// + /// Same as LastOrDefault().AsUnitObservable(). + /// + public static IObservable AsSingleUnitObservable(this IObservable source) + { + return new AsSingleUnitObservableObservable(source); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs.meta new file mode 100644 index 00000000..2d19473b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Conversions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e32bd7bbf28014b4ab2873cc8de3dea9 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs b/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs new file mode 100644 index 00000000..a13b51c5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs @@ -0,0 +1,375 @@ +using System; +using System.Collections.Generic; +using UniRx.Operators; + +namespace UniRx +{ + public static partial class Observable + { + /// + /// Create anonymous observable. Observer has exception durability. This is recommended for make operator and event like generator. + /// + public static IObservable Create(Func, IDisposable> subscribe) + { + if (subscribe == null) throw new ArgumentNullException("subscribe"); + + return new CreateObservable(subscribe); + } + + /// + /// Create anonymous observable. Observer has exception durability. This is recommended for make operator and event like generator(HotObservable). + /// + public static IObservable Create(Func, IDisposable> subscribe, bool isRequiredSubscribeOnCurrentThread) + { + if (subscribe == null) throw new ArgumentNullException("subscribe"); + + return new CreateObservable(subscribe, isRequiredSubscribeOnCurrentThread); + } + + /// + /// Create anonymous observable. Observer has exception durability. This is recommended for make operator and event like generator. + /// + public static IObservable CreateWithState(TState state, Func, IDisposable> subscribe) + { + if (subscribe == null) throw new ArgumentNullException("subscribe"); + + return new CreateObservable(state, subscribe); + } + + /// + /// Create anonymous observable. Observer has exception durability. This is recommended for make operator and event like generator(HotObservable). + /// + public static IObservable CreateWithState(TState state, Func, IDisposable> subscribe, bool isRequiredSubscribeOnCurrentThread) + { + if (subscribe == null) throw new ArgumentNullException("subscribe"); + + return new CreateObservable(state, subscribe, isRequiredSubscribeOnCurrentThread); + } + + /// + /// Create anonymous observable. Safe means auto detach when error raised in onNext pipeline. This is recommended for make generator (ColdObservable). + /// + public static IObservable CreateSafe(Func, IDisposable> subscribe) + { + if (subscribe == null) throw new ArgumentNullException("subscribe"); + + return new CreateSafeObservable(subscribe); + } + + /// + /// Create anonymous observable. Safe means auto detach when error raised in onNext pipeline. This is recommended for make generator (ColdObservable). + /// + public static IObservable CreateSafe(Func, IDisposable> subscribe, bool isRequiredSubscribeOnCurrentThread) + { + if (subscribe == null) throw new ArgumentNullException("subscribe"); + + return new CreateSafeObservable(subscribe, isRequiredSubscribeOnCurrentThread); + } + + /// + /// Empty Observable. Returns only OnCompleted. + /// + public static IObservable Empty() + { + return Empty(Scheduler.DefaultSchedulers.ConstantTimeOperations); + } + + /// + /// Empty Observable. Returns only OnCompleted on specified scheduler. + /// + public static IObservable Empty(IScheduler scheduler) + { + if (scheduler == Scheduler.Immediate) + { + return ImmutableEmptyObservable.Instance; + } + else + { + return new EmptyObservable(scheduler); + } + } + + /// + /// Empty Observable. Returns only OnCompleted. witness is for type inference. + /// + public static IObservable Empty(T witness) + { + return Empty(Scheduler.DefaultSchedulers.ConstantTimeOperations); + } + + /// + /// Empty Observable. Returns only OnCompleted on specified scheduler. witness is for type inference. + /// + public static IObservable Empty(IScheduler scheduler, T witness) + { + return Empty(scheduler); + } + + /// + /// Non-Terminating Observable. It's no returns, never finish. + /// + public static IObservable Never() + { + return ImmutableNeverObservable.Instance; + } + + /// + /// Non-Terminating Observable. It's no returns, never finish. witness is for type inference. + /// + public static IObservable Never(T witness) + { + return ImmutableNeverObservable.Instance; + } + + /// + /// Return single sequence Immediately. + /// + public static IObservable Return(T value) + { + return Return(value, Scheduler.DefaultSchedulers.ConstantTimeOperations); + } + + /// + /// Return single sequence on specified scheduler. + /// + public static IObservable Return(T value, IScheduler scheduler) + { + if (scheduler == Scheduler.Immediate) + { + return new ImmediateReturnObservable(value); + } + else + { + return new ReturnObservable(value, scheduler); + } + } + + /// + /// Return single sequence Immediately, optimized for Unit(no allocate memory). + /// + public static IObservable Return(Unit value) + { + return ImmutableReturnUnitObservable.Instance; + } + + /// + /// Return single sequence Immediately, optimized for Boolean(no allocate memory). + /// + public static IObservable Return(bool value) + { + return (value == true) + ? (IObservable)ImmutableReturnTrueObservable.Instance + : (IObservable)ImmutableReturnFalseObservable.Instance; + } + + /// + /// Return single sequence Immediately, optimized for Int32. + /// + public static IObservable Return(int value) + { + return ImmutableReturnInt32Observable.GetInt32Observable(value); + } + + /// + /// Same as Observable.Return(Unit.Default); but no allocate memory. + /// + public static IObservable ReturnUnit() + { + return ImmutableReturnUnitObservable.Instance; + } + + /// + /// Empty Observable. Returns only onError. + /// + public static IObservable Throw(Exception error) + { + return Throw(error, Scheduler.DefaultSchedulers.ConstantTimeOperations); + } + + /// + /// Empty Observable. Returns only onError. witness if for Type inference. + /// + public static IObservable Throw(Exception error, T witness) + { + return Throw(error, Scheduler.DefaultSchedulers.ConstantTimeOperations); + } + + /// + /// Empty Observable. Returns only onError on specified scheduler. + /// + public static IObservable Throw(Exception error, IScheduler scheduler) + { + return new ThrowObservable(error, scheduler); + } + + /// + /// Empty Observable. Returns only onError on specified scheduler. witness if for Type inference. + /// + public static IObservable Throw(Exception error, IScheduler scheduler, T witness) + { + return Throw(error, scheduler); + } + + public static IObservable Range(int start, int count) + { + return Range(start, count, Scheduler.DefaultSchedulers.Iteration); + } + + public static IObservable Range(int start, int count, IScheduler scheduler) + { + return new RangeObservable(start, count, scheduler); + } + + public static IObservable Repeat(T value) + { + return Repeat(value, Scheduler.DefaultSchedulers.Iteration); + } + + public static IObservable Repeat(T value, IScheduler scheduler) + { + if (scheduler == null) throw new ArgumentNullException("scheduler"); + + return new RepeatObservable(value, null, scheduler); + } + + public static IObservable Repeat(T value, int repeatCount) + { + return Repeat(value, repeatCount, Scheduler.DefaultSchedulers.Iteration); + } + + public static IObservable Repeat(T value, int repeatCount, IScheduler scheduler) + { + if (repeatCount < 0) throw new ArgumentOutOfRangeException("repeatCount"); + if (scheduler == null) throw new ArgumentNullException("scheduler"); + + return new RepeatObservable(value, repeatCount, scheduler); + } + + public static IObservable Repeat(this IObservable source) + { + return RepeatInfinite(source).Concat(); + } + + static IEnumerable> RepeatInfinite(IObservable source) + { + while (true) + { + yield return source; + } + } + + /// + /// Same as Repeat() but if arriving contiguous "OnComplete" Repeat stops. + /// + public static IObservable RepeatSafe(this IObservable source) + { + return new RepeatSafeObservable(RepeatInfinite(source), source.IsRequiredSubscribeOnCurrentThread()); + } + + public static IObservable Defer(Func> observableFactory) + { + return new DeferObservable(observableFactory); + } + + public static IObservable Start(Func function) + { + return new StartObservable(function, null, Scheduler.DefaultSchedulers.AsyncConversions); + } + + public static IObservable Start(Func function, TimeSpan timeSpan) + { + return new StartObservable(function, timeSpan, Scheduler.DefaultSchedulers.AsyncConversions); + } + + public static IObservable Start(Func function, IScheduler scheduler) + { + return new StartObservable(function, null, scheduler); + } + + public static IObservable Start(Func function, TimeSpan timeSpan, IScheduler scheduler) + { + return new StartObservable(function, timeSpan, scheduler); + } + + public static IObservable Start(Action action) + { + return new StartObservable(action, null, Scheduler.DefaultSchedulers.AsyncConversions); + } + + public static IObservable Start(Action action, TimeSpan timeSpan) + { + return new StartObservable(action, timeSpan, Scheduler.DefaultSchedulers.AsyncConversions); + } + + public static IObservable Start(Action action, IScheduler scheduler) + { + return new StartObservable(action, null, scheduler); + } + + public static IObservable Start(Action action, TimeSpan timeSpan, IScheduler scheduler) + { + return new StartObservable(action, timeSpan, scheduler); + } + + public static Func> ToAsync(Func function) + { + return ToAsync(function, Scheduler.DefaultSchedulers.AsyncConversions); + } + + public static Func> ToAsync(Func function, IScheduler scheduler) + { + return () => + { + var subject = new AsyncSubject(); + + scheduler.Schedule(() => + { + var result = default(T); + try + { + result = function(); + } + catch (Exception exception) + { + subject.OnError(exception); + return; + } + subject.OnNext(result); + subject.OnCompleted(); + }); + + return subject.AsObservable(); + }; + } + + public static Func> ToAsync(Action action) + { + return ToAsync(action, Scheduler.DefaultSchedulers.AsyncConversions); + } + + public static Func> ToAsync(Action action, IScheduler scheduler) + { + return () => + { + var subject = new AsyncSubject(); + + scheduler.Schedule(() => + { + try + { + action(); + } + catch (Exception exception) + { + subject.OnError(exception); + return; + } + subject.OnNext(Unit.Default); + subject.OnCompleted(); + }); + + return subject.AsObservable(); + }; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs.meta new file mode 100644 index 00000000..ce5f14a4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Creation.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e63036d2dba75f64382beed512fd086c +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs b/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs new file mode 100644 index 00000000..8faf6dcd --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UniRx.Operators; + +namespace UniRx +{ + public static partial class Observable + { + public static IObservable Finally(this IObservable source, Action finallyAction) + { + return new FinallyObservable(source, finallyAction); + } + + public static IObservable Catch(this IObservable source, Func> errorHandler) + where TException : Exception + { + return new CatchObservable(source, errorHandler); + } + + public static IObservable Catch(this IEnumerable> sources) + { + return new CatchObservable(sources); + } + + /// Catch exception and return Observable.Empty. + public static IObservable CatchIgnore(this IObservable source) + { + return source.Catch(Stubs.CatchIgnore); + } + + /// Catch exception and return Observable.Empty. + public static IObservable CatchIgnore(this IObservable source, Action errorAction) + where TException : Exception + { + var result = source.Catch((TException ex) => + { + errorAction(ex); + return Observable.Empty(); + }); + return result; + } + + public static IObservable Retry(this IObservable source) + { + return RepeatInfinite(source).Catch(); + } + + public static IObservable Retry(this IObservable source, int retryCount) + { + return System.Linq.Enumerable.Repeat(source, retryCount).Catch(); + } + + /// + /// Repeats the source observable sequence until it successfully terminates. + /// This is same as Retry(). + /// + public static IObservable OnErrorRetry( + this IObservable source) + { + var result = source.Retry(); + return result; + } + + /// + /// When catched exception, do onError action and repeat observable sequence. + /// + public static IObservable OnErrorRetry( + this IObservable source, Action onError) + where TException : Exception + { + return source.OnErrorRetry(onError, TimeSpan.Zero); + } + + /// + /// When catched exception, do onError action and repeat observable sequence after delay time. + /// + public static IObservable OnErrorRetry( + this IObservable source, Action onError, TimeSpan delay) + where TException : Exception + { + return source.OnErrorRetry(onError, int.MaxValue, delay); + } + + /// + /// When catched exception, do onError action and repeat observable sequence during within retryCount. + /// + public static IObservable OnErrorRetry( + this IObservable source, Action onError, int retryCount) + where TException : Exception + { + return source.OnErrorRetry(onError, retryCount, TimeSpan.Zero); + } + + /// + /// When catched exception, do onError action and repeat observable sequence after delay time during within retryCount. + /// + public static IObservable OnErrorRetry( + this IObservable source, Action onError, int retryCount, TimeSpan delay) + where TException : Exception + { + return source.OnErrorRetry(onError, retryCount, delay, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + /// + /// When catched exception, do onError action and repeat observable sequence after delay time(work on delayScheduler) during within retryCount. + /// + public static IObservable OnErrorRetry( + this IObservable source, Action onError, int retryCount, TimeSpan delay, IScheduler delayScheduler) + where TException : Exception + { + var result = Observable.Defer(() => + { + var dueTime = (delay.Ticks < 0) ? TimeSpan.Zero : delay; + var count = 0; + + IObservable self = null; + self = source.Catch((TException ex) => + { + onError(ex); + + return (++count < retryCount) + ? (dueTime == TimeSpan.Zero) + ? self.SubscribeOn(Scheduler.CurrentThread) + : self.DelaySubscription(dueTime, delayScheduler).SubscribeOn(Scheduler.CurrentThread) + : Observable.Throw(ex); + }); + return self; + }); + + return result; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs.meta new file mode 100644 index 00000000..642b2909 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.ErrorHandling.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f40cab35efe24e6448ac8455bc7a4eb9 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Events.cs b/Assets/Plugins/UniRx/Scripts/Observable.Events.cs new file mode 100644 index 00000000..305b13f2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Events.cs @@ -0,0 +1,34 @@ +using System; +using UniRx.Operators; + +namespace UniRx +{ + public static partial class Observable + { + public static IObservable> FromEventPattern(Func, TDelegate> conversion, Action addHandler, Action removeHandler) + where TEventArgs : EventArgs + { + return new FromEventPatternObservable(conversion, addHandler, removeHandler); + } + + public static IObservable FromEvent(Func conversion, Action addHandler, Action removeHandler) + { + return new FromEventObservable(conversion, addHandler, removeHandler); + } + + public static IObservable FromEvent(Func, TDelegate> conversion, Action addHandler, Action removeHandler) + { + return new FromEventObservable(conversion, addHandler, removeHandler); + } + + public static IObservable FromEvent(Action addHandler, Action removeHandler) + { + return new FromEventObservable(addHandler, removeHandler); + } + + public static IObservable FromEvent(Action> addHandler, Action> removeHandler) + { + return new FromEventObservable_(addHandler, removeHandler); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Events.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Events.cs.meta new file mode 100644 index 00000000..1c9535f0 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Events.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e591aafff0492c94590cf9702f6c408f +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs b/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs new file mode 100644 index 00000000..0a04bfa7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs @@ -0,0 +1,127 @@ +using System; + +namespace UniRx +{ + public static partial class Observable + { + public static Func> FromAsyncPattern(Func begin, Func end) + { + return () => + { + var subject = new AsyncSubject(); + try + { + begin(iar => + { + TResult result; + try + { + result = end(iar); + } + catch (Exception exception) + { + subject.OnError(exception); + return; + } + subject.OnNext(result); + subject.OnCompleted(); + }, null); + } + catch (Exception exception) + { + return Observable.Throw(exception, Scheduler.DefaultSchedulers.AsyncConversions); + } + return subject.AsObservable(); + }; + } + + public static Func> FromAsyncPattern(Func begin, Func end) + { + return x => + { + var subject = new AsyncSubject(); + try + { + begin(x, iar => + { + TResult result; + try + { + result = end(iar); + } + catch (Exception exception) + { + subject.OnError(exception); + return; + } + subject.OnNext(result); + subject.OnCompleted(); + }, null); + } + catch (Exception exception) + { + return Observable.Throw(exception, Scheduler.DefaultSchedulers.AsyncConversions); + } + return subject.AsObservable(); + }; + } + + public static Func> FromAsyncPattern(Func begin, Func end) + { + return (x, y) => + { + var subject = new AsyncSubject(); + try + { + begin(x, y, iar => + { + TResult result; + try + { + result = end(iar); + } + catch (Exception exception) + { + subject.OnError(exception); + return; + } + subject.OnNext(result); + subject.OnCompleted(); + }, null); + } + catch (Exception exception) + { + return Observable.Throw(exception, Scheduler.DefaultSchedulers.AsyncConversions); + } + return subject.AsObservable(); + }; + } + + public static Func> FromAsyncPattern(Func begin, Action end) + { + return FromAsyncPattern(begin, iar => + { + end(iar); + return Unit.Default; + }); + } + + public static Func> FromAsyncPattern(Func begin, Action end) + { + return FromAsyncPattern(begin, iar => + { + end(iar); + return Unit.Default; + }); + } + + public static Func> FromAsyncPattern(Func begin, Action end) + { + return FromAsyncPattern(begin, iar => + { + end(iar); + return Unit.Default; + }); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs.meta new file mode 100644 index 00000000..af6816b0 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.FromAsync.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 601f5bb7bb302a14cb46df717729b8c7 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs b/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs new file mode 100644 index 00000000..93588b57 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace UniRx +{ + public static partial class Observable + { + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs.meta new file mode 100644 index 00000000..ef655ac2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Joins.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dd92425c6c6dec24e9e52677cbc36aa0 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs b/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs new file mode 100644 index 00000000..36f8e167 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs @@ -0,0 +1,327 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UniRx.InternalUtil; +using UniRx.Operators; + +namespace UniRx +{ + // Take, Skip, etc.. + public static partial class Observable + { + public static IObservable Take(this IObservable source, int count) + { + if (source == null) throw new ArgumentNullException("source"); + if (count < 0) throw new ArgumentOutOfRangeException("count"); + + if (count == 0) return Empty(); + + // optimize .Take(count).Take(count) + var take = source as TakeObservable; + if (take != null && take.scheduler == null) + { + return take.Combine(count); + } + + return new TakeObservable(source, count); + } + + public static IObservable Take(this IObservable source, TimeSpan duration) + { + return Take(source, duration, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Take(this IObservable source, TimeSpan duration, IScheduler scheduler) + { + if (source == null) throw new ArgumentNullException("source"); + if (scheduler == null) throw new ArgumentNullException("scheduler"); + + // optimize .Take(duration).Take(duration) + var take = source as TakeObservable; + if (take != null && take.scheduler == scheduler) + { + return take.Combine(duration); + } + + return new TakeObservable(source, duration, scheduler); + } + + public static IObservable TakeWhile(this IObservable source, Func predicate) + { + return new TakeWhileObservable(source, predicate); + } + + public static IObservable TakeWhile(this IObservable source, Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + return new TakeWhileObservable(source, predicate); + } + + public static IObservable TakeUntil(this IObservable source, IObservable other) + { + if (source == null) throw new ArgumentNullException("source"); + if (other == null) throw new ArgumentNullException("other"); + + return new TakeUntilObservable(source, other); + } + + public static IObservable TakeLast(this IObservable source, int count) + { + if (source == null) throw new ArgumentNullException("source"); + if (count < 0) throw new ArgumentOutOfRangeException("count"); + + return new TakeLastObservable(source, count); + } + + public static IObservable TakeLast(this IObservable source, TimeSpan duration) + { + return TakeLast(source, duration, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable TakeLast(this IObservable source, TimeSpan duration, IScheduler scheduler) + { + if (source == null) throw new ArgumentNullException("source"); + + return new TakeLastObservable(source, duration, scheduler); + } + + public static IObservable Skip(this IObservable source, int count) + { + if (source == null) throw new ArgumentNullException("source"); + if (count < 0) throw new ArgumentOutOfRangeException("count"); + + // optimize .Skip(count).Skip(count) + var skip = source as SkipObservable; + if (skip != null && skip.scheduler == null) + { + return skip.Combine(count); + } + + return new SkipObservable(source, count); + } + + public static IObservable Skip(this IObservable source, TimeSpan duration) + { + return Skip(source, duration, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Skip(this IObservable source, TimeSpan duration, IScheduler scheduler) + { + if (source == null) throw new ArgumentNullException("source"); + if (scheduler == null) throw new ArgumentNullException("scheduler"); + + // optimize .Skip(duration).Skip(duration) + var skip = source as SkipObservable; + if (skip != null && skip.scheduler == scheduler) + { + return skip.Combine(duration); + } + + return new SkipObservable(source, duration, scheduler); + } + + public static IObservable SkipWhile(this IObservable source, Func predicate) + { + return new SkipWhileObservable(source, predicate); + } + + public static IObservable SkipWhile(this IObservable source, Func predicate) + { + if (source == null) throw new ArgumentNullException("source"); + if (predicate == null) throw new ArgumentNullException("predicate"); + + return new SkipWhileObservable(source, predicate); + } + + public static IObservable SkipUntil(this IObservable source, IObservable other) + { + return new SkipUntilObservable(source, other); + } + + public static IObservable> Buffer(this IObservable source, int count) + { + if (source == null) throw new ArgumentNullException("source"); + if (count <= 0) throw new ArgumentOutOfRangeException("count <= 0"); + + return new BufferObservable(source, count, 0); + } + + public static IObservable> Buffer(this IObservable source, int count, int skip) + { + if (source == null) throw new ArgumentNullException("source"); + if (count <= 0) throw new ArgumentOutOfRangeException("count <= 0"); + if (skip <= 0) throw new ArgumentOutOfRangeException("skip <= 0"); + + return new BufferObservable(source, count, skip); + } + + public static IObservable> Buffer(this IObservable source, TimeSpan timeSpan) + { + return Buffer(source, timeSpan, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable> Buffer(this IObservable source, TimeSpan timeSpan, IScheduler scheduler) + { + if (source == null) throw new ArgumentNullException("source"); + + return new BufferObservable(source, timeSpan, timeSpan, scheduler); + } + + public static IObservable> Buffer(this IObservable source, TimeSpan timeSpan, int count) + { + return Buffer(source, timeSpan, count, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable> Buffer(this IObservable source, TimeSpan timeSpan, int count, IScheduler scheduler) + { + if (source == null) throw new ArgumentNullException("source"); + if (count <= 0) throw new ArgumentOutOfRangeException("count <= 0"); + + return new BufferObservable(source, timeSpan, count, scheduler); + } + + public static IObservable> Buffer(this IObservable source, TimeSpan timeSpan, TimeSpan timeShift) + { + return new BufferObservable(source, timeSpan, timeShift, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable> Buffer(this IObservable source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler) + { + if (source == null) throw new ArgumentNullException("source"); + + return new BufferObservable(source, timeSpan, timeShift, scheduler); + } + + public static IObservable> Buffer(this IObservable source, IObservable windowBoundaries) + { + return new BufferObservable(source, windowBoundaries); + } + + /// Projects old and new element of a sequence into a new form. + public static IObservable> Pairwise(this IObservable source) + { + return new PairwiseObservable(source); + } + + /// Projects old and new element of a sequence into a new form. + public static IObservable Pairwise(this IObservable source, Func selector) + { + return new PairwiseObservable(source, selector); + } + + // first, last, single + + public static IObservable Last(this IObservable source) + { + return new LastObservable(source, false); + } + public static IObservable Last(this IObservable source, Func predicate) + { + return new LastObservable(source, predicate, false); + } + + public static IObservable LastOrDefault(this IObservable source) + { + return new LastObservable(source, true); + } + + public static IObservable LastOrDefault(this IObservable source, Func predicate) + { + return new LastObservable(source, predicate, true); + } + + public static IObservable First(this IObservable source) + { + return new FirstObservable(source, false); + } + public static IObservable First(this IObservable source, Func predicate) + { + return new FirstObservable(source, predicate, false); + } + + public static IObservable FirstOrDefault(this IObservable source) + { + return new FirstObservable(source, true); + } + + public static IObservable FirstOrDefault(this IObservable source, Func predicate) + { + return new FirstObservable(source, predicate, true); + } + + public static IObservable Single(this IObservable source) + { + return new SingleObservable(source, false); + } + public static IObservable Single(this IObservable source, Func predicate) + { + return new SingleObservable(source, predicate, false); + } + + public static IObservable SingleOrDefault(this IObservable source) + { + return new SingleObservable(source, true); + } + + public static IObservable SingleOrDefault(this IObservable source, Func predicate) + { + return new SingleObservable(source, predicate, true); + } + + // Grouping + + public static IObservable> GroupBy(this IObservable source, Func keySelector) + { + return GroupBy(source, keySelector, Stubs.Identity); + } + + public static IObservable> GroupBy(this IObservable source, Func keySelector, IEqualityComparer comparer) + { + return GroupBy(source, keySelector, Stubs.Identity, comparer); + } + + public static IObservable> GroupBy(this IObservable source, Func keySelector, Func elementSelector) + { +#if !UniRxLibrary + var comparer = UnityEqualityComparer.GetDefault(); +#else + var comparer = EqualityComparer.Default; +#endif + + return GroupBy(source, keySelector, elementSelector, comparer); + } + + public static IObservable> GroupBy(this IObservable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) + { + return new GroupByObservable(source, keySelector, elementSelector, null, comparer); + } + + public static IObservable> GroupBy(this IObservable source, Func keySelector, int capacity) + { + return GroupBy(source, keySelector, Stubs.Identity, capacity); + } + + public static IObservable> GroupBy(this IObservable source, Func keySelector, int capacity, IEqualityComparer comparer) + { + return GroupBy(source, keySelector, Stubs.Identity, capacity, comparer); + } + + public static IObservable> GroupBy(this IObservable source, Func keySelector, Func elementSelector, int capacity) + { +#if !UniRxLibrary + var comparer = UnityEqualityComparer.GetDefault(); +#else + var comparer = EqualityComparer.Default; +#endif + + return GroupBy(source, keySelector, elementSelector, capacity, comparer); + } + + public static IObservable> GroupBy(this IObservable source, Func keySelector, Func elementSelector, int capacity, IEqualityComparer comparer) + { + return new GroupByObservable(source, keySelector, elementSelector, capacity, comparer); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs.meta new file mode 100644 index 00000000..cadbdd05 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Paging.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f4c9428bf00006d408fcfe4c514ee798 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Time.cs b/Assets/Plugins/UniRx/Scripts/Observable.Time.cs new file mode 100644 index 00000000..1477d630 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Time.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using UniRx.Operators; + +namespace UniRx +{ + // Timer, Interval, etc... + public static partial class Observable + { + public static IObservable Interval(TimeSpan period) + { + return new TimerObservable(period, period, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Interval(TimeSpan period, IScheduler scheduler) + { + return new TimerObservable(period, period, scheduler); + } + + public static IObservable Timer(TimeSpan dueTime) + { + return new TimerObservable(dueTime, null, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Timer(DateTimeOffset dueTime) + { + return new TimerObservable(dueTime, null, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Timer(TimeSpan dueTime, TimeSpan period) + { + return new TimerObservable(dueTime, period, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Timer(DateTimeOffset dueTime, TimeSpan period) + { + return new TimerObservable(dueTime, period, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Timer(TimeSpan dueTime, IScheduler scheduler) + { + return new TimerObservable(dueTime, null, scheduler); + } + + public static IObservable Timer(DateTimeOffset dueTime, IScheduler scheduler) + { + return new TimerObservable(dueTime, null, scheduler); + } + + public static IObservable Timer(TimeSpan dueTime, TimeSpan period, IScheduler scheduler) + { + return new TimerObservable(dueTime, period, scheduler); + } + + public static IObservable Timer(DateTimeOffset dueTime, TimeSpan period, IScheduler scheduler) + { + return new TimerObservable(dueTime, period, scheduler); + } + + public static IObservable> Timestamp(this IObservable source) + { + return Timestamp(source, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable> Timestamp(this IObservable source, IScheduler scheduler) + { + return new TimestampObservable(source, scheduler); + } + + public static IObservable> TimeInterval(this IObservable source) + { + return TimeInterval(source, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable> TimeInterval(this IObservable source, IScheduler scheduler) + { + return new UniRx.Operators.TimeIntervalObservable(source, scheduler); + } + + public static IObservable Delay(this IObservable source, TimeSpan dueTime) + { + return source.Delay(dueTime, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Delay(this IObservable source, TimeSpan dueTime, IScheduler scheduler) + { + return new DelayObservable(source, dueTime, scheduler); + } + + public static IObservable Sample(this IObservable source, TimeSpan interval) + { + return source.Sample(interval, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Sample(this IObservable source, TimeSpan interval, IScheduler scheduler) + { + return new SampleObservable(source, interval, scheduler); + } + + public static IObservable Throttle(this IObservable source, TimeSpan dueTime) + { + return source.Throttle(dueTime, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Throttle(this IObservable source, TimeSpan dueTime, IScheduler scheduler) + { + return new ThrottleObservable(source, dueTime, scheduler); + } + + public static IObservable ThrottleFirst(this IObservable source, TimeSpan dueTime) + { + return source.ThrottleFirst(dueTime, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable ThrottleFirst(this IObservable source, TimeSpan dueTime, IScheduler scheduler) + { + return new ThrottleFirstObservable(source, dueTime, scheduler); + } + + public static IObservable Timeout(this IObservable source, TimeSpan dueTime) + { + return source.Timeout(dueTime, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Timeout(this IObservable source, TimeSpan dueTime, IScheduler scheduler) + { + return new TimeoutObservable(source, dueTime, scheduler); + } + + public static IObservable Timeout(this IObservable source, DateTimeOffset dueTime) + { + return source.Timeout(dueTime, Scheduler.DefaultSchedulers.TimeBasedOperations); + } + + public static IObservable Timeout(this IObservable source, DateTimeOffset dueTime, IScheduler scheduler) + { + return new TimeoutObservable(source, dueTime, scheduler); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.Time.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.Time.cs.meta new file mode 100644 index 00000000..559bc75a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.Time.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7da89fcf95f5c364ca62bbb874005d32 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observable.cs b/Assets/Plugins/UniRx/Scripts/Observable.cs new file mode 100644 index 00000000..1f5d10a4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.cs @@ -0,0 +1,292 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using UniRx.InternalUtil; +using UniRx.Operators; + +namespace UniRx +{ + // Standard Query Operators + + // onNext implementation guide. enclose otherFunc but onNext is not catch. + // try{ otherFunc(); } catch { onError() } + // onNext(); + + public static partial class Observable + { + static readonly TimeSpan InfiniteTimeSpan = new TimeSpan(0, 0, 0, 0, -1); // from .NET 4.5 + + public static IObservable Select(this IObservable source, Func selector) + { + // sometimes cause "which no ahead of time (AOT) code was generated." on IL2CPP... + + //var select = source as ISelect; + //if (select != null) + //{ + // return select.CombineSelector(selector); + //} + + // optimized path + var whereObservable = source as UniRx.Operators.WhereObservable; + if (whereObservable != null) + { + return whereObservable.CombineSelector(selector); + } + + return new SelectObservable(source, selector); + } + + public static IObservable Select(this IObservable source, Func selector) + { + return new SelectObservable(source, selector); + } + + public static IObservable Where(this IObservable source, Func predicate) + { + // optimized path + var whereObservable = source as UniRx.Operators.WhereObservable; + if (whereObservable != null) + { + return whereObservable.CombinePredicate(predicate); + } + + var selectObservable = source as UniRx.Operators.ISelect; + if (selectObservable != null) + { + return selectObservable.CombinePredicate(predicate); + } + + return new WhereObservable(source, predicate); + } + + public static IObservable Where(this IObservable source, Func predicate) + { + return new WhereObservable(source, predicate); + } + + /// + /// Lightweight SelectMany for Single Async Operation. + /// + public static IObservable ContinueWith(this IObservable source, IObservable other) + { + return ContinueWith(source, _ => other); + } + + /// + /// Lightweight SelectMany for Single Async Operation. + /// + public static IObservable ContinueWith(this IObservable source, Func> selector) + { + return new ContinueWithObservable(source, selector); + } + + public static IObservable SelectMany(this IObservable source, IObservable other) + { + return SelectMany(source, _ => other); + } + + public static IObservable SelectMany(this IObservable source, Func> selector) + { + return new SelectManyObservable(source, selector); + } + + public static IObservable SelectMany(this IObservable source, Func> selector) + { + return new SelectManyObservable(source, selector); + } + + public static IObservable SelectMany(this IObservable source, Func> collectionSelector, Func resultSelector) + { + return new SelectManyObservable(source, collectionSelector, resultSelector); + } + + public static IObservable SelectMany(this IObservable source, Func> collectionSelector, Func resultSelector) + { + return new SelectManyObservable(source, collectionSelector, resultSelector); + } + + public static IObservable SelectMany(this IObservable source, Func> selector) + { + return new SelectManyObservable(source, selector); + } + + public static IObservable SelectMany(this IObservable source, Func> selector) + { + return new SelectManyObservable(source, selector); + } + + public static IObservable SelectMany(this IObservable source, Func> collectionSelector, Func resultSelector) + { + return new SelectManyObservable(source, collectionSelector, resultSelector); + } + + public static IObservable SelectMany(this IObservable source, Func> collectionSelector, Func resultSelector) + { + return new SelectManyObservable(source, collectionSelector, resultSelector); + } + + public static IObservable ToArray(this IObservable source) + { + return new ToArrayObservable(source); + } + + public static IObservable> ToList(this IObservable source) + { + return new ToListObservable(source); + } + + public static IObservable Do(this IObservable source, IObserver observer) + { + return new DoObserverObservable(source, observer); + } + + public static IObservable Do(this IObservable source, Action onNext) + { + return new DoObservable(source, onNext, Stubs.Throw, Stubs.Nop); + } + + public static IObservable Do(this IObservable source, Action onNext, Action onError) + { + return new DoObservable(source, onNext, onError, Stubs.Nop); + } + + public static IObservable Do(this IObservable source, Action onNext, Action onCompleted) + { + return new DoObservable(source, onNext, Stubs.Throw, onCompleted); + } + + public static IObservable Do(this IObservable source, Action onNext, Action onError, Action onCompleted) + { + return new DoObservable(source, onNext, onError, onCompleted); + } + + public static IObservable DoOnError(this IObservable source, Action onError) + { + return new DoOnErrorObservable(source, onError); + } + + public static IObservable DoOnCompleted(this IObservable source, Action onCompleted) + { + return new DoOnCompletedObservable(source, onCompleted); + } + + public static IObservable DoOnTerminate(this IObservable source, Action onTerminate) + { + return new DoOnTerminateObservable(source, onTerminate); + } + + public static IObservable DoOnSubscribe(this IObservable source, Action onSubscribe) + { + return new DoOnSubscribeObservable(source, onSubscribe); + } + + public static IObservable DoOnCancel(this IObservable source, Action onCancel) + { + return new DoOnCancelObservable(source, onCancel); + } + + public static IObservable> Materialize(this IObservable source) + { + return new MaterializeObservable(source); + } + + public static IObservable Dematerialize(this IObservable> source) + { + return new DematerializeObservable(source); + } + + public static IObservable DefaultIfEmpty(this IObservable source) + { + return new DefaultIfEmptyObservable(source, default(T)); + } + + public static IObservable DefaultIfEmpty(this IObservable source, T defaultValue) + { + return new DefaultIfEmptyObservable(source, defaultValue); + } + + public static IObservable Distinct(this IObservable source) + { +#if !UniRxLibrary + var comparer = UnityEqualityComparer.GetDefault(); +#else + var comparer = EqualityComparer.Default; +#endif + + return new DistinctObservable(source, comparer); + } + + public static IObservable Distinct(this IObservable source, IEqualityComparer comparer) + { + return new DistinctObservable(source, comparer); + } + + public static IObservable Distinct(this IObservable source, Func keySelector) + { +#if !UniRxLibrary + var comparer = UnityEqualityComparer.GetDefault(); +#else + var comparer = EqualityComparer.Default; +#endif + + return new DistinctObservable(source, keySelector, comparer); + } + + public static IObservable Distinct(this IObservable source, Func keySelector, IEqualityComparer comparer) + { + return new DistinctObservable(source, keySelector, comparer); + } + + public static IObservable DistinctUntilChanged(this IObservable source) + { +#if !UniRxLibrary + var comparer = UnityEqualityComparer.GetDefault(); +#else + var comparer = EqualityComparer.Default; +#endif + + return new DistinctUntilChangedObservable(source, comparer); + } + + public static IObservable DistinctUntilChanged(this IObservable source, IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + return new DistinctUntilChangedObservable(source, comparer); + } + + public static IObservable DistinctUntilChanged(this IObservable source, Func keySelector) + { +#if !UniRxLibrary + var comparer = UnityEqualityComparer.GetDefault(); +#else + var comparer = EqualityComparer.Default; +#endif + + return new DistinctUntilChangedObservable(source, keySelector, comparer); + } + + public static IObservable DistinctUntilChanged(this IObservable source, Func keySelector, IEqualityComparer comparer) + { + if (source == null) throw new ArgumentNullException("source"); + + return new DistinctUntilChangedObservable(source, keySelector, comparer); + } + + public static IObservable IgnoreElements(this IObservable source) + { + return new IgnoreElementsObservable(source); + } + + public static IObservable ForEachAsync(this IObservable source, Action onNext) + { + return new ForEachAsyncObservable(source, onNext); + } + + public static IObservable ForEachAsync(this IObservable source, Action onNext) + { + return new ForEachAsyncObservable(source, onNext); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observable.cs.meta b/Assets/Plugins/UniRx/Scripts/Observable.cs.meta new file mode 100644 index 00000000..1446e1f8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a2dd1c80d4559fd4ca9ef62f20d031ab +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Observer.cs b/Assets/Plugins/UniRx/Scripts/Observer.cs new file mode 100644 index 00000000..47efd518 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observer.cs @@ -0,0 +1,524 @@ +using System; +using System.Threading; +using UniRx.InternalUtil; + +namespace UniRx +{ + public static class Observer + { + internal static IObserver CreateSubscribeObserver(Action onNext, Action onError, Action onCompleted) + { + // need compare for avoid iOS AOT + if (onNext == Stubs.Ignore) + { + return new Subscribe_(onError, onCompleted); + } + else + { + return new Subscribe(onNext, onError, onCompleted); + } + } + + internal static IObserver CreateSubscribeWithStateObserver(TState state, Action onNext, Action onError, Action onCompleted) + { + return new Subscribe(state, onNext, onError, onCompleted); + } + + internal static IObserver CreateSubscribeWithState2Observer(TState1 state1, TState2 state2, Action onNext, Action onError, Action onCompleted) + { + return new Subscribe(state1, state2, onNext, onError, onCompleted); + } + + internal static IObserver CreateSubscribeWithState3Observer(TState1 state1, TState2 state2, TState3 state3, Action onNext, Action onError, Action onCompleted) + { + return new Subscribe(state1, state2, state3, onNext, onError, onCompleted); + } + + public static IObserver Create(Action onNext) + { + return Create(onNext, UniRx.Stubs.Throw, UniRx.Stubs.Nop); + } + + public static IObserver Create(Action onNext, Action onError) + { + return Create(onNext, onError, UniRx.Stubs.Nop); + } + + public static IObserver Create(Action onNext, Action onCompleted) + { + return Create(onNext, UniRx.Stubs.Throw, onCompleted); + } + + public static IObserver Create(Action onNext, Action onError, Action onCompleted) + { + // need compare for avoid iOS AOT + if (onNext == Stubs.Ignore) + { + return new EmptyOnNextAnonymousObserver(onError, onCompleted); + } + else + { + return new AnonymousObserver(onNext, onError, onCompleted); + } + } + + public static IObserver CreateAutoDetachObserver(IObserver observer, IDisposable disposable) + { + return new AutoDetachObserver(observer, disposable); + } + + class AnonymousObserver : IObserver + { + readonly Action onNext; + readonly Action onError; + readonly Action onCompleted; + + int isStopped = 0; + + public AnonymousObserver(Action onNext, Action onError, Action onCompleted) + { + this.onNext = onNext; + this.onError = onError; + this.onCompleted = onCompleted; + } + + public void OnNext(T value) + { + if (isStopped == 0) + { + onNext(value); + } + } + + public void OnError(Exception error) + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onError(error); + } + } + + + public void OnCompleted() + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onCompleted(); + } + } + } + + class EmptyOnNextAnonymousObserver : IObserver + { + readonly Action onError; + readonly Action onCompleted; + + int isStopped = 0; + + public EmptyOnNextAnonymousObserver(Action onError, Action onCompleted) + { + this.onError = onError; + this.onCompleted = onCompleted; + } + + public void OnNext(T value) + { + } + + public void OnError(Exception error) + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onError(error); + } + } + + public void OnCompleted() + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onCompleted(); + } + } + } + + // same as AnonymousObserver... + class Subscribe : IObserver + { + readonly Action onNext; + readonly Action onError; + readonly Action onCompleted; + + int isStopped = 0; + + public Subscribe(Action onNext, Action onError, Action onCompleted) + { + this.onNext = onNext; + this.onError = onError; + this.onCompleted = onCompleted; + } + + public void OnNext(T value) + { + if (isStopped == 0) + { + onNext(value); + } + } + + public void OnError(Exception error) + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onError(error); + } + } + + + public void OnCompleted() + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onCompleted(); + } + } + } + + // same as EmptyOnNextAnonymousObserver... + class Subscribe_ : IObserver + { + readonly Action onError; + readonly Action onCompleted; + + int isStopped = 0; + + public Subscribe_(Action onError, Action onCompleted) + { + this.onError = onError; + this.onCompleted = onCompleted; + } + + public void OnNext(T value) + { + } + + public void OnError(Exception error) + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onError(error); + } + } + + public void OnCompleted() + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onCompleted(); + } + } + } + + // with state + class Subscribe : IObserver + { + readonly TState state; + readonly Action onNext; + readonly Action onError; + readonly Action onCompleted; + + int isStopped = 0; + + public Subscribe(TState state, Action onNext, Action onError, Action onCompleted) + { + this.state = state; + this.onNext = onNext; + this.onError = onError; + this.onCompleted = onCompleted; + } + + public void OnNext(T value) + { + if (isStopped == 0) + { + onNext(value, state); + } + } + + public void OnError(Exception error) + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onError(error, state); + } + } + + + public void OnCompleted() + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onCompleted(state); + } + } + } + + class Subscribe : IObserver + { + readonly TState1 state1; + readonly TState2 state2; + readonly Action onNext; + readonly Action onError; + readonly Action onCompleted; + + int isStopped = 0; + + public Subscribe(TState1 state1, TState2 state2, Action onNext, Action onError, Action onCompleted) + { + this.state1 = state1; + this.state2 = state2; + this.onNext = onNext; + this.onError = onError; + this.onCompleted = onCompleted; + } + + public void OnNext(T value) + { + if (isStopped == 0) + { + onNext(value, state1, state2); + } + } + + public void OnError(Exception error) + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onError(error, state1, state2); + } + } + + public void OnCompleted() + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onCompleted(state1, state2); + } + } + } + + class Subscribe : IObserver + { + readonly TState1 state1; + readonly TState2 state2; + readonly TState3 state3; + readonly Action onNext; + readonly Action onError; + readonly Action onCompleted; + + int isStopped = 0; + + public Subscribe(TState1 state1, TState2 state2, TState3 state3, Action onNext, Action onError, Action onCompleted) + { + this.state1 = state1; + this.state2 = state2; + this.state3 = state3; + this.onNext = onNext; + this.onError = onError; + this.onCompleted = onCompleted; + } + + public void OnNext(T value) + { + if (isStopped == 0) + { + onNext(value, state1, state2, state3); + } + } + + public void OnError(Exception error) + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onError(error, state1, state2, state3); + } + } + + + public void OnCompleted() + { + if (Interlocked.Increment(ref isStopped) == 1) + { + onCompleted(state1, state2, state3); + } + } + } + + class AutoDetachObserver : UniRx.Operators.OperatorObserverBase + { + public AutoDetachObserver(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + public static partial class ObserverExtensions + { + public static IObserver Synchronize(this IObserver observer) + { + return new UniRx.Operators.SynchronizedObserver(observer, new object()); + } + + public static IObserver Synchronize(this IObserver observer, object gate) + { + return new UniRx.Operators.SynchronizedObserver(observer, gate); + } + } + + public static partial class ObservableExtensions + { + public static IDisposable Subscribe(this IObservable source) + { + return source.Subscribe(UniRx.InternalUtil.ThrowObserver.Instance); + } + + public static IDisposable Subscribe(this IObservable source, Action onNext) + { + return source.Subscribe(Observer.CreateSubscribeObserver(onNext, Stubs.Throw, Stubs.Nop)); + } + + public static IDisposable Subscribe(this IObservable source, Action onNext, Action onError) + { + return source.Subscribe(Observer.CreateSubscribeObserver(onNext, onError, Stubs.Nop)); + } + + public static IDisposable Subscribe(this IObservable source, Action onNext, Action onCompleted) + { + return source.Subscribe(Observer.CreateSubscribeObserver(onNext, Stubs.Throw, onCompleted)); + } + + public static IDisposable Subscribe(this IObservable source, Action onNext, Action onError, Action onCompleted) + { + return source.Subscribe(Observer.CreateSubscribeObserver(onNext, onError, onCompleted)); + } + + public static IDisposable SubscribeWithState(this IObservable source, TState state, Action onNext) + { + return source.Subscribe(Observer.CreateSubscribeWithStateObserver(state, onNext, Stubs.Throw, Stubs.Ignore)); + } + + public static IDisposable SubscribeWithState(this IObservable source, TState state, Action onNext, Action onError) + { + return source.Subscribe(Observer.CreateSubscribeWithStateObserver(state, onNext, onError, Stubs.Ignore)); + } + + public static IDisposable SubscribeWithState(this IObservable source, TState state, Action onNext, Action onCompleted) + { + return source.Subscribe(Observer.CreateSubscribeWithStateObserver(state, onNext, Stubs.Throw, onCompleted)); + } + + public static IDisposable SubscribeWithState(this IObservable source, TState state, Action onNext, Action onError, Action onCompleted) + { + return source.Subscribe(Observer.CreateSubscribeWithStateObserver(state, onNext, onError, onCompleted)); + } + + public static IDisposable SubscribeWithState2(this IObservable source, TState1 state1, TState2 state2, Action onNext) + { + return source.Subscribe(Observer.CreateSubscribeWithState2Observer(state1, state2, onNext, Stubs.Throw, Stubs.Ignore)); + } + + public static IDisposable SubscribeWithState2(this IObservable source, TState1 state1, TState2 state2, Action onNext, Action onError) + { + return source.Subscribe(Observer.CreateSubscribeWithState2Observer(state1, state2, onNext, onError, Stubs.Ignore)); + } + + public static IDisposable SubscribeWithState2(this IObservable source, TState1 state1, TState2 state2, Action onNext, Action onCompleted) + { + return source.Subscribe(Observer.CreateSubscribeWithState2Observer(state1, state2, onNext, Stubs.Throw, onCompleted)); + } + + public static IDisposable SubscribeWithState2(this IObservable source, TState1 state1, TState2 state2, Action onNext, Action onError, Action onCompleted) + { + return source.Subscribe(Observer.CreateSubscribeWithState2Observer(state1, state2, onNext, onError, onCompleted)); + } + + public static IDisposable SubscribeWithState3(this IObservable source, TState1 state1, TState2 state2, TState3 state3, Action onNext) + { + return source.Subscribe(Observer.CreateSubscribeWithState3Observer(state1, state2, state3, onNext, Stubs.Throw, Stubs.Ignore)); + } + + public static IDisposable SubscribeWithState3(this IObservable source, TState1 state1, TState2 state2, TState3 state3, Action onNext, Action onError) + { + return source.Subscribe(Observer.CreateSubscribeWithState3Observer(state1, state2, state3, onNext, onError, Stubs.Ignore)); + } + + public static IDisposable SubscribeWithState3(this IObservable source, TState1 state1, TState2 state2, TState3 state3, Action onNext, Action onCompleted) + { + return source.Subscribe(Observer.CreateSubscribeWithState3Observer(state1, state2, state3, onNext, Stubs.Throw, onCompleted)); + } + + public static IDisposable SubscribeWithState3(this IObservable source, TState1 state1, TState2 state2, TState3 state3, Action onNext, Action onError, Action onCompleted) + { + return source.Subscribe(Observer.CreateSubscribeWithState3Observer(state1, state2, state3, onNext, onError, onCompleted)); + } + } + + internal static class Stubs + { + public static readonly Action Nop = () => { }; + public static readonly Action Throw = ex => { ex.Throw(); }; + + // marker for CatchIgnore and Catch avoid iOS AOT problem. + public static IObservable CatchIgnore(Exception ex) + { + return Observable.Empty(); + } + } + + internal static class Stubs + { + public static readonly Action Ignore = (T t) => { }; + public static readonly Func Identity = (T t) => t; + public static readonly Action Throw = (ex, _) => { ex.Throw(); }; + } + + internal static class Stubs + { + public static readonly Action Ignore = (x, y) => { }; + public static readonly Action Throw = (ex, _, __) => { ex.Throw(); }; + } + + + internal static class Stubs + { + public static readonly Action Ignore = (x, y, z) => { }; + public static readonly Action Throw = (ex, _, __, ___) => { ex.Throw(); }; + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Observer.cs.meta b/Assets/Plugins/UniRx/Scripts/Observer.cs.meta new file mode 100644 index 00000000..b7e528e3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Observer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 57d25c3f6fa1d334e89c384393252b8a +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators.meta b/Assets/Plugins/UniRx/Scripts/Operators.meta new file mode 100644 index 00000000..4e9bd916 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b37ab723fc6829344bcb6a5991a4e2a1 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs b/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs new file mode 100644 index 00000000..3edf634b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs @@ -0,0 +1,207 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class AggregateObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func accumulator; + + public AggregateObservable(IObservable source, Func accumulator) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.accumulator = accumulator; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Aggregate(this, observer, cancel)); + } + + class Aggregate : OperatorObserverBase + { + readonly AggregateObservable parent; + TSource accumulation; + bool seenValue; + + public Aggregate(AggregateObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.seenValue = false; + } + + public override void OnNext(TSource value) + { + if (!seenValue) + { + seenValue = true; + accumulation = value; + } + else + { + try + { + accumulation = parent.accumulator(accumulation, value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (!seenValue) + { + throw new InvalidOperationException("Sequence contains no elements."); + } + + observer.OnNext(accumulation); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class AggregateObservable : OperatorObservableBase + { + readonly IObservable source; + readonly TAccumulate seed; + readonly Func accumulator; + + public AggregateObservable(IObservable source, TAccumulate seed, Func accumulator) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.seed = seed; + this.accumulator = accumulator; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Aggregate(this, observer, cancel)); + } + + class Aggregate : OperatorObserverBase + { + readonly AggregateObservable parent; + TAccumulate accumulation; + + public Aggregate(AggregateObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.accumulation = parent.seed; + } + + public override void OnNext(TSource value) + { + try + { + accumulation = parent.accumulator(accumulation, value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + observer.OnNext(accumulation); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class AggregateObservable : OperatorObservableBase + { + readonly IObservable source; + readonly TAccumulate seed; + readonly Func accumulator; + readonly Func resultSelector; + + public AggregateObservable(IObservable source, TAccumulate seed, Func accumulator, Func resultSelector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.seed = seed; + this.accumulator = accumulator; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Aggregate(this, observer, cancel)); + } + + class Aggregate : OperatorObserverBase + { + readonly AggregateObservable parent; + TAccumulate accumulation; + + public Aggregate(AggregateObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.accumulation = parent.seed; + } + + public override void OnNext(TSource value) + { + try + { + accumulation = parent.accumulator(accumulation, value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + TResult result; + try + { + result = parent.resultSelector(accumulation); + } + catch (Exception ex) + { + OnError(ex); + return; + } + + observer.OnNext(result); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs.meta new file mode 100644 index 00000000..8b0311d1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Aggregate.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f777fc54ecf275349a3f007e760705b3 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs b/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs new file mode 100644 index 00000000..6f48a9d3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs @@ -0,0 +1,182 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class AmbObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IObservable second; + + public AmbObservable(IObservable source, IObservable second) + : base(source.IsRequiredSubscribeOnCurrentThread() || second.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.second = second; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new AmbOuterObserver(this, observer, cancel).Run(); + } + + class AmbOuterObserver : OperatorObserverBase + { + enum AmbState + { + Left, Right, Neither + } + + readonly AmbObservable parent; + readonly object gate = new object(); + SingleAssignmentDisposable leftSubscription; + SingleAssignmentDisposable rightSubscription; + AmbState choice = AmbState.Neither; + + public AmbOuterObserver(AmbObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + leftSubscription = new SingleAssignmentDisposable(); + rightSubscription = new SingleAssignmentDisposable(); + var d = StableCompositeDisposable.Create(leftSubscription, rightSubscription); + + var left = new Amb(); + left.targetDisposable = d; + left.targetObserver = new AmbDecisionObserver(this, AmbState.Left, rightSubscription, left); + + var right = new Amb(); + right.targetDisposable = d; + right.targetObserver = new AmbDecisionObserver(this, AmbState.Right, leftSubscription, right); + + leftSubscription.Disposable = parent.source.Subscribe(left); + rightSubscription.Disposable = parent.second.Subscribe(right); + + return d; + } + + public override void OnNext(T value) + { + // no use + } + + public override void OnError(Exception error) + { + // no use + } + + public override void OnCompleted() + { + // no use + } + + class Amb : IObserver + { + public IObserver targetObserver; + public IDisposable targetDisposable; + + public void OnNext(T value) + { + targetObserver.OnNext(value); + } + + public void OnError(Exception error) + { + try + { + targetObserver.OnError(error); + } + finally + { + targetObserver = UniRx.InternalUtil.EmptyObserver.Instance; + targetDisposable.Dispose(); + } + } + + public void OnCompleted() + { + try + { + targetObserver.OnCompleted(); + } + finally + { + targetObserver = UniRx.InternalUtil.EmptyObserver.Instance; + targetDisposable.Dispose(); + } + } + } + + class AmbDecisionObserver : IObserver + { + readonly AmbOuterObserver parent; + readonly AmbState me; + readonly IDisposable otherSubscription; + readonly Amb self; + + public AmbDecisionObserver(AmbOuterObserver parent, AmbState me, IDisposable otherSubscription, Amb self) + { + this.parent = parent; + this.me = me; + this.otherSubscription = otherSubscription; + this.self = self; + } + + public void OnNext(T value) + { + lock (parent.gate) + { + if (parent.choice == AmbState.Neither) + { + parent.choice = me; + otherSubscription.Dispose(); + self.targetObserver = parent.observer; + } + + if (parent.choice == me) self.targetObserver.OnNext(value); + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + if (parent.choice == AmbState.Neither) + { + parent.choice = me; + otherSubscription.Dispose(); + self.targetObserver = parent.observer; + } + + if (parent.choice == me) + { + self.targetObserver.OnError(error); + } + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + if (parent.choice == AmbState.Neither) + { + parent.choice = me; + otherSubscription.Dispose(); + self.targetObserver = parent.observer; + } + + if (parent.choice == me) + { + self.targetObserver.OnCompleted(); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs.meta new file mode 100644 index 00000000..70893f5e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Amb.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ad1a22922a735ee479baf0e179648532 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs b/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs new file mode 100644 index 00000000..9b3fa5a2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs @@ -0,0 +1,45 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class AsObservableObservable : OperatorObservableBase + { + readonly IObservable source; + + public AsObservableObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new AsObservable(observer, cancel)); + } + + class AsObservable : OperatorObserverBase + { + public AsObservable(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs.meta new file mode 100644 index 00000000..3fe746b3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9e4851fd48b2b42469d71b311254877b +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs b/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs new file mode 100644 index 00000000..1672e81d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs @@ -0,0 +1,46 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class AsSingleUnitObservableObservable : OperatorObservableBase + { + readonly IObservable source; + + public AsSingleUnitObservableObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new AsSingleUnitObservable(observer, cancel)); + } + + class AsSingleUnitObservable : OperatorObserverBase + { + public AsSingleUnitObservable(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + observer.OnNext(Unit.Default); + + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs.meta new file mode 100644 index 00000000..d08c6ed2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsSingleUnitObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3b5e05dba2d3aca4e9c3a6312bef8690 +timeCreated: 1462636004 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs b/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs new file mode 100644 index 00000000..ffc8cdec --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs @@ -0,0 +1,45 @@ +using System; + +namespace UniRx.Operators +{ + internal class AsUnitObservableObservable : OperatorObservableBase + { + readonly IObservable source; + + public AsUnitObservableObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new AsUnitObservable(observer, cancel)); + } + + class AsUnitObservable : OperatorObserverBase + { + public AsUnitObservable(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + base.observer.OnNext(Unit.Default); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs.meta new file mode 100644 index 00000000..bbe2c91b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/AsUnitObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 236f5f407bf92c949844fcaf450af450 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs b/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs new file mode 100644 index 00000000..ddc63549 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs @@ -0,0 +1,624 @@ +using System; +using System.Collections.Generic; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class BufferObservable : OperatorObservableBase> + { + readonly IObservable source; + readonly int count; + readonly int skip; + + readonly TimeSpan timeSpan; + readonly TimeSpan timeShift; + readonly IScheduler scheduler; + + public BufferObservable(IObservable source, int count, int skip) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.count = count; + this.skip = skip; + } + + public BufferObservable(IObservable source, TimeSpan timeSpan, TimeSpan timeShift, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.timeSpan = timeSpan; + this.timeShift = timeShift; + this.scheduler = scheduler; + } + + public BufferObservable(IObservable source, TimeSpan timeSpan, int count, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.timeSpan = timeSpan; + this.count = count; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + // count,skip + if (scheduler == null) + { + if (skip == 0) + { + return new Buffer(this, observer, cancel).Run(); + } + else + { + return new Buffer_(this, observer, cancel).Run(); + } + } + else + { + // time + count + if (count > 0) + { + return new BufferTC(this, observer, cancel).Run(); + } + else + { + if (timeSpan == timeShift) + { + return new BufferT(this, observer, cancel).Run(); + } + else + { + return new BufferTS(this, observer, cancel).Run(); + } + } + } + } + + // count only + class Buffer : OperatorObserverBase> + { + readonly BufferObservable parent; + List list; + + public Buffer(BufferObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + list = new List(parent.count); + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + list.Add(value); + if (list.Count == parent.count) + { + observer.OnNext(list); + list = new List(parent.count); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + if (list.Count > 0) + { + observer.OnNext(list); + } + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + // count and skip + class Buffer_ : OperatorObserverBase> + { + readonly BufferObservable parent; + Queue> q; + int index; + + public Buffer_(BufferObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + q = new Queue>(); + index = -1; + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + index++; + + if (index % parent.skip == 0) + { + q.Enqueue(new List(parent.count)); + } + + var len = q.Count; + for (int i = 0; i < len; i++) + { + var list = q.Dequeue(); + list.Add(value); + if (list.Count == parent.count) + { + observer.OnNext(list); + } + else + { + q.Enqueue(list); + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + foreach (var list in q) + { + observer.OnNext(list); + } + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + // timespan = timeshift + class BufferT : OperatorObserverBase> + { + static readonly T[] EmptyArray = new T[0]; + + readonly BufferObservable parent; + readonly object gate = new object(); + + List list; + + public BufferT(BufferObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + list = new List(); + + var timerSubscription = Observable.Interval(parent.timeSpan, parent.scheduler) + .Subscribe(new Buffer(this)); + + var sourceSubscription = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(timerSubscription, sourceSubscription); + } + + public override void OnNext(T value) + { + lock (gate) + { + list.Add(value); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + List currentList; + lock (gate) + { + currentList = list; + } + observer.OnNext(currentList); + try { observer.OnCompleted(); } finally { Dispose(); } + } + + class Buffer : IObserver + { + BufferT parent; + + public Buffer(BufferT parent) + { + this.parent = parent; + } + + public void OnNext(long value) + { + var isZero = false; + List currentList; + lock (parent.gate) + { + currentList = parent.list; + if (currentList.Count != 0) + { + parent.list = new List(); + } + else + { + isZero = true; + } + } + + parent.observer.OnNext((isZero) ? (IList)EmptyArray : currentList); + } + + public void OnError(Exception error) + { + } + + public void OnCompleted() + { + } + } + } + + // timespan + timeshift + class BufferTS : OperatorObserverBase> + { + readonly BufferObservable parent; + readonly object gate = new object(); + + Queue> q; + TimeSpan totalTime; + TimeSpan nextShift; + TimeSpan nextSpan; + SerialDisposable timerD; + + public BufferTS(BufferObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + totalTime = TimeSpan.Zero; + nextShift = parent.timeShift; + nextSpan = parent.timeSpan; + + q = new Queue>(); + + timerD = new SerialDisposable(); + q.Enqueue(new List()); + CreateTimer(); + + var subscription = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(subscription, timerD); + } + + void CreateTimer() + { + var m = new SingleAssignmentDisposable(); + timerD.Disposable = m; + + var isSpan = false; + var isShift = false; + if (nextSpan == nextShift) + { + isSpan = true; + isShift = true; + } + else if (nextSpan < nextShift) + isSpan = true; + else + isShift = true; + + var newTotalTime = isSpan ? nextSpan : nextShift; + var ts = newTotalTime - totalTime; + totalTime = newTotalTime; + + if (isSpan) + nextSpan += parent.timeShift; + if (isShift) + nextShift += parent.timeShift; + + m.Disposable = parent.scheduler.Schedule(ts, () => + { + lock (gate) + { + if (isShift) + { + var s = new List(); + q.Enqueue(s); + } + if (isSpan) + { + var s = q.Dequeue(); + observer.OnNext(s); + } + } + + CreateTimer(); + }); + } + + public override void OnNext(T value) + { + lock (gate) + { + foreach (var s in q) + { + s.Add(value); + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + lock (gate) + { + foreach (var list in q) + { + observer.OnNext(list); + } + + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + // timespan + count + class BufferTC : OperatorObserverBase> + { + static readonly T[] EmptyArray = new T[0]; // cache + + readonly BufferObservable parent; + readonly object gate = new object(); + + List list; + long timerId; + SerialDisposable timerD; + + public BufferTC(BufferObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + list = new List(); + timerId = 0L; + timerD = new SerialDisposable(); + + CreateTimer(); + var subscription = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(subscription, timerD); + } + + void CreateTimer() + { + var currentTimerId = timerId; + var timerS = new SingleAssignmentDisposable(); + timerD.Disposable = timerS; // restart timer(dispose before) + + + var periodicScheduler = parent.scheduler as ISchedulerPeriodic; + if (periodicScheduler != null) + { + timerS.Disposable = periodicScheduler.SchedulePeriodic(parent.timeSpan, () => OnNextTick(currentTimerId)); + } + else + { + timerS.Disposable = parent.scheduler.Schedule(parent.timeSpan, self => OnNextRecursive(currentTimerId, self)); + } + } + + void OnNextTick(long currentTimerId) + { + var isZero = false; + List currentList; + lock (gate) + { + if (currentTimerId != timerId) return; + + currentList = list; + if (currentList.Count != 0) + { + list = new List(); + } + else + { + isZero = true; + } + } + + observer.OnNext((isZero) ? (IList)EmptyArray : currentList); + } + + void OnNextRecursive(long currentTimerId, Action self) + { + var isZero = false; + List currentList; + lock (gate) + { + if (currentTimerId != timerId) return; + + currentList = list; + if (currentList.Count != 0) + { + list = new List(); + } + else + { + isZero = true; + } + } + + observer.OnNext((isZero) ? (IList)EmptyArray : currentList); + self(parent.timeSpan); + } + + public override void OnNext(T value) + { + List currentList = null; + lock (gate) + { + list.Add(value); + if (list.Count == parent.count) + { + currentList = list; + list = new List(); + timerId++; + CreateTimer(); + } + } + if (currentList != null) + { + observer.OnNext(currentList); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + List currentList; + lock (gate) + { + timerId++; + currentList = list; + } + observer.OnNext(currentList); + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + internal class BufferObservable : OperatorObservableBase> + { + readonly IObservable source; + readonly IObservable windowBoundaries; + + public BufferObservable(IObservable source, IObservable windowBoundaries) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.windowBoundaries = windowBoundaries; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return new Buffer(this, observer, cancel).Run(); + } + + class Buffer : OperatorObserverBase> + { + static readonly TSource[] EmptyArray = new TSource[0]; // cache + + readonly BufferObservable parent; + object gate = new object(); + List list; + + public Buffer(BufferObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + list = new List(); + + var sourceSubscription = parent.source.Subscribe(this); + var windowSubscription = parent.windowBoundaries.Subscribe(new Buffer_(this)); + + return StableCompositeDisposable.Create(sourceSubscription, windowSubscription); + } + + public override void OnNext(TSource value) + { + lock (gate) + { + list.Add(value); + } + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + lock (gate) + { + var currentList = list; + list = new List(); // safe + observer.OnNext(currentList); + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class Buffer_ : IObserver + { + readonly Buffer parent; + + public Buffer_(Buffer parent) + { + this.parent = parent; + } + + public void OnNext(TWindowBoundary value) + { + var isZero = false; + List currentList; + lock (parent.gate) + { + currentList = parent.list; + if (currentList.Count != 0) + { + parent.list = new List(); + } + else + { + isZero = true; + } + } + if (isZero) + { + parent.observer.OnNext(EmptyArray); + } + else + { + parent.observer.OnNext(currentList); + } + } + + public void OnError(Exception error) + { + parent.OnError(error); + } + + public void OnCompleted() + { + parent.OnCompleted(); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs.meta new file mode 100644 index 00000000..e2006a53 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Buffer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4137aec9640d3ea41a740d677026aa8c +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs b/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs new file mode 100644 index 00000000..92f1e4cc --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs @@ -0,0 +1,57 @@ +using System; + +namespace UniRx.Operators +{ + internal class CastObservable : OperatorObservableBase + { + readonly IObservable source; + + public CastObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Cast(observer, cancel)); + } + + class Cast : OperatorObserverBase + { + public Cast(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(TSource value) + { + var castValue = default(TResult); + try + { + castValue = (TResult)(object)value; + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + observer.OnNext(castValue); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs.meta new file mode 100644 index 00000000..d1d27c2c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Cast.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e70ae559c9b927742acbff91d50b3b22 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs b/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs new file mode 100644 index 00000000..97909695 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs @@ -0,0 +1,217 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class CatchObservable : OperatorObservableBase + where TException : Exception + { + readonly IObservable source; + readonly Func> errorHandler; + + public CatchObservable(IObservable source, Func> errorHandler) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.errorHandler = errorHandler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Catch(this, observer, cancel).Run(); + } + + class Catch : OperatorObserverBase + { + readonly CatchObservable parent; + SingleAssignmentDisposable sourceSubscription; + SingleAssignmentDisposable exceptionSubscription; + + public Catch(CatchObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + this.sourceSubscription = new SingleAssignmentDisposable(); + this.exceptionSubscription = new SingleAssignmentDisposable(); + + this.sourceSubscription.Disposable = parent.source.Subscribe(this); + return StableCompositeDisposable.Create(sourceSubscription, exceptionSubscription); + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + var e = error as TException; + if (e != null) + { + IObservable next; + try + { + if (parent.errorHandler == Stubs.CatchIgnore) + { + next = Observable.Empty(); // for avoid iOS AOT + } + else + { + next = parent.errorHandler(e); + } + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + + exceptionSubscription.Disposable = next.Subscribe(observer); + } + else + { + try { observer.OnError(error); } finally { Dispose(); }; + return; + } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + + + internal class CatchObservable : OperatorObservableBase + { + readonly IEnumerable> sources; + + public CatchObservable(IEnumerable> sources) + : base(true) + { + this.sources = sources; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Catch(this, observer, cancel).Run(); + } + + class Catch : OperatorObserverBase + { + readonly CatchObservable parent; + readonly object gate = new object(); + bool isDisposed; + IEnumerator> e; + SerialDisposable subscription; + Exception lastException; + Action nextSelf; + + public Catch(CatchObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + isDisposed = false; + e = parent.sources.GetEnumerator(); + subscription = new SerialDisposable(); + + var schedule = Scheduler.DefaultSchedulers.TailRecursion.Schedule(RecursiveRun); + + return StableCompositeDisposable.Create(schedule, subscription, Disposable.Create(() => + { + lock (gate) + { + this.isDisposed = true; + this.e.Dispose(); + } + })); + } + + void RecursiveRun(Action self) + { + lock (gate) + { + nextSelf = self; + if (isDisposed) return; + + var current = default(IObservable); + var hasNext = false; + var ex = default(Exception); + + try + { + hasNext = e.MoveNext(); + if (hasNext) + { + current = e.Current; + if (current == null) throw new InvalidOperationException("sequence is null."); + } + else + { + e.Dispose(); + } + } + catch (Exception exception) + { + ex = exception; + e.Dispose(); + } + + if (ex != null) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + if (!hasNext) + { + if (lastException != null) + { + try { observer.OnError(lastException); } + finally { Dispose(); } + } + else + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + return; + } + + var source = current; + var d = new SingleAssignmentDisposable(); + subscription.Disposable = d; + d.Disposable = source.Subscribe(this); + } + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + lastException = error; + nextSelf(); + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs.meta new file mode 100644 index 00000000..664ef44a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Catch.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 404a684db151ca34f8258c6fb373db8d +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs b/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs new file mode 100644 index 00000000..ac253ad6 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs @@ -0,0 +1,1010 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + public delegate TR CombineLatestFunc(T1 arg1, T2 arg2, T3 arg3); + public delegate TR CombineLatestFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4); + public delegate TR CombineLatestFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); + public delegate TR CombineLatestFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); + public delegate TR CombineLatestFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); + + + // binary + internal class CombineLatestObservable : OperatorObservableBase + { + readonly IObservable left; + readonly IObservable right; + readonly Func selector; + + public CombineLatestObservable(IObservable left, IObservable right, Func selector) + : base(left.IsRequiredSubscribeOnCurrentThread() || right.IsRequiredSubscribeOnCurrentThread()) + { + this.left = left; + this.right = right; + this.selector = selector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new CombineLatest(this, observer, cancel).Run(); + } + + class CombineLatest : OperatorObserverBase + { + readonly CombineLatestObservable parent; + readonly object gate = new object(); + + TLeft leftValue = default(TLeft); + bool leftStarted = false; + bool leftCompleted = false; + + TRight rightValue = default(TRight); + bool rightStarted = false; + bool rightCompleted = false; + + public CombineLatest(CombineLatestObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var l = parent.left.Subscribe(new LeftObserver(this)); + var r = parent.right.Subscribe(new RightObserver(this)); + + return StableCompositeDisposable.Create(l, r); + } + + // publish in lock + public void Publish() + { + if ((leftCompleted && !leftStarted) || (rightCompleted && !rightStarted)) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else if (!(leftStarted && rightStarted)) + { + return; + } + + TResult v; + try + { + v = parent.selector(leftValue, rightValue); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + OnNext(v); + } + + public override void OnNext(TResult value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + + class LeftObserver : IObserver + { + readonly CombineLatest parent; + + public LeftObserver(CombineLatest parent) + { + this.parent = parent; + } + + public void OnNext(TLeft value) + { + lock (parent.gate) + { + parent.leftStarted = true; + parent.leftValue = value; + parent.Publish(); + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + parent.OnError(error); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.leftCompleted = true; + if (parent.rightCompleted) parent.OnCompleted(); + } + } + } + + class RightObserver : IObserver + { + readonly CombineLatest parent; + + public RightObserver(CombineLatest parent) + { + this.parent = parent; + } + + + public void OnNext(TRight value) + { + lock (parent.gate) + { + parent.rightStarted = true; + parent.rightValue = value; + parent.Publish(); + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + parent.OnError(error); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.rightCompleted = true; + if (parent.leftCompleted) parent.OnCompleted(); + } + } + } + } + } + + // array + internal class CombineLatestObservable : OperatorObservableBase> + { + readonly IObservable[] sources; + + public CombineLatestObservable(IObservable[] sources) + : base(true) + { + this.sources = sources; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return new CombineLatest(this, observer, cancel).Run(); + } + + class CombineLatest : OperatorObserverBase, IList> + { + readonly CombineLatestObservable parent; + readonly object gate = new object(); + + int length; + T[] values; + bool[] isStarted; + bool[] isCompleted; + bool isAllValueStarted; + + public CombineLatest(CombineLatestObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + length = parent.sources.Length; + values = new T[length]; + isStarted = new bool[length]; + isCompleted = new bool[length]; + isAllValueStarted = false; + + var disposables = new IDisposable[length]; + for (int i = 0; i < length; i++) + { + var source = parent.sources[i]; + disposables[i] = source.Subscribe(new CombineLatestObserver(this, i)); + } + + return StableCompositeDisposable.CreateUnsafe(disposables); + } + + // publish is in the lock + void Publish(int index) + { + isStarted[index] = true; + + if (isAllValueStarted) + { + OnNext(new List(values)); + return; + } + + var allValueStarted = true; + for (int i = 0; i < length; i++) + { + if (!isStarted[i]) + { + allValueStarted = false; + break; + } + } + + isAllValueStarted = allValueStarted; + + if (isAllValueStarted) + { + OnNext(new List(values)); + return; + } + else + { + var allCompletedWithoutSelf = true; + for (int i = 0; i < length; i++) + { + if (i == index) continue; + if (!isCompleted[i]) + { + allCompletedWithoutSelf = false; + break; + } + } + + if (allCompletedWithoutSelf) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else + { + return; + } + } + } + + public override void OnNext(IList value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + + class CombineLatestObserver : IObserver + { + readonly CombineLatest parent; + readonly int index; + + public CombineLatestObserver(CombineLatest parent, int index) + { + this.parent = parent; + this.index = index; + } + + public void OnNext(T value) + { + lock (parent.gate) + { + parent.values[index] = value; + parent.Publish(index); + } + } + + public void OnError(Exception ex) + { + lock (parent.gate) + { + parent.OnError(ex); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.isCompleted[index] = true; + + var allTrue = true; + for (int i = 0; i < parent.length; i++) + { + if (!parent.isCompleted[i]) + { + allTrue = false; + break; + } + } + + if (allTrue) + { + parent.OnCompleted(); + } + } + } + } + } + } + + // generated from UniRx.Console.CombineLatestGenerator.tt + #region NTH + + internal class CombineLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + CombineLatestFunc resultSelector; + + public CombineLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + CombineLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new CombineLatest(3, this, observer, cancel).Run(); + } + + class CombineLatest : NthCombineLatestObserverBase + { + readonly CombineLatestObservable parent; + readonly object gate = new object(); + CombineLatestObserver c1; + CombineLatestObserver c2; + CombineLatestObserver c3; + + public CombineLatest(int length, CombineLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new CombineLatestObserver(gate, this, 0); + c2 = new CombineLatestObserver(gate, this, 1); + c3 = new CombineLatestObserver(gate, this, 2); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + + return StableCompositeDisposable.Create(s1, s2, s3); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class CombineLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + CombineLatestFunc resultSelector; + + public CombineLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + CombineLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new CombineLatest(4, this, observer, cancel).Run(); + } + + class CombineLatest : NthCombineLatestObserverBase + { + readonly CombineLatestObservable parent; + readonly object gate = new object(); + CombineLatestObserver c1; + CombineLatestObserver c2; + CombineLatestObserver c3; + CombineLatestObserver c4; + + public CombineLatest(int length, CombineLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new CombineLatestObserver(gate, this, 0); + c2 = new CombineLatestObserver(gate, this, 1); + c3 = new CombineLatestObserver(gate, this, 2); + c4 = new CombineLatestObserver(gate, this, 3); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + var s4 = parent.source4.Subscribe(c4); + + return StableCompositeDisposable.Create(s1, s2, s3, s4); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value, c4.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class CombineLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + CombineLatestFunc resultSelector; + + public CombineLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + CombineLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new CombineLatest(5, this, observer, cancel).Run(); + } + + class CombineLatest : NthCombineLatestObserverBase + { + readonly CombineLatestObservable parent; + readonly object gate = new object(); + CombineLatestObserver c1; + CombineLatestObserver c2; + CombineLatestObserver c3; + CombineLatestObserver c4; + CombineLatestObserver c5; + + public CombineLatest(int length, CombineLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new CombineLatestObserver(gate, this, 0); + c2 = new CombineLatestObserver(gate, this, 1); + c3 = new CombineLatestObserver(gate, this, 2); + c4 = new CombineLatestObserver(gate, this, 3); + c5 = new CombineLatestObserver(gate, this, 4); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + var s4 = parent.source4.Subscribe(c4); + var s5 = parent.source5.Subscribe(c5); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class CombineLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + IObservable source6; + CombineLatestFunc resultSelector; + + public CombineLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + IObservable source6, + CombineLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + source6.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.source6 = source6; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new CombineLatest(6, this, observer, cancel).Run(); + } + + class CombineLatest : NthCombineLatestObserverBase + { + readonly CombineLatestObservable parent; + readonly object gate = new object(); + CombineLatestObserver c1; + CombineLatestObserver c2; + CombineLatestObserver c3; + CombineLatestObserver c4; + CombineLatestObserver c5; + CombineLatestObserver c6; + + public CombineLatest(int length, CombineLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new CombineLatestObserver(gate, this, 0); + c2 = new CombineLatestObserver(gate, this, 1); + c3 = new CombineLatestObserver(gate, this, 2); + c4 = new CombineLatestObserver(gate, this, 3); + c5 = new CombineLatestObserver(gate, this, 4); + c6 = new CombineLatestObserver(gate, this, 5); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + var s4 = parent.source4.Subscribe(c4); + var s5 = parent.source5.Subscribe(c5); + var s6 = parent.source6.Subscribe(c6); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5, s6); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class CombineLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + IObservable source6; + IObservable source7; + CombineLatestFunc resultSelector; + + public CombineLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + IObservable source6, + IObservable source7, + CombineLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + source6.IsRequiredSubscribeOnCurrentThread() || + source7.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.source6 = source6; + this.source7 = source7; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new CombineLatest(7, this, observer, cancel).Run(); + } + + class CombineLatest : NthCombineLatestObserverBase + { + readonly CombineLatestObservable parent; + readonly object gate = new object(); + CombineLatestObserver c1; + CombineLatestObserver c2; + CombineLatestObserver c3; + CombineLatestObserver c4; + CombineLatestObserver c5; + CombineLatestObserver c6; + CombineLatestObserver c7; + + public CombineLatest(int length, CombineLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new CombineLatestObserver(gate, this, 0); + c2 = new CombineLatestObserver(gate, this, 1); + c3 = new CombineLatestObserver(gate, this, 2); + c4 = new CombineLatestObserver(gate, this, 3); + c5 = new CombineLatestObserver(gate, this, 4); + c6 = new CombineLatestObserver(gate, this, 5); + c7 = new CombineLatestObserver(gate, this, 6); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + var s4 = parent.source4.Subscribe(c4); + var s5 = parent.source5.Subscribe(c5); + var s6 = parent.source6.Subscribe(c6); + var s7 = parent.source7.Subscribe(c7); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5, s6, s7); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + #endregion + + // Nth infrastructure + + internal interface ICombineLatestObservable + { + void Publish(int index); + void Fail(Exception error); + void Done(int index); + } + + internal abstract class NthCombineLatestObserverBase : OperatorObserverBase, ICombineLatestObservable + { + readonly int length; + bool isAllValueStarted; + readonly bool[] isStarted; + readonly bool[] isCompleted; + + public NthCombineLatestObserverBase(int length, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.length = length; + this.isAllValueStarted = false; + this.isStarted = new bool[length]; + this.isCompleted = new bool[length]; + } + + public abstract T GetResult(); + + // operators in lock + public void Publish(int index) + { + isStarted[index] = true; + + if (isAllValueStarted) + { + var result = default(T); + try + { + result = GetResult(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + OnNext(result); + return; + } + + var allValueStarted = true; + for (int i = 0; i < length; i++) + { + if (!isStarted[i]) + { + allValueStarted = false; + break; + } + } + + isAllValueStarted = allValueStarted; + + if (isAllValueStarted) + { + var result = default(T); + try + { + result = GetResult(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + OnNext(result); + return; + } + else + { + var allCompletedWithoutSelf = true; + for (int i = 0; i < length; i++) + { + if (i == index) continue; + if (!isCompleted[i]) + { + allCompletedWithoutSelf = false; + break; + } + } + + if (allCompletedWithoutSelf) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else + { + return; + } + } + } + + public void Done(int index) + { + isCompleted[index] = true; + + var allTrue = true; + for (int i = 0; i < length; i++) + { + if (!isCompleted[i]) + { + allTrue = false; + break; + } + } + + if (allTrue) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + + public void Fail(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + } + + // Nth + internal class CombineLatestObserver : IObserver + { + readonly object gate; + readonly ICombineLatestObservable parent; + readonly int index; + T value; + + public T Value { get { return value; } } + + public CombineLatestObserver(object gate, ICombineLatestObservable parent, int index) + { + this.gate = gate; + this.parent = parent; + this.index = index; + } + + public void OnNext(T value) + { + lock (gate) + { + this.value = value; + parent.Publish(index); + } + } + + public void OnError(Exception error) + { + lock (gate) + { + parent.Fail(error); + } + } + + public void OnCompleted() + { + lock (gate) + { + parent.Done(index); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs.meta new file mode 100644 index 00000000..78b29463 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/CombineLatest.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 64910ffa78510ee48b3a395ee5b2cfe1 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs b/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs new file mode 100644 index 00000000..6b6bf574 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + // needs to more improvement + + internal class ConcatObservable : OperatorObservableBase + { + readonly IEnumerable> sources; + + public ConcatObservable(IEnumerable> sources) + : base(true) + { + this.sources = sources; + } + + public IObservable Combine(IEnumerable> combineSources) + { + return new ConcatObservable(CombineSources(this.sources, combineSources)); + } + + static IEnumerable> CombineSources(IEnumerable> first, IEnumerable> second) + { + foreach (var item in first) + { + yield return item; + } + foreach (var item in second) + { + yield return item; + } + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Concat(this, observer, cancel).Run(); + } + + class Concat : OperatorObserverBase + { + readonly ConcatObservable parent; + readonly object gate = new object(); + + bool isDisposed; + IEnumerator> e; + SerialDisposable subscription; + Action nextSelf; + + public Concat(ConcatObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + isDisposed = false; + e = parent.sources.GetEnumerator(); + subscription = new SerialDisposable(); + + var schedule = Scheduler.DefaultSchedulers.TailRecursion.Schedule(RecursiveRun); + + return StableCompositeDisposable.Create(schedule, subscription, Disposable.Create(() => + { + lock (gate) + { + this.isDisposed = true; + this.e.Dispose(); + } + })); + } + + void RecursiveRun(Action self) + { + lock (gate) + { + this.nextSelf = self; + if (isDisposed) return; + + var current = default(IObservable); + var hasNext = false; + var ex = default(Exception); + + try + { + hasNext = e.MoveNext(); + if (hasNext) + { + current = e.Current; + if (current == null) throw new InvalidOperationException("sequence is null."); + } + else + { + e.Dispose(); + } + } + catch (Exception exception) + { + ex = exception; + e.Dispose(); + } + + if (ex != null) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + if (!hasNext) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + + var source = current; + var d = new SingleAssignmentDisposable(); + subscription.Disposable = d; + d.Disposable = source.Subscribe(this); + } + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + this.nextSelf(); + } + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs.meta new file mode 100644 index 00000000..3ac21450 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Concat.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 740c2691a7e434f439abfdcac75ea809 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs b/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs new file mode 100644 index 00000000..ee46b3aa --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs @@ -0,0 +1,77 @@ +using System; + +namespace UniRx.Operators +{ + internal class ContinueWithObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func> selector; + + public ContinueWithObservable(IObservable source, Func> selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selector = selector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ContinueWith(this, observer, cancel).Run(); + } + + class ContinueWith : OperatorObserverBase + { + readonly ContinueWithObservable parent; + readonly SerialDisposable serialDisposable = new SerialDisposable(); + + bool seenValue; + TSource lastValue; + + public ContinueWith(ContinueWithObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var sourceDisposable = new SingleAssignmentDisposable(); + serialDisposable.Disposable = sourceDisposable; + + sourceDisposable.Disposable = parent.source.Subscribe(this); + return serialDisposable; + } + + public override void OnNext(TSource value) + { + this.seenValue = true; + this.lastValue = value; + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + + public override void OnCompleted() + { + if (seenValue) + { + try + { + var v = parent.selector(lastValue); + // dispose source subscription + serialDisposable.Disposable = v.Subscribe(observer); + } + catch (Exception error) + { + OnError(error); + } + } + else + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs.meta new file mode 100644 index 00000000..f691d07a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ContinueWith.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bea59b3eb246d244a99183eeb7f3bad4 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Create.cs b/Assets/Plugins/UniRx/Scripts/Operators/Create.cs new file mode 100644 index 00000000..f3e46a52 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Create.cs @@ -0,0 +1,156 @@ +using System; + +namespace UniRx.Operators +{ + internal class CreateObservable : OperatorObservableBase + { + readonly Func, IDisposable> subscribe; + + public CreateObservable(Func, IDisposable> subscribe) + : base(true) // fail safe + { + this.subscribe = subscribe; + } + + public CreateObservable(Func, IDisposable> subscribe, bool isRequiredSubscribeOnCurrentThread) + : base(isRequiredSubscribeOnCurrentThread) + { + this.subscribe = subscribe; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new Create(observer, cancel); + return subscribe(observer) ?? Disposable.Empty; + } + + class Create : OperatorObserverBase + { + public Create(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class CreateObservable : OperatorObservableBase + { + readonly TState state; + readonly Func, IDisposable> subscribe; + + public CreateObservable(TState state, Func, IDisposable> subscribe) + : base(true) // fail safe + { + this.state = state; + this.subscribe = subscribe; + } + + public CreateObservable(TState state, Func, IDisposable> subscribe, bool isRequiredSubscribeOnCurrentThread) + : base(isRequiredSubscribeOnCurrentThread) + { + this.state = state; + this.subscribe = subscribe; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new Create(observer, cancel); + return subscribe(state, observer) ?? Disposable.Empty; + } + + class Create : OperatorObserverBase + { + public Create(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class CreateSafeObservable : OperatorObservableBase + { + readonly Func, IDisposable> subscribe; + + public CreateSafeObservable(Func, IDisposable> subscribe) + : base(true) // fail safe + { + this.subscribe = subscribe; + } + + public CreateSafeObservable(Func, IDisposable> subscribe, bool isRequiredSubscribeOnCurrentThread) + : base(isRequiredSubscribeOnCurrentThread) + { + this.subscribe = subscribe; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new CreateSafe(observer, cancel); + return subscribe(observer) ?? Disposable.Empty; + } + + class CreateSafe : OperatorObserverBase + { + public CreateSafe(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); // safe + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Create.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Create.cs.meta new file mode 100644 index 00000000..33ab3003 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Create.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cae9e62bf5eb3dc4e9d93cf6ff606052 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs b/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs new file mode 100644 index 00000000..ef3001b4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs @@ -0,0 +1,58 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class DefaultIfEmptyObservable : OperatorObservableBase + { + readonly IObservable source; + readonly T defaultValue; + + public DefaultIfEmptyObservable(IObservable source, T defaultValue) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.defaultValue = defaultValue; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new DefaultIfEmpty(this, observer, cancel)); + } + + class DefaultIfEmpty : OperatorObserverBase + { + readonly DefaultIfEmptyObservable parent; + bool hasValue; + + public DefaultIfEmpty(DefaultIfEmptyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.hasValue = false; + } + + public override void OnNext(T value) + { + hasValue = true; + observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (!hasValue) + { + observer.OnNext(parent.defaultValue); + } + + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs.meta new file mode 100644 index 00000000..17fe0038 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/DefaultIfEmpty.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 551075cda284fbc489824d153743b1e6 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs b/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs new file mode 100644 index 00000000..b2a88f81 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs @@ -0,0 +1,64 @@ +using System; + +namespace UniRx.Operators +{ + internal class DeferObservable : OperatorObservableBase + { + readonly Func> observableFactory; + + public DeferObservable(Func> observableFactory) + : base(false) + { + this.observableFactory = observableFactory; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new Defer(observer, cancel); + + IObservable source; + try + { + source = observableFactory(); + } + catch (Exception ex) + { + source = Observable.Throw(ex); + } + + return source.Subscribe(observer); + } + + class Defer : OperatorObserverBase + { + public Defer(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs.meta new file mode 100644 index 00000000..ee6047fe --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Defer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 15ca418b98836d943864b1e8b82f6658 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs b/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs new file mode 100644 index 00000000..f4a6a5b7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs @@ -0,0 +1,227 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + internal class DelayObservable : OperatorObservableBase + { + readonly IObservable source; + readonly TimeSpan dueTime; + readonly IScheduler scheduler; + + public DelayObservable(IObservable source, TimeSpan dueTime, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.dueTime = dueTime; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Delay(this, observer, cancel).Run(); + } + + class Delay : OperatorObserverBase + { + readonly DelayObservable parent; + readonly object gate = new object(); + bool hasFailed; + bool running; + bool active; + Exception exception; + Queue> queue; + bool onCompleted; + DateTimeOffset completeAt; + IDisposable sourceSubscription; + TimeSpan delay; + bool ready; + SerialDisposable cancelable; + + public Delay(DelayObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + cancelable = new SerialDisposable(); + + active = false; + running = false; + queue = new Queue>(); + onCompleted = false; + completeAt = default(DateTimeOffset); + hasFailed = false; + exception = default(Exception); + ready = true; + delay = Scheduler.Normalize(parent.dueTime); + + var _sourceSubscription = new SingleAssignmentDisposable(); + sourceSubscription = _sourceSubscription; // assign to field + _sourceSubscription.Disposable = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(sourceSubscription, cancelable); + } + + public override void OnNext(T value) + { + var next = parent.scheduler.Now.Add(delay); + var shouldRun = false; + + lock (gate) + { + queue.Enqueue(new Timestamped(value, next)); + + shouldRun = ready && !active; + active = true; + } + + if (shouldRun) + { + cancelable.Disposable = parent.scheduler.Schedule(delay, DrainQueue); + } + } + + public override void OnError(Exception error) + { + sourceSubscription.Dispose(); + + var shouldRun = false; + + lock (gate) + { + queue.Clear(); + + exception = error; + hasFailed = true; + + shouldRun = !running; + } + + if (shouldRun) + { + try { base.observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + sourceSubscription.Dispose(); + + var next = parent.scheduler.Now.Add(delay); + var shouldRun = false; + + lock (gate) + { + completeAt = next; + onCompleted = true; + + shouldRun = ready && !active; + active = true; + } + + if (shouldRun) + { + cancelable.Disposable = parent.scheduler.Schedule(delay, DrainQueue); + } + } + + void DrainQueue(Action recurse) + { + lock (gate) + { + if (hasFailed) return; + running = true; + } + + var shouldYield = false; + + while (true) + { + var hasFailed = false; + var error = default(Exception); + + var hasValue = false; + var value = default(T); + var hasCompleted = false; + + var shouldRecurse = false; + var recurseDueTime = default(TimeSpan); + + lock (gate) + { + if (hasFailed) + { + error = exception; + hasFailed = true; + running = false; + } + else + { + if (queue.Count > 0) + { + var nextDue = queue.Peek().Timestamp; + + if (nextDue.CompareTo(parent.scheduler.Now) <= 0 && !shouldYield) + { + value = queue.Dequeue().Value; + hasValue = true; + } + else + { + shouldRecurse = true; + recurseDueTime = Scheduler.Normalize(nextDue.Subtract(parent.scheduler.Now)); + running = false; + } + } + else if (onCompleted) + { + if (completeAt.CompareTo(parent.scheduler.Now) <= 0 && !shouldYield) + { + hasCompleted = true; + } + else + { + shouldRecurse = true; + recurseDueTime = Scheduler.Normalize(completeAt.Subtract(parent.scheduler.Now)); + running = false; + } + } + else + { + running = false; + active = false; + } + } + } + + if (hasValue) + { + base.observer.OnNext(value); + shouldYield = true; + } + else + { + if (hasCompleted) + { + try { base.observer.OnCompleted(); } finally { Dispose(); } + } + else if (hasFailed) + { + try { base.observer.OnError(error); } finally { Dispose(); } + } + else if (shouldRecurse) + { + recurse(recurseDueTime); + } + + return; + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs.meta new file mode 100644 index 00000000..67f9cb48 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Delay.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2af9c507ce062994a904e4b5565b49c0 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs b/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs new file mode 100644 index 00000000..971293c6 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class DelaySubscriptionObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IScheduler scheduler; + readonly TimeSpan? dueTimeT; + readonly DateTimeOffset? dueTimeD; + + public DelaySubscriptionObservable(IObservable source,TimeSpan dueTime, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.scheduler = scheduler; + this.dueTimeT = dueTime; + } + + public DelaySubscriptionObservable(IObservable source, DateTimeOffset dueTime, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.scheduler = scheduler; + this.dueTimeD = dueTime; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (dueTimeT != null) + { + var d = new MultipleAssignmentDisposable(); + var dt = Scheduler.Normalize(dueTimeT.Value); + + d.Disposable = scheduler.Schedule(dt, () => + { + d.Disposable = source.Subscribe(observer); + }); + + return d; + } + else + { + var d = new MultipleAssignmentDisposable(); + + d.Disposable = scheduler.Schedule(dueTimeD.Value, () => + { + d.Disposable = source.Subscribe(observer); + }); + + return d; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs.meta new file mode 100644 index 00000000..bb9dc060 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/DelaySubscription.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4f532fc776d5298439cb8f03d52e1211 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs b/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs new file mode 100644 index 00000000..620139c4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs @@ -0,0 +1,66 @@ +using System; + +namespace UniRx.Operators +{ + internal class DematerializeObservable : OperatorObservableBase + { + readonly IObservable> source; + + public DematerializeObservable(IObservable> source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Dematerialize(this, observer, cancel).Run(); + } + + class Dematerialize : OperatorObserverBase, T> + { + readonly DematerializeObservable parent; + + public Dematerialize(DematerializeObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(Notification value) + { + switch (value.Kind) + { + case NotificationKind.OnNext: + observer.OnNext(value.Value); + break; + case NotificationKind.OnError: + try { observer.OnError(value.Exception); } + finally { Dispose(); } + break; + case NotificationKind.OnCompleted: + try { observer.OnCompleted(); } + finally { Dispose(); } + break; + default: + break; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs.meta new file mode 100644 index 00000000..1a0cfc03 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Dematerialize.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 80682be7e41afb44581208534f226d38 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs b/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs new file mode 100644 index 00000000..c9151c12 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class DistinctObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IEqualityComparer comparer; + + public DistinctObservable(IObservable source, IEqualityComparer comparer) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.comparer = comparer; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Distinct(this, observer, cancel)); + } + + class Distinct : OperatorObserverBase + { + readonly HashSet hashSet; + + public Distinct(DistinctObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + hashSet = (parent.comparer == null) + ? new HashSet() + : new HashSet(parent.comparer); + } + + public override void OnNext(T value) + { + var key = default(T); + var isAdded = false; + try + { + key = value; + isAdded = hashSet.Add(key); + } + catch (Exception exception) + { + try { observer.OnError(exception); } finally { Dispose(); } + return; + } + + if (isAdded) + { + observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + internal class DistinctObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IEqualityComparer comparer; + readonly Func keySelector; + + public DistinctObservable(IObservable source, Func keySelector, IEqualityComparer comparer) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.comparer = comparer; + this.keySelector = keySelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Distinct(this, observer, cancel)); + } + + class Distinct : OperatorObserverBase + { + readonly DistinctObservable parent; + readonly HashSet hashSet; + + public Distinct(DistinctObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + hashSet = (parent.comparer == null) + ? new HashSet() + : new HashSet(parent.comparer); + } + + public override void OnNext(T value) + { + var key = default(TKey); + var isAdded = false; + try + { + key = parent.keySelector(value); + isAdded = hashSet.Add(key); + } + catch (Exception exception) + { + try { observer.OnError(exception); } finally { Dispose(); } + return; + } + + if (isAdded) + { + observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs.meta new file mode 100644 index 00000000..330e124f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Distinct.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 376a7ed430bff5c4b860af4d23ab6b79 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs b/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs new file mode 100644 index 00000000..f6d9b102 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class DistinctUntilChangedObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IEqualityComparer comparer; + + public DistinctUntilChangedObservable(IObservable source, IEqualityComparer comparer) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.comparer = comparer; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new DistinctUntilChanged(this, observer, cancel)); + } + + class DistinctUntilChanged : OperatorObserverBase + { + readonly DistinctUntilChangedObservable parent; + bool isFirst = true; + T prevKey = default(T); + + public DistinctUntilChanged(DistinctUntilChangedObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + T currentKey; + try + { + currentKey = value; + } + catch (Exception exception) + { + try { observer.OnError(exception); } finally { Dispose(); } + return; + } + + var sameKey = false; + if (isFirst) + { + isFirst = false; + } + else + { + try + { + sameKey = parent.comparer.Equals(currentKey, prevKey); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + } + + if (!sameKey) + { + prevKey = currentKey; + observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + internal class DistinctUntilChangedObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IEqualityComparer comparer; + readonly Func keySelector; + + public DistinctUntilChangedObservable(IObservable source, Func keySelector, IEqualityComparer comparer) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.comparer = comparer; + this.keySelector = keySelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new DistinctUntilChanged(this, observer, cancel)); + } + + class DistinctUntilChanged : OperatorObserverBase + { + readonly DistinctUntilChangedObservable parent; + bool isFirst = true; + TKey prevKey = default(TKey); + + public DistinctUntilChanged(DistinctUntilChangedObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + TKey currentKey; + try + { + currentKey = parent.keySelector(value); + } + catch (Exception exception) + { + try { observer.OnError(exception); } finally { Dispose(); } + return; + } + + var sameKey = false; + if (isFirst) + { + isFirst = false; + } + else + { + try + { + sameKey = parent.comparer.Equals(currentKey, prevKey); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + } + + if (!sameKey) + { + prevKey = currentKey; + observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs.meta new file mode 100644 index 00000000..e43b2860 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/DistinctUntilChanged.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a09c4b58f60c22342871c30eaf589f6c +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Do.cs b/Assets/Plugins/UniRx/Scripts/Operators/Do.cs new file mode 100644 index 00000000..472bfdb3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Do.cs @@ -0,0 +1,477 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + // Do, DoOnError, DoOnCompleted, DoOnTerminate, DoOnSubscribe, DoOnCancel + + internal class DoObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Action onNext; + readonly Action onError; + readonly Action onCompleted; + + public DoObservable(IObservable source, Action onNext, Action onError, Action onCompleted) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.onNext = onNext; + this.onError = onError; + this.onCompleted = onCompleted; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Do(this, observer, cancel).Run(); + } + + class Do : OperatorObserverBase + { + readonly DoObservable parent; + + public Do(DoObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + try + { + parent.onNext(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try + { + parent.onError(error); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + try { observer.OnError(error); } finally { Dispose(); }; + } + + public override void OnCompleted() + { + try + { + parent.onCompleted(); + } + catch (Exception ex) + { + base.observer.OnError(ex); + Dispose(); + return; + } + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + + internal class DoObserverObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IObserver observer; + + public DoObserverObservable(IObservable source, IObserver observer) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.observer = observer; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Do(this, observer, cancel).Run(); + } + + class Do : OperatorObserverBase + { + readonly DoObserverObservable parent; + + public Do(DoObserverObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + try + { + parent.observer.OnNext(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try + { + parent.observer.OnError(error); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try + { + parent.observer.OnCompleted(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class DoOnErrorObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Action onError; + + public DoOnErrorObservable(IObservable source, Action onError) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.onError = onError; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new DoOnError(this, observer, cancel).Run(); + } + + class DoOnError : OperatorObserverBase + { + readonly DoOnErrorObservable parent; + + public DoOnError(DoOnErrorObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try + { + parent.onError(error); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class DoOnCompletedObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Action onCompleted; + + public DoOnCompletedObservable(IObservable source, Action onCompleted) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.onCompleted = onCompleted; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new DoOnCompleted(this, observer, cancel).Run(); + } + + class DoOnCompleted : OperatorObserverBase + { + readonly DoOnCompletedObservable parent; + + public DoOnCompleted(DoOnCompletedObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try + { + parent.onCompleted(); + } + catch (Exception ex) + { + base.observer.OnError(ex); + Dispose(); + return; + } + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + + internal class DoOnTerminateObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Action onTerminate; + + public DoOnTerminateObservable(IObservable source, Action onTerminate) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.onTerminate = onTerminate; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new DoOnTerminate(this, observer, cancel).Run(); + } + + class DoOnTerminate : OperatorObserverBase + { + readonly DoOnTerminateObservable parent; + + public DoOnTerminate(DoOnTerminateObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try + { + parent.onTerminate(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + try { observer.OnError(error); } finally { Dispose(); }; + } + + public override void OnCompleted() + { + try + { + parent.onTerminate(); + } + catch (Exception ex) + { + base.observer.OnError(ex); + Dispose(); + return; + } + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + + internal class DoOnSubscribeObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Action onSubscribe; + + public DoOnSubscribeObservable(IObservable source, Action onSubscribe) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.onSubscribe = onSubscribe; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new DoOnSubscribe(this, observer, cancel).Run(); + } + + class DoOnSubscribe : OperatorObserverBase + { + readonly DoOnSubscribeObservable parent; + + public DoOnSubscribe(DoOnSubscribeObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + try + { + parent.onSubscribe(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return Disposable.Empty; + } + + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + internal class DoOnCancelObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Action onCancel; + + public DoOnCancelObservable(IObservable source, Action onCancel) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.onCancel = onCancel; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new DoOnCancel(this, observer, cancel).Run(); + } + + class DoOnCancel : OperatorObserverBase + { + readonly DoOnCancelObservable parent; + bool isCompletedCall = false; + + public DoOnCancel(DoOnCancelObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return StableCompositeDisposable.Create(parent.source.Subscribe(this), Disposable.Create(() => + { + if (!isCompletedCall) + { + parent.onCancel(); + } + })); + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + isCompletedCall = true; + try { observer.OnError(error); } finally { Dispose(); }; + } + + public override void OnCompleted() + { + isCompletedCall = true; + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Do.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Do.cs.meta new file mode 100644 index 00000000..3b5f6034 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Do.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8f99ae8870195e34b8618451a95818e0 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs b/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs new file mode 100644 index 00000000..cefcc0b5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs @@ -0,0 +1,83 @@ +using System; + +namespace UniRx.Operators +{ + internal class EmptyObservable : OperatorObservableBase + { + readonly IScheduler scheduler; + + public EmptyObservable(IScheduler scheduler) + : base(false) + { + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new Empty(observer, cancel); + + if (scheduler == Scheduler.Immediate) + { + observer.OnCompleted(); + return Disposable.Empty; + } + else + { + return scheduler.Schedule(observer.OnCompleted); + } + } + + class Empty : OperatorObserverBase + { + public Empty(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class ImmutableEmptyObservable : IObservable, IOptimizedObservable + { + internal static ImmutableEmptyObservable Instance = new ImmutableEmptyObservable(); + + ImmutableEmptyObservable() + { + + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + public IDisposable Subscribe(IObserver observer) + { + observer.OnCompleted(); + return Disposable.Empty; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs.meta new file mode 100644 index 00000000..b6a88849 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Empty.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9e9a7050a289d3a4aa17cba89e085135 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs b/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs new file mode 100644 index 00000000..fb4ee658 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs @@ -0,0 +1,68 @@ +using System; + +namespace UniRx.Operators +{ + internal class FinallyObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Action finallyAction; + + public FinallyObservable(IObservable source, Action finallyAction) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.finallyAction = finallyAction; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Finally(this, observer, cancel).Run(); + } + + class Finally : OperatorObserverBase + { + readonly FinallyObservable parent; + + public Finally(FinallyObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + IDisposable subscription; + try + { + subscription = parent.source.Subscribe(this); + } + catch + { + // This behaviour is not same as .NET Official Rx + parent.finallyAction(); + throw; + } + + return StableCompositeDisposable.Create(subscription, Disposable.Create(() => + { + parent.finallyAction(); + })); + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs.meta new file mode 100644 index 00000000..d7ab8938 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Finally.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9ce919d8f2acf2b47a932e850e399d3a +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/First.cs b/Assets/Plugins/UniRx/Scripts/Operators/First.cs new file mode 100644 index 00000000..220a986d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/First.cs @@ -0,0 +1,166 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class FirstObservable : OperatorObservableBase + { + readonly IObservable source; + readonly bool useDefault; + readonly Func predicate; + + public FirstObservable(IObservable source, bool useDefault) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.useDefault = useDefault; + } + + public FirstObservable(IObservable source, Func predicate, bool useDefault) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicate = predicate; + this.useDefault = useDefault; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (predicate == null) + { + return source.Subscribe(new First(this, observer, cancel)); + } + else + { + return source.Subscribe(new First_(this, observer, cancel)); + } + } + + class First : OperatorObserverBase + { + readonly FirstObservable parent; + bool notPublished; + + public First(FirstObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.notPublished = true; + } + + public override void OnNext(T value) + { + if (notPublished) + { + notPublished = false; + observer.OnNext(value); + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (parent.useDefault) + { + if (notPublished) + { + observer.OnNext(default(T)); + } + try { observer.OnCompleted(); } + finally { Dispose(); } + } + else + { + if (notPublished) + { + try { observer.OnError(new InvalidOperationException("sequence is empty")); } + finally { Dispose(); } + } + else + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + } + + // with predicate + class First_ : OperatorObserverBase + { + readonly FirstObservable parent; + bool notPublished; + + public First_(FirstObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.notPublished = true; + } + + public override void OnNext(T value) + { + if (notPublished) + { + bool isPassed; + try + { + isPassed = parent.predicate(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + if (isPassed) + { + notPublished = false; + observer.OnNext(value); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (parent.useDefault) + { + if (notPublished) + { + observer.OnNext(default(T)); + } + try { observer.OnCompleted(); } + finally { Dispose(); } + } + else + { + if (notPublished) + { + try { observer.OnError(new InvalidOperationException("sequence is empty")); } + finally { Dispose(); } + } + else + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/First.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/First.cs.meta new file mode 100644 index 00000000..c1e9944d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/First.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8e3093220aeb1d54faa3fca9fe0af6c0 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs b/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs new file mode 100644 index 00000000..7a8aecfc --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs @@ -0,0 +1,116 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class ForEachAsyncObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Action onNext; + readonly Action onNextWithIndex; + + public ForEachAsyncObservable(IObservable source, Action onNext) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.onNext = onNext; + } + + public ForEachAsyncObservable(IObservable source, Action onNext) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.onNextWithIndex = onNext; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (onNext != null) + { + return source.Subscribe(new ForEachAsync(this, observer, cancel)); + } + else + { + return source.Subscribe(new ForEachAsync_(this, observer, cancel)); + } + } + + class ForEachAsync : OperatorObserverBase + { + readonly ForEachAsyncObservable parent; + + public ForEachAsync(ForEachAsyncObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + try + { + parent.onNext(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + observer.OnNext(Unit.Default); + + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + + // with index + class ForEachAsync_ : OperatorObserverBase + { + readonly ForEachAsyncObservable parent; + int index = 0; + + public ForEachAsync_(ForEachAsyncObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + try + { + parent.onNextWithIndex(value, index++); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + observer.OnNext(Unit.Default); + + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs.meta new file mode 100644 index 00000000..76086d0e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ForEachAsync.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5b66ecd2e5290bc4eb8c78a1ccc2d009 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs b/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs new file mode 100644 index 00000000..d137725b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs @@ -0,0 +1,323 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + // FromEvent, FromEventPattern + + internal class FromEventPatternObservable : OperatorObservableBase> + where TEventArgs : EventArgs + { + readonly Func, TDelegate> conversion; + readonly Action addHandler; + readonly Action removeHandler; + + public FromEventPatternObservable(Func, TDelegate> conversion, Action addHandler, Action removeHandler) + : base(false) + { + this.conversion = conversion; + this.addHandler = addHandler; + this.removeHandler = removeHandler; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + var fe = new FromEventPattern(this, observer); + return fe.Register() ? fe : Disposable.Empty; + } + + class FromEventPattern : IDisposable + { + readonly FromEventPatternObservable parent; + readonly IObserver> observer; + TDelegate handler; + + public FromEventPattern(FromEventPatternObservable parent, IObserver> observer) + { + this.parent = parent; + this.observer = observer; + } + + public bool Register() + { + handler = parent.conversion(OnNext); + try + { + parent.addHandler(handler); + } + catch (Exception ex) + { + observer.OnError(ex); + return false; + } + return true; + } + + void OnNext(object sender, TEventArgs eventArgs) + { + observer.OnNext(new EventPattern(sender, eventArgs)); + } + + public void Dispose() + { + if (handler != null) + { + parent.removeHandler(handler); + handler = default(TDelegate); + } + } + } + } + + internal class FromEventObservable : OperatorObservableBase + { + readonly Func conversion; + readonly Action addHandler; + readonly Action removeHandler; + + public FromEventObservable(Func conversion, Action addHandler, Action removeHandler) + : base(false) + { + this.conversion = conversion; + this.addHandler = addHandler; + this.removeHandler = removeHandler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var fe = new FromEvent(this, observer); + return fe.Register() ? fe : Disposable.Empty; + } + + class FromEvent : IDisposable + { + readonly FromEventObservable parent; + readonly IObserver observer; + TDelegate handler; + + public FromEvent(FromEventObservable parent, IObserver observer) + { + this.parent = parent; + this.observer = observer; + } + + public bool Register() + { + handler = parent.conversion(OnNext); + + try + { + parent.addHandler(handler); + } + catch (Exception ex) + { + observer.OnError(ex); + return false; + } + return true; + } + + void OnNext() + { + observer.OnNext(Unit.Default); + } + + public void Dispose() + { + if (handler != null) + { + parent.removeHandler(handler); + handler = default(TDelegate); + } + } + } + } + + internal class FromEventObservable : OperatorObservableBase + { + readonly Func, TDelegate> conversion; + readonly Action addHandler; + readonly Action removeHandler; + + public FromEventObservable(Func, TDelegate> conversion, Action addHandler, Action removeHandler) + : base(false) + { + this.conversion = conversion; + this.addHandler = addHandler; + this.removeHandler = removeHandler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var fe = new FromEvent(this, observer); + return fe.Register() ? fe : Disposable.Empty; + } + + class FromEvent : IDisposable + { + readonly FromEventObservable parent; + readonly IObserver observer; + TDelegate handler; + + public FromEvent(FromEventObservable parent, IObserver observer) + { + this.parent = parent; + this.observer = observer; + } + + public bool Register() + { + handler = parent.conversion(OnNext); + + try + { + parent.addHandler(handler); + } + catch (Exception ex) + { + observer.OnError(ex); + return false; + } + return true; + } + + void OnNext(TEventArgs args) + { + observer.OnNext(args); + } + + public void Dispose() + { + if (handler != null) + { + parent.removeHandler(handler); + handler = default(TDelegate); + } + } + } + } + + internal class FromEventObservable : OperatorObservableBase + { + readonly Action addHandler; + readonly Action removeHandler; + + public FromEventObservable(Action addHandler, Action removeHandler) + : base(false) + { + this.addHandler = addHandler; + this.removeHandler = removeHandler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var fe = new FromEvent(this, observer); + return fe.Register() ? fe : Disposable.Empty; + } + + class FromEvent : IDisposable + { + readonly FromEventObservable parent; + readonly IObserver observer; + Action handler; + + public FromEvent(FromEventObservable parent, IObserver observer) + { + this.parent = parent; + this.observer = observer; + this.handler = OnNext; + } + + public bool Register() + { + try + { + parent.addHandler(handler); + } + catch (Exception ex) + { + observer.OnError(ex); + return false; + } + return true; + } + + void OnNext() + { + observer.OnNext(Unit.Default); + } + + public void Dispose() + { + if (handler != null) + { + parent.removeHandler(handler); + handler = null; + } + } + } + } + + internal class FromEventObservable_ : OperatorObservableBase + { + readonly Action> addHandler; + readonly Action> removeHandler; + + public FromEventObservable_(Action> addHandler, Action> removeHandler) + : base(false) + { + this.addHandler = addHandler; + this.removeHandler = removeHandler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var fe = new FromEvent(this, observer); + return fe.Register() ? fe : Disposable.Empty; + } + + class FromEvent : IDisposable + { + readonly FromEventObservable_ parent; + readonly IObserver observer; + Action handler; + + public FromEvent(FromEventObservable_ parent, IObserver observer) + { + this.parent = parent; + this.observer = observer; + this.handler = OnNext; + } + + public bool Register() + { + try + { + parent.addHandler(handler); + } + catch (Exception ex) + { + observer.OnError(ex); + return false; + } + return true; + } + + void OnNext(T value) + { + observer.OnNext(value); + } + + public void Dispose() + { + if (handler != null) + { + parent.removeHandler(handler); + handler = null; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs.meta new file mode 100644 index 00000000..5284fd90 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/FromEvent.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 05fcc5083e94e704ca8f059e4e535ffa +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs b/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs new file mode 100644 index 00000000..60d63490 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs @@ -0,0 +1,196 @@ +using System; +using System.Collections.Generic; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class GroupedObservable : IGroupedObservable + { + readonly TKey key; + readonly IObservable subject; + readonly RefCountDisposable refCount; + + public TKey Key + { + get { return key; } + } + + public GroupedObservable(TKey key, ISubject subject, RefCountDisposable refCount) + { + this.key = key; + this.subject = subject; + this.refCount = refCount; + } + + public IDisposable Subscribe(IObserver observer) + { + var release = refCount.GetDisposable(); + var subscription = subject.Subscribe(observer); + return StableCompositeDisposable.Create(release, subscription); + } + } + + internal class GroupByObservable : OperatorObservableBase> + { + readonly IObservable source; + readonly Func keySelector; + readonly Func elementSelector; + readonly int? capacity; + readonly IEqualityComparer comparer; + + public GroupByObservable(IObservable source, Func keySelector, Func elementSelector, int? capacity, IEqualityComparer comparer) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.keySelector = keySelector; + this.elementSelector = elementSelector; + this.capacity = capacity; + this.comparer = comparer; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return new GroupBy(this, observer, cancel).Run(); + } + + class GroupBy : OperatorObserverBase> + { + readonly GroupByObservable parent; + readonly Dictionary> map; + ISubject nullKeySubject; + + CompositeDisposable groupDisposable; + RefCountDisposable refCountDisposable; + + public GroupBy(GroupByObservable parent, IObserver> observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + if (parent.capacity.HasValue) + { + map = new Dictionary>(parent.capacity.Value, parent.comparer); + } + else + { + map = new Dictionary>(parent.comparer); + } + } + + public IDisposable Run() + { + groupDisposable = new CompositeDisposable(); + refCountDisposable = new RefCountDisposable(groupDisposable); + + groupDisposable.Add(parent.source.Subscribe(this)); + + return refCountDisposable; + } + + public override void OnNext(TSource value) + { + var key = default(TKey); + try + { + key = parent.keySelector(value); + } + catch (Exception exception) + { + Error(exception); + return; + } + + var fireNewMapEntry = false; + var writer = default(ISubject); + try + { + if (key == null) + { + if (nullKeySubject == null) + { + nullKeySubject = new Subject(); + fireNewMapEntry = true; + } + + writer = nullKeySubject; + } + else + { + if (!map.TryGetValue(key, out writer)) + { + writer = new Subject(); + map.Add(key, writer); + fireNewMapEntry = true; + } + } + } + catch (Exception exception) + { + Error(exception); + return; + } + + if (fireNewMapEntry) + { + var group = new GroupedObservable(key, writer, refCountDisposable); + observer.OnNext(group); + } + + var element = default(TElement); + try + { + element = parent.elementSelector(value); + } + catch (Exception exception) + { + Error(exception); + return; + } + + writer.OnNext(element); + } + + public override void OnError(Exception error) + { + Error(error); + } + + public override void OnCompleted() + { + try + { + if (nullKeySubject != null) nullKeySubject.OnCompleted(); + + foreach (var s in map.Values) + { + s.OnCompleted(); + } + + observer.OnCompleted(); + } + finally + { + Dispose(); + } + } + + void Error(Exception exception) + { + try + { + if (nullKeySubject != null) nullKeySubject.OnError(exception); + + foreach (var s in map.Values) + { + s.OnError(exception); + } + + observer.OnError(exception); + } + finally + { + Dispose(); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs.meta new file mode 100644 index 00000000..1f2d951f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/GroupBy.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7345fc4a6df05ca47ab89ec819bccde6 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs b/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs new file mode 100644 index 00000000..f8cec0ba --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs @@ -0,0 +1,44 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class IgnoreElementsObservable : OperatorObservableBase + { + readonly IObservable source; + + public IgnoreElementsObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new IgnoreElements(observer, cancel)); + } + + class IgnoreElements : OperatorObserverBase + { + public IgnoreElements(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs.meta new file mode 100644 index 00000000..f36f8ce2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/IgnoreElements.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d6c8ca210619da74b92cbdb3e8c58127 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Last.cs b/Assets/Plugins/UniRx/Scripts/Operators/Last.cs new file mode 100644 index 00000000..78172869 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Last.cs @@ -0,0 +1,165 @@ +using System; + +namespace UniRx.Operators +{ + internal class LastObservable : OperatorObservableBase + { + readonly IObservable source; + readonly bool useDefault; + readonly Func predicate; + + public LastObservable(IObservable source, bool useDefault) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.useDefault = useDefault; + } + + public LastObservable(IObservable source, Func predicate, bool useDefault) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicate = predicate; + this.useDefault = useDefault; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (predicate == null) + { + return source.Subscribe(new Last(this, observer, cancel)); + } + else + { + return source.Subscribe(new Last_(this, observer, cancel)); + } + } + + class Last : OperatorObserverBase + { + readonly LastObservable parent; + bool notPublished; + T lastValue; + + public Last(LastObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.notPublished = true; + } + + public override void OnNext(T value) + { + notPublished = false; + lastValue = value; + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (parent.useDefault) + { + if (notPublished) + { + observer.OnNext(default(T)); + } + else + { + observer.OnNext(lastValue); + } + try { observer.OnCompleted(); } + finally { Dispose(); } + } + else + { + if (notPublished) + { + try { observer.OnError(new InvalidOperationException("sequence is empty")); } + finally { Dispose(); } + } + else + { + observer.OnNext(lastValue); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + } + + class Last_ : OperatorObserverBase + { + readonly LastObservable parent; + bool notPublished; + T lastValue; + + public Last_(LastObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.notPublished = true; + } + + public override void OnNext(T value) + { + bool isPassed; + try + { + isPassed = parent.predicate(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + if (isPassed) + { + notPublished = false; + lastValue = value; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (parent.useDefault) + { + if (notPublished) + { + observer.OnNext(default(T)); + } + else + { + observer.OnNext(lastValue); + } + try { observer.OnCompleted(); } + finally { Dispose(); } + } + else + { + if (notPublished) + { + try { observer.OnError(new InvalidOperationException("sequence is empty")); } + finally { Dispose(); } + } + else + { + observer.OnNext(lastValue); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Last.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Last.cs.meta new file mode 100644 index 00000000..8165fbae --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Last.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 696780c8759162d4b996683ec13d7e0b +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs b/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs new file mode 100644 index 00000000..5c9d108c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs @@ -0,0 +1,53 @@ +using System; + +namespace UniRx.Operators +{ + internal class MaterializeObservable : OperatorObservableBase> + { + readonly IObservable source; + + public MaterializeObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return new Materialize(this, observer, cancel).Run(); + } + + class Materialize : OperatorObserverBase> + { + readonly MaterializeObservable parent; + + public Materialize(MaterializeObservable parent, IObserver> observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + observer.OnNext(Notification.CreateOnNext(value)); + } + + public override void OnError(Exception error) + { + observer.OnNext(Notification.CreateOnError(error)); + try { observer.OnCompleted(); } finally { Dispose(); } + } + + public override void OnCompleted() + { + observer.OnNext(Notification.CreateOnCompleted()); + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs.meta new file mode 100644 index 00000000..a949074f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Materialize.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 09d3ba9e6d5fe4643bbf0df943652908 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs b/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs new file mode 100644 index 00000000..9221ad61 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs @@ -0,0 +1,264 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class MergeObservable : OperatorObservableBase + { + private readonly IObservable> sources; + private readonly int maxConcurrent; + + public MergeObservable(IObservable> sources, bool isRequiredSubscribeOnCurrentThread) + : base(isRequiredSubscribeOnCurrentThread) + { + this.sources = sources; + } + + public MergeObservable(IObservable> sources, int maxConcurrent, bool isRequiredSubscribeOnCurrentThread) + : base(isRequiredSubscribeOnCurrentThread) + { + this.sources = sources; + this.maxConcurrent = maxConcurrent; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (maxConcurrent > 0) + { + return new MergeConcurrentObserver(this, observer, cancel).Run(); + } + else + { + return new MergeOuterObserver(this, observer, cancel).Run(); + } + } + + class MergeOuterObserver : OperatorObserverBase, T> + { + readonly MergeObservable parent; + + CompositeDisposable collectionDisposable; + SingleAssignmentDisposable sourceDisposable; + object gate = new object(); + bool isStopped = false; + + public MergeOuterObserver(MergeObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + collectionDisposable = new CompositeDisposable(); + sourceDisposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(sourceDisposable); + + sourceDisposable.Disposable = parent.sources.Subscribe(this); + return collectionDisposable; + } + + public override void OnNext(IObservable value) + { + var disposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(disposable); + var collectionObserver = new Merge(this, disposable); + disposable.Disposable = value.Subscribe(collectionObserver); + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + isStopped = true; + if (collectionDisposable.Count == 1) + { + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + else + { + sourceDisposable.Dispose(); + } + } + + class Merge : OperatorObserverBase + { + readonly MergeOuterObserver parent; + readonly IDisposable cancel; + + public Merge(MergeOuterObserver parent, IDisposable cancel) + : base(parent.observer, cancel) + { + this.parent = parent; + this.cancel = cancel; + } + + public override void OnNext(T value) + { + lock (parent.gate) + { + base.observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + lock (parent.gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + parent.collectionDisposable.Remove(cancel); + if (parent.isStopped && parent.collectionDisposable.Count == 1) + { + lock (parent.gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } + } + + class MergeConcurrentObserver : OperatorObserverBase, T> + { + readonly MergeObservable parent; + + CompositeDisposable collectionDisposable; + SingleAssignmentDisposable sourceDisposable; + object gate = new object(); + bool isStopped = false; + + // concurrency + Queue> q; + int activeCount; + + public MergeConcurrentObserver(MergeObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + q = new Queue>(); + activeCount = 0; + + collectionDisposable = new CompositeDisposable(); + sourceDisposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(sourceDisposable); + + sourceDisposable.Disposable = parent.sources.Subscribe(this); + return collectionDisposable; + } + + public override void OnNext(IObservable value) + { + lock (gate) + { + if (activeCount < parent.maxConcurrent) + { + activeCount++; + Subscribe(value); + } + else + { + q.Enqueue(value); + } + } + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + lock (gate) + { + isStopped = true; + if (activeCount == 0) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + else + { + sourceDisposable.Dispose(); + } + } + } + + void Subscribe(IObservable innerSource) + { + var disposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(disposable); + var collectionObserver = new Merge(this, disposable); + disposable.Disposable = innerSource.Subscribe(collectionObserver); + } + + class Merge : OperatorObserverBase + { + readonly MergeConcurrentObserver parent; + readonly IDisposable cancel; + + public Merge(MergeConcurrentObserver parent, IDisposable cancel) + : base(parent.observer, cancel) + { + this.parent = parent; + this.cancel = cancel; + } + + public override void OnNext(T value) + { + lock (parent.gate) + { + base.observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + lock (parent.gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + parent.collectionDisposable.Remove(cancel); + lock (parent.gate) + { + if (parent.q.Count > 0) + { + var source = parent.q.Dequeue(); + parent.Subscribe(source); + } + else + { + parent.activeCount--; + if (parent.isStopped && parent.activeCount == 0) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs.meta new file mode 100644 index 00000000..936c75de --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Merge.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 94158fab525468d4e896a62f633257e6 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Never.cs b/Assets/Plugins/UniRx/Scripts/Operators/Never.cs new file mode 100644 index 00000000..ad6a7789 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Never.cs @@ -0,0 +1,32 @@ +using System; + +namespace UniRx.Operators +{ + internal class NeverObservable : OperatorObservableBase + { + public NeverObservable() + : base(false) + { + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return Disposable.Empty; + } + } + + internal class ImmutableNeverObservable : IObservable, IOptimizedObservable + { + internal static ImmutableNeverObservable Instance = new ImmutableNeverObservable(); + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + public IDisposable Subscribe(IObserver observer) + { + return Disposable.Empty; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Never.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Never.cs.meta new file mode 100644 index 00000000..50371e6e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Never.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b5db8d5c73883214abaf3715002da256 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs b/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs new file mode 100644 index 00000000..b8f02f18 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs @@ -0,0 +1,210 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class ObserveOnObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IScheduler scheduler; + + public ObserveOnObservable(IObservable source, IScheduler scheduler) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var queueing = scheduler as ISchedulerQueueing; + if (queueing == null) + { + return new ObserveOn(this, observer, cancel).Run(); + } + else + { + return new ObserveOn_(this, queueing, observer, cancel).Run(); + } + } + + class ObserveOn : OperatorObserverBase + { + class SchedulableAction : IDisposable + { + public Notification data; + public LinkedListNode node; + public IDisposable schedule; + + public void Dispose() + { + if (schedule != null) + schedule.Dispose(); + schedule = null; + + if (node.List != null) + { + node.List.Remove(node); + } + } + + public bool IsScheduled { get { return schedule != null; } } + } + + readonly ObserveOnObservable parent; + readonly LinkedList actions = new LinkedList(); + bool isDisposed; + + public ObserveOn(ObserveOnObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + isDisposed = false; + + var sourceDisposable = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(sourceDisposable, Disposable.Create(() => + { + lock (actions) + { + isDisposed = true; + + while (actions.Count > 0) + { + // Dispose will both cancel the action (if not already running) + // and remove it from 'actions' + actions.First.Value.Dispose(); + } + } + })); + } + + public override void OnNext(T value) + { + QueueAction(new Notification.OnNextNotification(value)); + } + + public override void OnError(Exception error) + { + QueueAction(new Notification.OnErrorNotification(error)); + } + + public override void OnCompleted() + { + QueueAction(new Notification.OnCompletedNotification()); + } + + private void QueueAction(Notification data) + { + var action = new SchedulableAction { data = data }; + lock (actions) + { + if (isDisposed) return; + + action.node = actions.AddLast(action); + ProcessNext(); + } + } + + private void ProcessNext() + { + lock (actions) + { + if (actions.Count == 0 || isDisposed) + return; + + var action = actions.First.Value; + + if (action.IsScheduled) + return; + + action.schedule = parent.scheduler.Schedule(() => + { + try + { + switch (action.data.Kind) + { + case NotificationKind.OnNext: + observer.OnNext(action.data.Value); + break; + case NotificationKind.OnError: + observer.OnError(action.data.Exception); + break; + case NotificationKind.OnCompleted: + observer.OnCompleted(); + break; + } + } + finally + { + lock (actions) + { + action.Dispose(); + } + + if (action.data.Kind == NotificationKind.OnNext) + ProcessNext(); + else + Dispose(); + } + }); + } + } + } + + class ObserveOn_ : OperatorObserverBase + { + readonly ObserveOnObservable parent; + readonly ISchedulerQueueing scheduler; + readonly BooleanDisposable isDisposed; + readonly Action onNext; + + public ObserveOn_(ObserveOnObservable parent, ISchedulerQueueing scheduler, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.scheduler = scheduler; + this.isDisposed = new BooleanDisposable(); + this.onNext = new Action(OnNext_); // cache delegate + } + + public IDisposable Run() + { + var sourceDisposable = parent.source.Subscribe(this); + return StableCompositeDisposable.Create(sourceDisposable, isDisposed); + } + + void OnNext_(T value) + { + base.observer.OnNext(value); + } + + void OnError_(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + + void OnCompleted_(Unit _) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + + public override void OnNext(T value) + { + scheduler.ScheduleQueueing(isDisposed, value, onNext); + } + + public override void OnError(Exception error) + { + scheduler.ScheduleQueueing(isDisposed, error, OnError_); + } + + public override void OnCompleted() + { + scheduler.ScheduleQueueing(isDisposed, Unit.Default, OnCompleted_); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs.meta new file mode 100644 index 00000000..684cfc29 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ObserveOn.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 39df784f492c7404286d05b09a840705 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs b/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs new file mode 100644 index 00000000..76857f80 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs @@ -0,0 +1,47 @@ +using System; + +namespace UniRx.Operators +{ + internal class OfTypeObservable : OperatorObservableBase + { + readonly IObservable source; + + public OfTypeObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new OfType(observer, cancel)); + } + + class OfType : OperatorObserverBase + { + public OfType(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(TSource value) + { + if (value is TResult) + { + var castValue = (TResult)(object)value; + observer.OnNext(castValue); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs.meta new file mode 100644 index 00000000..3d899027 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/OfType.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 981fd4bf7704404459a0deed254a03e5 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs new file mode 100644 index 00000000..e00c8648 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs @@ -0,0 +1,42 @@ +using System; + +namespace UniRx.Operators +{ + // implements note : all field must be readonly. + public abstract class OperatorObservableBase : IObservable, IOptimizedObservable + { + readonly bool isRequiredSubscribeOnCurrentThread; + + public OperatorObservableBase(bool isRequiredSubscribeOnCurrentThread) + { + this.isRequiredSubscribeOnCurrentThread = isRequiredSubscribeOnCurrentThread; + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return isRequiredSubscribeOnCurrentThread; + } + + public IDisposable Subscribe(IObserver observer) + { + var subscription = new SingleAssignmentDisposable(); + + // note: + // does not make the safe observer, it breaks exception durability. + // var safeObserver = Observer.CreateAutoDetachObserver(observer, subscription); + + if (isRequiredSubscribeOnCurrentThread && Scheduler.IsCurrentThreadSchedulerScheduleRequired) + { + Scheduler.CurrentThread.Schedule(() => subscription.Disposable = SubscribeCore(observer, subscription)); + } + else + { + subscription.Disposable = SubscribeCore(observer, subscription); + } + + return subscription; + } + + protected abstract IDisposable SubscribeCore(IObserver observer, IDisposable cancel); + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs.meta new file mode 100644 index 00000000..25d2ceec --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1b94a1a0ae5d509488c6242454216bdb +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs new file mode 100644 index 00000000..725842c4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading; + +namespace UniRx.Operators +{ + public abstract class OperatorObserverBase : IDisposable, IObserver + { + protected internal volatile IObserver observer; + IDisposable cancel; + + public OperatorObserverBase(IObserver observer, IDisposable cancel) + { + this.observer = observer; + this.cancel = cancel; + } + + public abstract void OnNext(TSource value); + + public abstract void OnError(Exception error); + + public abstract void OnCompleted(); + + public void Dispose() + { + observer = UniRx.InternalUtil.EmptyObserver.Instance; + var target = System.Threading.Interlocked.Exchange(ref cancel, null); + if (target != null) + { + target.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs.meta new file mode 100644 index 00000000..9854d9d7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/OperatorObserverBase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 258901a4513be8f4a8bfcca91e70bb12 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs b/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs new file mode 100644 index 00000000..4b9bcccf --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs @@ -0,0 +1,120 @@ +using System; + +namespace UniRx.Operators +{ + internal class PairwiseObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func selector; + + public PairwiseObservable(IObservable source, Func selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selector = selector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Pairwise(this, observer, cancel)); + } + + class Pairwise : OperatorObserverBase + { + readonly PairwiseObservable parent; + T prev = default(T); + bool isFirst = true; + + public Pairwise(PairwiseObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + if (isFirst) + { + isFirst = false; + prev = value; + return; + } + + TR v; + try + { + v = parent.selector(prev, value); + prev = value; + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + observer.OnNext(v); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + internal class PairwiseObservable : OperatorObservableBase> + { + readonly IObservable source; + + public PairwiseObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return source.Subscribe(new Pairwise(observer, cancel)); + } + + class Pairwise : OperatorObserverBase> + { + T prev = default(T); + bool isFirst = true; + + public Pairwise(IObserver> observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + if (isFirst) + { + isFirst = false; + prev = value; + return; + } + + var pair = new Pair(prev, value); + prev = value; + observer.OnNext(pair); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs.meta new file mode 100644 index 00000000..76d9aa36 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/PairWise.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f66e4871304e6e74d8548d597457e53c +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Range.cs b/Assets/Plugins/UniRx/Scripts/Operators/Range.cs new file mode 100644 index 00000000..b96da8e3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Range.cs @@ -0,0 +1,89 @@ +using System; + +namespace UniRx.Operators +{ + internal class RangeObservable : OperatorObservableBase + { + readonly int start; + readonly int count; + readonly IScheduler scheduler; + + public RangeObservable(int start, int count, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + if (count < 0) throw new ArgumentOutOfRangeException("count < 0"); + + this.start = start; + this.count = count; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new Range(observer, cancel); + + if (scheduler == Scheduler.Immediate) + { + for (int i = 0; i < count; i++) + { + int v = start + i; + observer.OnNext(v); + } + observer.OnCompleted(); + + return Disposable.Empty; + } + else + { + var i = 0; + return scheduler.Schedule((Action self) => + { + if (i < count) + { + int v = start + i; + observer.OnNext(v); + i++; + self(); + } + else + { + observer.OnCompleted(); + } + }); + } + } + + class Range : OperatorObserverBase + { + public Range(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(int value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Range.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Range.cs.meta new file mode 100644 index 00000000..39c12d87 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Range.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2249fbe589c8d3042ac201c1ab4be76f +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs b/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs new file mode 100644 index 00000000..49287066 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs @@ -0,0 +1,77 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class RefCountObservable : OperatorObservableBase + { + readonly IConnectableObservable source; + readonly object gate = new object(); + int refCount = 0; + IDisposable connection; + + public RefCountObservable(IConnectableObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new RefCount(this, observer, cancel).Run(); + } + + class RefCount : OperatorObserverBase + { + readonly RefCountObservable parent; + + public RefCount(RefCountObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var subcription = parent.source.Subscribe(this); + + lock (parent.gate) + { + if (++parent.refCount == 1) + { + parent.connection = parent.source.Connect(); + } + } + + return Disposable.Create(() => + { + subcription.Dispose(); + + lock (parent.gate) + { + if (--parent.refCount == 0) + { + parent.connection.Dispose(); + } + } + }); + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs.meta new file mode 100644 index 00000000..93437213 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/RefCount.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 17a77b422aa699d4d8cfbf6de804d238 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs b/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs new file mode 100644 index 00000000..4d519f5d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs @@ -0,0 +1,99 @@ +using System; + +namespace UniRx.Operators +{ + internal class RepeatObservable : OperatorObservableBase + { + readonly T value; + readonly int? repeatCount; + readonly IScheduler scheduler; + + public RepeatObservable(T value, int? repeatCount, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + this.value = value; + this.repeatCount = repeatCount; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new Repeat(observer, cancel); + + if (repeatCount == null) + { + return scheduler.Schedule((Action self) => + { + observer.OnNext(value); + self(); + }); + } + else + { + if (scheduler == Scheduler.Immediate) + { + var count = this.repeatCount.Value; + for (int i = 0; i < count; i++) + { + observer.OnNext(value); + } + observer.OnCompleted(); + return Disposable.Empty; + } + else + { + var currentCount = this.repeatCount.Value; + return scheduler.Schedule((Action self) => + { + if (currentCount > 0) + { + observer.OnNext(value); + currentCount--; + } + + if (currentCount == 0) + { + observer.OnCompleted(); + return; + } + + self(); + }); + } + } + } + + class Repeat : OperatorObserverBase + { + public Repeat(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs.meta new file mode 100644 index 00000000..345d90a2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Repeat.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 63930706f2ea6e847866fc6d914b0d2e +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs b/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs new file mode 100644 index 00000000..4b4a0d98 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class RepeatSafeObservable : OperatorObservableBase + { + readonly IEnumerable> sources; + + public RepeatSafeObservable(IEnumerable> sources, bool isRequiredSubscribeOnCurrentThread) + : base(isRequiredSubscribeOnCurrentThread) + { + this.sources = sources; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new RepeatSafe(this, observer, cancel).Run(); + } + + class RepeatSafe : OperatorObserverBase + { + readonly RepeatSafeObservable parent; + readonly object gate = new object(); + + IEnumerator> e; + SerialDisposable subscription; + Action nextSelf; + bool isDisposed; + bool isRunNext; + + public RepeatSafe(RepeatSafeObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + isDisposed = false; + isRunNext = false; + e = parent.sources.GetEnumerator(); + subscription = new SerialDisposable(); + + var schedule = Scheduler.DefaultSchedulers.TailRecursion.Schedule(RecursiveRun); + + return StableCompositeDisposable.Create(schedule, subscription, Disposable.Create(() => + { + lock (gate) + { + isDisposed = true; + e.Dispose(); + } + })); + } + + void RecursiveRun(Action self) + { + lock (gate) + { + this.nextSelf = self; + if (isDisposed) return; + + var current = default(IObservable); + var hasNext = false; + var ex = default(Exception); + + try + { + hasNext = e.MoveNext(); + if (hasNext) + { + current = e.Current; + if (current == null) throw new InvalidOperationException("sequence is null."); + } + else + { + e.Dispose(); + } + } + catch (Exception exception) + { + ex = exception; + e.Dispose(); + } + + if (ex != null) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + if (!hasNext) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + + var source = e.Current; + var d = new SingleAssignmentDisposable(); + subscription.Disposable = d; + d.Disposable = source.Subscribe(this); + } + } + + public override void OnNext(T value) + { + isRunNext = true; + base.observer.OnNext(value); + } + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (isRunNext && !isDisposed) + { + isRunNext = false; + this.nextSelf(); + } + else + { + e.Dispose(); + if (!isDisposed) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs.meta new file mode 100644 index 00000000..b9b4318e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/RepeatSafe.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6458fa5124443dc4bb95ad3d0b743934 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Return.cs b/Assets/Plugins/UniRx/Scripts/Operators/Return.cs new file mode 100644 index 00000000..45167c7d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Return.cs @@ -0,0 +1,205 @@ +using System; + +namespace UniRx.Operators +{ + internal class ReturnObservable : OperatorObservableBase + { + readonly T value; + readonly IScheduler scheduler; + + public ReturnObservable(T value, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + this.value = value; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new Return(observer, cancel); + + if (scheduler == Scheduler.Immediate) + { + observer.OnNext(value); + observer.OnCompleted(); + return Disposable.Empty; + } + else + { + return scheduler.Schedule(() => + { + observer.OnNext(value); + observer.OnCompleted(); + }); + } + } + + class Return : OperatorObserverBase + { + public Return(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class ImmediateReturnObservable : IObservable, IOptimizedObservable + { + readonly T value; + + public ImmediateReturnObservable(T value) + { + this.value = value; + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + public IDisposable Subscribe(IObserver observer) + { + observer.OnNext(value); + observer.OnCompleted(); + return Disposable.Empty; + } + } + + internal class ImmutableReturnUnitObservable : IObservable, IOptimizedObservable + { + internal static ImmutableReturnUnitObservable Instance = new ImmutableReturnUnitObservable(); + + ImmutableReturnUnitObservable() + { + + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + public IDisposable Subscribe(IObserver observer) + { + observer.OnNext(Unit.Default); + observer.OnCompleted(); + return Disposable.Empty; + } + } + + internal class ImmutableReturnTrueObservable : IObservable, IOptimizedObservable + { + internal static ImmutableReturnTrueObservable Instance = new ImmutableReturnTrueObservable(); + + ImmutableReturnTrueObservable() + { + + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + public IDisposable Subscribe(IObserver observer) + { + observer.OnNext(true); + observer.OnCompleted(); + return Disposable.Empty; + } + } + + internal class ImmutableReturnFalseObservable : IObservable, IOptimizedObservable + { + internal static ImmutableReturnFalseObservable Instance = new ImmutableReturnFalseObservable(); + + ImmutableReturnFalseObservable() + { + + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + public IDisposable Subscribe(IObserver observer) + { + observer.OnNext(false); + observer.OnCompleted(); + return Disposable.Empty; + } + } + + internal class ImmutableReturnInt32Observable : IObservable, IOptimizedObservable + { + static ImmutableReturnInt32Observable[] Caches = new ImmutableReturnInt32Observable[] + { + new ImmutableReturnInt32Observable(-1), + new ImmutableReturnInt32Observable(0), + new ImmutableReturnInt32Observable(1), + new ImmutableReturnInt32Observable(2), + new ImmutableReturnInt32Observable(3), + new ImmutableReturnInt32Observable(4), + new ImmutableReturnInt32Observable(5), + new ImmutableReturnInt32Observable(6), + new ImmutableReturnInt32Observable(7), + new ImmutableReturnInt32Observable(8), + new ImmutableReturnInt32Observable(9), + }; + + public static IObservable GetInt32Observable(int x) + { + if (-1 <= x && x <= 9) + { + return Caches[x + 1]; + } + + return new ImmediateReturnObservable(x); + } + + readonly int x; + + ImmutableReturnInt32Observable(int x) + { + this.x = x; + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + public IDisposable Subscribe(IObserver observer) + { + observer.OnNext(x); + observer.OnCompleted(); + return Disposable.Empty; + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Return.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Return.cs.meta new file mode 100644 index 00000000..16d6217b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Return.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 25648117feeec6043bd39468bfab62b7 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs b/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs new file mode 100644 index 00000000..7c73de7f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs @@ -0,0 +1,241 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + internal class SampleObservable : OperatorObservableBase + { + readonly IObservable source; + readonly TimeSpan interval; + readonly IScheduler scheduler; + + public SampleObservable(IObservable source, TimeSpan interval, IScheduler scheduler) + : base(source.IsRequiredSubscribeOnCurrentThread() || scheduler == Scheduler.CurrentThread) + { + this.source = source; + this.interval = interval; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Sample(this, observer, cancel).Run(); + } + + class Sample : OperatorObserverBase + { + readonly SampleObservable parent; + readonly object gate = new object(); + T latestValue = default(T); + bool isUpdated = false; + bool isCompleted = false; + SingleAssignmentDisposable sourceSubscription; + + public Sample(SampleObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + sourceSubscription = new SingleAssignmentDisposable(); + sourceSubscription.Disposable = parent.source.Subscribe(this); + + + IDisposable scheduling; + var periodicScheduler = parent.scheduler as ISchedulerPeriodic; + if (periodicScheduler != null) + { + scheduling = periodicScheduler.SchedulePeriodic(parent.interval, OnNextTick); + } + else + { + scheduling = parent.scheduler.Schedule(parent.interval, OnNextRecursive); + } + + return StableCompositeDisposable.Create(sourceSubscription, scheduling); + } + + void OnNextTick() + { + lock (gate) + { + if (isUpdated) + { + var value = latestValue; + isUpdated = false; + observer.OnNext(value); + } + if (isCompleted) + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + void OnNextRecursive(Action self) + { + lock (gate) + { + if (isUpdated) + { + var value = latestValue; + isUpdated = false; + observer.OnNext(value); + } + if (isCompleted) + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + self(parent.interval); + } + + public override void OnNext(T value) + { + lock (gate) + { + latestValue = value; + isUpdated = true; + } + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { base.observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + lock (gate) + { + isCompleted = true; + sourceSubscription.Dispose(); + } + } + } + } + + internal class SampleObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IObservable intervalSource; + + public SampleObservable(IObservable source, IObservable intervalSource) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.intervalSource = intervalSource; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Sample(this, observer, cancel).Run(); + } + + class Sample : OperatorObserverBase + { + readonly SampleObservable parent; + readonly object gate = new object(); + T latestValue = default(T); + bool isUpdated = false; + bool isCompleted = false; + SingleAssignmentDisposable sourceSubscription; + + public Sample( + SampleObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + sourceSubscription = new SingleAssignmentDisposable(); + sourceSubscription.Disposable = parent.source.Subscribe(this); + + var scheduling = this.parent.intervalSource.Subscribe(new SampleTick(this)); + + return StableCompositeDisposable.Create(sourceSubscription, scheduling); + } + + public override void OnNext(T value) + { + lock (gate) + { + latestValue = value; + isUpdated = true; + } + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { base.observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + lock (gate) + { + isCompleted = true; + sourceSubscription.Dispose(); + } + } + + class SampleTick : IObserver + { + readonly Sample parent; + + public SampleTick(Sample parent) + { + this.parent = parent; + } + + public void OnCompleted() + { + lock (parent.gate) + { + if (parent.isUpdated) + { + parent.isUpdated = false; + parent.observer.OnNext(parent.latestValue); + } + if (parent.isCompleted) + { + try { parent.observer.OnCompleted(); } finally { parent.Dispose(); } + } + } + } + + public void OnError(Exception error) + { + } + + public void OnNext(T2 _) + { + lock (parent.gate) + { + if (parent.isUpdated) + { + var value = parent.latestValue; + parent.isUpdated = false; + parent.observer.OnNext(value); + } + if (parent.isCompleted) + { + try { parent.observer.OnCompleted(); } finally { parent.Dispose(); } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs.meta new file mode 100644 index 00000000..f7274362 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Sample.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 414e918f6a4dfc549b2a8c916a6325e1 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs b/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs new file mode 100644 index 00000000..417222af --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs @@ -0,0 +1,139 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class ScanObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func accumulator; + + public ScanObservable(IObservable source, Func accumulator) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.accumulator = accumulator; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Scan(this, observer, cancel)); + } + + class Scan : OperatorObserverBase + { + readonly ScanObservable parent; + TSource accumulation; + bool isFirst; + + public Scan(ScanObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.isFirst = true; + } + + public override void OnNext(TSource value) + { + if (isFirst) + { + isFirst = false; + accumulation = value; + } + else + { + try + { + accumulation = parent.accumulator(accumulation, value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + } + + observer.OnNext(accumulation); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class ScanObservable : OperatorObservableBase + { + readonly IObservable source; + readonly TAccumulate seed; + readonly Func accumulator; + + public ScanObservable(IObservable source, TAccumulate seed, Func accumulator) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.seed = seed; + this.accumulator = accumulator; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Scan(this, observer, cancel)); + } + + class Scan : OperatorObserverBase + { + readonly ScanObservable parent; + TAccumulate accumulation; + bool isFirst; + + public Scan(ScanObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.isFirst = true; + } + + public override void OnNext(TSource value) + { + if (isFirst) + { + isFirst = false; + accumulation = parent.seed; + } + + try + { + accumulation = parent.accumulator(accumulation, value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + observer.OnNext(accumulation); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs.meta new file mode 100644 index 00000000..47c62623 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Scan.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 461fecd0ef4d48c4d95aae68c2ca2c1c +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Select.cs b/Assets/Plugins/UniRx/Scripts/Operators/Select.cs new file mode 100644 index 00000000..ec45e645 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Select.cs @@ -0,0 +1,146 @@ +using System; + +namespace UniRx.Operators +{ + internal interface ISelect + { + // IObservable CombineSelector(Func selector); + IObservable CombinePredicate(Func predicate); + } + + internal class SelectObservable : OperatorObservableBase, ISelect + { + readonly IObservable source; + readonly Func selector; + readonly Func selectorWithIndex; + + public SelectObservable(IObservable source, Func selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selector = selector; + } + + public SelectObservable(IObservable source, Func selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selectorWithIndex = selector; + } + + // sometimes cause "which no ahead of time (AOT) code was generated." on IL2CPP... + + //public IObservable CombineSelector(Func combineSelector) + //{ + // if (this.selector != null) + // { + // return new Select(source, x => combineSelector(this.selector(x))); + // } + // else + // { + // return new Select(this, combineSelector); + // } + //} + + public IObservable CombinePredicate(Func predicate) + { + if (this.selector != null) + { + return new SelectWhereObservable(this.source, this.selector, predicate); + } + else + { + return new WhereObservable(this, predicate); // can't combine + } + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (selector != null) + { + return source.Subscribe(new Select(this, observer, cancel)); + } + else + { + return source.Subscribe(new Select_(this, observer, cancel)); + } + } + + class Select : OperatorObserverBase + { + readonly SelectObservable parent; + + public Select(SelectObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + var v = default(TR); + try + { + v = parent.selector(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + observer.OnNext(v); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + // with Index + class Select_ : OperatorObserverBase + { + readonly SelectObservable parent; + int index; + + public Select_(SelectObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + this.index = 0; + } + + public override void OnNext(T value) + { + var v = default(TR); + try + { + v = parent.selectorWithIndex(value, index++); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + observer.OnNext(v); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Select.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Select.cs.meta new file mode 100644 index 00000000..ccf8119d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Select.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 997e36ad7b02b804ea1f03d05e60bed5 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs b/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs new file mode 100644 index 00000000..a199692f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs @@ -0,0 +1,910 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class SelectManyObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func> selector; + readonly Func> selectorWithIndex; + readonly Func> selectorEnumerable; + readonly Func> selectorEnumerableWithIndex; + + public SelectManyObservable(IObservable source, Func> selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selector = selector; + } + + public SelectManyObservable(IObservable source, Func> selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selectorWithIndex = selector; + } + + public SelectManyObservable(IObservable source, Func> selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selectorEnumerable = selector; + } + + public SelectManyObservable(IObservable source, Func> selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selectorEnumerableWithIndex = selector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (this.selector != null) + { + return new SelectManyOuterObserver(this, observer, cancel).Run(); + } + else if (this.selectorWithIndex != null) + { + return new SelectManyObserverWithIndex(this, observer, cancel).Run(); + } + else if (this.selectorEnumerable != null) + { + return new SelectManyEnumerableObserver(this, observer, cancel).Run(); + } + else if (this.selectorEnumerableWithIndex != null) + { + return new SelectManyEnumerableObserverWithIndex(this, observer, cancel).Run(); + } + else + { + throw new InvalidOperationException(); + } + } + + class SelectManyOuterObserver : OperatorObserverBase + { + readonly SelectManyObservable parent; + + CompositeDisposable collectionDisposable; + SingleAssignmentDisposable sourceDisposable; + object gate = new object(); + bool isStopped = false; + + public SelectManyOuterObserver(SelectManyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + collectionDisposable = new CompositeDisposable(); + sourceDisposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(sourceDisposable); + + sourceDisposable.Disposable = parent.source.Subscribe(this); + return collectionDisposable; + } + + public override void OnNext(TSource value) + { + IObservable nextObservable; + try + { + nextObservable = parent.selector(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + + var disposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(disposable); + var collectionObserver = new SelectMany(this, disposable); + disposable.Disposable = nextObservable.Subscribe(collectionObserver); + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + isStopped = true; + if (collectionDisposable.Count == 1) + { + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + else + { + sourceDisposable.Dispose(); + } + } + + class SelectMany : OperatorObserverBase + { + readonly SelectManyOuterObserver parent; + readonly IDisposable cancel; + + public SelectMany(SelectManyOuterObserver parent, IDisposable cancel) + : base(parent.observer, cancel) + { + this.parent = parent; + this.cancel = cancel; + } + + public override void OnNext(TResult value) + { + lock (parent.gate) + { + base.observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + lock (parent.gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + parent.collectionDisposable.Remove(cancel); + if (parent.isStopped && parent.collectionDisposable.Count == 1) + { + lock (parent.gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } + } + + class SelectManyObserverWithIndex : OperatorObserverBase + { + readonly SelectManyObservable parent; + + CompositeDisposable collectionDisposable; + int index = 0; + object gate = new object(); + bool isStopped = false; + SingleAssignmentDisposable sourceDisposable; + + public SelectManyObserverWithIndex(SelectManyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + collectionDisposable = new CompositeDisposable(); + sourceDisposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(sourceDisposable); + + sourceDisposable.Disposable = parent.source.Subscribe(this); + return collectionDisposable; + } + + public override void OnNext(TSource value) + { + IObservable nextObservable; + try + { + nextObservable = parent.selectorWithIndex(value, index++); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + + var disposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(disposable); + var collectionObserver = new SelectMany(this, disposable); + disposable.Disposable = nextObservable.Subscribe(collectionObserver); + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + isStopped = true; + if (collectionDisposable.Count == 1) + { + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + else + { + sourceDisposable.Dispose(); + } + } + + class SelectMany : OperatorObserverBase + { + readonly SelectManyObserverWithIndex parent; + readonly IDisposable cancel; + + public SelectMany(SelectManyObserverWithIndex parent, IDisposable cancel) + : base(parent.observer, cancel) + { + this.parent = parent; + this.cancel = cancel; + } + + public override void OnNext(TResult value) + { + lock (parent.gate) + { + base.observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + lock (parent.gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + parent.collectionDisposable.Remove(cancel); + if (parent.isStopped && parent.collectionDisposable.Count == 1) + { + lock (parent.gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } + } + + class SelectManyEnumerableObserver : OperatorObserverBase + { + readonly SelectManyObservable parent; + + public SelectManyEnumerableObserver(SelectManyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(TSource value) + { + IEnumerable nextEnumerable; + try + { + nextEnumerable = parent.selectorEnumerable(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + + var e = nextEnumerable.GetEnumerator(); + try + { + var hasNext = true; + while (hasNext) + { + hasNext = false; + var current = default(TResult); + + try + { + hasNext = e.MoveNext(); + if (hasNext) + { + current = e.Current; + } + } + catch (Exception exception) + { + try { observer.OnError(exception); } finally { Dispose(); } + return; + } + + if (hasNext) + { + observer.OnNext(current); + } + } + } + finally + { + if (e != null) + { + e.Dispose(); + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class SelectManyEnumerableObserverWithIndex : OperatorObserverBase + { + readonly SelectManyObservable parent; + int index = 0; + + public SelectManyEnumerableObserverWithIndex(SelectManyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(TSource value) + { + IEnumerable nextEnumerable; + try + { + nextEnumerable = parent.selectorEnumerableWithIndex(value, index++); + } + catch (Exception ex) + { + OnError(ex); + return; + } + + var e = nextEnumerable.GetEnumerator(); + try + { + var hasNext = true; + while (hasNext) + { + hasNext = false; + var current = default(TResult); + + try + { + hasNext = e.MoveNext(); + if (hasNext) + { + current = e.Current; + } + } + catch (Exception exception) + { + try { observer.OnError(exception); } finally { Dispose(); } + return; + } + + if (hasNext) + { + observer.OnNext(current); + } + } + } + finally + { + if (e != null) + { + e.Dispose(); + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + // with resultSelector + internal class SelectManyObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func> collectionSelector; + readonly Func> collectionSelectorWithIndex; + readonly Func> collectionSelectorEnumerable; + readonly Func> collectionSelectorEnumerableWithIndex; + readonly Func resultSelector; + readonly Func resultSelectorWithIndex; + + public SelectManyObservable(IObservable source, Func> collectionSelector, Func resultSelector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.collectionSelector = collectionSelector; + this.resultSelector = resultSelector; + } + + public SelectManyObservable(IObservable source, Func> collectionSelector, Func resultSelector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.collectionSelectorWithIndex = collectionSelector; + this.resultSelectorWithIndex = resultSelector; + } + + public SelectManyObservable(IObservable source, Func> collectionSelector, Func resultSelector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.collectionSelectorEnumerable = collectionSelector; + this.resultSelector = resultSelector; + } + + public SelectManyObservable(IObservable source, Func> collectionSelector, Func resultSelector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.collectionSelectorEnumerableWithIndex = collectionSelector; + this.resultSelectorWithIndex = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (collectionSelector != null) + { + return new SelectManyOuterObserver(this, observer, cancel).Run(); + } + else if (collectionSelectorWithIndex != null) + { + return new SelectManyObserverWithIndex(this, observer, cancel).Run(); + } + else if (collectionSelectorEnumerable != null) + { + return new SelectManyEnumerableObserver(this, observer, cancel).Run(); + } + else if (collectionSelectorEnumerableWithIndex != null) + { + return new SelectManyEnumerableObserverWithIndex(this, observer, cancel).Run(); + } + else + { + throw new InvalidOperationException(); + } + } + + class SelectManyOuterObserver : OperatorObserverBase + { + readonly SelectManyObservable parent; + + CompositeDisposable collectionDisposable; + object gate = new object(); + bool isStopped = false; + SingleAssignmentDisposable sourceDisposable; + + public SelectManyOuterObserver(SelectManyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + collectionDisposable = new CompositeDisposable(); + sourceDisposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(sourceDisposable); + + sourceDisposable.Disposable = parent.source.Subscribe(this); + return collectionDisposable; + } + + public override void OnNext(TSource value) + { + IObservable nextObservable; + try + { + nextObservable = parent.collectionSelector(value); + } + catch (Exception ex) + { + OnError(ex); + return; + } + + var disposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(disposable); + var collectionObserver = new SelectMany(this, value, disposable); + disposable.Disposable = nextObservable.Subscribe(collectionObserver); + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + isStopped = true; + if (collectionDisposable.Count == 1) + { + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + else + { + sourceDisposable.Dispose(); + } + } + + class SelectMany : OperatorObserverBase + { + readonly SelectManyOuterObserver parent; + readonly TSource sourceValue; + readonly IDisposable cancel; + + public SelectMany(SelectManyOuterObserver parent, TSource value, IDisposable cancel) + : base(parent.observer, cancel) + { + this.parent = parent; + this.sourceValue = value; + this.cancel = cancel; + } + + public override void OnNext(TCollection value) + { + TResult resultValue; + try + { + resultValue = parent.parent.resultSelector(sourceValue, value); + } + catch (Exception ex) + { + OnError(ex); + return; + } + + lock (parent.gate) + { + base.observer.OnNext(resultValue); + } + } + + public override void OnError(Exception error) + { + lock (parent.gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + parent.collectionDisposable.Remove(cancel); + if (parent.isStopped && parent.collectionDisposable.Count == 1) + { + lock (parent.gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } + } + + class SelectManyObserverWithIndex : OperatorObserverBase + { + readonly SelectManyObservable parent; + + CompositeDisposable collectionDisposable; + object gate = new object(); + bool isStopped = false; + SingleAssignmentDisposable sourceDisposable; + int index = 0; + + public SelectManyObserverWithIndex(SelectManyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + collectionDisposable = new CompositeDisposable(); + sourceDisposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(sourceDisposable); + + sourceDisposable.Disposable = parent.source.Subscribe(this); + return collectionDisposable; + } + + public override void OnNext(TSource value) + { + var i = index++; + IObservable nextObservable; + try + { + nextObservable = parent.collectionSelectorWithIndex(value, i); + } + catch (Exception ex) + { + OnError(ex); + return; + } + + var disposable = new SingleAssignmentDisposable(); + collectionDisposable.Add(disposable); + var collectionObserver = new SelectManyObserver(this, value, i, disposable); + disposable.Disposable = nextObservable.Subscribe(collectionObserver); + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + isStopped = true; + if (collectionDisposable.Count == 1) + { + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + else + { + sourceDisposable.Dispose(); + } + } + + class SelectManyObserver : OperatorObserverBase + { + readonly SelectManyObserverWithIndex parent; + readonly TSource sourceValue; + readonly int sourceIndex; + readonly IDisposable cancel; + int index; + + public SelectManyObserver(SelectManyObserverWithIndex parent, TSource value, int index, IDisposable cancel) + : base(parent.observer, cancel) + { + this.parent = parent; + this.sourceValue = value; + this.sourceIndex = index; + this.cancel = cancel; + } + + public override void OnNext(TCollection value) + { + TResult resultValue; + try + { + resultValue = parent.parent.resultSelectorWithIndex(sourceValue, sourceIndex, value, index++); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + + lock (parent.gate) + { + base.observer.OnNext(resultValue); + } + } + + public override void OnError(Exception error) + { + lock (parent.gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + parent.collectionDisposable.Remove(cancel); + if (parent.isStopped && parent.collectionDisposable.Count == 1) + { + lock (parent.gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } + } + + class SelectManyEnumerableObserver : OperatorObserverBase + { + readonly SelectManyObservable parent; + + public SelectManyEnumerableObserver(SelectManyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(TSource value) + { + IEnumerable nextEnumerable; + try + { + nextEnumerable = parent.collectionSelectorEnumerable(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + + var e = nextEnumerable.GetEnumerator(); + try + { + var hasNext = true; + while (hasNext) + { + hasNext = false; + var current = default(TResult); + + try + { + hasNext = e.MoveNext(); + if (hasNext) + { + current = parent.resultSelector(value, e.Current); + } + } + catch (Exception exception) + { + try { observer.OnError(exception); } finally { Dispose(); } + return; + } + + if (hasNext) + { + observer.OnNext(current); + } + } + } + finally + { + if (e != null) + { + e.Dispose(); + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class SelectManyEnumerableObserverWithIndex : OperatorObserverBase + { + readonly SelectManyObservable parent; + int index = 0; + + public SelectManyEnumerableObserverWithIndex(SelectManyObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(TSource value) + { + var i = index++; + IEnumerable nextEnumerable; + try + { + nextEnumerable = parent.collectionSelectorEnumerableWithIndex(value, i); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); }; + return; + } + + var e = nextEnumerable.GetEnumerator(); + try + { + var sequenceI = 0; + var hasNext = true; + while (hasNext) + { + hasNext = false; + var current = default(TResult); + + try + { + hasNext = e.MoveNext(); + if (hasNext) + { + current = parent.resultSelectorWithIndex(value, i, e.Current, sequenceI++); + } + } + catch (Exception exception) + { + try { observer.OnError(exception); } finally { Dispose(); } + return; + } + + if (hasNext) + { + observer.OnNext(current); + } + } + } + finally + { + if (e != null) + { + e.Dispose(); + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs.meta new file mode 100644 index 00000000..298569f6 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SelectMany.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6496e8557f6066e4380c32935b6f37c3 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs b/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs new file mode 100644 index 00000000..fd768e74 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs @@ -0,0 +1,77 @@ +using System; + +namespace UniRx.Operators +{ + // Optimize for .Select().Where() + + internal class SelectWhereObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func selector; + readonly Func predicate; + + public SelectWhereObservable(IObservable source, Func selector, Func predicate) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.selector = selector; + this.predicate = predicate; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new SelectWhere(this, observer, cancel)); + } + + class SelectWhere : OperatorObserverBase + { + readonly SelectWhereObservable parent; + + public SelectWhere(SelectWhereObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + var v = default(TR); + try + { + v = parent.selector(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + var isPassed = false; + try + { + isPassed = parent.predicate(v); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + if (isPassed) + { + observer.OnNext(v); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs.meta new file mode 100644 index 00000000..5f8a8824 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SelectWhere.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6a7561d10967d6b4d9c2a67ffc3b9d85 +timeCreated: 1468748731 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Single.cs b/Assets/Plugins/UniRx/Scripts/Operators/Single.cs new file mode 100644 index 00000000..a7d828f7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Single.cs @@ -0,0 +1,182 @@ +using System; + +namespace UniRx.Operators +{ + internal class SingleObservable : OperatorObservableBase + { + readonly IObservable source; + readonly bool useDefault; + readonly Func predicate; + + public SingleObservable(IObservable source, bool useDefault) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.useDefault = useDefault; + } + + public SingleObservable(IObservable source, Func predicate, bool useDefault) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicate = predicate; + this.useDefault = useDefault; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (predicate == null) + { + return source.Subscribe(new Single(this, observer, cancel)); + } + else + { + return source.Subscribe(new Single_(this, observer, cancel)); + } + } + + class Single : OperatorObserverBase + { + readonly SingleObservable parent; + bool seenValue; + T lastValue; + + public Single(SingleObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.seenValue = false; + } + + public override void OnNext(T value) + { + if (seenValue) + { + try { observer.OnError(new InvalidOperationException("sequence is not single")); } + finally { Dispose(); } + } + else + { + seenValue = true; + lastValue = value; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (parent.useDefault) + { + if (!seenValue) + { + observer.OnNext(default(T)); + } + else + { + observer.OnNext(lastValue); + } + try { observer.OnCompleted(); } + finally { Dispose(); } + } + else + { + if (!seenValue) + { + try { observer.OnError(new InvalidOperationException("sequence is empty")); } + finally { Dispose(); } + } + else + { + observer.OnNext(lastValue); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + } + + class Single_ : OperatorObserverBase + { + readonly SingleObservable parent; + bool seenValue; + T lastValue; + + public Single_(SingleObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.seenValue = false; + } + + public override void OnNext(T value) + { + bool isPassed; + try + { + isPassed = parent.predicate(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + if (isPassed) + { + if (seenValue) + { + try { observer.OnError(new InvalidOperationException("sequence is not single")); } + finally { Dispose(); } + return; + } + else + { + seenValue = true; + lastValue = value; + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (parent.useDefault) + { + if (!seenValue) + { + observer.OnNext(default(T)); + } + else + { + observer.OnNext(lastValue); + } + try { observer.OnCompleted(); } + finally { Dispose(); } + } + else + { + if (!seenValue) + { + try { observer.OnError(new InvalidOperationException("sequence is empty")); } + finally { Dispose(); } + } + else + { + observer.OnNext(lastValue); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Single.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Single.cs.meta new file mode 100644 index 00000000..4e94dbde --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Single.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9a50aee929f403f4ea076fc11f71fc53 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs b/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs new file mode 100644 index 00000000..39cf4a01 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs @@ -0,0 +1,138 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class SkipObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int count; + readonly TimeSpan duration; + internal readonly IScheduler scheduler; // public for optimization check + + public SkipObservable(IObservable source, int count) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.count = count; + } + + public SkipObservable(IObservable source, TimeSpan duration, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.duration = duration; + this.scheduler = scheduler; + } + + // optimize combiner + + public IObservable Combine(int count) + { + // use sum + // xs = 6 + // xs.Skip(2) = 4 + // xs.Skip(2).Skip(3) = 1 + + return new SkipObservable(source, this.count + count); + } + + public IObservable Combine(TimeSpan duration) + { + // use max + // xs = 6s + // xs.Skip(2s) = 2s + // xs.Skip(2s).Skip(3s) = 3s + + return (duration <= this.duration) + ? this + : new SkipObservable(source, duration, scheduler); + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (scheduler == null) + { + return source.Subscribe(new Skip(this, observer, cancel)); + } + else + { + return new Skip_(this, observer, cancel).Run(); + } + } + + class Skip : OperatorObserverBase + { + int remaining; + + public Skip(SkipObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.remaining = parent.count; + } + + public override void OnNext(T value) + { + if (remaining <= 0) + { + base.observer.OnNext(value); + } + else + { + remaining--; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class Skip_ : OperatorObserverBase + { + readonly SkipObservable parent; + volatile bool open; + + public Skip_(SkipObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var d1 = parent.scheduler.Schedule(parent.duration, Tick); + var d2 = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(d1, d2); + } + + void Tick() + { + open = true; + } + + public override void OnNext(T value) + { + if (open) + { + base.observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs.meta new file mode 100644 index 00000000..235a4c2d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Skip.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1ffcb45c02e14e94bb37c6513b04bb7c +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs b/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs new file mode 100644 index 00000000..21e64844 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs @@ -0,0 +1,119 @@ +using System; + +namespace UniRx.Operators +{ + internal class SkipUntilObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IObservable other; + + public SkipUntilObservable(IObservable source, IObservable other) + : base(source.IsRequiredSubscribeOnCurrentThread() || other.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.other = other; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new SkipUntilOuterObserver(this, observer, cancel).Run(); + } + + class SkipUntilOuterObserver : OperatorObserverBase + { + readonly SkipUntilObservable parent; + + public SkipUntilOuterObserver(SkipUntilObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var sourceSubscription = new SingleAssignmentDisposable(); + var sourceObserver = new SkipUntil(this, sourceSubscription); + + var otherSubscription = new SingleAssignmentDisposable(); + var otherObserver = new SkipUntilOther(this, sourceObserver, otherSubscription); + + sourceSubscription.Disposable = parent.source.Subscribe(sourceObserver); + otherSubscription.Disposable = parent.other.Subscribe(otherObserver); + + return StableCompositeDisposable.Create(otherSubscription, sourceSubscription); + } + + public override void OnNext(T value) + { + } + + public override void OnError(Exception error) + { + } + + public override void OnCompleted() + { + } + + class SkipUntil : IObserver + { + public volatile IObserver observer; + readonly SkipUntilOuterObserver parent; + readonly IDisposable subscription; + + public SkipUntil(SkipUntilOuterObserver parent, IDisposable subscription) + { + this.parent = parent; + observer = UniRx.InternalUtil.EmptyObserver.Instance; + this.subscription = subscription; + } + + public void OnNext(T value) + { + observer.OnNext(value); + } + + public void OnError(Exception error) + { + try { observer.OnError(error); } + finally { parent.Dispose(); } + } + + public void OnCompleted() + { + try { observer.OnCompleted(); } + finally { subscription.Dispose(); } + } + } + + class SkipUntilOther : IObserver + { + readonly SkipUntilOuterObserver parent; + readonly SkipUntil sourceObserver; + readonly IDisposable subscription; + + public SkipUntilOther(SkipUntilOuterObserver parent, SkipUntil sourceObserver, IDisposable subscription) + { + this.parent = parent; + this.sourceObserver = sourceObserver; + this.subscription = subscription; + } + + public void OnNext(TOther value) + { + sourceObserver.observer = parent.observer; + subscription.Dispose(); + } + + public void OnError(Exception error) + { + try { parent.observer.OnError(error); } finally { parent.Dispose(); } + } + + public void OnCompleted() + { + subscription.Dispose(); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs.meta new file mode 100644 index 00000000..963abf3c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SkipUntil.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 52314487e375f3d44a49bc5ceb90adab +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs b/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs new file mode 100644 index 00000000..c68c4e30 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs @@ -0,0 +1,130 @@ +using System; + +namespace UniRx.Operators +{ + internal class SkipWhileObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func predicate; + readonly Func predicateWithIndex; + + public SkipWhileObservable(IObservable source, Func predicate) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicate = predicate; + } + + public SkipWhileObservable(IObservable source, Func predicateWithIndex) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicateWithIndex = predicateWithIndex; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (predicate != null) + { + return new SkipWhile(this, observer, cancel).Run(); + } + else + { + return new SkipWhile_(this, observer, cancel).Run(); + } + } + + class SkipWhile : OperatorObserverBase + { + readonly SkipWhileObservable parent; + bool endSkip = false; + + public SkipWhile(SkipWhileObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + if (!endSkip) + { + try + { + endSkip = !parent.predicate(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + if (!endSkip) return; + } + + observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class SkipWhile_ : OperatorObserverBase + { + readonly SkipWhileObservable parent; + bool endSkip = false; + int index = 0; + + public SkipWhile_(SkipWhileObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + if (!endSkip) + { + try + { + endSkip = !parent.predicateWithIndex(value, index++); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + if (!endSkip) return; + } + + observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs.meta new file mode 100644 index 00000000..eaf6409e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SkipWhile.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4bc7a1e818d05654694d51e883739cca +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Start.cs b/Assets/Plugins/UniRx/Scripts/Operators/Start.cs new file mode 100644 index 00000000..72afaa5f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Start.cs @@ -0,0 +1,101 @@ +using System; + +namespace UniRx.Operators +{ + internal class StartObservable : OperatorObservableBase + { + readonly Action action; + readonly Func function; + readonly IScheduler scheduler; + readonly TimeSpan? startAfter; + + public StartObservable(Func function, TimeSpan? startAfter, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + this.function = function; + this.startAfter = startAfter; + this.scheduler = scheduler; + } + + public StartObservable(Action action, TimeSpan? startAfter, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + this.action = action; + this.startAfter = startAfter; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (startAfter != null) + { + return scheduler.Schedule(startAfter.Value, new StartObserver(this, observer, cancel).Run); + } + else + { + return scheduler.Schedule(new StartObserver(this, observer, cancel).Run); + } + } + + class StartObserver : OperatorObserverBase + { + readonly StartObservable parent; + + public StartObserver(StartObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public void Run() + { + var result = default(T); + try + { + if (parent.function != null) + { + result = parent.function(); + } + else + { + parent.action(); + } + } + catch (Exception exception) + { + try { observer.OnError(exception); } + finally { Dispose(); } + return; + } + + OnNext(result); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Start.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Start.cs.meta new file mode 100644 index 00000000..3efa6986 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Start.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2b99cac67f8c387439619e01a480c465 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs b/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs new file mode 100644 index 00000000..877fad7b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs @@ -0,0 +1,82 @@ +using System; + +namespace UniRx.Operators +{ + internal class StartWithObservable : OperatorObservableBase + { + readonly IObservable source; + readonly T value; + readonly Func valueFactory; + + public StartWithObservable(IObservable source, T value) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.value = value; + } + + public StartWithObservable(IObservable source, Func valueFactory) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.valueFactory = valueFactory; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new StartWith(this, observer, cancel).Run(); + } + + class StartWith : OperatorObserverBase + { + readonly StartWithObservable parent; + + public StartWith(StartWithObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + T t; + if (parent.valueFactory == null) + { + t = parent.value; + } + else + { + try + { + t = parent.valueFactory(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return Disposable.Empty; + } + } + + OnNext(t); + return parent.source.Subscribe(base.observer); // good bye StartWithObserver + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs.meta new file mode 100644 index 00000000..c17e3a9d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/StartWith.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 05df6719453543e458dc3e0d29ac7fa8 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs b/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs new file mode 100644 index 00000000..75025f28 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class SubscribeOnObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IScheduler scheduler; + + public SubscribeOnObservable(IObservable source, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var m = new SingleAssignmentDisposable(); + var d = new SerialDisposable(); + d.Disposable = m; + + m.Disposable = scheduler.Schedule(() => + { + d.Disposable = new ScheduledDisposable(scheduler, source.Subscribe(observer)); + }); + + return d; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs.meta new file mode 100644 index 00000000..f039a2ea --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SubscribeOn.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bff34f363b1797c4396815b5b3a4be1c +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs b/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs new file mode 100644 index 00000000..6e0d22b5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + internal class SwitchObservable : OperatorObservableBase + { + readonly IObservable> sources; + + public SwitchObservable(IObservable> sources) + : base(true) + { + this.sources = sources; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new SwitchObserver(this, observer, cancel).Run(); + } + + class SwitchObserver : OperatorObserverBase, T> + { + readonly SwitchObservable parent; + + readonly object gate = new object(); + readonly SerialDisposable innerSubscription = new SerialDisposable(); + bool isStopped = false; + ulong latest = 0UL; + bool hasLatest = false; + + public SwitchObserver(SwitchObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var subscription = parent.sources.Subscribe(this); + return StableCompositeDisposable.Create(subscription, innerSubscription); + } + + public override void OnNext(IObservable value) + { + var id = default(ulong); + lock (gate) + { + id = unchecked(++latest); + hasLatest = true; + } + + var d = new SingleAssignmentDisposable(); + innerSubscription.Disposable = d; + d.Disposable = value.Subscribe(new Switch(this, id)); + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + } + + public override void OnCompleted() + { + lock (gate) + { + isStopped = true; + if (!hasLatest) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + class Switch : IObserver + { + readonly SwitchObserver parent; + readonly ulong id; + + public Switch(SwitchObserver observer, ulong id) + { + this.parent = observer; + this.id = id; + } + + public void OnNext(T value) + { + lock (parent.gate) + { + if (parent.latest == id) + { + parent.observer.OnNext(value); + } + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + if (parent.latest == id) + { + parent.observer.OnError(error); + } + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + if (parent.latest == id) + { + parent.hasLatest = false; + if (parent.isStopped) + { + parent.observer.OnCompleted(); + } + } + } + } + } + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs.meta new file mode 100644 index 00000000..fe3ef6b3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Switch.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5e16cdc638ec3bf41bbd380b75991734 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs b/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs new file mode 100644 index 00000000..f39e0ddd --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs @@ -0,0 +1,57 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class SynchronizeObservable : OperatorObservableBase + { + readonly IObservable source; + readonly object gate; + + public SynchronizeObservable(IObservable source, object gate) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.gate = gate; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new Synchronize(this, observer, cancel)); + } + + class Synchronize : OperatorObserverBase + { + readonly SynchronizeObservable parent; + + public Synchronize(SynchronizeObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + lock (parent.gate) + { + base.observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + lock (parent.gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + lock (parent.gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs.meta new file mode 100644 index 00000000..73cd1e55 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Synchronize.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 31ddcb8477b384b4c9867568f6dc8359 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs b/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs new file mode 100644 index 00000000..6bf8d2e4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs @@ -0,0 +1,40 @@ +using System; + +namespace UniRx.Operators +{ + internal class SynchronizedObserver : IObserver + { + readonly IObserver observer; + readonly object gate; + + public SynchronizedObserver(IObserver observer, object gate) + { + this.observer = observer; + this.gate = gate; + } + + public void OnNext(T value) + { + lock (gate) + { + observer.OnNext(value); + } + } + + public void OnError(Exception error) + { + lock (gate) + { + observer.OnError(error); + } + } + + public void OnCompleted() + { + lock (gate) + { + observer.OnCompleted(); + } + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs.meta new file mode 100644 index 00000000..26e7ec0a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/SynchronizedObserver.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4fd465af6ee05a64f9115b45b58360b7 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Take.cs b/Assets/Plugins/UniRx/Scripts/Operators/Take.cs new file mode 100644 index 00000000..34308882 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Take.cs @@ -0,0 +1,150 @@ +using System; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class TakeObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int count; + readonly TimeSpan duration; + internal readonly IScheduler scheduler; // public for optimization check + + public TakeObservable(IObservable source, int count) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.count = count; + } + + public TakeObservable(IObservable source, TimeSpan duration, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.duration = duration; + this.scheduler = scheduler; + } + + // optimize combiner + + public IObservable Combine(int count) + { + // xs = 6 + // xs.Take(5) = 5 | xs.Take(3) = 3 + // xs.Take(5).Take(3) = 3 | xs.Take(3).Take(5) = 3 + + // use minimum one + return (this.count <= count) + ? this + : new TakeObservable(source, count); + } + + public IObservable Combine(TimeSpan duration) + { + // xs = 6s + // xs.Take(5s) = 5s | xs.Take(3s) = 3s + // xs.Take(5s).Take(3s) = 3s | xs.Take(3s).Take(5s) = 3s + + // use minimum one + return (this.duration <= duration) + ? this + : new TakeObservable(source, duration, scheduler); + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (scheduler == null) + { + return source.Subscribe(new Take(this, observer, cancel)); + } + else + { + return new Take_(this, observer, cancel).Run(); + } + } + + class Take : OperatorObserverBase + { + int rest; + + public Take(TakeObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.rest = parent.count; + } + + public override void OnNext(T value) + { + if (rest > 0) + { + rest -= 1; + base.observer.OnNext(value); + if (rest == 0) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class Take_ : OperatorObserverBase + { + readonly TakeObservable parent; + readonly object gate = new object(); + + public Take_(TakeObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var d1 = parent.scheduler.Schedule(parent.duration, Tick); + var d2 = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(d1, d2); + } + + void Tick() + { + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + + public override void OnNext(T value) + { + lock (gate) + { + base.observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + } + + public override void OnCompleted() + { + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Take.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Take.cs.meta new file mode 100644 index 00000000..a887e335 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Take.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5275fc8bb6611984781d8ccd56b9b572 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs b/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs new file mode 100644 index 00000000..95009a78 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using UniRx.Operators; + +namespace UniRx.Operators +{ + internal class TakeLastObservable : OperatorObservableBase + { + readonly IObservable source; + + // count + readonly int count; + + // duration + readonly TimeSpan duration; + readonly IScheduler scheduler; + + public TakeLastObservable(IObservable source, int count) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.count = count; + } + + public TakeLastObservable(IObservable source, TimeSpan duration, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.duration = duration; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (scheduler == null) + { + return new TakeLast(this, observer, cancel).Run(); + } + else + { + return new TakeLast_(this, observer, cancel).Run(); + } + } + + // count + class TakeLast : OperatorObserverBase + { + readonly TakeLastObservable parent; + readonly Queue q; + + public TakeLast(TakeLastObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.q = new Queue(); + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + q.Enqueue(value); + if (q.Count > parent.count) + { + q.Dequeue(); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + foreach (var item in q) + { + observer.OnNext(item); + } + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + // time + class TakeLast_ : OperatorObserverBase + { + DateTimeOffset startTime; + readonly TakeLastObservable parent; + readonly Queue> q; + + public TakeLast_(TakeLastObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.q = new Queue>(); + } + + public IDisposable Run() + { + startTime = parent.scheduler.Now; + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + var now = parent.scheduler.Now; + var elapsed = now - startTime; + q.Enqueue(new TimeInterval(value, elapsed)); + Trim(elapsed); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); }; + } + + public override void OnCompleted() + { + var now = parent.scheduler.Now; + var elapsed = now - startTime; + Trim(elapsed); + + foreach (var item in q) + { + observer.OnNext(item.Value); + } + try { observer.OnCompleted(); } finally { Dispose(); }; + } + + void Trim(TimeSpan now) + { + while (q.Count > 0 && now - q.Peek().Interval >= parent.duration) + { + q.Dequeue(); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs.meta new file mode 100644 index 00000000..50d31bbc --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeLast.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8ea2ac59577a3214f9fb66ccc62f2ffd +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs b/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs new file mode 100644 index 00000000..dab95d09 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs @@ -0,0 +1,128 @@ +using System; + +namespace UniRx.Operators +{ + internal class TakeUntilObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IObservable other; + + public TakeUntilObservable(IObservable source, IObservable other) + : base(source.IsRequiredSubscribeOnCurrentThread() || other.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.other = other; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new TakeUntil(this, observer, cancel).Run(); + } + + class TakeUntil : OperatorObserverBase + { + readonly TakeUntilObservable parent; + object gate = new object(); + + public TakeUntil(TakeUntilObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var otherSubscription = new SingleAssignmentDisposable(); + var otherObserver = new TakeUntilOther(this, otherSubscription); + otherSubscription.Disposable = parent.other.Subscribe(otherObserver); + + var sourceSubscription = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(otherSubscription, sourceSubscription); + } + + public override void OnNext(T value) + { + lock (gate) + { + observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class TakeUntilOther : IObserver + { + readonly TakeUntil sourceObserver; + readonly IDisposable subscription; + + public TakeUntilOther(TakeUntil sourceObserver, IDisposable subscription) + { + this.sourceObserver = sourceObserver; + this.subscription = subscription; + } + + public void OnNext(TOther value) + { + lock (sourceObserver.gate) + { + try + { + sourceObserver.observer.OnCompleted(); + } + finally + { + sourceObserver.Dispose(); + subscription.Dispose(); + } + } + } + + public void OnError(Exception error) + { + lock (sourceObserver.gate) + { + try + { + sourceObserver.observer.OnError(error); + } + finally + { + sourceObserver.Dispose(); + subscription.Dispose(); + } + } + } + + public void OnCompleted() + { + lock (sourceObserver.gate) + { + try + { + sourceObserver.observer.OnCompleted(); + } + finally + { + sourceObserver.Dispose(); + subscription.Dispose(); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs.meta new file mode 100644 index 00000000..eb6f28f2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeUntil.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 163e3eab299b735418c94e634fecd811 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs b/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs new file mode 100644 index 00000000..99b4de47 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs @@ -0,0 +1,134 @@ +using System; + +namespace UniRx.Operators +{ + internal class TakeWhileObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func predicate; + readonly Func predicateWithIndex; + + public TakeWhileObservable(IObservable source, Func predicate) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicate = predicate; + } + + public TakeWhileObservable(IObservable source, Func predicateWithIndex) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicateWithIndex = predicateWithIndex; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (predicate != null) + { + return new TakeWhile(this, observer, cancel).Run(); + } + else + { + return new TakeWhile_(this, observer, cancel).Run(); + } + } + + class TakeWhile : OperatorObserverBase + { + readonly TakeWhileObservable parent; + + public TakeWhile(TakeWhileObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + bool isPassed; + try + { + isPassed = parent.predicate(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + if (isPassed) + { + observer.OnNext(value); + } + else + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class TakeWhile_ : OperatorObserverBase + { + readonly TakeWhileObservable parent; + int index = 0; + + public TakeWhile_(TakeWhileObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + return parent.source.Subscribe(this); + } + + public override void OnNext(T value) + { + bool isPassed; + try + { + isPassed = parent.predicateWithIndex(value, index++); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + if (isPassed) + { + observer.OnNext(value); + } + else + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs.meta new file mode 100644 index 00000000..51f71976 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/TakeWhile.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d6f2da76023d9734ebb4ed1883fda2bc +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs b/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs new file mode 100644 index 00000000..23a1c39b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + internal class ThrottleObservable : OperatorObservableBase + { + readonly IObservable source; + readonly TimeSpan dueTime; + readonly IScheduler scheduler; + + public ThrottleObservable(IObservable source, TimeSpan dueTime, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.dueTime = dueTime; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Throttle(this, observer, cancel).Run(); + } + + class Throttle : OperatorObserverBase + { + readonly ThrottleObservable parent; + readonly object gate = new object(); + T latestValue = default(T); + bool hasValue = false; + SerialDisposable cancelable; + ulong id = 0; + + public Throttle(ThrottleObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + cancelable = new SerialDisposable(); + var subscription = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(cancelable, subscription); + } + + void OnNext(ulong currentid) + { + lock (gate) + { + if (hasValue && id == currentid) + { + observer.OnNext(latestValue); + } + hasValue = false; + } + } + + public override void OnNext(T value) + { + ulong currentid; + lock (gate) + { + hasValue = true; + latestValue = value; + id = unchecked(id + 1); + currentid = id; + } + + var d = new SingleAssignmentDisposable(); + cancelable.Disposable = d; + d.Disposable = parent.scheduler.Schedule(parent.dueTime, () => OnNext(currentid)); + } + + public override void OnError(Exception error) + { + cancelable.Dispose(); + + lock (gate) + { + hasValue = false; + id = unchecked(id + 1); + try { observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + cancelable.Dispose(); + + lock (gate) + { + if (hasValue) + { + observer.OnNext(latestValue); + } + hasValue = false; + id = unchecked(id + 1); + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs.meta new file mode 100644 index 00000000..379ddf3b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Throttle.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dc296a61927394b4b908b385087f23d0 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs b/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs new file mode 100644 index 00000000..e3a36dfb --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs @@ -0,0 +1,87 @@ +using System; + +namespace UniRx.Operators +{ + internal class ThrottleFirstObservable : OperatorObservableBase + { + readonly IObservable source; + readonly TimeSpan dueTime; + readonly IScheduler scheduler; + + public ThrottleFirstObservable(IObservable source, TimeSpan dueTime, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.dueTime = dueTime; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ThrottleFirst(this, observer, cancel).Run(); + } + + class ThrottleFirst : OperatorObserverBase + { + readonly ThrottleFirstObservable parent; + readonly object gate = new object(); + bool open = true; + SerialDisposable cancelable; + + public ThrottleFirst(ThrottleFirstObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + cancelable = new SerialDisposable(); + var subscription = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(cancelable, subscription); + } + + void OnNext() + { + lock (gate) + { + open = true; + } + } + + public override void OnNext(T value) + { + lock (gate) + { + if (!open) return; + observer.OnNext(value); + open = false; + } + + var d = new SingleAssignmentDisposable(); + cancelable.Disposable = d; + d.Disposable = parent.scheduler.Schedule(parent.dueTime, OnNext); + } + + public override void OnError(Exception error) + { + cancelable.Dispose(); + + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + cancelable.Dispose(); + + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs.meta new file mode 100644 index 00000000..ba66ab06 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ThrottleFirst.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 32b6a6efbab897b41a055d830a4d9755 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs b/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs new file mode 100644 index 00000000..ba618c8e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs @@ -0,0 +1,69 @@ +using System; + +namespace UniRx.Operators +{ + internal class ThrowObservable : OperatorObservableBase + { + readonly Exception error; + readonly IScheduler scheduler; + + public ThrowObservable(Exception error, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + this.error = error; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + observer = new Throw(observer, cancel); + + if (scheduler == Scheduler.Immediate) + { + observer.OnError(error); + return Disposable.Empty; + } + else + { + return scheduler.Schedule(() => + { + observer.OnError(error); + observer.OnCompleted(); + }); + } + } + + class Throw : OperatorObserverBase + { + public Throw(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs.meta new file mode 100644 index 00000000..6c275d51 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Throw.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1e5623719e9b1f1418aa67a63abed4cc +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs b/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs new file mode 100644 index 00000000..e28d6722 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs @@ -0,0 +1,56 @@ +using System; + +namespace UniRx.Operators +{ + internal class TimeIntervalObservable : OperatorObservableBase> + { + readonly IObservable source; + readonly IScheduler scheduler; + + public TimeIntervalObservable(IObservable source, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return source.Subscribe(new TimeInterval(this, observer, cancel)); + } + + class TimeInterval : OperatorObserverBase> + { + readonly TimeIntervalObservable parent; + DateTimeOffset lastTime; + + public TimeInterval(TimeIntervalObservable parent, IObserver> observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + this.lastTime = parent.scheduler.Now; + } + + public override void OnNext(T value) + { + var now = parent.scheduler.Now; + var span = now.Subtract(lastTime); + lastTime = now; + + base.observer.OnNext(new UniRx.TimeInterval(value, span)); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs.meta new file mode 100644 index 00000000..035d7531 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/TimeInterval.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 065e40ebd4bd4a848b58a7a90dac881d +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs b/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs new file mode 100644 index 00000000..541dd740 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs @@ -0,0 +1,198 @@ +using System; + +namespace UniRx.Operators +{ + internal class TimeoutObservable : OperatorObservableBase + { + readonly IObservable source; + readonly TimeSpan? dueTime; + readonly DateTimeOffset? dueTimeDT; + readonly IScheduler scheduler; + + public TimeoutObservable(IObservable source, TimeSpan dueTime, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.dueTime = dueTime; + this.scheduler = scheduler; + } + + public TimeoutObservable(IObservable source, DateTimeOffset dueTime, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.dueTimeDT = dueTime; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (dueTime != null) + { + return new Timeout(this, observer, cancel).Run(); + } + else + { + return new Timeout_(this, observer, cancel).Run(); + } + } + + class Timeout : OperatorObserverBase + { + readonly TimeoutObservable parent; + readonly object gate = new object(); + ulong objectId = 0ul; + bool isTimeout = false; + SingleAssignmentDisposable sourceSubscription; + SerialDisposable timerSubscription; + + public Timeout(TimeoutObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + sourceSubscription = new SingleAssignmentDisposable(); + timerSubscription = new SerialDisposable(); + timerSubscription.Disposable = RunTimer(objectId); + sourceSubscription.Disposable = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(timerSubscription, sourceSubscription); + } + + IDisposable RunTimer(ulong timerId) + { + return parent.scheduler.Schedule(parent.dueTime.Value, () => + { + lock (gate) + { + if (objectId == timerId) + { + isTimeout = true; + } + } + if (isTimeout) + { + try { observer.OnError(new TimeoutException()); } finally { Dispose(); } + } + }); + } + + public override void OnNext(T value) + { + ulong useObjectId; + bool timeout; + lock (gate) + { + timeout = isTimeout; + objectId++; + useObjectId = objectId; + } + if (timeout) return; + + timerSubscription.Disposable = Disposable.Empty; // cancel old timer + observer.OnNext(value); + timerSubscription.Disposable = RunTimer(useObjectId); + } + + public override void OnError(Exception error) + { + bool timeout; + lock (gate) + { + timeout = isTimeout; + objectId++; + } + if (timeout) return; + + timerSubscription.Dispose(); + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + bool timeout; + lock (gate) + { + timeout = isTimeout; + objectId++; + } + if (timeout) return; + + timerSubscription.Dispose(); + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class Timeout_ : OperatorObserverBase + { + readonly TimeoutObservable parent; + readonly object gate = new object(); + bool isFinished = false; + SingleAssignmentDisposable sourceSubscription; + IDisposable timerSubscription; + + public Timeout_(TimeoutObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + sourceSubscription = new SingleAssignmentDisposable(); + + timerSubscription = parent.scheduler.Schedule(parent.dueTimeDT.Value, OnNext); + sourceSubscription.Disposable = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(timerSubscription, sourceSubscription); + } + + // in timer + void OnNext() + { + lock (gate) + { + if (isFinished) return; + isFinished = true; + } + + sourceSubscription.Dispose(); + try { observer.OnError(new TimeoutException()); } finally { Dispose(); } + } + + public override void OnNext(T value) + { + lock (gate) + { + if (!isFinished) observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + lock (gate) + { + if (isFinished) return; + isFinished = true; + timerSubscription.Dispose(); + } + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + + lock (gate) + { + if (!isFinished) + { + isFinished = true; + timerSubscription.Dispose(); + } + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs.meta new file mode 100644 index 00000000..4ec24d2d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a22cd4a86f62fc64384dddb043530703 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs b/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs new file mode 100644 index 00000000..b2f1f1a1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs @@ -0,0 +1,124 @@ +using System; + +namespace UniRx.Operators +{ + internal class TimerObservable : OperatorObservableBase + { + readonly DateTimeOffset? dueTimeA; + readonly TimeSpan? dueTimeB; + readonly TimeSpan? period; + readonly IScheduler scheduler; + + public TimerObservable(DateTimeOffset dueTime, TimeSpan? period, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + this.dueTimeA = dueTime; + this.period = period; + this.scheduler = scheduler; + } + + public TimerObservable(TimeSpan dueTime, TimeSpan? period, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + this.dueTimeB = dueTime; + this.period = period; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var timerObserver = new Timer(observer, cancel); + + var dueTime = (dueTimeA != null) + ? dueTimeA.Value - scheduler.Now + : dueTimeB.Value; + + // one-shot + if (period == null) + { + return scheduler.Schedule(Scheduler.Normalize(dueTime), () => + { + timerObserver.OnNext(); + timerObserver.OnCompleted(); + }); + } + else + { + var periodicScheduler = scheduler as ISchedulerPeriodic; + if (periodicScheduler != null) + { + if (dueTime == period.Value) + { + // same(Observable.Interval), run periodic + return periodicScheduler.SchedulePeriodic(Scheduler.Normalize(dueTime), timerObserver.OnNext); + } + else + { + // Schedule Once + Scheudle Periodic + var disposable = new SerialDisposable(); + + disposable.Disposable = scheduler.Schedule(Scheduler.Normalize(dueTime), () => + { + timerObserver.OnNext(); // run first + + var timeP = Scheduler.Normalize(period.Value); + disposable.Disposable = periodicScheduler.SchedulePeriodic(timeP, timerObserver.OnNext); // run periodic + }); + + return disposable; + } + } + else + { + var timeP = Scheduler.Normalize(period.Value); + + return scheduler.Schedule(Scheduler.Normalize(dueTime), self => + { + timerObserver.OnNext(); + self(timeP); + }); + } + } + } + + class Timer : OperatorObserverBase + { + long index = 0; + + public Timer(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public void OnNext() + { + try + { + base.observer.OnNext(index++); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnNext(long value) + { + // no use. + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs.meta new file mode 100644 index 00000000..f9ebcc07 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6be220be1da39e14ea87b366c149953e +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs b/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs new file mode 100644 index 00000000..c81ce1aa --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs @@ -0,0 +1,50 @@ +using System; + +namespace UniRx.Operators +{ + internal class TimestampObservable : OperatorObservableBase> + { + readonly IObservable source; + readonly IScheduler scheduler; + + public TimestampObservable(IObservable source, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread || source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return source.Subscribe(new Timestamp(this, observer, cancel)); + } + + class Timestamp : OperatorObserverBase> + { + readonly TimestampObservable parent; + + public Timestamp(TimestampObservable parent, IObserver> observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + base.observer.OnNext(new Timestamped(value, parent.scheduler.Now)); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs.meta new file mode 100644 index 00000000..dac70a00 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Timestamp.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d9ec806fec477b243a812e7f609a4453 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs b/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs new file mode 100644 index 00000000..6f926978 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class ToArrayObservable : OperatorObservableBase + { + readonly IObservable source; + + public ToArrayObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new ToArray(observer, cancel)); + } + + class ToArray : OperatorObserverBase + { + readonly List list = new List(); + + public ToArray(IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(TSource value) + { + try + { + list.Add(value); // sometimes cause error on multithread + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + TSource[] result; + try + { + result = list.ToArray(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + base.observer.OnNext(result); + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs.meta new file mode 100644 index 00000000..0c1405d3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToArray.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 38d1f7c869353b542af469b0e3fae89a +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs b/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs new file mode 100644 index 00000000..df0bbd9c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class ToListObservable : OperatorObservableBase> + { + readonly IObservable source; + + public ToListObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return source.Subscribe(new ToList(observer, cancel)); + } + + class ToList : OperatorObserverBase> + { + readonly List list = new List(); + + public ToList(IObserver> observer, IDisposable cancel) + : base(observer, cancel) + { + } + + public override void OnNext(TSource value) + { + try + { + list.Add(value); // sometimes cause error on multithread + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + base.observer.OnNext(list); + try { observer.OnCompleted(); } finally { Dispose(); }; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs.meta new file mode 100644 index 00000000..82903659 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToList.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cee1b9300a644c9458346c1f80f64197 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs b/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs new file mode 100644 index 00000000..6adaecd9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class ToObservableObservable : OperatorObservableBase + { + readonly IEnumerable source; + readonly IScheduler scheduler; + + public ToObservableObservable(IEnumerable source, IScheduler scheduler) + : base(scheduler == Scheduler.CurrentThread) + { + this.source = source; + this.scheduler = scheduler; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ToObservable(this, observer, cancel).Run(); + } + + class ToObservable : OperatorObserverBase + { + readonly ToObservableObservable parent; + + public ToObservable(ToObservableObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var e = default(IEnumerator); + try + { + e = parent.source.GetEnumerator(); + } + catch (Exception exception) + { + OnError(exception); + return Disposable.Empty; + } + + if (parent.scheduler == Scheduler.Immediate) + { + while (true) + { + bool hasNext; + var current = default(T); + try + { + hasNext = e.MoveNext(); + if (hasNext) current = e.Current; + } + catch (Exception ex) + { + e.Dispose(); + try { observer.OnError(ex); } + finally { Dispose(); } + break; + } + + if (hasNext) + { + observer.OnNext(current); + } + else + { + e.Dispose(); + try { observer.OnCompleted(); } + finally { Dispose(); } + break; + } + } + + return Disposable.Empty; + } + + var flag = new SingleAssignmentDisposable(); + flag.Disposable = parent.scheduler.Schedule(self => + { + if (flag.IsDisposed) + { + e.Dispose(); + return; + } + + bool hasNext; + var current = default(T); + try + { + hasNext = e.MoveNext(); + if (hasNext) current = e.Current; + } + catch (Exception ex) + { + e.Dispose(); + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + if (hasNext) + { + observer.OnNext(current); + self(); + } + else + { + e.Dispose(); + try { observer.OnCompleted(); } + finally { Dispose(); } + } + }); + + return flag; + } + + public override void OnNext(T value) + { + // do nothing + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs.meta new file mode 100644 index 00000000..78a4d0cd --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ToObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7cd3ae084c8ca754f9aceca2e18c3af9 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs b/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs new file mode 100644 index 00000000..abf77f7f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs @@ -0,0 +1,63 @@ +using System; +using UniRx.InternalUtil; + +namespace UniRx.Operators +{ + internal class Wait : IObserver + { + static readonly TimeSpan InfiniteTimeSpan = new TimeSpan(0, 0, 0, 0, -1); // from .NET 4.5 + + readonly IObservable source; + readonly TimeSpan timeout; + + System.Threading.ManualResetEvent semaphore; + + bool seenValue = false; + T value = default(T); + Exception ex = default(Exception); + + public Wait(IObservable source, TimeSpan timeout) + { + this.source = source; + this.timeout = timeout; + } + + public T Run() + { + semaphore = new System.Threading.ManualResetEvent(false); + using (source.Subscribe(this)) + { + var waitComplete = (timeout == InfiniteTimeSpan) + ? semaphore.WaitOne() + : semaphore.WaitOne(timeout); + + if (!waitComplete) + { + throw new TimeoutException("OnCompleted not fired."); + } + } + + if (ex != null) ex.Throw(); + if (!seenValue) throw new InvalidOperationException("No Elements."); + + return value; + } + + public void OnNext(T value) + { + seenValue = true; + this.value = value; + } + + public void OnError(Exception error) + { + this.ex = error; + semaphore.Set(); + } + + public void OnCompleted() + { + semaphore.Set(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs.meta new file mode 100644 index 00000000..e3979a3c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Wait.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ea55c5647aa075b4f894dd37abf5e469 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs b/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs new file mode 100644 index 00000000..88bcccc5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs @@ -0,0 +1,485 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class WhenAllObservable : OperatorObservableBase + { + readonly IObservable[] sources; + readonly IEnumerable> sourcesEnumerable; + + public WhenAllObservable(IObservable[] sources) + : base(false) + { + this.sources = sources; + } + + public WhenAllObservable(IEnumerable> sources) + : base(false) + { + this.sourcesEnumerable = sources; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (sources != null) + { + return new WhenAll(this.sources, observer, cancel).Run(); + } + else + { + var xs = sourcesEnumerable as IList>; + if (xs == null) + { + xs = new List>(sourcesEnumerable); // materialize observables + } + return new WhenAll_(xs, observer, cancel).Run(); + } + } + + class WhenAll : OperatorObserverBase + { + readonly IObservable[] sources; + readonly object gate = new object(); + int completedCount; + int length; + T[] values; + + public WhenAll(IObservable[] sources, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.sources = sources; + } + + public IDisposable Run() + { + length = sources.Length; + + // fail safe... + if (length == 0) + { + OnNext(new T[0]); + try { observer.OnCompleted(); } finally { Dispose(); } + return Disposable.Empty; + } + + completedCount = 0; + values = new T[length]; + + var subscriptions = new IDisposable[length]; + for (int index = 0; index < length; index++) + { + var source = sources[index]; + var observer = new WhenAllCollectionObserver(this, index); + subscriptions[index] = source.Subscribe(observer); + } + + return StableCompositeDisposable.CreateUnsafe(subscriptions); + } + + public override void OnNext(T[] value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + + class WhenAllCollectionObserver : IObserver + { + readonly WhenAll parent; + readonly int index; + bool isCompleted = false; + + public WhenAllCollectionObserver(WhenAll parent, int index) + { + this.parent = parent; + this.index = index; + } + + public void OnNext(T value) + { + lock (parent.gate) + { + if (!isCompleted) + { + parent.values[index] = value; + } + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + if (!isCompleted) + { + parent.OnError(error); + } + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + if (!isCompleted) + { + isCompleted = true; + parent.completedCount++; + if (parent.completedCount == parent.length) + { + parent.OnNext(parent.values); + parent.OnCompleted(); + } + } + } + } + } + } + + class WhenAll_ : OperatorObserverBase + { + readonly IList> sources; + readonly object gate = new object(); + int completedCount; + int length; + T[] values; + + public WhenAll_(IList> sources, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.sources = sources; + } + + public IDisposable Run() + { + length = sources.Count; + + // fail safe... + if (length == 0) + { + OnNext(new T[0]); + try { observer.OnCompleted(); } finally { Dispose(); } + return Disposable.Empty; + } + + completedCount = 0; + values = new T[length]; + + var subscriptions = new IDisposable[length]; + for (int index = 0; index < length; index++) + { + var source = sources[index]; + var observer = new WhenAllCollectionObserver(this, index); + subscriptions[index] = source.Subscribe(observer); + } + + return StableCompositeDisposable.CreateUnsafe(subscriptions); + } + + public override void OnNext(T[] value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + + class WhenAllCollectionObserver : IObserver + { + readonly WhenAll_ parent; + readonly int index; + bool isCompleted = false; + + public WhenAllCollectionObserver(WhenAll_ parent, int index) + { + this.parent = parent; + this.index = index; + } + + public void OnNext(T value) + { + lock (parent.gate) + { + if (!isCompleted) + { + parent.values[index] = value; + } + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + if (!isCompleted) + { + parent.OnError(error); + } + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + if (!isCompleted) + { + isCompleted = true; + parent.completedCount++; + if (parent.completedCount == parent.length) + { + parent.OnNext(parent.values); + parent.OnCompleted(); + } + } + } + } + } + } + } + + internal class WhenAllObservable : OperatorObservableBase + { + readonly IObservable[] sources; + readonly IEnumerable> sourcesEnumerable; + + public WhenAllObservable(IObservable[] sources) + : base(false) + { + this.sources = sources; + } + + public WhenAllObservable(IEnumerable> sources) + : base(false) + { + this.sourcesEnumerable = sources; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (sources != null) + { + return new WhenAll(this.sources, observer, cancel).Run(); + } + else + { + var xs = sourcesEnumerable as IList>; + if (xs == null) + { + xs = new List>(sourcesEnumerable); // materialize observables + } + return new WhenAll_(xs, observer, cancel).Run(); + } + } + + class WhenAll : OperatorObserverBase + { + readonly IObservable[] sources; + readonly object gate = new object(); + int completedCount; + int length; + + public WhenAll(IObservable[] sources, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.sources = sources; + } + + public IDisposable Run() + { + length = sources.Length; + + // fail safe... + if (length == 0) + { + OnNext(Unit.Default); + try { observer.OnCompleted(); } finally { Dispose(); } + return Disposable.Empty; + } + + completedCount = 0; + + var subscriptions = new IDisposable[length]; + for (int index = 0; index < sources.Length; index++) + { + var source = sources[index]; + var observer = new WhenAllCollectionObserver(this); + subscriptions[index] = source.Subscribe(observer); + } + + return StableCompositeDisposable.CreateUnsafe(subscriptions); + } + + public override void OnNext(Unit value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + + class WhenAllCollectionObserver : IObserver + { + readonly WhenAll parent; + bool isCompleted = false; + + public WhenAllCollectionObserver(WhenAll parent) + { + this.parent = parent; + } + + public void OnNext(Unit value) + { + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + if (!isCompleted) + { + parent.OnError(error); + } + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + if (!isCompleted) + { + isCompleted = true; + parent.completedCount++; + if (parent.completedCount == parent.length) + { + parent.OnNext(Unit.Default); + parent.OnCompleted(); + } + } + } + } + } + } + + class WhenAll_ : OperatorObserverBase + { + readonly IList> sources; + readonly object gate = new object(); + int completedCount; + int length; + + public WhenAll_(IList> sources, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.sources = sources; + } + + public IDisposable Run() + { + length = sources.Count; + + // fail safe... + if (length == 0) + { + OnNext(Unit.Default); + try { observer.OnCompleted(); } finally { Dispose(); } + return Disposable.Empty; + } + + completedCount = 0; + + var subscriptions = new IDisposable[length]; + for (int index = 0; index < length; index++) + { + var source = sources[index]; + var observer = new WhenAllCollectionObserver(this); + subscriptions[index] = source.Subscribe(observer); + } + + return StableCompositeDisposable.CreateUnsafe(subscriptions); + } + + public override void OnNext(Unit value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + + class WhenAllCollectionObserver : IObserver + { + readonly WhenAll_ parent; + bool isCompleted = false; + + public WhenAllCollectionObserver(WhenAll_ parent) + { + this.parent = parent; + } + + public void OnNext(Unit value) + { + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + if (!isCompleted) + { + parent.OnError(error); + } + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + if (!isCompleted) + { + isCompleted = true; + parent.completedCount++; + if (parent.completedCount == parent.length) + { + parent.OnNext(Unit.Default); + parent.OnCompleted(); + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs.meta new file mode 100644 index 00000000..f5e559a5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/WhenAll.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0af8ada83db8f8a408ee6e9aa994fbbd +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Where.cs b/Assets/Plugins/UniRx/Scripts/Operators/Where.cs new file mode 100644 index 00000000..9faf62d6 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Where.cs @@ -0,0 +1,147 @@ +using System; + +namespace UniRx.Operators +{ + internal class WhereObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func predicate; + readonly Func predicateWithIndex; + + public WhereObservable(IObservable source, Func predicate) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicate = predicate; + } + + public WhereObservable(IObservable source, Func predicateWithIndex) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicateWithIndex = predicateWithIndex; + } + + // Optimize for .Where().Where() + + public IObservable CombinePredicate(Func combinePredicate) + { + if (this.predicate != null) + { + return new WhereObservable(source, x => this.predicate(x) && combinePredicate(x)); + } + else + { + return new WhereObservable(this, combinePredicate); + } + } + + // Optimize for .Where().Select() + + public IObservable CombineSelector(Func selector) + { + if (this.predicate != null) + { + return new WhereSelectObservable(source, predicate, selector); + } + else + { + return new SelectObservable(this, selector); // can't combine + } + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + if (predicate != null) + { + return source.Subscribe(new Where(this, observer, cancel)); + } + else + { + return source.Subscribe(new Where_(this, observer, cancel)); + } + } + + class Where : OperatorObserverBase + { + readonly WhereObservable parent; + + public Where(WhereObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + var isPassed = false; + try + { + isPassed = parent.predicate(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + if (isPassed) + { + observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class Where_ : OperatorObserverBase + { + readonly WhereObservable parent; + int index; + + public Where_(WhereObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + this.index = 0; + } + + public override void OnNext(T value) + { + var isPassed = false; + try + { + isPassed = parent.predicateWithIndex(value, index++); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + if (isPassed) + { + observer.OnNext(value); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Where.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Where.cs.meta new file mode 100644 index 00000000..9e53076b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Where.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a035699dbe9572548afa47c460bad078 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs b/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs new file mode 100644 index 00000000..72493ff7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs @@ -0,0 +1,77 @@ +using System; + +namespace UniRx.Operators +{ + // Optimize for .Where().Select() + + internal class WhereSelectObservable : OperatorObservableBase + { + readonly IObservable source; + readonly Func predicate; + readonly Func selector; + + public WhereSelectObservable(IObservable source, Func predicate, Func selector) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.predicate = predicate; + this.selector = selector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return source.Subscribe(new WhereSelect(this, observer, cancel)); + } + + class WhereSelect : OperatorObserverBase + { + readonly WhereSelectObservable parent; + + public WhereSelect(WhereSelectObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public override void OnNext(T value) + { + var isPassed = false; + try + { + isPassed = parent.predicate(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + if (isPassed) + { + var v = default(TR); + try + { + v = parent.selector(value); + } + catch (Exception ex) + { + try { observer.OnError(ex); } finally { Dispose(); } + return; + } + + observer.OnNext(v); + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs.meta new file mode 100644 index 00000000..328b2b9f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/WhereSelect.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f7453a184d42aa34c854977496f381b9 +timeCreated: 1468743755 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs b/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs new file mode 100644 index 00000000..47d7d255 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + internal class WithLatestFromObservable : OperatorObservableBase + { + readonly IObservable left; + readonly IObservable right; + readonly Func selector; + + public WithLatestFromObservable(IObservable left, IObservable right, Func selector) + : base(left.IsRequiredSubscribeOnCurrentThread() || right.IsRequiredSubscribeOnCurrentThread()) + { + this.left = left; + this.right = right; + this.selector = selector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new WithLatestFrom(this, observer, cancel).Run(); + } + + class WithLatestFrom : OperatorObserverBase + { + readonly WithLatestFromObservable parent; + readonly object gate = new object(); + + volatile bool hasLatest; + TRight latestValue = default(TRight); + + public WithLatestFrom(WithLatestFromObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var l = parent.left.Subscribe(new LeftObserver(this)); + var rSubscription = new SingleAssignmentDisposable(); + rSubscription.Disposable = parent.right.Subscribe(new RightObserver(this, rSubscription)); + + return StableCompositeDisposable.Create(l, rSubscription); + } + + public override void OnNext(TResult value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + + class LeftObserver : IObserver + { + readonly WithLatestFrom parent; + + public LeftObserver(WithLatestFrom parent) + { + this.parent = parent; + } + + public void OnNext(TLeft value) + { + if (parent.hasLatest) + { + var result = default(TResult); + try + { + result = parent.parent.selector(value, parent.latestValue); + } + catch (Exception ex) + { + lock (parent.gate) + { + parent.OnError(ex); + } + return; + } + + lock (parent.gate) + { + parent.OnNext(result); + } + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + parent.OnError(error); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.OnCompleted(); + } + } + } + + class RightObserver : IObserver + { + readonly WithLatestFrom parent; + readonly IDisposable selfSubscription; + + public RightObserver(WithLatestFrom parent, IDisposable subscription) + { + this.parent = parent; + this.selfSubscription = subscription; + } + + public void OnNext(TRight value) + { + parent.latestValue = value; + parent.hasLatest = true; + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + parent.OnError(error); + } + } + + public void OnCompleted() + { + selfSubscription.Dispose(); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs.meta new file mode 100644 index 00000000..be6f9f68 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/WithLatestFrom.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: eb0bc7125d343ed45bb7e36ff1a53362 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs b/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs new file mode 100644 index 00000000..1d66edc4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs @@ -0,0 +1,1004 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + public delegate TR ZipFunc(T1 arg1, T2 arg2, T3 arg3); + public delegate TR ZipFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4); + public delegate TR ZipFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); + public delegate TR ZipFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); + public delegate TR ZipFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); + + // binary + internal class ZipObservable : OperatorObservableBase + { + readonly IObservable left; + readonly IObservable right; + readonly Func selector; + + public ZipObservable(IObservable left, IObservable right, Func selector) + : base(left.IsRequiredSubscribeOnCurrentThread() || right.IsRequiredSubscribeOnCurrentThread()) + { + this.left = left; + this.right = right; + this.selector = selector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Zip(this, observer, cancel).Run(); + } + + class Zip : OperatorObserverBase + { + readonly ZipObservable parent; + + readonly object gate = new object(); + readonly Queue leftQ = new Queue(); + bool leftCompleted = false; + readonly Queue rightQ = new Queue(); + bool rightCompleted = false; + + public Zip(ZipObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var l = parent.left.Subscribe(new LeftZipObserver(this)); + var r = parent.right.Subscribe(new RightZipObserver(this)); + + return StableCompositeDisposable.Create(l, r, Disposable.Create(() => + { + lock (gate) + { + leftQ.Clear(); + rightQ.Clear(); + } + })); + } + + // dequeue is in the lock + void Dequeue() + { + TLeft lv; + TRight rv; + TResult v; + + if (leftQ.Count != 0 && rightQ.Count != 0) + { + lv = leftQ.Dequeue(); + rv = rightQ.Dequeue(); + } + else if (leftCompleted || rightCompleted) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else + { + return; + } + + try + { + v = parent.selector(lv, rv); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + OnNext(v); + } + + public override void OnNext(TResult value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + + class LeftZipObserver : IObserver + { + readonly Zip parent; + + public LeftZipObserver(Zip parent) + { + this.parent = parent; + } + + public void OnNext(TLeft value) + { + lock (parent.gate) + { + parent.leftQ.Enqueue(value); + parent.Dequeue(); + } + } + + public void OnError(Exception ex) + { + lock (parent.gate) + { + parent.OnError(ex); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.leftCompleted = true; + if (parent.rightCompleted) parent.OnCompleted(); + } + } + } + + class RightZipObserver : IObserver + { + readonly Zip parent; + + public RightZipObserver(Zip parent) + { + this.parent = parent; + } + + public void OnNext(TRight value) + { + lock (parent.gate) + { + parent.rightQ.Enqueue(value); + parent.Dequeue(); + } + } + + public void OnError(Exception ex) + { + lock (parent.gate) + { + parent.OnError(ex); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.rightCompleted = true; + if (parent.leftCompleted) parent.OnCompleted(); + } + } + } + } + } + + // array + internal class ZipObservable : OperatorObservableBase> + { + readonly IObservable[] sources; + + public ZipObservable(IObservable[] sources) + : base(true) + { + this.sources = sources; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return new Zip(this, observer, cancel).Run(); + } + + class Zip : OperatorObserverBase, IList> + { + readonly ZipObservable parent; + readonly object gate = new object(); + + Queue[] queues; + bool[] isDone; + int length; + + public Zip(ZipObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + length = parent.sources.Length; + queues = new Queue[length]; + isDone = new bool[length]; + + for (int i = 0; i < length; i++) + { + queues[i] = new Queue(); + } + + var disposables = new IDisposable[length + 1]; + for (int i = 0; i < length; i++) + { + var source = parent.sources[i]; + disposables[i] = source.Subscribe(new ZipObserver(this, i)); + } + + disposables[length] = Disposable.Create(() => + { + lock (gate) + { + for (int i = 0; i < length; i++) + { + var q = queues[i]; + q.Clear(); + } + } + }); + + return StableCompositeDisposable.CreateUnsafe(disposables); + } + + // dequeue is in the lock + void Dequeue(int index) + { + var allQueueHasValue = true; + for (int i = 0; i < length; i++) + { + if (queues[i].Count == 0) + { + allQueueHasValue = false; + break; + } + } + + if (!allQueueHasValue) + { + var allCompletedWithoutSelf = true; + for (int i = 0; i < length; i++) + { + if (i == index) continue; + if (!isDone[i]) + { + allCompletedWithoutSelf = false; + break; + } + } + + if (allCompletedWithoutSelf) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else + { + return; + } + } + + var array = new T[length]; + for (int i = 0; i < length; i++) + { + array[i] = queues[i].Dequeue(); + } + + OnNext(array); + } + + public override void OnNext(IList value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + + class ZipObserver : IObserver + { + readonly Zip parent; + readonly int index; + + public ZipObserver(Zip parent, int index) + { + this.parent = parent; + this.index = index; + } + + public void OnNext(T value) + { + lock (parent.gate) + { + parent.queues[index].Enqueue(value); + parent.Dequeue(index); + } + } + + public void OnError(Exception ex) + { + lock (parent.gate) + { + parent.OnError(ex); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.isDone[index] = true; + var allTrue = true; + for (int i = 0; i < parent.length; i++) + { + if (!parent.isDone[i]) + { + allTrue = false; + break; + } + } + + if (allTrue) + { + parent.OnCompleted(); + } + } + } + } + } + } + + // Generated from UniRx.Console.ZipGenerator.tt + #region NTH + + internal class ZipObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + ZipFunc resultSelector; + + public ZipObservable( + IObservable source1, + IObservable source2, + IObservable source3, + ZipFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Zip(this, observer, cancel).Run(); + } + + class Zip : NthZipObserverBase + { + readonly ZipObservable parent; + readonly object gate = new object(); + readonly Queue q1 = new Queue(); + readonly Queue q2 = new Queue(); + readonly Queue q3 = new Queue(); + + public Zip(ZipObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + base.SetQueue(new System.Collections.ICollection[] { q1, q2, q3 }); + var s1 = parent.source1.Subscribe(new ZipObserver(gate, this, 0, q1)); + var s2 = parent.source2.Subscribe(new ZipObserver(gate, this, 1, q2)); + var s3 = parent.source3.Subscribe(new ZipObserver(gate, this, 2, q3)); + + return StableCompositeDisposable.Create(s1, s2, s3, Disposable.Create(() => + { + lock (gate) + { + q1.Clear(); q2.Clear(); q3.Clear(); + } + })); + } + + public override TR GetResult() + { + return parent.resultSelector(q1.Dequeue(), q2.Dequeue(), q3.Dequeue()); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class ZipObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + ZipFunc resultSelector; + + public ZipObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + ZipFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Zip(this, observer, cancel).Run(); + } + + class Zip : NthZipObserverBase + { + readonly ZipObservable parent; + readonly object gate = new object(); + readonly Queue q1 = new Queue(); + readonly Queue q2 = new Queue(); + readonly Queue q3 = new Queue(); + readonly Queue q4 = new Queue(); + + public Zip(ZipObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + base.SetQueue(new System.Collections.ICollection[] { q1, q2, q3, q4 }); + var s1 = parent.source1.Subscribe(new ZipObserver(gate, this, 0, q1)); + var s2 = parent.source2.Subscribe(new ZipObserver(gate, this, 1, q2)); + var s3 = parent.source3.Subscribe(new ZipObserver(gate, this, 2, q3)); + var s4 = parent.source4.Subscribe(new ZipObserver(gate, this, 3, q4)); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, Disposable.Create(() => + { + lock (gate) + { + q1.Clear(); q2.Clear(); q3.Clear(); q4.Clear(); + } + })); + } + + public override TR GetResult() + { + return parent.resultSelector(q1.Dequeue(), q2.Dequeue(), q3.Dequeue(), q4.Dequeue()); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class ZipObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + ZipFunc resultSelector; + + public ZipObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + ZipFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Zip(this, observer, cancel).Run(); + } + + class Zip : NthZipObserverBase + { + readonly ZipObservable parent; + readonly object gate = new object(); + readonly Queue q1 = new Queue(); + readonly Queue q2 = new Queue(); + readonly Queue q3 = new Queue(); + readonly Queue q4 = new Queue(); + readonly Queue q5 = new Queue(); + + public Zip(ZipObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + base.SetQueue(new System.Collections.ICollection[] { q1, q2, q3, q4, q5 }); + var s1 = parent.source1.Subscribe(new ZipObserver(gate, this, 0, q1)); + var s2 = parent.source2.Subscribe(new ZipObserver(gate, this, 1, q2)); + var s3 = parent.source3.Subscribe(new ZipObserver(gate, this, 2, q3)); + var s4 = parent.source4.Subscribe(new ZipObserver(gate, this, 3, q4)); + var s5 = parent.source5.Subscribe(new ZipObserver(gate, this, 4, q5)); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5, Disposable.Create(() => + { + lock (gate) + { + q1.Clear(); q2.Clear(); q3.Clear(); q4.Clear(); q5.Clear(); + } + })); + } + + public override TR GetResult() + { + return parent.resultSelector(q1.Dequeue(), q2.Dequeue(), q3.Dequeue(), q4.Dequeue(), q5.Dequeue()); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class ZipObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + IObservable source6; + ZipFunc resultSelector; + + public ZipObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + IObservable source6, + ZipFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + source6.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.source6 = source6; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Zip(this, observer, cancel).Run(); + } + + class Zip : NthZipObserverBase + { + readonly ZipObservable parent; + readonly object gate = new object(); + readonly Queue q1 = new Queue(); + readonly Queue q2 = new Queue(); + readonly Queue q3 = new Queue(); + readonly Queue q4 = new Queue(); + readonly Queue q5 = new Queue(); + readonly Queue q6 = new Queue(); + + public Zip(ZipObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + base.SetQueue(new System.Collections.ICollection[] { q1, q2, q3, q4, q5, q6 }); + var s1 = parent.source1.Subscribe(new ZipObserver(gate, this, 0, q1)); + var s2 = parent.source2.Subscribe(new ZipObserver(gate, this, 1, q2)); + var s3 = parent.source3.Subscribe(new ZipObserver(gate, this, 2, q3)); + var s4 = parent.source4.Subscribe(new ZipObserver(gate, this, 3, q4)); + var s5 = parent.source5.Subscribe(new ZipObserver(gate, this, 4, q5)); + var s6 = parent.source6.Subscribe(new ZipObserver(gate, this, 5, q6)); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5, s6, Disposable.Create(() => + { + lock (gate) + { + q1.Clear(); q2.Clear(); q3.Clear(); q4.Clear(); q5.Clear(); q6.Clear(); + } + })); + } + + public override TR GetResult() + { + return parent.resultSelector(q1.Dequeue(), q2.Dequeue(), q3.Dequeue(), q4.Dequeue(), q5.Dequeue(), q6.Dequeue()); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class ZipObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + IObservable source6; + IObservable source7; + ZipFunc resultSelector; + + public ZipObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + IObservable source6, + IObservable source7, + ZipFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + source6.IsRequiredSubscribeOnCurrentThread() || + source7.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.source6 = source6; + this.source7 = source7; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new Zip(this, observer, cancel).Run(); + } + + class Zip : NthZipObserverBase + { + readonly ZipObservable parent; + readonly object gate = new object(); + readonly Queue q1 = new Queue(); + readonly Queue q2 = new Queue(); + readonly Queue q3 = new Queue(); + readonly Queue q4 = new Queue(); + readonly Queue q5 = new Queue(); + readonly Queue q6 = new Queue(); + readonly Queue q7 = new Queue(); + + public Zip(ZipObservable parent, IObserver observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + base.SetQueue(new System.Collections.ICollection[] { q1, q2, q3, q4, q5, q6, q7 }); + var s1 = parent.source1.Subscribe(new ZipObserver(gate, this, 0, q1)); + var s2 = parent.source2.Subscribe(new ZipObserver(gate, this, 1, q2)); + var s3 = parent.source3.Subscribe(new ZipObserver(gate, this, 2, q3)); + var s4 = parent.source4.Subscribe(new ZipObserver(gate, this, 3, q4)); + var s5 = parent.source5.Subscribe(new ZipObserver(gate, this, 4, q5)); + var s6 = parent.source6.Subscribe(new ZipObserver(gate, this, 5, q6)); + var s7 = parent.source7.Subscribe(new ZipObserver(gate, this, 6, q7)); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5, s6, s7, Disposable.Create(() => + { + lock (gate) + { + q1.Clear(); q2.Clear(); q3.Clear(); q4.Clear(); q5.Clear(); q6.Clear(); q7.Clear(); + } + })); + } + + public override TR GetResult() + { + return parent.resultSelector(q1.Dequeue(), q2.Dequeue(), q3.Dequeue(), q4.Dequeue(), q5.Dequeue(), q6.Dequeue(), q7.Dequeue()); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + #endregion + + // Nth infrastructure + + internal interface IZipObservable + { + void Dequeue(int index); + void Fail(Exception error); + void Done(int index); + } + + internal abstract class NthZipObserverBase : OperatorObserverBase, IZipObservable + { + System.Collections.ICollection[] queues; + bool[] isDone; + int length; + + public NthZipObserverBase(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + protected void SetQueue(System.Collections.ICollection[] queues) + { + this.queues = queues; + this.length = queues.Length; + this.isDone = new bool[length]; + } + + public abstract T GetResult(); + + // operators in lock + public void Dequeue(int index) + { + var allQueueHasValue = true; + for (int i = 0; i < length; i++) + { + if (queues[i].Count == 0) + { + allQueueHasValue = false; + break; + } + } + + if (!allQueueHasValue) + { + var allCompletedWithoutSelf = true; + for (int i = 0; i < length; i++) + { + if (i == index) continue; + if (!isDone[i]) + { + allCompletedWithoutSelf = false; + break; + } + } + + if (allCompletedWithoutSelf) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else + { + return; + } + } + + var result = default(T); + try + { + result = GetResult(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + OnNext(result); + } + + public void Done(int index) + { + isDone[index] = true; + var allTrue = true; + for (int i = 0; i < length; i++) + { + if (!isDone[i]) + { + allTrue = false; + break; + } + } + + if (allTrue) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + + public void Fail(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + } + + + // nth + internal class ZipObserver : IObserver + { + readonly object gate; + readonly IZipObservable parent; + readonly int index; + readonly Queue queue; + + public ZipObserver(object gate, IZipObservable parent, int index, Queue queue) + { + this.gate = gate; + this.parent = parent; + this.index = index; + this.queue = queue; + } + + public void OnNext(T value) + { + lock (gate) + { + queue.Enqueue(value); + parent.Dequeue(index); + } + } + + public void OnError(Exception error) + { + lock (gate) + { + parent.Fail(error); + } + } + + public void OnCompleted() + { + lock (gate) + { + parent.Done(index); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs.meta new file mode 100644 index 00000000..b5c12206 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/Zip.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4e92e25f9bb221d478d4af5bcd8b8a2c +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs b/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs new file mode 100644 index 00000000..424d4217 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs @@ -0,0 +1,992 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace UniRx.Operators +{ + public delegate TR ZipLatestFunc(T1 arg1, T2 arg2, T3 arg3); + public delegate TR ZipLatestFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4); + public delegate TR ZipLatestFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); + public delegate TR ZipLatestFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); + public delegate TR ZipLatestFunc(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); + + // binary + internal class ZipLatestObservable : OperatorObservableBase + { + readonly IObservable left; + readonly IObservable right; + readonly Func selector; + + public ZipLatestObservable(IObservable left, IObservable right, Func selector) + : base(left.IsRequiredSubscribeOnCurrentThread() || right.IsRequiredSubscribeOnCurrentThread()) + { + this.left = left; + this.right = right; + this.selector = selector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ZipLatest(this, observer, cancel).Run(); + } + + class ZipLatest : OperatorObserverBase + { + readonly ZipLatestObservable parent; + readonly object gate = new object(); + + TLeft leftValue = default(TLeft); + bool leftStarted = false; + bool leftCompleted = false; + + TRight rightValue = default(TRight); + bool rightStarted = false; + bool rightCompleted = false; + + public ZipLatest(ZipLatestObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + var l = parent.left.Subscribe(new LeftObserver(this)); + var r = parent.right.Subscribe(new RightObserver(this)); + + return StableCompositeDisposable.Create(l, r); + } + + // publish in lock + public void Publish() + { + if ((leftCompleted && !leftStarted) || (rightCompleted && !rightStarted)) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else if (!(leftStarted && rightStarted)) + { + return; + } + + TResult v; + try + { + v = parent.selector(leftValue, rightValue); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + + OnNext(v); + leftStarted = false; + rightStarted = false; + + if (leftCompleted || rightCompleted) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + } + + public override void OnNext(TResult value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + + class LeftObserver : IObserver + { + readonly ZipLatest parent; + + public LeftObserver(ZipLatest parent) + { + this.parent = parent; + } + + public void OnNext(TLeft value) + { + lock (parent.gate) + { + parent.leftStarted = true; + parent.leftValue = value; + parent.Publish(); + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + parent.OnError(error); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.leftCompleted = true; + if (parent.rightCompleted) parent.OnCompleted(); + } + } + } + + class RightObserver : IObserver + { + readonly ZipLatest parent; + + public RightObserver(ZipLatest parent) + { + this.parent = parent; + } + + + public void OnNext(TRight value) + { + lock (parent.gate) + { + parent.rightStarted = true; + parent.rightValue = value; + parent.Publish(); + } + } + + public void OnError(Exception error) + { + lock (parent.gate) + { + parent.OnError(error); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.rightCompleted = true; + if (parent.leftCompleted) parent.OnCompleted(); + } + } + } + } + } + + // array + internal class ZipLatestObservable : OperatorObservableBase> + { + readonly IObservable[] sources; + + public ZipLatestObservable(IObservable[] sources) + : base(true) + { + this.sources = sources; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return new ZipLatest(this, observer, cancel).Run(); + } + + class ZipLatest : OperatorObserverBase, IList> + { + readonly ZipLatestObservable parent; + readonly object gate = new object(); + + int length; + T[] values; + bool[] isStarted; + bool[] isCompleted; + + public ZipLatest(ZipLatestObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + length = parent.sources.Length; + values = new T[length]; + isStarted = new bool[length]; + isCompleted = new bool[length]; + + var disposables = new IDisposable[length]; + for (int i = 0; i < length; i++) + { + var source = parent.sources[i]; + disposables[i] = source.Subscribe(new ZipLatestObserver(this, i)); + } + + return StableCompositeDisposable.CreateUnsafe(disposables); + } + + // publish is in the lock + void Publish(int index) + { + isStarted[index] = true; + + var hasOnCompleted = false; + var allValueStarted = true; + for (int i = 0; i < length; i++) + { + if (!isStarted[i]) + { + allValueStarted = false; + break; + } + if (i == index) continue; + if (isCompleted[i]) hasOnCompleted = true; + } + + if (allValueStarted) + { + OnNext(new List(values)); + if (hasOnCompleted) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else + { + Array.Clear(isStarted, 0, length); // reset + return; + } + } + else + { + for (int i = 0; i < length; i++) + { + if (i == index) continue; + if (isCompleted[i] && !isStarted[i]) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + } + } + } + + public override void OnNext(IList value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + + class ZipLatestObserver : IObserver + { + readonly ZipLatest parent; + readonly int index; + + public ZipLatestObserver(ZipLatest parent, int index) + { + this.parent = parent; + this.index = index; + } + + public void OnNext(T value) + { + lock (parent.gate) + { + parent.values[index] = value; + parent.Publish(index); + } + } + + public void OnError(Exception ex) + { + lock (parent.gate) + { + parent.OnError(ex); + } + } + + public void OnCompleted() + { + lock (parent.gate) + { + parent.isCompleted[index] = true; + + var allTrue = true; + for (int i = 0; i < parent.length; i++) + { + if (!parent.isCompleted[i]) + { + allTrue = false; + break; + } + } + + if (allTrue) + { + parent.OnCompleted(); + } + } + } + } + } + } + + // generated from UniRx.Console.ZipLatestGenerator.tt + #region NTH + + internal class ZipLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + ZipLatestFunc resultSelector; + + public ZipLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + ZipLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ZipLatest(3, this, observer, cancel).Run(); + } + + class ZipLatest : NthZipLatestObserverBase + { + readonly ZipLatestObservable parent; + readonly object gate = new object(); + ZipLatestObserver c1; + ZipLatestObserver c2; + ZipLatestObserver c3; + + public ZipLatest(int length, ZipLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new ZipLatestObserver(gate, this, 0); + c2 = new ZipLatestObserver(gate, this, 1); + c3 = new ZipLatestObserver(gate, this, 2); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + + return StableCompositeDisposable.Create(s1, s2, s3); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class ZipLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + ZipLatestFunc resultSelector; + + public ZipLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + ZipLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ZipLatest(4, this, observer, cancel).Run(); + } + + class ZipLatest : NthZipLatestObserverBase + { + readonly ZipLatestObservable parent; + readonly object gate = new object(); + ZipLatestObserver c1; + ZipLatestObserver c2; + ZipLatestObserver c3; + ZipLatestObserver c4; + + public ZipLatest(int length, ZipLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new ZipLatestObserver(gate, this, 0); + c2 = new ZipLatestObserver(gate, this, 1); + c3 = new ZipLatestObserver(gate, this, 2); + c4 = new ZipLatestObserver(gate, this, 3); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + var s4 = parent.source4.Subscribe(c4); + + return StableCompositeDisposable.Create(s1, s2, s3, s4); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value, c4.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class ZipLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + ZipLatestFunc resultSelector; + + public ZipLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + ZipLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ZipLatest(5, this, observer, cancel).Run(); + } + + class ZipLatest : NthZipLatestObserverBase + { + readonly ZipLatestObservable parent; + readonly object gate = new object(); + ZipLatestObserver c1; + ZipLatestObserver c2; + ZipLatestObserver c3; + ZipLatestObserver c4; + ZipLatestObserver c5; + + public ZipLatest(int length, ZipLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new ZipLatestObserver(gate, this, 0); + c2 = new ZipLatestObserver(gate, this, 1); + c3 = new ZipLatestObserver(gate, this, 2); + c4 = new ZipLatestObserver(gate, this, 3); + c5 = new ZipLatestObserver(gate, this, 4); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + var s4 = parent.source4.Subscribe(c4); + var s5 = parent.source5.Subscribe(c5); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class ZipLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + IObservable source6; + ZipLatestFunc resultSelector; + + public ZipLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + IObservable source6, + ZipLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + source6.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.source6 = source6; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ZipLatest(6, this, observer, cancel).Run(); + } + + class ZipLatest : NthZipLatestObserverBase + { + readonly ZipLatestObservable parent; + readonly object gate = new object(); + ZipLatestObserver c1; + ZipLatestObserver c2; + ZipLatestObserver c3; + ZipLatestObserver c4; + ZipLatestObserver c5; + ZipLatestObserver c6; + + public ZipLatest(int length, ZipLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new ZipLatestObserver(gate, this, 0); + c2 = new ZipLatestObserver(gate, this, 1); + c3 = new ZipLatestObserver(gate, this, 2); + c4 = new ZipLatestObserver(gate, this, 3); + c5 = new ZipLatestObserver(gate, this, 4); + c6 = new ZipLatestObserver(gate, this, 5); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + var s4 = parent.source4.Subscribe(c4); + var s5 = parent.source5.Subscribe(c5); + var s6 = parent.source6.Subscribe(c6); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5, s6); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + + internal class ZipLatestObservable : OperatorObservableBase + { + IObservable source1; + IObservable source2; + IObservable source3; + IObservable source4; + IObservable source5; + IObservable source6; + IObservable source7; + ZipLatestFunc resultSelector; + + public ZipLatestObservable( + IObservable source1, + IObservable source2, + IObservable source3, + IObservable source4, + IObservable source5, + IObservable source6, + IObservable source7, + ZipLatestFunc resultSelector) + : base( + source1.IsRequiredSubscribeOnCurrentThread() || + source2.IsRequiredSubscribeOnCurrentThread() || + source3.IsRequiredSubscribeOnCurrentThread() || + source4.IsRequiredSubscribeOnCurrentThread() || + source5.IsRequiredSubscribeOnCurrentThread() || + source6.IsRequiredSubscribeOnCurrentThread() || + source7.IsRequiredSubscribeOnCurrentThread() || + false) + { + this.source1 = source1; + this.source2 = source2; + this.source3 = source3; + this.source4 = source4; + this.source5 = source5; + this.source6 = source6; + this.source7 = source7; + this.resultSelector = resultSelector; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ZipLatest(7, this, observer, cancel).Run(); + } + + class ZipLatest : NthZipLatestObserverBase + { + readonly ZipLatestObservable parent; + readonly object gate = new object(); + ZipLatestObserver c1; + ZipLatestObserver c2; + ZipLatestObserver c3; + ZipLatestObserver c4; + ZipLatestObserver c5; + ZipLatestObserver c6; + ZipLatestObserver c7; + + public ZipLatest(int length, ZipLatestObservable parent, IObserver observer, IDisposable cancel) + : base(length, observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + c1 = new ZipLatestObserver(gate, this, 0); + c2 = new ZipLatestObserver(gate, this, 1); + c3 = new ZipLatestObserver(gate, this, 2); + c4 = new ZipLatestObserver(gate, this, 3); + c5 = new ZipLatestObserver(gate, this, 4); + c6 = new ZipLatestObserver(gate, this, 5); + c7 = new ZipLatestObserver(gate, this, 6); + + var s1 = parent.source1.Subscribe(c1); + var s2 = parent.source2.Subscribe(c2); + var s3 = parent.source3.Subscribe(c3); + var s4 = parent.source4.Subscribe(c4); + var s5 = parent.source5.Subscribe(c5); + var s6 = parent.source6.Subscribe(c6); + var s7 = parent.source7.Subscribe(c7); + + return StableCompositeDisposable.Create(s1, s2, s3, s4, s5, s6, s7); + } + + public override TR GetResult() + { + return parent.resultSelector(c1.Value, c2.Value, c3.Value, c4.Value, c5.Value, c6.Value, c7.Value); + } + + public override void OnNext(TR value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + #endregion + + // Nth infrastructure + + internal interface IZipLatestObservable + { + void Publish(int index); + void Fail(Exception error); + void Done(int index); + } + + internal abstract class NthZipLatestObserverBase : OperatorObserverBase, IZipLatestObservable + { + readonly int length; + readonly bool[] isStarted; + readonly bool[] isCompleted; + + public NthZipLatestObserverBase(int length, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.length = length; + this.isStarted = new bool[length]; + this.isCompleted = new bool[length]; + } + + public abstract T GetResult(); + + // operators in lock + public void Publish(int index) + { + isStarted[index] = true; + + var hasOnCompleted = false; + var allValueStarted = true; + for (int i = 0; i < length; i++) + { + if (!isStarted[i]) + { + allValueStarted = false; + break; + } + if (i == index) continue; + if (isCompleted[i]) hasOnCompleted = true; + } + + if (allValueStarted) + { + var result = default(T); + try + { + result = GetResult(); + } + catch (Exception ex) + { + try { observer.OnError(ex); } + finally { Dispose(); } + return; + } + OnNext(result); + + if (hasOnCompleted) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + else + { + Array.Clear(isStarted, 0, length); // reset + return; + } + } + else + { + for (int i = 0; i < length; i++) + { + if (i == index) continue; + if (isCompleted[i] && !isStarted[i]) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + return; + } + } + } + } + + public void Done(int index) + { + isCompleted[index] = true; + + var allTrue = true; + for (int i = 0; i < length; i++) + { + if (!isCompleted[i]) + { + allTrue = false; + break; + } + } + + if (allTrue) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + + public void Fail(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + } + + // Nth + internal class ZipLatestObserver : IObserver + { + readonly object gate; + readonly IZipLatestObservable parent; + readonly int index; + T value; + + public T Value { get { return value; } } + + public ZipLatestObserver(object gate, IZipLatestObservable parent, int index) + { + this.gate = gate; + this.parent = parent; + this.index = index; + } + + public void OnNext(T value) + { + lock (gate) + { + this.value = value; + parent.Publish(index); + } + } + + public void OnError(Exception error) + { + lock (gate) + { + parent.Fail(error); + } + } + + public void OnCompleted() + { + lock (gate) + { + parent.Done(index); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs.meta b/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs.meta new file mode 100644 index 00000000..e050ab95 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Operators/ZipLatest.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f84ea50040d682c43811d1d98ae7fec8 +timeCreated: 1455373908 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Pair.cs b/Assets/Plugins/UniRx/Scripts/Pair.cs new file mode 100644 index 00000000..f511af0e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Pair.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; + +namespace UniRx +{ + // Pair is used for Observable.Pairwise + [Serializable] + public struct Pair : IEquatable> + { + readonly T previous; + readonly T current; + + public T Previous + { + get { return previous; } + } + + public T Current + { + get { return current; } + } + + public Pair(T previous, T current) + { + this.previous = previous; + this.current = current; + } + + public override int GetHashCode() + { + var comparer = EqualityComparer.Default; + + int h0; + h0 = comparer.GetHashCode(previous); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(current); + return h0; + } + + public override bool Equals(object obj) + { + if (!(obj is Pair)) return false; + + return Equals((Pair)obj); + } + + public bool Equals(Pair other) + { + var comparer = EqualityComparer.Default; + + return comparer.Equals(previous, other.Previous) && + comparer.Equals(current, other.Current); + } + + public override string ToString() + { + return string.Format("({0}, {1})", previous, current); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Pair.cs.meta b/Assets/Plugins/UniRx/Scripts/Pair.cs.meta new file mode 100644 index 00000000..d7c24cec --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Pair.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7947c520dfd9de94bb381e45dc105752 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers.meta b/Assets/Plugins/UniRx/Scripts/Schedulers.meta new file mode 100644 index 00000000..01beb91f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ca4cbb2e99a69854d93ad929ef72117b +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs b/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs new file mode 100644 index 00000000..52f10284 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs @@ -0,0 +1,135 @@ +// this code is borrowed from RxOfficial(rx.codeplex.com) and modified + +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +using System.ComponentModel; +using System.Threading; +using UniRx.InternalUtil; +using UniRx; +using System; +using System.Diagnostics; +using System.Collections.Generic; + +namespace UniRx +{ + + public static partial class Scheduler + { + public static readonly IScheduler CurrentThread = new CurrentThreadScheduler(); + + public static bool IsCurrentThreadSchedulerScheduleRequired { get { return CurrentThreadScheduler.IsScheduleRequired; } } + + /// + /// Represents an object that schedules units of work on the current thread. + /// + /// Singleton instance of this type exposed through this static property. + class CurrentThreadScheduler : IScheduler + { + [ThreadStatic] + static SchedulerQueue s_threadLocalQueue; + + [ThreadStatic] + static Stopwatch s_clock; + + private static SchedulerQueue GetQueue() + { + return s_threadLocalQueue; + } + + private static void SetQueue(SchedulerQueue newQueue) + { + s_threadLocalQueue = newQueue; + } + + private static TimeSpan Time + { + get + { + if (s_clock == null) + s_clock = Stopwatch.StartNew(); + + return s_clock.Elapsed; + } + } + + /// + /// Gets a value that indicates whether the caller must call a Schedule method. + /// + [EditorBrowsable(EditorBrowsableState.Advanced)] + public static bool IsScheduleRequired + { + get + { + return GetQueue() == null; + } + } + + public IDisposable Schedule(Action action) + { + return Schedule(TimeSpan.Zero, action); + } + + public IDisposable Schedule(TimeSpan dueTime, Action action) + { + if (action == null) + throw new ArgumentNullException("action"); + + var dt = Time + Scheduler.Normalize(dueTime); + + var si = new ScheduledItem(action, dt); + + var queue = GetQueue(); + + if (queue == null) + { + queue = new SchedulerQueue(4); + queue.Enqueue(si); + + CurrentThreadScheduler.SetQueue(queue); + try + { + Trampoline.Run(queue); + } + finally + { + CurrentThreadScheduler.SetQueue(null); + } + } + else + { + queue.Enqueue(si); + } + + return si.Cancellation; + } + + static class Trampoline + { + public static void Run(SchedulerQueue queue) + { + while (queue.Count > 0) + { + var item = queue.Dequeue(); + if (!item.IsCanceled) + { + var wait = item.DueTime - CurrentThreadScheduler.Time; + if (wait.Ticks > 0) + { + Thread.Sleep(wait); + } + + if (!item.IsCanceled) + item.Invoke(); + } + } + } + } + + public DateTimeOffset Now + { + get { return Scheduler.Now; } + } + } + } +} + diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs.meta new file mode 100644 index 00000000..e1310956 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/CurrentThreadScheduler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1d547b5ee71b7284db1fecfcdfa59fac +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs b/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs new file mode 100644 index 00000000..71c9e51a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs @@ -0,0 +1,30 @@ +using System; + +namespace UniRx +{ + public interface IScheduler + { + DateTimeOffset Now { get; } + + // Interface is changed from official Rx for avoid iOS AOT problem (state is dangerous). + + IDisposable Schedule(Action action); + + IDisposable Schedule(TimeSpan dueTime, Action action); + } + + public interface ISchedulerPeriodic + { + IDisposable SchedulePeriodic(TimeSpan period, Action action); + } + + public interface ISchedulerLongRunning + { + IDisposable ScheduleLongRunning(Action action); + } + + public interface ISchedulerQueueing + { + void ScheduleQueueing(ICancelable cancel, T state, Action action); + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs.meta new file mode 100644 index 00000000..ae2adfcc --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/IScheduler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7409b202c20d3894b9677c8f2a27f3aa +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs b/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs new file mode 100644 index 00000000..b41e2450 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Threading; + +namespace UniRx +{ + public static partial class Scheduler + { + public static readonly IScheduler Immediate = new ImmediateScheduler(); + + class ImmediateScheduler : IScheduler + { + public ImmediateScheduler() + { + } + + public DateTimeOffset Now + { + get { return Scheduler.Now; } + } + + public IDisposable Schedule(Action action) + { + action(); + return Disposable.Empty; + } + + public IDisposable Schedule(TimeSpan dueTime, Action action) + { + var wait = Scheduler.Normalize(dueTime); + if (wait.Ticks > 0) + { + Thread.Sleep(wait); + } + + action(); + return Disposable.Empty; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs.meta new file mode 100644 index 00000000..d2ef97f9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/ImmediateScheduler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 87be5fca34f9b44428b7fb1ce9147860 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs b/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs new file mode 100644 index 00000000..a9f63a1d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs @@ -0,0 +1,235 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Threading; + +namespace UniRx +{ + // Scheduler Extension + public static partial class Scheduler + { + // configurable defaults + public static class DefaultSchedulers + { + static IScheduler constantTime; + public static IScheduler ConstantTimeOperations + { + get + { + return constantTime ?? (constantTime = Scheduler.Immediate); + } + set + { + constantTime = value; + } + } + + static IScheduler tailRecursion; + public static IScheduler TailRecursion + { + get + { + return tailRecursion ?? (tailRecursion = Scheduler.Immediate); + } + set + { + tailRecursion = value; + } + } + + static IScheduler iteration; + public static IScheduler Iteration + { + get + { + return iteration ?? (iteration = Scheduler.CurrentThread); + } + set + { + iteration = value; + } + } + + static IScheduler timeBasedOperations; + public static IScheduler TimeBasedOperations + { + get + { +#if UniRxLibrary + return timeBasedOperations ?? (timeBasedOperations = Scheduler.ThreadPool); +#else + return timeBasedOperations ?? (timeBasedOperations = Scheduler.MainThread); // MainThread as default for TimeBased Operation +#endif + } + set + { + timeBasedOperations = value; + } + } + + static IScheduler asyncConversions; + public static IScheduler AsyncConversions + { + get + { +#if WEB_GL + // WebGL does not support threadpool + return asyncConversions ?? (asyncConversions = Scheduler.MainThread); +#else + return asyncConversions ?? (asyncConversions = Scheduler.ThreadPool); +#endif + } + set + { + asyncConversions = value; + } + } + + public static void SetDotNetCompatible() + { + ConstantTimeOperations = Scheduler.Immediate; + TailRecursion = Scheduler.Immediate; + Iteration = Scheduler.CurrentThread; + TimeBasedOperations = Scheduler.ThreadPool; + AsyncConversions = Scheduler.ThreadPool; + } + } + + // utils + + public static DateTimeOffset Now + { + get { return DateTimeOffset.UtcNow; } + } + + public static TimeSpan Normalize(TimeSpan timeSpan) + { + return timeSpan >= TimeSpan.Zero ? timeSpan : TimeSpan.Zero; + } + + public static IDisposable Schedule(this IScheduler scheduler, DateTimeOffset dueTime, Action action) + { + return scheduler.Schedule(dueTime - scheduler.Now, action); + } + + public static IDisposable Schedule(this IScheduler scheduler, Action action) + { + // InvokeRec1 + var group = new CompositeDisposable(1); + var gate = new object(); + + Action recursiveAction = null; + recursiveAction = () => action(() => + { + var isAdded = false; + var isDone = false; + var d = default(IDisposable); + d = scheduler.Schedule(() => + { + lock (gate) + { + if (isAdded) + group.Remove(d); + else + isDone = true; + } + recursiveAction(); + }); + + lock (gate) + { + if (!isDone) + { + group.Add(d); + isAdded = true; + } + } + }); + + group.Add(scheduler.Schedule(recursiveAction)); + + return group; + } + + public static IDisposable Schedule(this IScheduler scheduler, TimeSpan dueTime, Action> action) + { + // InvokeRec2 + + var group = new CompositeDisposable(1); + var gate = new object(); + + Action recursiveAction = null; + recursiveAction = () => action(dt => + { + var isAdded = false; + var isDone = false; + var d = default(IDisposable); + d = scheduler.Schedule(dt, () => + { + lock (gate) + { + if (isAdded) + group.Remove(d); + else + isDone = true; + } + recursiveAction(); + }); + + lock (gate) + { + if (!isDone) + { + group.Add(d); + isAdded = true; + } + } + }); + + group.Add(scheduler.Schedule(dueTime, recursiveAction)); + + return group; + } + + public static IDisposable Schedule(this IScheduler scheduler, DateTimeOffset dueTime, Action> action) + { + // InvokeRec3 + + var group = new CompositeDisposable(1); + var gate = new object(); + + Action recursiveAction = null; + recursiveAction = () => action(dt => + { + var isAdded = false; + var isDone = false; + var d = default(IDisposable); + d = scheduler.Schedule(dt, () => + { + lock (gate) + { + if (isAdded) + group.Remove(d); + else + isDone = true; + } + recursiveAction(); + }); + + lock (gate) + { + if (!isDone) + { + group.Add(d); + isAdded = true; + } + } + }); + + group.Add(scheduler.Schedule(dueTime, recursiveAction)); + + return group; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs.meta new file mode 100644 index 00000000..1d2d1628 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/Scheduler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bfeb53a7ea29f714798ba6bb3bd70ba4 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs b/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs new file mode 100644 index 00000000..3a12b0ad --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs @@ -0,0 +1,197 @@ +#if !UNITY_METRO + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using UniRx.InternalUtil; + +namespace UniRx +{ + public static partial class Scheduler + { + public static readonly IScheduler ThreadPool = new ThreadPoolScheduler(); + + class ThreadPoolScheduler : IScheduler, ISchedulerPeriodic + { + public ThreadPoolScheduler() + { + } + + public DateTimeOffset Now + { + get { return Scheduler.Now; } + } + + public IDisposable Schedule(Action action) + { + var d = new BooleanDisposable(); + + System.Threading.ThreadPool.QueueUserWorkItem(_ => + { + if (!d.IsDisposed) + { + action(); + } + }); + + return d; + } + + public IDisposable Schedule(DateTimeOffset dueTime, Action action) + { + return Schedule(dueTime - Now, action); + } + + public IDisposable Schedule(TimeSpan dueTime, Action action) + { + return new Timer(dueTime, action); + } + + public IDisposable SchedulePeriodic(TimeSpan period, Action action) + { + return new PeriodicTimer(period, action); + } + + public void ScheduleQueueing(ICancelable cancel, T state, Action action) + { + System.Threading.ThreadPool.QueueUserWorkItem(callBackState => + { + if (!cancel.IsDisposed) + { + action((T)callBackState); + } + }, state); + } + + // timer was borrwed from Rx Official + + sealed class Timer : IDisposable + { + static readonly HashSet s_timers = new HashSet(); + + private readonly SingleAssignmentDisposable _disposable; + + private Action _action; + private System.Threading.Timer _timer; + + private bool _hasAdded; + private bool _hasRemoved; + + public Timer(TimeSpan dueTime, Action action) + { + _disposable = new SingleAssignmentDisposable(); + _disposable.Disposable = Disposable.Create(Unroot); + + _action = action; + _timer = new System.Threading.Timer(Tick, null, dueTime, TimeSpan.FromMilliseconds(System.Threading.Timeout.Infinite)); + + lock (s_timers) + { + if (!_hasRemoved) + { + s_timers.Add(_timer); + + _hasAdded = true; + } + } + } + + private void Tick(object state) + { + try + { + if (!_disposable.IsDisposed) + { + _action(); + } + } + finally + { + Unroot(); + } + } + + private void Unroot() + { + _action = Stubs.Nop; + + var timer = default(System.Threading.Timer); + + lock (s_timers) + { + if (!_hasRemoved) + { + timer = _timer; + _timer = null; + + if (_hasAdded && timer != null) + s_timers.Remove(timer); + + _hasRemoved = true; + } + } + + if (timer != null) + timer.Dispose(); + } + + public void Dispose() + { + _disposable.Dispose(); + } + } + + sealed class PeriodicTimer : IDisposable + { + static readonly HashSet s_timers = new HashSet(); + + private Action _action; + private System.Threading.Timer _timer; + private readonly AsyncLock _gate; + + public PeriodicTimer(TimeSpan period, Action action) + { + this._action = action; + this._timer = new System.Threading.Timer(Tick, null, period, period); + this._gate = new AsyncLock(); + + lock (s_timers) + { + s_timers.Add(_timer); + } + } + + private void Tick(object state) + { + _gate.Wait(() => + { + _action(); + }); + } + + public void Dispose() + { + var timer = default(System.Threading.Timer); + + lock (s_timers) + { + timer = _timer; + _timer = null; + + if (timer != null) + s_timers.Remove(timer); + } + + if (timer != null) + { + timer.Dispose(); + _action = Stubs.Nop; + } + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs.meta new file mode 100644 index 00000000..41a33c33 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Schedulers/ThreadPoolScheduler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f8189a60f4619be489df10eca6a78fbb +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Subjects.meta b/Assets/Plugins/UniRx/Scripts/Subjects.meta new file mode 100644 index 00000000..fca8e763 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 660d85cac8b3db241b8e6e333d493d38 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs b/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs new file mode 100644 index 00000000..98b3086b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs @@ -0,0 +1,328 @@ +using System; +using System.Collections.Generic; +using UniRx.InternalUtil; + +#if (NET_4_6 || NET_STANDARD_2_0) +using System.Runtime.CompilerServices; +using System.Threading; +#endif + +namespace UniRx +{ + public sealed class AsyncSubject : ISubject, IOptimizedObservable, IDisposable +#if (NET_4_6 || NET_STANDARD_2_0) + , INotifyCompletion +#endif + { + object observerLock = new object(); + + T lastValue; + bool hasValue; + bool isStopped; + bool isDisposed; + Exception lastError; + IObserver outObserver = EmptyObserver.Instance; + + public T Value + { + get + { + ThrowIfDisposed(); + if (!isStopped) throw new InvalidOperationException("AsyncSubject is not completed yet"); + if (lastError != null) lastError.Throw(); + return lastValue; + } + } + + public bool HasObservers + { + get + { + return !(outObserver is EmptyObserver) && !isStopped && !isDisposed; + } + } + + public bool IsCompleted { get { return isStopped; } } + + public void OnCompleted() + { + IObserver old; + T v; + bool hv; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + old = outObserver; + outObserver = EmptyObserver.Instance; + isStopped = true; + v = lastValue; + hv = hasValue; + } + + if (hv) + { + old.OnNext(v); + old.OnCompleted(); + } + else + { + old.OnCompleted(); + } + } + + public void OnError(Exception error) + { + if (error == null) throw new ArgumentNullException("error"); + + IObserver old; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + old = outObserver; + outObserver = EmptyObserver.Instance; + isStopped = true; + lastError = error; + } + + old.OnError(error); + } + + public void OnNext(T value) + { + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + this.hasValue = true; + this.lastValue = value; + } + } + + public IDisposable Subscribe(IObserver observer) + { + if (observer == null) throw new ArgumentNullException("observer"); + + var ex = default(Exception); + var v = default(T); + var hv = false; + + lock (observerLock) + { + ThrowIfDisposed(); + if (!isStopped) + { + var listObserver = outObserver as ListObserver; + if (listObserver != null) + { + outObserver = listObserver.Add(observer); + } + else + { + var current = outObserver; + if (current is EmptyObserver) + { + outObserver = observer; + } + else + { + outObserver = new ListObserver(new ImmutableList>(new[] { current, observer })); + } + } + + return new Subscription(this, observer); + } + + ex = lastError; + v = lastValue; + hv = hasValue; + } + + if (ex != null) + { + observer.OnError(ex); + } + else if (hv) + { + observer.OnNext(v); + observer.OnCompleted(); + } + else + { + observer.OnCompleted(); + } + + return Disposable.Empty; + } + + public void Dispose() + { + lock (observerLock) + { + isDisposed = true; + outObserver = DisposedObserver.Instance; + lastError = null; + lastValue = default(T); + } + } + + void ThrowIfDisposed() + { + if (isDisposed) throw new ObjectDisposedException(""); + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + class Subscription : IDisposable + { + readonly object gate = new object(); + AsyncSubject parent; + IObserver unsubscribeTarget; + + public Subscription(AsyncSubject parent, IObserver unsubscribeTarget) + { + this.parent = parent; + this.unsubscribeTarget = unsubscribeTarget; + } + + public void Dispose() + { + lock (gate) + { + if (parent != null) + { + lock (parent.observerLock) + { + var listObserver = parent.outObserver as ListObserver; + if (listObserver != null) + { + parent.outObserver = listObserver.Remove(unsubscribeTarget); + } + else + { + parent.outObserver = EmptyObserver.Instance; + } + + unsubscribeTarget = null; + parent = null; + } + } + } + } + } + + +#if (NET_4_6 || NET_STANDARD_2_0) + + /// + /// Gets an awaitable object for the current AsyncSubject. + /// + /// Object that can be awaited. + public AsyncSubject GetAwaiter() + { + return this; + } + + /// + /// Specifies a callback action that will be invoked when the subject completes. + /// + /// Callback action that will be invoked when the subject completes. + /// is null. + public void OnCompleted(Action continuation) + { + if (continuation == null) + throw new ArgumentNullException("continuation"); + + OnCompleted(continuation, true); + } + + void OnCompleted(Action continuation, bool originalContext) + { + // + // [OK] Use of unsafe Subscribe: this type's Subscribe implementation is safe. + // + this.Subscribe/*Unsafe*/(new AwaitObserver(continuation, originalContext)); + } + + class AwaitObserver : IObserver + { + private readonly SynchronizationContext _context; + private readonly Action _callback; + + public AwaitObserver(Action callback, bool originalContext) + { + if (originalContext) + _context = SynchronizationContext.Current; + + _callback = callback; + } + + public void OnCompleted() + { + InvokeOnOriginalContext(); + } + + public void OnError(Exception error) + { + InvokeOnOriginalContext(); + } + + public void OnNext(T value) + { + } + + private void InvokeOnOriginalContext() + { + if (_context != null) + { + // + // No need for OperationStarted and OperationCompleted calls here; + // this code is invoked through await support and will have a way + // to observe its start/complete behavior, either through returned + // Task objects or the async method builder's interaction with the + // SynchronizationContext object. + // + _context.Post(c => ((Action)c)(), _callback); + } + else + { + _callback(); + } + } + } + + /// + /// Gets the last element of the subject, potentially blocking until the subject completes successfully or exceptionally. + /// + /// The last element of the subject. Throws an InvalidOperationException if no element was received. + /// The source sequence is empty. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Await pattern for C# and VB compilers.")] + public T GetResult() + { + if (!isStopped) + { + var e = new ManualResetEvent(false); + OnCompleted(() => e.Set(), false); + e.WaitOne(); + } + + if (lastError != null) + { + lastError.Throw(); + } + + if (!hasValue) + throw new InvalidOperationException("NO_ELEMENTS"); + + return lastValue; + } +#endif + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs.meta new file mode 100644 index 00000000..77e6ed2f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/AsyncSubject.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 137cd44250b484d4ba2390d510f8423f +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs b/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs new file mode 100644 index 00000000..028c7833 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs @@ -0,0 +1,204 @@ +using System; +using UniRx.InternalUtil; + +namespace UniRx +{ + public sealed class BehaviorSubject : ISubject, IDisposable, IOptimizedObservable + { + object observerLock = new object(); + + bool isStopped; + bool isDisposed; + T lastValue; + Exception lastError; + IObserver outObserver = EmptyObserver.Instance; + + public BehaviorSubject(T defaultValue) + { + lastValue = defaultValue; + } + + public T Value + { + get + { + ThrowIfDisposed(); + if (lastError != null) lastError.Throw(); + return lastValue; + } + } + + public bool HasObservers + { + get + { + return !(outObserver is EmptyObserver) && !isStopped && !isDisposed; + } + } + + public void OnCompleted() + { + IObserver old; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + old = outObserver; + outObserver = EmptyObserver.Instance; + isStopped = true; + } + + old.OnCompleted(); + } + + public void OnError(Exception error) + { + if (error == null) throw new ArgumentNullException("error"); + + IObserver old; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + old = outObserver; + outObserver = EmptyObserver.Instance; + isStopped = true; + lastError = error; + } + + old.OnError(error); + } + + public void OnNext(T value) + { + IObserver current; + lock (observerLock) + { + if (isStopped) return; + + lastValue = value; + current = outObserver; + } + + current.OnNext(value); + } + + public IDisposable Subscribe(IObserver observer) + { + if (observer == null) throw new ArgumentNullException("observer"); + + var ex = default(Exception); + var v = default(T); + var subscription = default(Subscription); + + lock (observerLock) + { + ThrowIfDisposed(); + if (!isStopped) + { + var listObserver = outObserver as ListObserver; + if (listObserver != null) + { + outObserver = listObserver.Add(observer); + } + else + { + var current = outObserver; + if (current is EmptyObserver) + { + outObserver = observer; + } + else + { + outObserver = new ListObserver(new ImmutableList>(new[] { current, observer })); + } + } + + v = lastValue; + subscription = new Subscription(this, observer); + } + else + { + ex = lastError; + } + } + + if (subscription != null) + { + observer.OnNext(v); + return subscription; + } + else if (ex != null) + { + observer.OnError(ex); + } + else + { + observer.OnCompleted(); + } + + return Disposable.Empty; + } + + public void Dispose() + { + lock (observerLock) + { + isDisposed = true; + outObserver = DisposedObserver.Instance; + lastError = null; + lastValue = default(T); + } + } + + void ThrowIfDisposed() + { + if (isDisposed) throw new ObjectDisposedException(""); + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + class Subscription : IDisposable + { + readonly object gate = new object(); + BehaviorSubject parent; + IObserver unsubscribeTarget; + + public Subscription(BehaviorSubject parent, IObserver unsubscribeTarget) + { + this.parent = parent; + this.unsubscribeTarget = unsubscribeTarget; + } + + public void Dispose() + { + lock (gate) + { + if (parent != null) + { + lock (parent.observerLock) + { + var listObserver = parent.outObserver as ListObserver; + if (listObserver != null) + { + parent.outObserver = listObserver.Remove(unsubscribeTarget); + } + else + { + parent.outObserver = EmptyObserver.Instance; + } + + unsubscribeTarget = null; + parent = null; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs.meta new file mode 100644 index 00000000..40ab73fe --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/BehaviorSubject.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2fa461d2fc0c4ec4999e0b9aff16dd47 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs b/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs new file mode 100644 index 00000000..63862cb0 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs @@ -0,0 +1,71 @@ +using System; + +namespace UniRx +{ + public interface IConnectableObservable : IObservable + { + IDisposable Connect(); + } + + public static partial class Observable + { + class ConnectableObservable : IConnectableObservable + { + readonly IObservable source; + readonly ISubject subject; + readonly object gate = new object(); + Connection connection; + + public ConnectableObservable(IObservable source, ISubject subject) + { + this.source = source.AsObservable(); + this.subject = subject; + } + + public IDisposable Connect() + { + lock (gate) + { + // don't subscribe twice + if (connection == null) + { + var subscription = source.Subscribe(subject); + connection = new Connection(this, subscription); + } + + return connection; + } + } + + public IDisposable Subscribe(IObserver observer) + { + return subject.Subscribe(observer); + } + + class Connection : IDisposable + { + readonly ConnectableObservable parent; + IDisposable subscription; + + public Connection(ConnectableObservable parent, IDisposable subscription) + { + this.parent = parent; + this.subscription = subscription; + } + + public void Dispose() + { + lock (parent.gate) + { + if (subscription != null) + { + subscription.Dispose(); + subscription = null; + parent.connection = null; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs.meta new file mode 100644 index 00000000..c6a0404e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ConnectableObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8de419b467eded246bc4fc5e70859f73 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs b/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs new file mode 100644 index 00000000..4d33f188 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace UniRx +{ + public interface ISubject : IObserver, IObservable + { + } + + public interface ISubject : ISubject, IObserver, IObservable + { + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs.meta new file mode 100644 index 00000000..bad4695a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ISubject.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e9dbcd28e4f3965408744e0ee03b7bc8 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs b/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs new file mode 100644 index 00000000..59d0cb69 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs @@ -0,0 +1,251 @@ +using System; +using System.Collections.Generic; +using UniRx.InternalUtil; + +namespace UniRx +{ + public sealed class ReplaySubject : ISubject, IOptimizedObservable, IDisposable + { + object observerLock = new object(); + + bool isStopped; + bool isDisposed; + Exception lastError; + IObserver outObserver = EmptyObserver.Instance; + + readonly int bufferSize; + readonly TimeSpan window; + readonly DateTimeOffset startTime; + readonly IScheduler scheduler; + Queue> queue = new Queue>(); + + + public ReplaySubject() + : this(int.MaxValue, TimeSpan.MaxValue, Scheduler.DefaultSchedulers.Iteration) + { + } + + public ReplaySubject(IScheduler scheduler) + : this(int.MaxValue, TimeSpan.MaxValue, scheduler) + { + } + + public ReplaySubject(int bufferSize) + : this(bufferSize, TimeSpan.MaxValue, Scheduler.DefaultSchedulers.Iteration) + { + } + + public ReplaySubject(int bufferSize, IScheduler scheduler) + : this(bufferSize, TimeSpan.MaxValue, scheduler) + { + } + + public ReplaySubject(TimeSpan window) + : this(int.MaxValue, window, Scheduler.DefaultSchedulers.Iteration) + { + } + + public ReplaySubject(TimeSpan window, IScheduler scheduler) + : this(int.MaxValue, window, scheduler) + { + } + + // full constructor + public ReplaySubject(int bufferSize, TimeSpan window, IScheduler scheduler) + { + if (bufferSize < 0) throw new ArgumentOutOfRangeException("bufferSize"); + if (window < TimeSpan.Zero) throw new ArgumentOutOfRangeException("window"); + if (scheduler == null) throw new ArgumentNullException("scheduler"); + + this.bufferSize = bufferSize; + this.window = window; + this.scheduler = scheduler; + startTime = scheduler.Now; + } + + void Trim() + { + var elapsedTime = Scheduler.Normalize(scheduler.Now - startTime); + + while (queue.Count > bufferSize) + { + queue.Dequeue(); + } + while (queue.Count > 0 && elapsedTime.Subtract(queue.Peek().Interval).CompareTo(window) > 0) + { + queue.Dequeue(); + } + } + + public void OnCompleted() + { + IObserver old; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + old = outObserver; + outObserver = EmptyObserver.Instance; + isStopped = true; + Trim(); + } + + old.OnCompleted(); + } + + public void OnError(Exception error) + { + if (error == null) throw new ArgumentNullException("error"); + + IObserver old; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + old = outObserver; + outObserver = EmptyObserver.Instance; + isStopped = true; + lastError = error; + Trim(); + } + + old.OnError(error); + } + + public void OnNext(T value) + { + IObserver current; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + // enQ + queue.Enqueue(new TimeInterval(value, scheduler.Now - startTime)); + Trim(); + + current = outObserver; + } + + current.OnNext(value); + } + + public IDisposable Subscribe(IObserver observer) + { + if (observer == null) throw new ArgumentNullException("observer"); + + var ex = default(Exception); + var subscription = default(Subscription); + + lock (observerLock) + { + ThrowIfDisposed(); + if (!isStopped) + { + var listObserver = outObserver as ListObserver; + if (listObserver != null) + { + outObserver = listObserver.Add(observer); + } + else + { + var current = outObserver; + if (current is EmptyObserver) + { + outObserver = observer; + } + else + { + outObserver = new ListObserver(new ImmutableList>(new[] { current, observer })); + } + } + + subscription = new Subscription(this, observer); + } + + ex = lastError; + Trim(); + foreach (var item in queue) + { + observer.OnNext(item.Value); + } + } + + if (subscription != null) + { + return subscription; + } + else if (ex != null) + { + observer.OnError(ex); + } + else + { + observer.OnCompleted(); + } + + return Disposable.Empty; + } + + public void Dispose() + { + lock (observerLock) + { + isDisposed = true; + outObserver = DisposedObserver.Instance; + lastError = null; + queue = null; + } + } + + void ThrowIfDisposed() + { + if (isDisposed) throw new ObjectDisposedException(""); + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + class Subscription : IDisposable + { + readonly object gate = new object(); + ReplaySubject parent; + IObserver unsubscribeTarget; + + public Subscription(ReplaySubject parent, IObserver unsubscribeTarget) + { + this.parent = parent; + this.unsubscribeTarget = unsubscribeTarget; + } + + public void Dispose() + { + lock (gate) + { + if (parent != null) + { + lock (parent.observerLock) + { + var listObserver = parent.outObserver as ListObserver; + if (listObserver != null) + { + parent.outObserver = listObserver.Remove(unsubscribeTarget); + } + else + { + parent.outObserver = EmptyObserver.Instance; + } + + unsubscribeTarget = null; + parent = null; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs.meta new file mode 100644 index 00000000..057102ad --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/ReplaySubject.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d9b0c2f29645e1f468259893bf9afb68 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs b/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs new file mode 100644 index 00000000..8fa7df1d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UniRx.InternalUtil; + +namespace UniRx +{ + public sealed class Subject : ISubject, IDisposable, IOptimizedObservable + { + object observerLock = new object(); + + bool isStopped; + bool isDisposed; + Exception lastError; + IObserver outObserver = EmptyObserver.Instance; + + public bool HasObservers + { + get + { + return !(outObserver is EmptyObserver) && !isStopped && !isDisposed; + } + } + + public void OnCompleted() + { + IObserver old; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + old = outObserver; + outObserver = EmptyObserver.Instance; + isStopped = true; + } + + old.OnCompleted(); + } + + public void OnError(Exception error) + { + if (error == null) throw new ArgumentNullException("error"); + + IObserver old; + lock (observerLock) + { + ThrowIfDisposed(); + if (isStopped) return; + + old = outObserver; + outObserver = EmptyObserver.Instance; + isStopped = true; + lastError = error; + } + + old.OnError(error); + } + + public void OnNext(T value) + { + outObserver.OnNext(value); + } + + public IDisposable Subscribe(IObserver observer) + { + if (observer == null) throw new ArgumentNullException("observer"); + + var ex = default(Exception); + + lock (observerLock) + { + ThrowIfDisposed(); + if (!isStopped) + { + var listObserver = outObserver as ListObserver; + if (listObserver != null) + { + outObserver = listObserver.Add(observer); + } + else + { + var current = outObserver; + if (current is EmptyObserver) + { + outObserver = observer; + } + else + { + outObserver = new ListObserver(new ImmutableList>(new[] { current, observer })); + } + } + + return new Subscription(this, observer); + } + + ex = lastError; + } + + if (ex != null) + { + observer.OnError(ex); + } + else + { + observer.OnCompleted(); + } + + return Disposable.Empty; + } + + public void Dispose() + { + lock (observerLock) + { + isDisposed = true; + outObserver = DisposedObserver.Instance; + } + } + + void ThrowIfDisposed() + { + if (isDisposed) throw new ObjectDisposedException(""); + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + + class Subscription : IDisposable + { + readonly object gate = new object(); + Subject parent; + IObserver unsubscribeTarget; + + public Subscription(Subject parent, IObserver unsubscribeTarget) + { + this.parent = parent; + this.unsubscribeTarget = unsubscribeTarget; + } + + public void Dispose() + { + lock (gate) + { + if (parent != null) + { + lock (parent.observerLock) + { + var listObserver = parent.outObserver as ListObserver; + if (listObserver != null) + { + parent.outObserver = listObserver.Remove(unsubscribeTarget); + } + else + { + parent.outObserver = EmptyObserver.Instance; + } + + unsubscribeTarget = null; + parent = null; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs.meta new file mode 100644 index 00000000..cb6358fd --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d5fdc90caca9cbe4b9cd9c3fae81e7f6 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs b/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs new file mode 100644 index 00000000..4cbc9a73 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs @@ -0,0 +1,61 @@ +using System; + +namespace UniRx +{ + public static class SubjectExtensions + { + public static ISubject Synchronize(this ISubject subject) + { + return new AnonymousSubject((subject as IObserver).Synchronize(), subject); + } + + public static ISubject Synchronize(this ISubject subject, object gate) + { + return new AnonymousSubject((subject as IObserver).Synchronize(gate), subject); + } + + class AnonymousSubject : ISubject + { + readonly IObserver observer; + readonly IObservable observable; + + public AnonymousSubject(IObserver observer, IObservable observable) + { + this.observer = observer; + this.observable = observable; + } + + public void OnCompleted() + { + observer.OnCompleted(); + } + + public void OnError(Exception error) + { + if (error == null) throw new ArgumentNullException("error"); + + observer.OnError(error); + } + + public void OnNext(T value) + { + observer.OnNext(value); + } + + public IDisposable Subscribe(IObserver observer) + { + if (observer == null) throw new ArgumentNullException("observer"); + + return observable.Subscribe(observer); + } + } + + class AnonymousSubject : AnonymousSubject, ISubject + { + public AnonymousSubject(IObserver observer, IObservable observable) + : base(observer, observable) + { + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs.meta new file mode 100644 index 00000000..ec21501b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Subjects/SubjectExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 359bf19588606a14fb0edc6efa97deaf +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/System.meta b/Assets/Plugins/UniRx/Scripts/System.meta new file mode 100644 index 00000000..2a9a64fa --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e38b8fd0fa968d0438280dbb22012b81 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/System/IObservable.cs b/Assets/Plugins/UniRx/Scripts/System/IObservable.cs new file mode 100644 index 00000000..77516f58 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/IObservable.cs @@ -0,0 +1,23 @@ +// defined from .NET Framework 4.0 and NETFX_CORE + +using System; + +#if !(NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0) + +namespace UniRx +{ + public interface IObservable + { + IDisposable Subscribe(IObserver observer); + } +} + +#endif + +namespace UniRx +{ + public interface IGroupedObservable : IObservable + { + TKey Key { get; } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/System/IObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/System/IObservable.cs.meta new file mode 100644 index 00000000..f5438014 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/IObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9703f7aad3c6b334badd37c1b41d0d8f +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/System/IObserver.cs b/Assets/Plugins/UniRx/Scripts/System/IObserver.cs new file mode 100644 index 00000000..bbc213f1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/IObserver.cs @@ -0,0 +1,17 @@ +// defined from .NET Framework 4.0 and NETFX_CORE + +#if !(NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0) + +using System; + +namespace UniRx +{ + public interface IObserver + { + void OnCompleted(); + void OnError(Exception error); + void OnNext(T value); + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/System/IObserver.cs.meta b/Assets/Plugins/UniRx/Scripts/System/IObserver.cs.meta new file mode 100644 index 00000000..82af2d2b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/IObserver.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1fc7a9cec9d3b644da7dbcf18ea16270 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs b/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs new file mode 100644 index 00000000..124e4a0d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs @@ -0,0 +1,27 @@ +using System; + +namespace UniRx +{ + public interface IOptimizedObservable : IObservable + { + bool IsRequiredSubscribeOnCurrentThread(); + } + + public static class OptimizedObservableExtensions + { + public static bool IsRequiredSubscribeOnCurrentThread(this IObservable source) + { + var obs = source as IOptimizedObservable; + if (obs == null) return true; + + return obs.IsRequiredSubscribeOnCurrentThread(); + } + + public static bool IsRequiredSubscribeOnCurrentThread(this IObservable source, IScheduler scheduler) + { + if (scheduler == Scheduler.CurrentThread) return true; + + return IsRequiredSubscribeOnCurrentThread(source); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs.meta b/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs.meta new file mode 100644 index 00000000..c3dfcfd8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/IOptimizedObservable.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5a2d3a7c73260e14a875d62586ae28f9 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/System/IProgress.cs b/Assets/Plugins/UniRx/Scripts/System/IProgress.cs new file mode 100644 index 00000000..7764ec7c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/IProgress.cs @@ -0,0 +1,30 @@ +// defined from .NET Framework 4.5 and NETFX_CORE + +#if !(NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0) + +using System; + +namespace UniRx +{ + public interface IProgress + { + void Report(T value); + } + + public class Progress : IProgress + { + readonly Action report; + + public Progress(Action report) + { + this.report = report; + } + + public void Report(T value) + { + report(value); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/System/IProgress.cs.meta b/Assets/Plugins/UniRx/Scripts/System/IProgress.cs.meta new file mode 100644 index 00000000..7f866940 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/IProgress.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a38a024b6babf8d48b7e32f2f8fb8686 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/System/Tuple.cs b/Assets/Plugins/UniRx/Scripts/System/Tuple.cs new file mode 100644 index 00000000..47e04e1b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/Tuple.cs @@ -0,0 +1,1195 @@ +// defined from .NET Framework 4.0 and NETFX_CORE +// This code is basaed from mono/mcs, but some performance modified +// 1. class to struct +// 2. implements IEquatable + +// note, we need to create ValueTuple or UniRxTuple... +#if !(NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0) + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace UniRx +{ + public interface IStructuralEquatable + { + bool Equals(object other, IEqualityComparer comparer); + + int GetHashCode(IEqualityComparer comparer); + } + + public interface IStructuralComparable + { + int CompareTo(object other, IComparer comparer); + } + + interface ITuple + { + string ToString(); + } + + public static class Tuple + { + public static Tuple> Create + ( + T1 item1, + T2 item2, + T3 item3, + T4 item4, + T5 item5, + T6 item6, + T7 item7, + T8 item8) + { + return new Tuple>(item1, item2, item3, item4, item5, item6, item7, new Tuple(item8)); + } + + public static Tuple Create + ( + T1 item1, + T2 item2, + T3 item3, + T4 item4, + T5 item5, + T6 item6, + T7 item7) + { + return new Tuple(item1, item2, item3, item4, item5, item6, item7); + } + + public static Tuple Create + ( + T1 item1, + T2 item2, + T3 item3, + T4 item4, + T5 item5, + T6 item6) + { + return new Tuple(item1, item2, item3, item4, item5, item6); + } + + public static Tuple Create + ( + T1 item1, + T2 item2, + T3 item3, + T4 item4, + T5 item5) + { + return new Tuple(item1, item2, item3, item4, item5); + } + + public static Tuple Create + ( + T1 item1, + T2 item2, + T3 item3, + T4 item4) + { + return new Tuple(item1, item2, item3, item4); + } + + public static Tuple Create + ( + T1 item1, + T2 item2, + T3 item3) + { + return new Tuple(item1, item2, item3); + } + + public static Tuple Create + ( + T1 item1, + T2 item2) + { + return new Tuple(item1, item2); + } + + public static Tuple Create + ( + T1 item1) + { + return new Tuple(item1); + } + } + + public partial class Tuple + { + public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) + { + this.item1 = item1; + this.item2 = item2; + this.item3 = item3; + this.item4 = item4; + this.item5 = item5; + this.item6 = item6; + this.item7 = item7; + this.rest = rest; + + if (!(rest is ITuple)) + throw new ArgumentException("rest", "The last element of an eight element tuple must be a Tuple."); + } + } + + [Serializable] + public struct Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple, IEquatable> + { + T1 item1; + + public Tuple(T1 item1) + { + this.item1 = item1; + } + + public T1 Item1 + { + get { return item1; } + } + + int IComparable.CompareTo(object obj) + { + return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); + } + + int IStructuralComparable.CompareTo(object other, IComparer comparer) + { + if (other == null) return 1; + if (!(other is Tuple)) + { + throw new ArgumentException("other"); + } + var t = (Tuple)other; + return comparer.Compare(item1, t.item1); + } + + public override bool Equals(object obj) + { + return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); + } + + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) + { + if (!(other is Tuple)) + return false; + + var t = (Tuple)other; + return comparer.Equals(item1, t.item1); + } + + public override int GetHashCode() + { + return EqualityComparer.Default.GetHashCode(item1); + } + + int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) + { + return comparer.GetHashCode(item1); + } + + string ITuple.ToString() + { + return String.Format("{0}", item1); + } + + public override string ToString() + { + return "(" + ((ITuple)this).ToString() + ")"; + } + + public bool Equals(Tuple other) + { + return EqualityComparer.Default.Equals(item1, other.item1); + } + } + + [Serializable] + public struct Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple, IEquatable> + { + T1 item1; + T2 item2; + + public Tuple(T1 item1, T2 item2) + { + this.item1 = item1; + this.item2 = item2; + } + + public T1 Item1 + { + get { return item1; } + } + + public T2 Item2 + { + get { return item2; } + } + + int IComparable.CompareTo(object obj) + { + return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); + } + + int IStructuralComparable.CompareTo(object other, IComparer comparer) + { + if (other == null) return 1; + if (!(other is Tuple)) + { + throw new ArgumentException("other"); + } + var t = (Tuple)other; + + int res = comparer.Compare(item1, t.item1); + if (res != 0) return res; + return comparer.Compare(item2, t.item2); + } + + public override bool Equals(object obj) + { + return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); + } + + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) + { + if (!(other is Tuple)) + return false; + + var t = (Tuple)other; + return comparer.Equals(item1, t.item1) && + comparer.Equals(item2, t.item2); + } + + public override int GetHashCode() + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + + int h0; + h0 = comparer1.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer2.GetHashCode(item2); + return h0; + } + + int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) + { + int h0; + h0 = comparer.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item2); + return h0; + } + + string ITuple.ToString() + { + return String.Format("{0}, {1}", item1, item2); + } + + public override string ToString() + { + return "(" + ((ITuple)this).ToString() + ")"; + } + + public bool Equals(Tuple other) + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + + return comparer1.Equals(item1, other.item1) && + comparer2.Equals(item2, other.item2); + } + } + + [Serializable] + public struct Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple, IEquatable> + { + T1 item1; + T2 item2; + T3 item3; + + public Tuple(T1 item1, T2 item2, T3 item3) + { + this.item1 = item1; + this.item2 = item2; + this.item3 = item3; + } + + public T1 Item1 + { + get { return item1; } + } + + public T2 Item2 + { + get { return item2; } + } + + public T3 Item3 + { + get { return item3; } + } + + int IComparable.CompareTo(object obj) + { + return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); + } + + int IStructuralComparable.CompareTo(object other, IComparer comparer) + { + if (other == null) return 1; + if (!(other is Tuple)) + { + throw new ArgumentException("other"); + } + var t = (Tuple)other; + + int res = comparer.Compare(item1, t.item1); + if (res != 0) return res; + res = comparer.Compare(item2, t.item2); + if (res != 0) return res; + return comparer.Compare(item3, t.item3); + } + + public override bool Equals(object obj) + { + return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); + } + + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) + { + if (!(other is Tuple)) + return false; + + var t = (Tuple)other; + return comparer.Equals(item1, t.item1) && + comparer.Equals(item2, t.item2) && + comparer.Equals(item3, t.item3); + } + + public override int GetHashCode() + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + + int h0; + h0 = comparer1.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer2.GetHashCode(item2); + h0 = (h0 << 5) + h0 ^ comparer3.GetHashCode(item3); + return h0; + } + + int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) + { + int h0; + h0 = comparer.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item2); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item3); + return h0; + } + + string ITuple.ToString() + { + return String.Format("{0}, {1}, {2}", item1, item2, item3); + } + + public override string ToString() + { + return "(" + ((ITuple)this).ToString() + ")"; + } + + public bool Equals(Tuple other) + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + + return comparer1.Equals(item1, other.item1) && + comparer2.Equals(item2, other.item2) && + comparer3.Equals(item3, other.item3); + } + } + + [Serializable] + public struct Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple, IEquatable> + { + T1 item1; + T2 item2; + T3 item3; + T4 item4; + + public Tuple(T1 item1, T2 item2, T3 item3, T4 item4) + { + this.item1 = item1; + this.item2 = item2; + this.item3 = item3; + this.item4 = item4; + } + + public T1 Item1 + { + get { return item1; } + } + + public T2 Item2 + { + get { return item2; } + } + + public T3 Item3 + { + get { return item3; } + } + + public T4 Item4 + { + get { return item4; } + } + + int IComparable.CompareTo(object obj) + { + return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); + } + + int IStructuralComparable.CompareTo(object other, IComparer comparer) + { + if (other == null) return 1; + if (!(other is Tuple)) + { + throw new ArgumentException("other"); + } + var t = (Tuple)other; + + int res = comparer.Compare(item1, t.item1); + if (res != 0) return res; + res = comparer.Compare(item2, t.item2); + if (res != 0) return res; + res = comparer.Compare(item3, t.item3); + if (res != 0) return res; + return comparer.Compare(item4, t.item4); + } + + public override bool Equals(object obj) + { + return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); + } + + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) + { + if (!(other is Tuple)) + return false; + var t = (Tuple)other; + + return comparer.Equals(item1, t.item1) && + comparer.Equals(item2, t.item2) && + comparer.Equals(item3, t.item3) && + comparer.Equals(item4, t.item4); + } + + public override int GetHashCode() + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + + int h0, h1; + h0 = comparer1.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer2.GetHashCode(item2); + h1 = comparer3.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer4.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + return h0; + } + + int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) + { + int h0, h1; + h0 = comparer.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item2); + h1 = comparer.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + return h0; + } + + string ITuple.ToString() + { + return String.Format("{0}, {1}, {2}, {3}", item1, item2, item3, item4); + } + + public override string ToString() + { + return "(" + ((ITuple)this).ToString() + ")"; + } + + public bool Equals(Tuple other) + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + + return comparer1.Equals(item1, other.item1) && + comparer2.Equals(item2, other.item2) && + comparer3.Equals(item3, other.item3) && + comparer4.Equals(item4, other.item4); + } + } + + [Serializable] + public struct Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple, IEquatable> + { + T1 item1; + T2 item2; + T3 item3; + T4 item4; + T5 item5; + + public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) + { + this.item1 = item1; + this.item2 = item2; + this.item3 = item3; + this.item4 = item4; + this.item5 = item5; + } + + public T1 Item1 + { + get { return item1; } + } + + public T2 Item2 + { + get { return item2; } + } + + public T3 Item3 + { + get { return item3; } + } + + public T4 Item4 + { + get { return item4; } + } + + public T5 Item5 + { + get { return item5; } + } + + int IComparable.CompareTo(object obj) + { + return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); + } + + int IStructuralComparable.CompareTo(object other, IComparer comparer) + { + if (other == null) return 1; + if (!(other is Tuple)) + { + throw new ArgumentException("other"); + } + var t = (Tuple)other; + + int res = comparer.Compare(item1, t.item1); + if (res != 0) return res; + res = comparer.Compare(item2, t.item2); + if (res != 0) return res; + res = comparer.Compare(item3, t.item3); + if (res != 0) return res; + res = comparer.Compare(item4, t.item4); + if (res != 0) return res; + return comparer.Compare(item5, t.item5); + } + + public override bool Equals(object obj) + { + return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); + } + + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) + { + if (!(other is Tuple)) + return false; + var t = (Tuple)other; + + return comparer.Equals(item1, t.item1) && + comparer.Equals(item2, t.item2) && + comparer.Equals(item3, t.item3) && + comparer.Equals(item4, t.item4) && + comparer.Equals(item5, t.item5); + } + + public override int GetHashCode() + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + var comparer5 = EqualityComparer.Default; + + int h0, h1; + h0 = comparer1.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer2.GetHashCode(item2); + h1 = comparer3.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer4.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + h0 = (h0 << 5) + h0 ^ comparer5.GetHashCode(item5); + return h0; + } + + int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) + { + int h0, h1; + h0 = comparer.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item2); + h1 = comparer.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item5); + return h0; + } + + string ITuple.ToString() + { + return String.Format("{0}, {1}, {2}, {3}, {4}", item1, item2, item3, item4, item5); + } + + public override string ToString() + { + return "(" + ((ITuple)this).ToString() + ")"; + } + + public bool Equals(Tuple other) + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + var comparer5 = EqualityComparer.Default; + + return comparer1.Equals(item1, other.Item1) && + comparer2.Equals(item2, other.Item2) && + comparer3.Equals(item3, other.Item3) && + comparer4.Equals(item4, other.Item4) && + comparer5.Equals(item5, other.Item5); + } + } + + [Serializable] + public struct Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple, IEquatable> + { + T1 item1; + T2 item2; + T3 item3; + T4 item4; + T5 item5; + T6 item6; + + public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) + { + this.item1 = item1; + this.item2 = item2; + this.item3 = item3; + this.item4 = item4; + this.item5 = item5; + this.item6 = item6; + } + + public T1 Item1 + { + get { return item1; } + } + + public T2 Item2 + { + get { return item2; } + } + + public T3 Item3 + { + get { return item3; } + } + + public T4 Item4 + { + get { return item4; } + } + + public T5 Item5 + { + get { return item5; } + } + + public T6 Item6 + { + get { return item6; } + } + + int IComparable.CompareTo(object obj) + { + return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); + } + + int IStructuralComparable.CompareTo(object other, IComparer comparer) + { + if (other == null) return 1; + if (!(other is Tuple)) + { + throw new ArgumentException("other"); + } + var t = (Tuple)other; + + int res = comparer.Compare(item1, t.item1); + if (res != 0) return res; + res = comparer.Compare(item2, t.item2); + if (res != 0) return res; + res = comparer.Compare(item3, t.item3); + if (res != 0) return res; + res = comparer.Compare(item4, t.item4); + if (res != 0) return res; + res = comparer.Compare(item5, t.item5); + if (res != 0) return res; + return comparer.Compare(item6, t.item6); + } + + public override bool Equals(object obj) + { + return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); + } + + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) + { + if (!(other is Tuple)) + return false; + var t = (Tuple)other; + + return comparer.Equals(item1, t.item1) && + comparer.Equals(item2, t.item2) && + comparer.Equals(item3, t.item3) && + comparer.Equals(item4, t.item4) && + comparer.Equals(item5, t.item5) && + comparer.Equals(item6, t.item6); + } + + public override int GetHashCode() + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + var comparer5 = EqualityComparer.Default; + var comparer6 = EqualityComparer.Default; + + int h0, h1; + h0 = comparer1.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer2.GetHashCode(item2); + h1 = comparer3.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer4.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + h1 = comparer5.GetHashCode(item5); + h1 = (h1 << 5) + h1 ^ comparer6.GetHashCode(item6); + h0 = (h0 << 5) + h0 ^ h1; + return h0; + } + + int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) + { + int h0, h1; + h0 = comparer.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item2); + h1 = comparer.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + h1 = comparer.GetHashCode(item5); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item6); + h0 = (h0 << 5) + h0 ^ h1; + return h0; + } + + string ITuple.ToString() + { + return String.Format("{0}, {1}, {2}, {3}, {4}, {5}", item1, item2, item3, item4, item5, item6); + } + + public override string ToString() + { + return "(" + ((ITuple)this).ToString() + ")"; + } + + public bool Equals(Tuple other) + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + var comparer5 = EqualityComparer.Default; + var comparer6 = EqualityComparer.Default; + + return comparer1.Equals(item1, other.Item1) && + comparer2.Equals(item2, other.Item2) && + comparer3.Equals(item3, other.Item3) && + comparer4.Equals(item4, other.Item4) && + comparer5.Equals(item5, other.Item5) && + comparer6.Equals(item6, other.Item6); + } + } + + [Serializable] + public struct Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple, IEquatable> + { + T1 item1; + T2 item2; + T3 item3; + T4 item4; + T5 item5; + T6 item6; + T7 item7; + + public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) + { + this.item1 = item1; + this.item2 = item2; + this.item3 = item3; + this.item4 = item4; + this.item5 = item5; + this.item6 = item6; + this.item7 = item7; + } + + public T1 Item1 + { + get { return item1; } + } + + public T2 Item2 + { + get { return item2; } + } + + public T3 Item3 + { + get { return item3; } + } + + public T4 Item4 + { + get { return item4; } + } + + public T5 Item5 + { + get { return item5; } + } + + public T6 Item6 + { + get { return item6; } + } + + public T7 Item7 + { + get { return item7; } + } + + int IComparable.CompareTo(object obj) + { + return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); + } + + int IStructuralComparable.CompareTo(object other, IComparer comparer) + { + if (other == null) return 1; + if (!(other is Tuple)) + { + throw new ArgumentException("other"); + } + var t = (Tuple)other; + + int res = comparer.Compare(item1, t.item1); + if (res != 0) return res; + res = comparer.Compare(item2, t.item2); + if (res != 0) return res; + res = comparer.Compare(item3, t.item3); + if (res != 0) return res; + res = comparer.Compare(item4, t.item4); + if (res != 0) return res; + res = comparer.Compare(item5, t.item5); + if (res != 0) return res; + res = comparer.Compare(item6, t.item6); + if (res != 0) return res; + return comparer.Compare(item7, t.item7); + } + + public override bool Equals(object obj) + { + return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); + } + + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) + { + if (!(other is Tuple)) + return false; + var t = (Tuple)other; + + return comparer.Equals(item1, t.item1) && + comparer.Equals(item2, t.item2) && + comparer.Equals(item3, t.item3) && + comparer.Equals(item4, t.item4) && + comparer.Equals(item5, t.item5) && + comparer.Equals(item6, t.item6) && + comparer.Equals(item7, t.item7); + } + + public override int GetHashCode() + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + var comparer5 = EqualityComparer.Default; + var comparer6 = EqualityComparer.Default; + var comparer7 = EqualityComparer.Default; + + int h0, h1; + h0 = comparer1.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer2.GetHashCode(item2); + h1 = comparer3.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer4.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + h1 = comparer5.GetHashCode(item5); + h1 = (h1 << 5) + h1 ^ comparer6.GetHashCode(item6); + h1 = (h1 << 5) + h1 ^ comparer7.GetHashCode(item7); + h0 = (h0 << 5) + h0 ^ h1; + return h0; + } + + int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) + { + int h0, h1; + h0 = comparer.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item2); + h1 = comparer.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + h1 = comparer.GetHashCode(item5); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item6); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item7); + h0 = (h0 << 5) + h0 ^ h1; + return h0; + } + + string ITuple.ToString() + { + return String.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}", item1, item2, item3, item4, item5, item6, item7); + } + + public override string ToString() + { + return "(" + ((ITuple)this).ToString() + ")"; + } + + public bool Equals(Tuple other) + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + var comparer5 = EqualityComparer.Default; + var comparer6 = EqualityComparer.Default; + var comparer7 = EqualityComparer.Default; + + return comparer1.Equals(item1, other.Item1) && + comparer2.Equals(item2, other.Item2) && + comparer3.Equals(item3, other.Item3) && + comparer4.Equals(item4, other.Item4) && + comparer5.Equals(item5, other.Item5) && + comparer6.Equals(item6, other.Item6) && + comparer7.Equals(item7, other.Item7); + } + } + + [Serializable] + public partial class Tuple : IStructuralEquatable, IStructuralComparable, IComparable, ITuple, IEquatable> + { + T1 item1; + T2 item2; + T3 item3; + T4 item4; + T5 item5; + T6 item6; + T7 item7; + TRest rest; + + public T1 Item1 + { + get { return item1; } + } + + public T2 Item2 + { + get { return item2; } + } + + public T3 Item3 + { + get { return item3; } + } + + public T4 Item4 + { + get { return item4; } + } + + public T5 Item5 + { + get { return item5; } + } + + public T6 Item6 + { + get { return item6; } + } + + public T7 Item7 + { + get { return item7; } + } + + public TRest Rest + { + get { return rest; } + } + + int IComparable.CompareTo(object obj) + { + return ((IStructuralComparable)this).CompareTo(obj, Comparer.Default); + } + + int IStructuralComparable.CompareTo(object other, IComparer comparer) + { + if (other == null) return 1; + if (!(other is Tuple)) + { + throw new ArgumentException("other"); + } + var t = (Tuple)other; + + int res = comparer.Compare(item1, t.item1); + if (res != 0) return res; + res = comparer.Compare(item2, t.item2); + if (res != 0) return res; + res = comparer.Compare(item3, t.item3); + if (res != 0) return res; + res = comparer.Compare(item4, t.item4); + if (res != 0) return res; + res = comparer.Compare(item5, t.item5); + if (res != 0) return res; + res = comparer.Compare(item6, t.item6); + if (res != 0) return res; + res = comparer.Compare(item7, t.item7); + if (res != 0) return res; + return comparer.Compare(rest, t.rest); + } + + public override bool Equals(object obj) + { + return ((IStructuralEquatable)this).Equals(obj, EqualityComparer.Default); + } + + bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer) + { + if (!(other is Tuple)) + return false; + var t = (Tuple)other; + + return comparer.Equals(item1, t.item1) && + comparer.Equals(item2, t.item2) && + comparer.Equals(item3, t.item3) && + comparer.Equals(item4, t.item4) && + comparer.Equals(item5, t.item5) && + comparer.Equals(item6, t.item6) && + comparer.Equals(item7, t.item7) && + comparer.Equals(rest, t.rest); + } + + public override int GetHashCode() + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + var comparer5 = EqualityComparer.Default; + var comparer6 = EqualityComparer.Default; + var comparer7 = EqualityComparer.Default; + var comparer8 = EqualityComparer.Default; + + int h0, h1, h2; + h0 = comparer1.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer2.GetHashCode(item2); + h1 = comparer3.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer4.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + h1 = comparer5.GetHashCode(item5); + h1 = (h1 << 5) + h1 ^ comparer6.GetHashCode(item6); + h2 = comparer7.GetHashCode(item7); + h2 = (h2 << 5) + h2 ^ comparer8.GetHashCode(rest); + h1 = (h1 << 5) + h1 ^ h2; + h0 = (h0 << 5) + h0 ^ h1; + return h0; + } + + int IStructuralEquatable.GetHashCode(IEqualityComparer comparer) + { + int h0, h1, h2; + h0 = comparer.GetHashCode(item1); + h0 = (h0 << 5) + h0 ^ comparer.GetHashCode(item2); + h1 = comparer.GetHashCode(item3); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item4); + h0 = (h0 << 5) + h0 ^ h1; + h1 = comparer.GetHashCode(item5); + h1 = (h1 << 5) + h1 ^ comparer.GetHashCode(item6); + h2 = comparer.GetHashCode(item7); + h2 = (h2 << 5) + h2 ^ comparer.GetHashCode(rest); + h1 = (h1 << 5) + h1 ^ h2; + h0 = (h0 << 5) + h0 ^ h1; + return h0; + } + + string ITuple.ToString() + { + return String.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}", item1, item2, item3, item4, item5, item6, item7, ((ITuple)rest).ToString()); + } + + public override string ToString() + { + return "(" + ((ITuple)this).ToString() + ")"; + } + + public bool Equals(Tuple other) + { + var comparer1 = EqualityComparer.Default; + var comparer2 = EqualityComparer.Default; + var comparer3 = EqualityComparer.Default; + var comparer4 = EqualityComparer.Default; + var comparer5 = EqualityComparer.Default; + var comparer6 = EqualityComparer.Default; + var comparer7 = EqualityComparer.Default; + var comparer8 = EqualityComparer.Default; + + return comparer1.Equals(item1, other.Item1) && + comparer2.Equals(item2, other.Item2) && + comparer3.Equals(item3, other.Item3) && + comparer4.Equals(item4, other.Item4) && + comparer5.Equals(item5, other.Item5) && + comparer6.Equals(item6, other.Item6) && + comparer7.Equals(item7, other.Item7) && + comparer8.Equals(rest, other.rest); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/System/Tuple.cs.meta b/Assets/Plugins/UniRx/Scripts/System/Tuple.cs.meta new file mode 100644 index 00000000..3ecf72a2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/Tuple.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: be811500a5640704b92de622c9202d48 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/System/Unit.cs b/Assets/Plugins/UniRx/Scripts/System/Unit.cs new file mode 100644 index 00000000..90b71eb1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/Unit.cs @@ -0,0 +1,41 @@ +using System; + +namespace UniRx +{ + [Serializable] + public struct Unit : IEquatable + { + static readonly Unit @default = new Unit(); + + public static Unit Default { get { return @default; } } + + public static bool operator ==(Unit first, Unit second) + { + return true; + } + + public static bool operator !=(Unit first, Unit second) + { + return false; + } + + public bool Equals(Unit other) + { + return true; + } + public override bool Equals(object obj) + { + return obj is Unit; + } + + public override int GetHashCode() + { + return 0; + } + + public override string ToString() + { + return "()"; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/System/Unit.cs.meta b/Assets/Plugins/UniRx/Scripts/System/Unit.cs.meta new file mode 100644 index 00000000..5eda9323 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/System/Unit.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 14f6907c0ae17e64c8fc34f08c3038a4 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Tasks.meta b/Assets/Plugins/UniRx/Scripts/Tasks.meta new file mode 100644 index 00000000..67db7d49 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Tasks.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f4389552ae1b4f54fb6d931c0a6efd08 +folderAsset: yes +timeCreated: 1475139656 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs b/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs new file mode 100644 index 00000000..d5a7970a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs @@ -0,0 +1,367 @@ +// this code is borrowed from RxOfficial(rx.codeplex.com) and modified + +#if (NET_4_6 || NET_STANDARD_2_0) + +using System; +using System.Threading.Tasks; +using System.Threading; + +namespace UniRx +{ + /// + /// Provides a set of static methods for converting tasks to observable sequences. + /// + public static class TaskObservableExtensions + { + /// + /// Returns an observable sequence that signals when the task completes. + /// + /// Task to convert to an observable sequence. + /// An observable sequence that produces a unit value when the task completes, or propagates the exception produced by the task. + /// is null. + /// If the specified task object supports cancellation, consider using instead. + public static IObservable ToObservable(this Task task) + { + if (task == null) + throw new ArgumentNullException("task"); + + return ToObservableImpl(task, null); + } + + /// + /// Returns an observable sequence that signals when the task completes. + /// + /// Task to convert to an observable sequence. + /// Scheduler on which to notify observers about completion, cancellation or failure. + /// An observable sequence that produces a unit value when the task completes, or propagates the exception produced by the task. + /// is null or is null. + /// If the specified task object supports cancellation, consider using instead. + public static IObservable ToObservable(this Task task, IScheduler scheduler) + { + if (task == null) + throw new ArgumentNullException("task"); + if (scheduler == null) + throw new ArgumentNullException("scheduler"); + + return ToObservableImpl(task, scheduler); + } + + private static IObservable ToObservableImpl(Task task, IScheduler scheduler) + { + var res = default(IObservable); + + if (task.IsCompleted) + { + scheduler = scheduler ?? Scheduler.Immediate; + + switch (task.Status) + { + case TaskStatus.RanToCompletion: + res = Observable.Return(Unit.Default, scheduler); + break; + case TaskStatus.Faulted: + res = Observable.Throw(task.Exception.InnerException, scheduler); + break; + case TaskStatus.Canceled: + res = Observable.Throw(new TaskCanceledException(task), scheduler); + break; + } + } + else + { + // + // Separate method to avoid closure in synchronous completion case. + // + res = ToObservableSlow(task, scheduler); + } + + return res; + } + + private static IObservable ToObservableSlow(Task task, IScheduler scheduler) + { + var subject = new AsyncSubject(); + + var options = GetTaskContinuationOptions(scheduler); + + task.ContinueWith(t => ToObservableDone(task, subject), options); + + return ToObservableResult(subject, scheduler); + } + + private static void ToObservableDone(Task task, IObserver subject) + { + switch (task.Status) + { + case TaskStatus.RanToCompletion: + subject.OnNext(Unit.Default); + subject.OnCompleted(); + break; + case TaskStatus.Faulted: + subject.OnError(task.Exception.InnerException); + break; + case TaskStatus.Canceled: + subject.OnError(new TaskCanceledException(task)); + break; + } + } + + /// + /// Returns an observable sequence that propagates the result of the task. + /// + /// The type of the result produced by the task. + /// Task to convert to an observable sequence. + /// An observable sequence that produces the task's result, or propagates the exception produced by the task. + /// is null. + /// If the specified task object supports cancellation, consider using instead. + public static IObservable ToObservable(this Task task) + { + if (task == null) + throw new ArgumentNullException("task"); + + return ToObservableImpl(task, null); + } + + /// + /// Returns an observable sequence that propagates the result of the task. + /// + /// The type of the result produced by the task. + /// Task to convert to an observable sequence. + /// Scheduler on which to notify observers about completion, cancellation or failure. + /// An observable sequence that produces the task's result, or propagates the exception produced by the task. + /// is null or is null. + /// If the specified task object supports cancellation, consider using instead. + public static IObservable ToObservable(this Task task, IScheduler scheduler) + { + if (task == null) + throw new ArgumentNullException("task"); + if (scheduler == null) + throw new ArgumentNullException("scheduler"); + + return ToObservableImpl(task, scheduler); + } + + private static IObservable ToObservableImpl(Task task, IScheduler scheduler) + { + var res = default(IObservable); + + if (task.IsCompleted) + { + scheduler = scheduler ?? Scheduler.Immediate; + + switch (task.Status) + { + case TaskStatus.RanToCompletion: + res = Observable.Return(task.Result, scheduler); + break; + case TaskStatus.Faulted: + res = Observable.Throw(task.Exception.InnerException, scheduler); + break; + case TaskStatus.Canceled: + res = Observable.Throw(new TaskCanceledException(task), scheduler); + break; + } + } + else + { + // + // Separate method to avoid closure in synchronous completion case. + // + res = ToObservableSlow(task, scheduler); + } + + return res; + } + + private static IObservable ToObservableSlow(Task task, IScheduler scheduler) + { + var subject = new AsyncSubject(); + + var options = GetTaskContinuationOptions(scheduler); + + task.ContinueWith(t => ToObservableDone(task, subject), options); + + return ToObservableResult(subject, scheduler); + } + + private static void ToObservableDone(Task task, IObserver subject) + { + switch (task.Status) + { + case TaskStatus.RanToCompletion: + subject.OnNext(task.Result); + subject.OnCompleted(); + break; + case TaskStatus.Faulted: + subject.OnError(task.Exception.InnerException); + break; + case TaskStatus.Canceled: + subject.OnError(new TaskCanceledException(task)); + break; + } + } + + private static TaskContinuationOptions GetTaskContinuationOptions(IScheduler scheduler) + { + var options = TaskContinuationOptions.None; + + if (scheduler != null) + { + // + // We explicitly don't special-case the immediate scheduler here. If the user asks for a + // synchronous completion, we'll try our best. However, there's no guarantee due to the + // internal stack probing in the TPL, which may cause asynchronous completion on a thread + // pool thread in order to avoid stack overflows. Therefore we can only attempt to be more + // efficient in the case where the user specified a scheduler, hence we know that the + // continuation will trigger a scheduling operation. In case of the immediate scheduler, + // it really becomes "immediate scheduling" wherever the TPL decided to run the continuation, + // i.e. not necessarily where the task was completed from. + // + options |= TaskContinuationOptions.ExecuteSynchronously; + } + + return options; + } + + private static IObservable ToObservableResult(AsyncSubject subject, IScheduler scheduler) + { + if (scheduler != null) + { + return subject.ObserveOn(scheduler); + } + else + { + return subject.AsObservable(); + } + } + + /// + /// Returns a task that will receive the last value or the exception produced by the observable sequence. + /// + /// The type of the elements in the source sequence. + /// Observable sequence to convert to a task. + /// A task that will receive the last element or the exception produced by the observable sequence. + /// is null. + public static Task ToTask(this IObservable observable) + { + if (observable == null) + throw new ArgumentNullException("observable"); + + return observable.ToTask(new CancellationToken(), null); + } + + /// + /// Returns a task that will receive the last value or the exception produced by the observable sequence. + /// + /// The type of the elements in the source sequence. + /// Observable sequence to convert to a task. + /// The state to use as the underlying task's AsyncState. + /// A task that will receive the last element or the exception produced by the observable sequence. + /// is null. + public static Task ToTask(this IObservable observable, object state) + { + if (observable == null) + throw new ArgumentNullException("observable"); + + return observable.ToTask(new CancellationToken(), state); + } + + /// + /// Returns a task that will receive the last value or the exception produced by the observable sequence. + /// + /// The type of the elements in the source sequence. + /// Observable sequence to convert to a task. + /// Cancellation token that can be used to cancel the task, causing unsubscription from the observable sequence. + /// A task that will receive the last element or the exception produced by the observable sequence. + /// is null. + public static Task ToTask(this IObservable observable, CancellationToken cancellationToken) + { + if (observable == null) + throw new ArgumentNullException("observable"); + + return observable.ToTask(cancellationToken, null); + } + + /// + /// Returns a task that will receive the last value or the exception produced by the observable sequence. + /// + /// The type of the elements in the source sequence. + /// Observable sequence to convert to a task. + /// Cancellation token that can be used to cancel the task, causing unsubscription from the observable sequence. + /// The state to use as the underlying task's AsyncState. + /// A task that will receive the last element or the exception produced by the observable sequence. + /// is null. + public static Task ToTask(this IObservable observable, CancellationToken cancellationToken, object state) + { + if (observable == null) + throw new ArgumentNullException("observable"); + + var hasValue = false; + var lastValue = default(TResult); + + var tcs = new TaskCompletionSource(state); + + var disposable = new SingleAssignmentDisposable(); + + var ctr = default(CancellationTokenRegistration); + + if (cancellationToken.CanBeCanceled) + { + ctr = cancellationToken.Register(() => + { + disposable.Dispose(); + tcs.TrySetCanceled(cancellationToken); + }); + } + + var taskCompletionObserver = Observer.Create( + value => + { + hasValue = true; + lastValue = value; + }, + ex => + { + tcs.TrySetException(ex); + + ctr.Dispose(); // no null-check needed (struct) + disposable.Dispose(); + }, + () => + { + if (hasValue) + tcs.TrySetResult(lastValue); + else + tcs.TrySetException(new InvalidOperationException("Strings_Linq.NO_ELEMENTS")); + + ctr.Dispose(); // no null-check needed (struct) + disposable.Dispose(); + } + ); + + // + // Subtle race condition: if the source completes before we reach the line below, the SingleAssigmentDisposable + // will already have been disposed. Upon assignment, the disposable resource being set will be disposed on the + // spot, which may throw an exception. (Similar to TFS 487142) + // + try + { + // + // [OK] Use of unsafe Subscribe: we're catching the exception here to set the TaskCompletionSource. + // + // Notice we could use a safe subscription to route errors through OnError, but we still need the + // exception handling logic here for the reason explained above. We cannot afford to throw here + // and as a result never set the TaskCompletionSource, so we tunnel everything through here. + // + disposable.Disposable = observable.Subscribe/*Unsafe*/(taskCompletionObserver); + } + catch (Exception ex) + { + tcs.TrySetException(ex); + } + + return tcs.Task; + } + } +} +#endif diff --git a/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs.meta new file mode 100644 index 00000000..406e68c2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Tasks/TaskObservableExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d4f80d45cec56574e990cc840d1ac16b +timeCreated: 1475139656 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/TimeInterval.cs b/Assets/Plugins/UniRx/Scripts/TimeInterval.cs new file mode 100644 index 00000000..e43e79e3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/TimeInterval.cs @@ -0,0 +1,117 @@ +// original code from rx.codeplex.com + +/* ------------------ */ + +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Globalization; + +namespace UniRx +{ + /// + /// Represents a value associated with time interval information. + /// The time interval can represent the time it took to produce the value, the interval relative to a previous value, the value's delivery time relative to a base, etc. + /// + /// The type of the value being annotated with time interval information. + [Serializable] + public struct TimeInterval : IEquatable> + { + private readonly TimeSpan _interval; + private readonly T _value; + + /// + /// Constructs a time interval value. + /// + /// The value to be annotated with a time interval. + /// Time interval associated with the value. + public TimeInterval(T value, TimeSpan interval) + { + _interval = interval; + _value = value; + } + + /// + /// Gets the value. + /// + public T Value + { + get { return _value; } + } + + /// + /// Gets the interval. + /// + public TimeSpan Interval + { + get { return _interval; } + } + + /// + /// Determines whether the current TimeInterval<T> value has the same Value and Interval as a specified TimeInterval<T> value. + /// + /// An object to compare to the current TimeInterval<T> value. + /// true if both TimeInterval<T> values have the same Value and Interval; otherwise, false. + public bool Equals(TimeInterval other) + { + return other.Interval.Equals(Interval) && EqualityComparer.Default.Equals(Value, other.Value); + } + + /// + /// Determines whether the two specified TimeInterval<T> values have the same Value and Interval. + /// + /// The first TimeInterval<T> value to compare. + /// The second TimeInterval<T> value to compare. + /// true if the first TimeInterval<T> value has the same Value and Interval as the second TimeInterval<T> value; otherwise, false. + public static bool operator ==(TimeInterval first, TimeInterval second) + { + return first.Equals(second); + } + + /// + /// Determines whether the two specified TimeInterval<T> values don't have the same Value and Interval. + /// + /// The first TimeInterval<T> value to compare. + /// The second TimeInterval<T> value to compare. + /// true if the first TimeInterval<T> value has a different Value or Interval as the second TimeInterval<T> value; otherwise, false. + public static bool operator !=(TimeInterval first, TimeInterval second) + { + return !first.Equals(second); + } + + /// + /// Determines whether the specified System.Object is equal to the current TimeInterval<T>. + /// + /// The System.Object to compare with the current TimeInterval<T>. + /// true if the specified System.Object is equal to the current TimeInterval<T>; otherwise, false. + public override bool Equals(object obj) + { + if (!(obj is TimeInterval)) + return false; + + var other = (TimeInterval)obj; + return this.Equals(other); + } + + /// + /// Returns the hash code for the current TimeInterval<T> value. + /// + /// A hash code for the current TimeInterval<T> value. + public override int GetHashCode() + { + var valueHashCode = Value == null ? 1963 : Value.GetHashCode(); + + return Interval.GetHashCode() ^ valueHashCode; + } + + /// + /// Returns a string representation of the current TimeInterval<T> value. + /// + /// String representation of the current TimeInterval<T> value. + public override string ToString() + { + return String.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Interval); + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/TimeInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/TimeInterval.cs.meta new file mode 100644 index 00000000..259eba88 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/TimeInterval.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dd48622e783cadc47af9a6b456ac8438 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/Timestamped.cs b/Assets/Plugins/UniRx/Scripts/Timestamped.cs new file mode 100644 index 00000000..cc409d2f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Timestamped.cs @@ -0,0 +1,135 @@ +// original code from rx.codeplex.com + +/* ------------------ */ + +// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Globalization; + +namespace UniRx +{ + /// + /// Represents value with a timestamp on it. + /// The timestamp typically represents the time the value was received, using an IScheduler's clock to obtain the current time. + /// + /// The type of the value being timestamped. + [Serializable] + public struct Timestamped : IEquatable> + { + private readonly DateTimeOffset _timestamp; + private readonly T _value; + + /// + /// Constructs a timestamped value. + /// + /// The value to be annotated with a timestamp. + /// Timestamp associated with the value. + public Timestamped(T value, DateTimeOffset timestamp) + { + _timestamp = timestamp; + _value = value; + } + + /// + /// Gets the value. + /// + public T Value + { + get { return _value; } + } + + /// + /// Gets the timestamp. + /// + public DateTimeOffset Timestamp + { + get { return _timestamp; } + } + + /// + /// Determines whether the current Timestamped<T> value has the same Value and Timestamp as a specified Timestamped<T> value. + /// + /// An object to compare to the current Timestamped<T> value. + /// true if both Timestamped<T> values have the same Value and Timestamp; otherwise, false. + public bool Equals(Timestamped other) + { + return other.Timestamp.Equals(Timestamp) && EqualityComparer.Default.Equals(Value, other.Value); + } + + /// + /// Determines whether the two specified Timestamped<T> values have the same Value and Timestamp. + /// + /// The first Timestamped<T> value to compare. + /// The second Timestamped<T> value to compare. + /// true if the first Timestamped<T> value has the same Value and Timestamp as the second Timestamped<T> value; otherwise, false. + public static bool operator ==(Timestamped first, Timestamped second) + { + return first.Equals(second); + } + + /// + /// Determines whether the two specified Timestamped<T> values don't have the same Value and Timestamp. + /// + /// The first Timestamped<T> value to compare. + /// The second Timestamped<T> value to compare. + /// true if the first Timestamped<T> value has a different Value or Timestamp as the second Timestamped<T> value; otherwise, false. + public static bool operator !=(Timestamped first, Timestamped second) + { + return !first.Equals(second); + } + + /// + /// Determines whether the specified System.Object is equal to the current Timestamped<T>. + /// + /// The System.Object to compare with the current Timestamped<T>. + /// true if the specified System.Object is equal to the current Timestamped<T>; otherwise, false. + public override bool Equals(object obj) + { + if (!(obj is Timestamped)) + return false; + + var other = (Timestamped)obj; + return this.Equals(other); + } + + /// + /// Returns the hash code for the current Timestamped<T> value. + /// + /// A hash code for the current Timestamped<T> value. + public override int GetHashCode() + { + var valueHashCode = Value == null ? 1979 : Value.GetHashCode(); + + return _timestamp.GetHashCode() ^ valueHashCode; + } + + /// + /// Returns a string representation of the current Timestamped<T> value. + /// + /// String representation of the current Timestamped<T> value. + public override string ToString() + { + return String.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Timestamp); + } + } + + /// + /// A helper class with a factory method for creating Timestamped<T> instances. + /// + public static class Timestamped + { + /// + /// Creates an instance of a Timestamped<T>. This is syntactic sugar that uses type inference + /// to avoid specifying a type in a constructor call, which is very useful when using anonymous types. + /// + /// The value to be annotated with a timestamp. + /// Timestamp associated with the value. + /// Creates a new timestamped value. + public static Timestamped Create(T value, DateTimeOffset timestamp) + { + return new Timestamped(value, timestamp); + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/Timestamped.cs.meta b/Assets/Plugins/UniRx/Scripts/Timestamped.cs.meta new file mode 100644 index 00000000..1319fe87 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/Timestamped.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c1d908b82d0e2b4489d3351a484e5eae +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UniRx.asmdef b/Assets/Plugins/UniRx/Scripts/UniRx.asmdef new file mode 100644 index 00000000..2339898d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UniRx.asmdef @@ -0,0 +1,12 @@ +{ + "name": "UniRx", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [] +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UniRx.asmdef.meta b/Assets/Plugins/UniRx/Scripts/UniRx.asmdef.meta new file mode 100644 index 00000000..aaf3bd21 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UniRx.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 560b04d1a97f54a4e82edc0cbbb69285 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge.meta new file mode 100644 index 00000000..e0e2d7b8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c6fa31db6d33195438d3a9c49effc512 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs new file mode 100644 index 00000000..996f160c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections; +using System.Threading; +using UnityEngine; + +#if !UniRxLibrary +using ObservableUnity = UniRx.Observable; +#endif + +namespace UniRx +{ + public static partial class AsyncOperationExtensions + { + /// + /// If you needs return value, use AsAsyncOperationObservable instead. + /// + public static IObservable AsObservable(this AsyncOperation asyncOperation, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => AsObservableCore(asyncOperation, observer, progress, cancellation)); + } + + // T: where T : AsyncOperation is ambigious with IObservable.AsObservable + public static IObservable AsAsyncOperationObservable(this T asyncOperation, IProgress progress = null) + where T : AsyncOperation + { + return ObservableUnity.FromCoroutine((observer, cancellation) => AsObservableCore(asyncOperation, observer, progress, cancellation)); + } + + static IEnumerator AsObservableCore(T asyncOperation, IObserver observer, IProgress reportProgress, CancellationToken cancel) + where T : AsyncOperation + { + if (reportProgress != null) + { + while (!asyncOperation.isDone && !cancel.IsCancellationRequested) + { + try + { + reportProgress.Report(asyncOperation.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + yield return null; + } + } + else + { + if (!asyncOperation.isDone) + { + yield return asyncOperation; + } + } + + if (cancel.IsCancellationRequested) yield break; + + if (reportProgress != null) + { + try + { + reportProgress.Report(asyncOperation.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + } + + observer.OnNext(asyncOperation); + observer.OnCompleted(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs.meta new file mode 100644 index 00000000..1e33df4d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/AsyncOperationExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 245d77a29b1ece34e96bfc80f8c825d8 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs new file mode 100644 index 00000000..0384ba6b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs @@ -0,0 +1,40 @@ +#if !(NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0) + +using System; + +namespace UniRx +{ + public struct CancellationToken + { + readonly ICancelable source; + + public static readonly CancellationToken Empty = new CancellationToken(null); + + /// Same as Empty. + public static readonly CancellationToken None = new CancellationToken(null); + + public CancellationToken(ICancelable source) + { + this.source = source; + } + + public bool IsCancellationRequested + { + get + { + return (source == null) ? false : source.IsDisposed; + } + } + + public void ThrowIfCancellationRequested() + { + if (IsCancellationRequested) + { + throw new OperationCanceledException(); + } + } + } +} + +#endif + diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs.meta new file mode 100644 index 00000000..b376a5a4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CancellationToken.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e02a1bf45f8861048a6014cf7eab1825 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs new file mode 100644 index 00000000..c2d8ee8b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs @@ -0,0 +1,125 @@ +#if (NET_4_6 || NET_STANDARD_2_0) + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace UniRx +{ + public class CoroutineAsyncBridge : INotifyCompletion + { + Action continuation; + public bool IsCompleted { get; private set; } + + CoroutineAsyncBridge() + { + IsCompleted = false; + } + + public static CoroutineAsyncBridge Start(T awaitTarget) + { + var bridge = new CoroutineAsyncBridge(); + MainThreadDispatcher.StartCoroutine(bridge.Run(awaitTarget)); + return bridge; + } + + IEnumerator Run(T target) + { + yield return target; + IsCompleted = true; + continuation(); + } + + public void OnCompleted(Action continuation) + { + this.continuation = continuation; + } + + public void GetResult() + { + if (!IsCompleted) throw new InvalidOperationException("coroutine not yet completed"); + } + } + + public class CoroutineAsyncBridge : INotifyCompletion + { + readonly T result; + Action continuation; + public bool IsCompleted { get; private set; } + + CoroutineAsyncBridge(T result) + { + IsCompleted = false; + this.result = result; + } + + public static CoroutineAsyncBridge Start(T awaitTarget) + { + var bridge = new CoroutineAsyncBridge(awaitTarget); + MainThreadDispatcher.StartCoroutine(bridge.Run(awaitTarget)); + return bridge; + } + + IEnumerator Run(T target) + { + yield return target; + IsCompleted = true; + continuation(); + } + + public void OnCompleted(Action continuation) + { + this.continuation = continuation; + } + + public T GetResult() + { + if (!IsCompleted) throw new InvalidOperationException("coroutine not yet completed"); + return result; + } + } + + public static class CoroutineAsyncExtensions + { + public static CoroutineAsyncBridge GetAwaiter(this Coroutine coroutine) + { + return CoroutineAsyncBridge.Start(coroutine); + } + +#if !(CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))) + + // should use UniRx.Async in C# 7.0 + +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + public static CoroutineAsyncBridge GetAwaiter(this WWW www) + { + return CoroutineAsyncBridge.Start(www); + } +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif + + + + public static CoroutineAsyncBridge GetAwaiter(this AsyncOperation asyncOperation) + { + return CoroutineAsyncBridge.Start(asyncOperation); + } + + public static CoroutineAsyncBridge GetAwaiter(this IEnumerator coroutine) + { + return CoroutineAsyncBridge.Start(coroutine); + } + +#endif + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs.meta new file mode 100644 index 00000000..0c245ddf --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/CoroutineAsyncBridge.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 93ca3de3810199947871ab4a77014fa3 +timeCreated: 1475193276 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics.meta new file mode 100644 index 00000000..852204ba --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 125ca82be137b8544a2b65f7150ee2d4 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs new file mode 100644 index 00000000..d7c5d570 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; + +namespace UniRx.Diagnostics +{ + public struct LogEntry + { + // requires + public string LoggerName { get; private set; } + public LogType LogType { get; private set; } + public string Message { get; private set; } + public DateTime Timestamp { get; private set; } + + // options + + /// [Optional] + public UnityEngine.Object Context { get; private set; } + /// [Optional] + public Exception Exception { get; private set; } + /// [Optional] + public string StackTrace { get; private set; } + /// [Optional] + public object State { get; private set; } + + public LogEntry(string loggerName, LogType logType, DateTime timestamp, string message, UnityEngine.Object context = null, Exception exception = null, string stackTrace = null, object state = null) + : this() + { + this.LoggerName = loggerName; + this.LogType = logType; + this.Timestamp = timestamp; + this.Message = message; + this.Context = context; + this.Exception = exception; + this.StackTrace = stackTrace; + this.State = state; + } + + public override string ToString() + { + var plusEx = (Exception != null) ? (Environment.NewLine + Exception.ToString()) : ""; + return "[" + Timestamp.ToString() + "]" + + "[" + LoggerName + "]" + + "[" + LogType.ToString() + "]" + + Message + + plusEx; + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs.meta new file mode 100644 index 00000000..6fb7092d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntry.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 53917e87e91c0e4449402e5d85a04765 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs new file mode 100644 index 00000000..d70cc9d1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace UniRx.Diagnostics +{ + public static partial class LogEntryExtensions + { + public static IDisposable LogToUnityDebug(this IObservable source) + { + return source.Subscribe(new UnityDebugSink()); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs.meta new file mode 100644 index 00000000..f71269dd --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/LogEntryExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8706ef5a13e53ec46b4848a7eec5e826 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs new file mode 100644 index 00000000..9123bcab --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; + +namespace UniRx.Diagnostics +{ + public partial class Logger + { + static bool isInitialized = false; + static bool isDebugBuild = false; + + public string Name { get; private set; } + protected readonly Action logPublisher; + + public Logger(string loggerName) + { + this.Name = loggerName; + this.logPublisher = ObservableLogger.RegisterLogger(this); + } + + /// Output LogType.Log but only enables isDebugBuild + public virtual void Debug(object message, UnityEngine.Object context = null) + { + if (!isInitialized) + { + isInitialized = true; + isDebugBuild = UnityEngine.Debug.isDebugBuild; + } + + if (isDebugBuild) + { + logPublisher(new LogEntry( + message: (message != null) ? message.ToString() : "", + logType: LogType.Log, + timestamp: DateTime.Now, + loggerName: Name, + context: context)); + } + } + + /// Output LogType.Log but only enables isDebugBuild + public virtual void DebugFormat(string format, params object[] args) + { + if (!isInitialized) + { + isInitialized = true; + isDebugBuild = UnityEngine.Debug.isDebugBuild; + } + + if (isDebugBuild) + { + logPublisher(new LogEntry( + message: (format != null) ? string.Format(format, args) : "", + logType: LogType.Log, + timestamp: DateTime.Now, + loggerName: Name, + context: null)); + } + } + + public virtual void Log(object message, UnityEngine.Object context = null) + { + logPublisher(new LogEntry( + message: (message != null) ? message.ToString() : "", + logType: LogType.Log, + timestamp: DateTime.Now, + loggerName: Name, + context: context)); + } + + public virtual void LogFormat(string format, params object[] args) + { + logPublisher(new LogEntry( + message: (format != null) ? string.Format(format, args) : "", + logType: LogType.Log, + timestamp: DateTime.Now, + loggerName: Name, + context: null)); + } + + public virtual void Warning(object message, UnityEngine.Object context = null) + { + logPublisher(new LogEntry( + message: (message != null) ? message.ToString() : "", + logType: LogType.Warning, + timestamp: DateTime.Now, + loggerName: Name, + context: context)); + } + + public virtual void WarningFormat(string format, params object[] args) + { + logPublisher(new LogEntry( + message: (format != null) ? string.Format(format, args) : "", + logType: LogType.Warning, + timestamp: DateTime.Now, + loggerName: Name, + context: null)); + } + + public virtual void Error(object message, UnityEngine.Object context = null) + { + logPublisher(new LogEntry( + message: (message != null) ? message.ToString() : "", + logType: LogType.Error, + timestamp: DateTime.Now, + loggerName: Name, + context: context)); + } + + public virtual void ErrorFormat(string format, params object[] args) + { + logPublisher(new LogEntry( + message: (format != null) ? string.Format(format, args) : "", + logType: LogType.Error, + timestamp: DateTime.Now, + loggerName: Name, + context: null)); + } + + public virtual void Exception(Exception exception, UnityEngine.Object context = null) + { + logPublisher(new LogEntry( + message: (exception != null) ? exception.ToString() : "", + exception: exception, + logType: LogType.Exception, + timestamp: DateTime.Now, + loggerName: Name, + context: context)); + } + + /// Publish raw LogEntry. + public virtual void Raw(LogEntry logEntry) + { + logPublisher(logEntry); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs.meta new file mode 100644 index 00000000..e8e4fd71 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/Logger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f0ecf366503cb0644bdd90934d24da62 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs new file mode 100644 index 00000000..f200681a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs @@ -0,0 +1,42 @@ +using System; + +namespace UniRx.Diagnostics +{ + public static class ObservableDebugExtensions + { + /// + /// Debug helper of observbale stream. Works for only DEBUG symbol. + /// + public static IObservable Debug(this IObservable source, string label = null) + { +#if DEBUG + var l = (label == null) ? "" : "[" + label + "]"; + return source.Materialize() + .Do(x => UnityEngine.Debug.Log(l + x.ToString())) + .Dematerialize() + .DoOnCancel(() => UnityEngine.Debug.Log(l + "OnCancel")) + .DoOnSubscribe(() => UnityEngine.Debug.Log(l + "OnSubscribe")); + +#else + return source; +#endif + } + + /// + /// Debug helper of observbale stream. Works for only DEBUG symbol. + /// + public static IObservable Debug(this IObservable source, UniRx.Diagnostics.Logger logger) + { +#if DEBUG + return source.Materialize() + .Do(x => logger.Debug(x.ToString())) + .Dematerialize() + .DoOnCancel(() => logger.Debug("OnCancel")) + .DoOnSubscribe(() => logger.Debug("OnSubscribe")); + +#else + return source; +#endif + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs.meta new file mode 100644 index 00000000..4d5f179e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableDebugExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b43f948e095c3e749a0506709be90d68 +timeCreated: 1468662620 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs new file mode 100644 index 00000000..44913a76 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; + +namespace UniRx.Diagnostics +{ + public class ObservableLogger : IObservable + { + static readonly Subject logPublisher = new Subject(); + + public static readonly ObservableLogger Listener = new ObservableLogger(); + + private ObservableLogger() + { + + } + + public static Action RegisterLogger(Logger logger) + { + if (logger.Name == null) throw new ArgumentNullException("logger.Name is null"); + + return logPublisher.OnNext; + } + + public IDisposable Subscribe(IObserver observer) + { + return logPublisher.Subscribe(observer); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs.meta new file mode 100644 index 00000000..a2e274e7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/ObservableLogger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 063f79dc45f902c459f0955d27b445d7 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs new file mode 100644 index 00000000..ecaf3279 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; + +namespace UniRx.Diagnostics +{ + public class UnityDebugSink : IObserver + { + public void OnCompleted() + { + // do nothing + } + + public void OnError(Exception error) + { + // do nothing + } + + public void OnNext(LogEntry value) + { + // avoid multithread exception. + // (value.Context == null) can only be called from the main thread. + var ctx = (System.Object)value.Context; + + switch (value.LogType) + { + case LogType.Error: + if (ctx == null) + { + Debug.LogError(value.Message); + } + else + { + Debug.LogError(value.Message, value.Context); + } + break; + case LogType.Exception: + if (ctx == null) + { + Debug.LogException(value.Exception); + } + else + { + Debug.LogException(value.Exception, value.Context); + } + break; + case LogType.Log: + if (ctx == null) + { + Debug.Log(value.Message); + } + else + { + Debug.Log(value.Message, value.Context); + } + break; + case LogType.Warning: + if (ctx == null) + { + Debug.LogWarning(value.Message); + } + else + { + Debug.LogWarning(value.Message, value.Context); + } + break; + default: + break; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs.meta new file mode 100644 index 00000000..c3c63faf --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Diagnostics/UnityDebugSink.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 882166c30c3bff841b1e12d62c392e02 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs new file mode 100644 index 00000000..8d1333c4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Globalization; + +namespace UniRx +{ + /// + /// Represents a value associated with time interval information. + /// The time interval can represent the time it took to produce the value, the interval relative to a previous value, the value's delivery time relative to a base, etc. + /// + /// The type of the value being annotated with time interval information. + [Serializable] + public struct FrameInterval : IEquatable> + { + private readonly int _interval; + private readonly T _value; + + /// + /// Constructs a time interval value. + /// + /// The value to be annotated with a time interval. + /// Time interval associated with the value. + public FrameInterval(T value, int interval) + { + _interval = interval; + _value = value; + } + + /// + /// Gets the value. + /// + public T Value + { + get { return _value; } + } + + /// + /// Gets the interval. + /// + public int Interval + { + get { return _interval; } + } + + /// + /// Determines whether the current FrameInterval<T> value has the same Value and Interval as a specified FrameInterval<T> value. + /// + /// An object to compare to the current FrameInterval<T> value. + /// true if both FrameInterval<T> values have the same Value and Interval; otherwise, false. + public bool Equals(FrameInterval other) + { + return other.Interval.Equals(Interval) && EqualityComparer.Default.Equals(Value, other.Value); + } + + /// + /// Determines whether the two specified FrameInterval<T> values have the same Value and Interval. + /// + /// The first FrameInterval<T> value to compare. + /// The second FrameInterval<T> value to compare. + /// true if the first FrameInterval<T> value has the same Value and Interval as the second FrameInterval<T> value; otherwise, false. + public static bool operator ==(FrameInterval first, FrameInterval second) + { + return first.Equals(second); + } + + /// + /// Determines whether the two specified FrameInterval<T> values don't have the same Value and Interval. + /// + /// The first FrameInterval<T> value to compare. + /// The second FrameInterval<T> value to compare. + /// true if the first FrameInterval<T> value has a different Value or Interval as the second FrameInterval<T> value; otherwise, false. + public static bool operator !=(FrameInterval first, FrameInterval second) + { + return !first.Equals(second); + } + + /// + /// Determines whether the specified System.Object is equal to the current FrameInterval<T>. + /// + /// The System.Object to compare with the current FrameInterval<T>. + /// true if the specified System.Object is equal to the current FrameInterval<T>; otherwise, false. + public override bool Equals(object obj) + { + if (!(obj is FrameInterval)) + return false; + + var other = (FrameInterval)obj; + return this.Equals(other); + } + + /// + /// Returns the hash code for the current FrameInterval<T> value. + /// + /// A hash code for the current FrameInterval<T> value. + public override int GetHashCode() + { + var valueHashCode = Value == null ? 1963 : Value.GetHashCode(); + + return Interval.GetHashCode() ^ valueHashCode; + } + + /// + /// Returns a string representation of the current FrameInterval<T> value. + /// + /// String representation of the current FrameInterval<T> value. + public override string ToString() + { + return String.Format(CultureInfo.CurrentCulture, "{0}@{1}", Value, Interval); + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs.meta new file mode 100644 index 00000000..25c60075 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/FrameInterval.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 266d1e44d71e7774c9abc5b23773e3f1 +timeCreated: 1467771656 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs new file mode 100644 index 00000000..ac549887 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs @@ -0,0 +1,325 @@ +using System; +using System.Collections.Generic; +using UniRx.InternalUtil; +using UnityEngine; + +namespace UniRx +{ + /// + /// Inspectable ReactiveProperty. + /// + [Serializable] + public class IntReactiveProperty : ReactiveProperty + { + public IntReactiveProperty() + : base() + { + + } + + public IntReactiveProperty(int initialValue) + : base(initialValue) + { + + } + } + + /// + /// Inspectable ReactiveProperty. + /// + [Serializable] + public class LongReactiveProperty : ReactiveProperty + { + public LongReactiveProperty() + : base() + { + + } + + public LongReactiveProperty(long initialValue) + : base(initialValue) + { + + } + } + + + /// + /// Inspectable ReactiveProperty. + /// + [Serializable] + public class ByteReactiveProperty : ReactiveProperty + { + public ByteReactiveProperty() + : base() + { + + } + + public ByteReactiveProperty(byte initialValue) + : base(initialValue) + { + + } + } + + /// + /// Inspectable ReactiveProperty. + /// + [Serializable] + public class FloatReactiveProperty : ReactiveProperty + { + public FloatReactiveProperty() + : base() + { + + } + + public FloatReactiveProperty(float initialValue) + : base(initialValue) + { + + } + } + + /// + /// Inspectable ReactiveProperty. + /// + [Serializable] + public class DoubleReactiveProperty : ReactiveProperty + { + public DoubleReactiveProperty() + : base() + { + + } + + public DoubleReactiveProperty(double initialValue) + : base(initialValue) + { + + } + } + + /// + /// Inspectable ReactiveProperty. + /// + [Serializable] + public class StringReactiveProperty : ReactiveProperty + { + public StringReactiveProperty() + : base() + { + + } + + public StringReactiveProperty(string initialValue) + : base(initialValue) + { + + } + } + + /// + /// Inspectable ReactiveProperty. + /// + [Serializable] + public class BoolReactiveProperty : ReactiveProperty + { + public BoolReactiveProperty() + : base() + { + + } + + public BoolReactiveProperty(bool initialValue) + : base(initialValue) + { + + } + } + + /// Inspectable ReactiveProperty. + [Serializable] + public class Vector2ReactiveProperty : ReactiveProperty + { + public Vector2ReactiveProperty() + { + + } + + public Vector2ReactiveProperty(Vector2 initialValue) + : base(initialValue) + { + + } + + protected override IEqualityComparer EqualityComparer + { + get + { + return UnityEqualityComparer.Vector2; + } + } + } + + /// Inspectable ReactiveProperty. + [Serializable] + public class Vector3ReactiveProperty : ReactiveProperty + { + public Vector3ReactiveProperty() + { + + } + + public Vector3ReactiveProperty(Vector3 initialValue) + : base(initialValue) + { + + } + + protected override IEqualityComparer EqualityComparer + { + get + { + return UnityEqualityComparer.Vector3; + } + } + } + + /// Inspectable ReactiveProperty. + [Serializable] + public class Vector4ReactiveProperty : ReactiveProperty + { + public Vector4ReactiveProperty() + { + + } + + public Vector4ReactiveProperty(Vector4 initialValue) + : base(initialValue) + { + + } + + protected override IEqualityComparer EqualityComparer + { + get + { + return UnityEqualityComparer.Vector4; + } + } + } + + /// Inspectable ReactiveProperty. + [Serializable] + public class ColorReactiveProperty : ReactiveProperty + { + public ColorReactiveProperty() + { + + } + + public ColorReactiveProperty(Color initialValue) + : base(initialValue) + { + + } + + protected override IEqualityComparer EqualityComparer + { + get + { + return UnityEqualityComparer.Color; + } + } + } + + /// Inspectable ReactiveProperty. + [Serializable] + public class RectReactiveProperty : ReactiveProperty + { + public RectReactiveProperty() + { + + } + + public RectReactiveProperty(Rect initialValue) + : base(initialValue) + { + + } + + protected override IEqualityComparer EqualityComparer + { + get + { + return UnityEqualityComparer.Rect; + } + } + } + + /// Inspectable ReactiveProperty. + [Serializable] + public class AnimationCurveReactiveProperty : ReactiveProperty + { + public AnimationCurveReactiveProperty() + { + + } + + public AnimationCurveReactiveProperty(AnimationCurve initialValue) + : base(initialValue) + { + + } + } + + /// Inspectable ReactiveProperty. + [Serializable] + public class BoundsReactiveProperty : ReactiveProperty + { + public BoundsReactiveProperty() + { + + } + + public BoundsReactiveProperty(Bounds initialValue) + : base(initialValue) + { + + } + + protected override IEqualityComparer EqualityComparer + { + get + { + return UnityEqualityComparer.Bounds; + } + } + } + + /// Inspectable ReactiveProperty. + [Serializable] + public class QuaternionReactiveProperty : ReactiveProperty + { + public QuaternionReactiveProperty() + { + + } + + public QuaternionReactiveProperty(Quaternion initialValue) + : base(initialValue) + { + + } + + protected override IEqualityComparer EqualityComparer + { + get + { + return UnityEqualityComparer.Quaternion; + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs.meta new file mode 100644 index 00000000..e6aee100 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectableReactiveProperty.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 13c690f353ea23141aca4090d28aaa9c +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs new file mode 100644 index 00000000..9dd43164 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs @@ -0,0 +1,306 @@ +using System; +using System.Reflection; +using UnityEngine; +using System.Text.RegularExpressions; +using System.Collections; +using System.Linq; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace UniRx +{ + [System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple = false, Inherited = false)] + public class InspectorDisplayAttribute : PropertyAttribute + { + public string FieldName { get; private set; } + public bool NotifyPropertyChanged { get; private set; } + + public InspectorDisplayAttribute(string fieldName = "value", bool notifyPropertyChanged = true) + { + FieldName = fieldName; + NotifyPropertyChanged = notifyPropertyChanged; + } + } + + /// + /// Enables multiline input field for StringReactiveProperty. Default line is 3. + /// + [System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple = false, Inherited = false)] + public class MultilineReactivePropertyAttribute : PropertyAttribute + { + public int Lines { get; private set; } + + public MultilineReactivePropertyAttribute() + { + Lines = 3; + } + + public MultilineReactivePropertyAttribute(int lines) + { + this.Lines = lines; + } + } + + /// + /// Enables range input field for Int/FloatReactiveProperty. + /// + [System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple = false, Inherited = false)] + public class RangeReactivePropertyAttribute : PropertyAttribute + { + public float Min { get; private set; } + public float Max { get; private set; } + + public RangeReactivePropertyAttribute(float min, float max) + { + this.Min = min; + this.Max = max; + } + } + +#if UNITY_EDITOR + + + // InspectorDisplay and for Specialized ReactiveProperty + // If you want to customize other specialized ReactiveProperty + // [UnityEditor.CustomPropertyDrawer(typeof(YourSpecializedReactiveProperty))] + // public class ExtendInspectorDisplayDrawer : InspectorDisplayDrawer { } + + [UnityEditor.CustomPropertyDrawer(typeof(InspectorDisplayAttribute))] + [UnityEditor.CustomPropertyDrawer(typeof(IntReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(LongReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(ByteReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(FloatReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(DoubleReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(StringReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(BoolReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(Vector2ReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(Vector3ReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(Vector4ReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(ColorReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(RectReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(AnimationCurveReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(BoundsReactiveProperty))] + [UnityEditor.CustomPropertyDrawer(typeof(QuaternionReactiveProperty))] + public class InspectorDisplayDrawer : UnityEditor.PropertyDrawer + { + public override void OnGUI(Rect position, UnityEditor.SerializedProperty property, GUIContent label) + { + string fieldName; + bool notifyPropertyChanged; + { + var attr = this.attribute as InspectorDisplayAttribute; + fieldName = (attr == null) ? "value" : attr.FieldName; + notifyPropertyChanged = (attr == null) ? true : attr.NotifyPropertyChanged; + } + + if (notifyPropertyChanged) + { + EditorGUI.BeginChangeCheck(); + } + var targetSerializedProperty = property.FindPropertyRelative(fieldName); + if (targetSerializedProperty == null) + { + UnityEditor.EditorGUI.LabelField(position, label, new GUIContent() { text = "InspectorDisplay can't find target:" + fieldName }); + if (notifyPropertyChanged) + { + EditorGUI.EndChangeCheck(); + } + return; + } + else + { + EmitPropertyField(position, targetSerializedProperty, label); + } + + if (notifyPropertyChanged) + { + if (EditorGUI.EndChangeCheck()) + { + property.serializedObject.ApplyModifiedProperties(); // deserialize to field + + var paths = property.propertyPath.Split('.'); // X.Y.Z... + var attachedComponent = property.serializedObject.targetObject; + + var targetProp = (paths.Length == 1) + ? fieldInfo.GetValue(attachedComponent) + : GetValueRecursive(attachedComponent, 0, paths); + if (targetProp == null) return; + var propInfo = targetProp.GetType().GetProperty(fieldName, BindingFlags.IgnoreCase | BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + var modifiedValue = propInfo.GetValue(targetProp, null); // retrieve new value + + var methodInfo = targetProp.GetType().GetMethod("SetValueAndForceNotify", BindingFlags.IgnoreCase | BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + if (methodInfo != null) + { + methodInfo.Invoke(targetProp, new object[] { modifiedValue }); + } + } + else + { + property.serializedObject.ApplyModifiedProperties(); + } + } + } + + object GetValueRecursive(object obj, int index, string[] paths) + { + var path = paths[index]; + + FieldInfo fldInfo = null; + var type = obj.GetType(); + while (fldInfo == null) + { + // attempt to get information about the field + fldInfo = type.GetField(path, BindingFlags.IgnoreCase | BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + + if (fldInfo != null || + type.BaseType == null || + type.BaseType.IsSubclassOf(typeof(ReactiveProperty<>))) break; + + // if the field information is missing, it may be in the base class + type = type.BaseType; + } + + // If array, path = Array.data[index] + if (fldInfo == null && path == "Array") + { + try + { + path = paths[++index]; + var m = Regex.Match(path, @"(.+)\[([0-9]+)*\]"); + var arrayIndex = int.Parse(m.Groups[2].Value); + var arrayValue = (obj as System.Collections.IList)[arrayIndex]; + if (index < paths.Length - 1) + { + return GetValueRecursive(arrayValue, ++index, paths); + } + else + { + return arrayValue; + } + } + catch + { + Debug.Log("InspectorDisplayDrawer Exception, objType:" + obj.GetType().Name + " path:" + string.Join(", ", paths)); + throw; + } + } + else if (fldInfo == null) + { + throw new Exception("Can't decode path, please report to UniRx's GitHub issues:" + string.Join(", ", paths)); + } + + var v = fldInfo.GetValue(obj); + if (index < paths.Length - 1) + { + return GetValueRecursive(v, ++index, paths); + } + + return v; + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + var attr = this.attribute as InspectorDisplayAttribute; + var fieldName = (attr == null) ? "value" : attr.FieldName; + + var height = base.GetPropertyHeight(property, label); + var valueProperty = property.FindPropertyRelative(fieldName); + if (valueProperty == null) + { + return height; + } + + if (valueProperty.propertyType == SerializedPropertyType.Rect) + { + return height * 2; + } + if (valueProperty.propertyType == SerializedPropertyType.Bounds) + { + return height * 3; + } + if (valueProperty.propertyType == SerializedPropertyType.String) + { + var multilineAttr = GetMultilineAttribute(); + if (multilineAttr != null) + { + return ((!EditorGUIUtility.wideMode) ? 16f : 0f) + 16f + (float)((multilineAttr.Lines - 1) * 13); + }; + } + + if (valueProperty.isExpanded) + { + var count = 0; + var e = valueProperty.GetEnumerator(); + while (e.MoveNext()) count++; + return ((height + 4) * count) + 6; // (Line = 20 + Padding) ? + } + + return height; + } + + protected virtual void EmitPropertyField(Rect position, UnityEditor.SerializedProperty targetSerializedProperty, GUIContent label) + { + var multiline = GetMultilineAttribute(); + if (multiline == null) + { + var range = GetRangeAttribute(); + if (range == null) + { + UnityEditor.EditorGUI.PropertyField(position, targetSerializedProperty, label, includeChildren: true); + } + else + { + if (targetSerializedProperty.propertyType == SerializedPropertyType.Float) + { + EditorGUI.Slider(position, targetSerializedProperty, range.Min, range.Max, label); + } + else if (targetSerializedProperty.propertyType == SerializedPropertyType.Integer) + { + EditorGUI.IntSlider(position, targetSerializedProperty, (int)range.Min, (int)range.Max, label); + } + else + { + EditorGUI.LabelField(position, label.text, "Use Range with float or int."); + } + } + } + else + { + var property = targetSerializedProperty; + + label = EditorGUI.BeginProperty(position, label, property); + var method = typeof(EditorGUI).GetMethod("MultiFieldPrefixLabel", BindingFlags.Static | BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.NonPublic); + position = (Rect)method.Invoke(null, new object[] { position, 0, label, 1 }); + + EditorGUI.BeginChangeCheck(); + int indentLevel = EditorGUI.indentLevel; + EditorGUI.indentLevel = 0; + var stringValue = EditorGUI.TextArea(position, property.stringValue); + EditorGUI.indentLevel = indentLevel; + if (EditorGUI.EndChangeCheck()) + { + property.stringValue = stringValue; + } + EditorGUI.EndProperty(); + } + } + + MultilineReactivePropertyAttribute GetMultilineAttribute() + { + var fi = this.fieldInfo; + if (fi == null) return null; + return fi.GetCustomAttributes(false).OfType().FirstOrDefault(); + } + + RangeReactivePropertyAttribute GetRangeAttribute() + { + var fi = this.fieldInfo; + if (fi == null) return null; + return fi.GetCustomAttributes(false).OfType().FirstOrDefault(); + } + } + +#endif +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs.meta new file mode 100644 index 00000000..9ac054cf --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/InspectorDisplayDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6180f9fd2198dee44ae7f4a617529ffa +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs new file mode 100644 index 00000000..dd65fe25 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UniRx.Triggers; +using UnityEngine; + +namespace UniRx +{ + public static partial class DisposableExtensions + { + /// Dispose self on target gameObject has been destroyed. Return value is self disposable. + public static T AddTo(this T disposable, GameObject gameObject) + where T : IDisposable + { + if (gameObject == null) + { + disposable.Dispose(); + return disposable; + } + + var trigger = gameObject.GetComponent(); + if (trigger == null) + { + trigger = gameObject.AddComponent(); + } + +#pragma warning disable 618 + + // If gameObject is deactive, does not raise OnDestroy, watch and invoke trigger. + if (!trigger.IsActivated && !trigger.IsMonitoredActivate && !trigger.gameObject.activeInHierarchy) + { + trigger.IsMonitoredActivate = true; + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(MonitorTriggerHealth(trigger, gameObject)); + } + +#pragma warning restore 618 + + trigger.AddDisposableOnDestroy(disposable); + return disposable; + } + + static IEnumerator MonitorTriggerHealth(ObservableDestroyTrigger trigger, GameObject targetGameObject) + { + while (true) + { + yield return null; + if (trigger.IsActivated) yield break; + + if (targetGameObject == null) // isDestroy + { + trigger.ForceRaiseOnDestroy(); // Force publish OnDestroy + yield break; + } + } + } + + /// Dispose self on target gameObject has been destroyed. Return value is self disposable. + public static T AddTo(this T disposable, Component gameObjectComponent) + where T : IDisposable + { + if (gameObjectComponent == null) + { + disposable.Dispose(); + return disposable; + } + + return AddTo(disposable, gameObjectComponent.gameObject); + } + + /// + /// Add disposable(self) to CompositeDisposable(or other ICollection) and Dispose self on target gameObject has been destroyed. + /// Return value is self disposable. + /// + public static T AddTo(this T disposable, ICollection container, GameObject gameObject) + where T : IDisposable + { + return disposable.AddTo(container).AddTo(gameObject); + } + + /// + /// Add disposable(self) to CompositeDisposable(or other ICollection) and Dispose self on target gameObject has been destroyed. + /// Return value is self disposable. + /// + public static T AddTo(this T disposable, ICollection container, Component gameObjectComponent) + where T : IDisposable + { + return disposable.AddTo(container).AddTo(gameObjectComponent); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs.meta new file mode 100644 index 00000000..1491bd12 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a7474e4acdc541340a1f566b2df46355 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs new file mode 100644 index 00000000..91cc8c45 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs @@ -0,0 +1,683 @@ +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) +#define SupportCustomYieldInstruction +#endif + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using System.Threading; +using UniRx.InternalUtil; +using UnityEngine; + +namespace UniRx +{ + public sealed class MainThreadDispatcher : MonoBehaviour + { + public enum CullingMode + { + /// + /// Won't remove any MainThreadDispatchers. + /// + Disabled, + + /// + /// Checks if there is an existing MainThreadDispatcher on Awake(). If so, the new dispatcher removes itself. + /// + Self, + + /// + /// Search for excess MainThreadDispatchers and removes them all on Awake(). + /// + All + } + + public static CullingMode cullingMode = CullingMode.Self; + +#if UNITY_EDITOR + + // In UnityEditor's EditorMode can't instantiate and work MonoBehaviour.Update. + // EditorThreadDispatcher use EditorApplication.update instead of MonoBehaviour.Update. + class EditorThreadDispatcher + { + static object gate = new object(); + static EditorThreadDispatcher instance; + + public static EditorThreadDispatcher Instance + { + get + { + // Activate EditorThreadDispatcher is dangerous, completely Lazy. + lock (gate) + { + if (instance == null) + { + instance = new EditorThreadDispatcher(); + } + + return instance; + } + } + } + + ThreadSafeQueueWorker editorQueueWorker = new ThreadSafeQueueWorker(); + + EditorThreadDispatcher() + { + UnityEditor.EditorApplication.update += Update; + } + + public void Enqueue(Action action, object state) + { + editorQueueWorker.Enqueue(action, state); + } + + public void UnsafeInvoke(Action action) + { + try + { + action(); + } + catch (Exception ex) + { + Debug.LogException(ex); + } + } + + public void UnsafeInvoke(Action action, T state) + { + try + { + action(state); + } + catch (Exception ex) + { + Debug.LogException(ex); + } + } + + public void PseudoStartCoroutine(IEnumerator routine) + { + editorQueueWorker.Enqueue(_ => ConsumeEnumerator(routine), null); + } + + void Update() + { + editorQueueWorker.ExecuteAll(x => Debug.LogException(x)); + } + + void ConsumeEnumerator(IEnumerator routine) + { + if (routine.MoveNext()) + { + var current = routine.Current; + if (current == null) + { + goto ENQUEUE; + } + + var type = current.GetType(); +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + if (type == typeof(WWW)) + { + var www = (WWW)current; + editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitWWW(www, routine)), null); + return; + } +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif + else if (type == typeof(AsyncOperation)) + { + var asyncOperation = (AsyncOperation)current; + editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitAsyncOperation(asyncOperation, routine)), null); + return; + } + else if (type == typeof(WaitForSeconds)) + { + var waitForSeconds = (WaitForSeconds)current; + var accessor = typeof(WaitForSeconds).GetField("m_Seconds", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic); + var second = (float)accessor.GetValue(waitForSeconds); + editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitForSeconds(second, routine)), null); + return; + } + else if (type == typeof(Coroutine)) + { + Debug.Log("Can't wait coroutine on UnityEditor"); + goto ENQUEUE; + } +#if SupportCustomYieldInstruction + else if (current is IEnumerator) + { + var enumerator = (IEnumerator)current; + editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapEnumerator(enumerator, routine)), null); + return; + } +#endif + + ENQUEUE: + editorQueueWorker.Enqueue(_ => ConsumeEnumerator(routine), null); // next update + } + } + +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + IEnumerator UnwrapWaitWWW(WWW www, IEnumerator continuation) + { + while (!www.isDone) + { + yield return null; + } + ConsumeEnumerator(continuation); + } +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif + + IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation, IEnumerator continuation) + { + while (!asyncOperation.isDone) + { + yield return null; + } + ConsumeEnumerator(continuation); + } + + IEnumerator UnwrapWaitForSeconds(float second, IEnumerator continuation) + { + var startTime = DateTimeOffset.UtcNow; + while (true) + { + yield return null; + + var elapsed = (DateTimeOffset.UtcNow - startTime).TotalSeconds; + if (elapsed >= second) + { + break; + } + }; + ConsumeEnumerator(continuation); + } + + IEnumerator UnwrapEnumerator(IEnumerator enumerator, IEnumerator continuation) + { + while (enumerator.MoveNext()) + { + yield return null; + } + ConsumeEnumerator(continuation); + } + } + +#endif + + /// Dispatch Asyncrhonous action. + public static void Post(Action action, object state) + { +#if UNITY_EDITOR + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.Enqueue(action, state); return; } + +#endif + + var dispatcher = Instance; + if (!isQuitting && !object.ReferenceEquals(dispatcher, null)) + { + dispatcher.queueWorker.Enqueue(action, state); + } + } + + /// Dispatch Synchronous action if possible. + public static void Send(Action action, object state) + { +#if UNITY_EDITOR + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.Enqueue(action, state); return; } +#endif + + if (mainThreadToken != null) + { + try + { + action(state); + } + catch (Exception ex) + { + var dispatcher = MainThreadDispatcher.Instance; + if (dispatcher != null) + { + dispatcher.unhandledExceptionCallback(ex); + } + } + } + else + { + Post(action, state); + } + } + + /// Run Synchronous action. + public static void UnsafeSend(Action action) + { +#if UNITY_EDITOR + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.UnsafeInvoke(action); return; } +#endif + + try + { + action(); + } + catch (Exception ex) + { + var dispatcher = MainThreadDispatcher.Instance; + if (dispatcher != null) + { + dispatcher.unhandledExceptionCallback(ex); + } + } + } + + /// Run Synchronous action. + public static void UnsafeSend(Action action, T state) + { +#if UNITY_EDITOR + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.UnsafeInvoke(action, state); return; } +#endif + + try + { + action(state); + } + catch (Exception ex) + { + var dispatcher = MainThreadDispatcher.Instance; + if (dispatcher != null) + { + dispatcher.unhandledExceptionCallback(ex); + } + } + } + + /// ThreadSafe StartCoroutine. + public static void SendStartCoroutine(IEnumerator routine) + { + if (mainThreadToken != null) + { + StartCoroutine(routine); + } + else + { +#if UNITY_EDITOR + // call from other thread + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return; } +#endif + + var dispatcher = Instance; + if (!isQuitting && !object.ReferenceEquals(dispatcher, null)) + { + dispatcher.queueWorker.Enqueue(_ => + { + var dispacher2 = Instance; + if (dispacher2 != null) + { + (dispacher2 as MonoBehaviour).StartCoroutine(routine); + } + }, null); + } + } + } + + public static void StartUpdateMicroCoroutine(IEnumerator routine) + { +#if UNITY_EDITOR + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return; } +#endif + + var dispatcher = Instance; + if (dispatcher != null) + { + dispatcher.updateMicroCoroutine.AddCoroutine(routine); + } + } + + public static void StartFixedUpdateMicroCoroutine(IEnumerator routine) + { +#if UNITY_EDITOR + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return; } +#endif + + var dispatcher = Instance; + if (dispatcher != null) + { + dispatcher.fixedUpdateMicroCoroutine.AddCoroutine(routine); + } + } + + public static void StartEndOfFrameMicroCoroutine(IEnumerator routine) + { +#if UNITY_EDITOR + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return; } +#endif + + var dispatcher = Instance; + if (dispatcher != null) + { + dispatcher.endOfFrameMicroCoroutine.AddCoroutine(routine); + } + } + + new public static Coroutine StartCoroutine(IEnumerator routine) + { +#if UNITY_EDITOR + if (!ScenePlaybackDetector.IsPlaying) { EditorThreadDispatcher.Instance.PseudoStartCoroutine(routine); return null; } +#endif + + var dispatcher = Instance; + if (dispatcher != null) + { + return (dispatcher as MonoBehaviour).StartCoroutine(routine); + } + else + { + return null; + } + } + + public static void RegisterUnhandledExceptionCallback(Action exceptionCallback) + { + if (exceptionCallback == null) + { + // do nothing + Instance.unhandledExceptionCallback = Stubs.Ignore; + } + else + { + Instance.unhandledExceptionCallback = exceptionCallback; + } + } + + ThreadSafeQueueWorker queueWorker = new ThreadSafeQueueWorker(); + Action unhandledExceptionCallback = ex => Debug.LogException(ex); // default + + MicroCoroutine updateMicroCoroutine = null; + MicroCoroutine fixedUpdateMicroCoroutine = null; + MicroCoroutine endOfFrameMicroCoroutine = null; + + static MainThreadDispatcher instance; + static bool initialized; + static bool isQuitting = false; + + public static string InstanceName + { + get + { + if (instance == null) + { + throw new NullReferenceException("MainThreadDispatcher is not initialized."); + } + return instance.name; + } + } + + public static bool IsInitialized + { + get { return initialized && instance != null; } + } + + [ThreadStatic] + static object mainThreadToken; + + static MainThreadDispatcher Instance + { + get + { + Initialize(); + return instance; + } + } + + public static void Initialize() + { + if (!initialized) + { +#if UNITY_EDITOR + // Don't try to add a GameObject when the scene is not playing. Only valid in the Editor, EditorView. + if (!ScenePlaybackDetector.IsPlaying) return; +#endif + MainThreadDispatcher dispatcher = null; + + try + { + dispatcher = GameObject.FindObjectOfType(); + } + catch + { + // Throw exception when calling from a worker thread. + var ex = new Exception("UniRx requires a MainThreadDispatcher component created on the main thread. Make sure it is added to the scene before calling UniRx from a worker thread."); + UnityEngine.Debug.LogException(ex); + throw ex; + } + + if (isQuitting) + { + // don't create new instance after quitting + // avoid "Some objects were not cleaned up when closing the scene find target" error. + return; + } + + if (dispatcher == null) + { + // awake call immediately from UnityEngine + new GameObject("MainThreadDispatcher").AddComponent(); + } + else + { + dispatcher.Awake(); // force awake + } + } + } + + public static bool IsInMainThread + { + get + { + return (mainThreadToken != null); + } + } + + void Awake() + { + if (instance == null) + { + instance = this; + mainThreadToken = new object(); + initialized = true; + + updateMicroCoroutine = new MicroCoroutine(ex => unhandledExceptionCallback(ex)); + fixedUpdateMicroCoroutine = new MicroCoroutine(ex => unhandledExceptionCallback(ex)); + endOfFrameMicroCoroutine = new MicroCoroutine(ex => unhandledExceptionCallback(ex)); + + StartCoroutine(RunUpdateMicroCoroutine()); + StartCoroutine(RunFixedUpdateMicroCoroutine()); + StartCoroutine(RunEndOfFrameMicroCoroutine()); + + DontDestroyOnLoad(gameObject); + } + else + { + if (this != instance) + { + if (cullingMode == CullingMode.Self) + { + // Try to destroy this dispatcher if there's already one in the scene. + Debug.LogWarning("There is already a MainThreadDispatcher in the scene. Removing myself..."); + DestroyDispatcher(this); + } + else if (cullingMode == CullingMode.All) + { + Debug.LogWarning("There is already a MainThreadDispatcher in the scene. Cleaning up all excess dispatchers..."); + CullAllExcessDispatchers(); + } + else + { + Debug.LogWarning("There is already a MainThreadDispatcher in the scene."); + } + } + } + } + + IEnumerator RunUpdateMicroCoroutine() + { + while (true) + { + yield return null; + updateMicroCoroutine.Run(); + } + } + + IEnumerator RunFixedUpdateMicroCoroutine() + { + while (true) + { + yield return YieldInstructionCache.WaitForFixedUpdate; + fixedUpdateMicroCoroutine.Run(); + } + } + + IEnumerator RunEndOfFrameMicroCoroutine() + { + while (true) + { + yield return YieldInstructionCache.WaitForEndOfFrame; + endOfFrameMicroCoroutine.Run(); + } + } + + static void DestroyDispatcher(MainThreadDispatcher aDispatcher) + { + if (aDispatcher != instance) + { + // Try to remove game object if it's empty + var components = aDispatcher.gameObject.GetComponents(); + if (aDispatcher.gameObject.transform.childCount == 0 && components.Length == 2) + { + if (components[0] is Transform && components[1] is MainThreadDispatcher) + { + Destroy(aDispatcher.gameObject); + } + } + else + { + // Remove component + MonoBehaviour.Destroy(aDispatcher); + } + } + } + + public static void CullAllExcessDispatchers() + { + var dispatchers = GameObject.FindObjectsOfType(); + for (int i = 0; i < dispatchers.Length; i++) + { + DestroyDispatcher(dispatchers[i]); + } + } + + void OnDestroy() + { + if (instance == this) + { + instance = GameObject.FindObjectOfType(); + initialized = instance != null; + + /* + // Although `this` still refers to a gameObject, it won't be found. + var foundDispatcher = GameObject.FindObjectOfType(); + + if (foundDispatcher != null) + { + // select another game object + Debug.Log("new instance: " + foundDispatcher.name); + instance = foundDispatcher; + initialized = true; + } + */ + } + } + + void Update() + { + if (update != null) + { + try + { + update.OnNext(Unit.Default); + } + catch (Exception ex) + { + unhandledExceptionCallback(ex); + } + } + queueWorker.ExecuteAll(unhandledExceptionCallback); + } + + // for Lifecycle Management + + Subject update; + + public static IObservable UpdateAsObservable() + { + return Instance.update ?? (Instance.update = new Subject()); + } + + Subject lateUpdate; + + void LateUpdate() + { + if (lateUpdate != null) lateUpdate.OnNext(Unit.Default); + } + + public static IObservable LateUpdateAsObservable() + { + return Instance.lateUpdate ?? (Instance.lateUpdate = new Subject()); + } + + Subject onApplicationFocus; + + void OnApplicationFocus(bool focus) + { + if (onApplicationFocus != null) onApplicationFocus.OnNext(focus); + } + + public static IObservable OnApplicationFocusAsObservable() + { + return Instance.onApplicationFocus ?? (Instance.onApplicationFocus = new Subject()); + } + + Subject onApplicationPause; + + void OnApplicationPause(bool pause) + { + if (onApplicationPause != null) onApplicationPause.OnNext(pause); + } + + public static IObservable OnApplicationPauseAsObservable() + { + return Instance.onApplicationPause ?? (Instance.onApplicationPause = new Subject()); + } + + Subject onApplicationQuit; + + void OnApplicationQuit() + { + isQuitting = true; + if (onApplicationQuit != null) onApplicationQuit.OnNext(Unit.Default); + } + + public static IObservable OnApplicationQuitAsObservable() + { + return Instance.onApplicationQuit ?? (Instance.onApplicationQuit = new Subject()); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs.meta new file mode 100644 index 00000000..0825892c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadDispatcher.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c3cd207057515c4438a31a6a7b548fe7 +timeCreated: 1465903910 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -16000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs new file mode 100644 index 00000000..03de6f35 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs @@ -0,0 +1,579 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using UnityEngine; + +namespace UniRx +{ +#if UniRxLibrary + public static partial class SchedulerUnity + { +#else + public static partial class Scheduler + { + public static void SetDefaultForUnity() + { + Scheduler.DefaultSchedulers.ConstantTimeOperations = Scheduler.Immediate; + Scheduler.DefaultSchedulers.TailRecursion = Scheduler.Immediate; + Scheduler.DefaultSchedulers.Iteration = Scheduler.CurrentThread; + Scheduler.DefaultSchedulers.TimeBasedOperations = MainThread; + Scheduler.DefaultSchedulers.AsyncConversions = Scheduler.ThreadPool; + } +#endif + static IScheduler mainThread; + + /// + /// Unity native MainThread Queue Scheduler. Run on mainthread and delayed on coroutine update loop, elapsed time is calculated based on Time.time. + /// + public static IScheduler MainThread + { + get + { + return mainThread ?? (mainThread = new MainThreadScheduler()); + } + } + + static IScheduler mainThreadIgnoreTimeScale; + + /// + /// Another MainThread scheduler, delay elapsed time is calculated based on Time.unscaledDeltaTime. + /// + public static IScheduler MainThreadIgnoreTimeScale + { + get + { + return mainThreadIgnoreTimeScale ?? (mainThreadIgnoreTimeScale = new IgnoreTimeScaleMainThreadScheduler()); + } + } + + static IScheduler mainThreadFixedUpdate; + + /// + /// Run on fixed update mainthread, delay elapsed time is calculated based on Time.fixedTime. + /// + public static IScheduler MainThreadFixedUpdate + { + get + { + return mainThreadFixedUpdate ?? (mainThreadFixedUpdate = new FixedUpdateMainThreadScheduler()); + } + } + + static IScheduler mainThreadEndOfFrame; + + /// + /// Run on end of frame mainthread, delay elapsed time is calculated based on Time.deltaTime. + /// + public static IScheduler MainThreadEndOfFrame + { + get + { + return mainThreadEndOfFrame ?? (mainThreadEndOfFrame = new EndOfFrameMainThreadScheduler()); + } + } + + class MainThreadScheduler : IScheduler, ISchedulerPeriodic, ISchedulerQueueing + { + readonly Action scheduleAction; + + public MainThreadScheduler() + { + MainThreadDispatcher.Initialize(); + scheduleAction = new Action(Schedule); + } + + // delay action is run in StartCoroutine + // Okay to action run synchronous and guaranteed run on MainThread + IEnumerator DelayAction(TimeSpan dueTime, Action action, ICancelable cancellation) + { + // zero == every frame + if (dueTime == TimeSpan.Zero) + { + yield return null; // not immediately, run next frame + } + else + { + yield return new WaitForSeconds((float)dueTime.TotalSeconds); + } + + if (cancellation.IsDisposed) yield break; + MainThreadDispatcher.UnsafeSend(action); + } + + IEnumerator PeriodicAction(TimeSpan period, Action action, ICancelable cancellation) + { + // zero == every frame + if (period == TimeSpan.Zero) + { + while (true) + { + yield return null; // not immediately, run next frame + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action); + } + } + else + { + var seconds = (float)(period.TotalMilliseconds / 1000.0); + var yieldInstruction = new WaitForSeconds(seconds); // cache single instruction object + + while (true) + { + yield return yieldInstruction; + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action); + } + } + } + + public DateTimeOffset Now + { + get { return Scheduler.Now; } + } + + void Schedule(object state) + { + var t = (Tuple)state; + if (!t.Item1.IsDisposed) + { + t.Item2(); + } + } + + public IDisposable Schedule(Action action) + { + var d = new BooleanDisposable(); + MainThreadDispatcher.Post(scheduleAction, Tuple.Create(d, action)); + return d; + } + + public IDisposable Schedule(DateTimeOffset dueTime, Action action) + { + return Schedule(dueTime - Now, action); + } + + public IDisposable Schedule(TimeSpan dueTime, Action action) + { + var d = new BooleanDisposable(); + var time = Scheduler.Normalize(dueTime); + + MainThreadDispatcher.SendStartCoroutine(DelayAction(time, action, d)); + + return d; + } + + public IDisposable SchedulePeriodic(TimeSpan period, Action action) + { + var d = new BooleanDisposable(); + var time = Scheduler.Normalize(period); + + MainThreadDispatcher.SendStartCoroutine(PeriodicAction(time, action, d)); + + return d; + } + + void ScheduleQueueing(object state) + { + var t = (Tuple>)state; + if (!t.Item1.IsDisposed) + { + t.Item3(t.Item2); + } + } + + public void ScheduleQueueing(ICancelable cancel, T state, Action action) + { + MainThreadDispatcher.Post(QueuedAction.Instance, Tuple.Create(cancel, state, action)); + } + + static class QueuedAction + { + public static readonly Action Instance = new Action(Invoke); + + public static void Invoke(object state) + { + var t = (Tuple>)state; + + if (!t.Item1.IsDisposed) + { + t.Item3(t.Item2); + } + } + } + } + + class IgnoreTimeScaleMainThreadScheduler : IScheduler, ISchedulerPeriodic, ISchedulerQueueing + { + readonly Action scheduleAction; + + public IgnoreTimeScaleMainThreadScheduler() + { + MainThreadDispatcher.Initialize(); + scheduleAction = new Action(Schedule); + } + + IEnumerator DelayAction(TimeSpan dueTime, Action action, ICancelable cancellation) + { + if (dueTime == TimeSpan.Zero) + { + yield return null; + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action); + } + else + { + var elapsed = 0f; + var dt = (float)dueTime.TotalSeconds; + while (true) + { + yield return null; + if (cancellation.IsDisposed) break; + + elapsed += Time.unscaledDeltaTime; + if (elapsed >= dt) + { + MainThreadDispatcher.UnsafeSend(action); + break; + } + } + } + } + + IEnumerator PeriodicAction(TimeSpan period, Action action, ICancelable cancellation) + { + // zero == every frame + if (period == TimeSpan.Zero) + { + while (true) + { + yield return null; // not immediately, run next frame + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action); + } + } + else + { + var elapsed = 0f; + var dt = (float)period.TotalSeconds; + while (true) + { + yield return null; + if (cancellation.IsDisposed) break; + + elapsed += Time.unscaledDeltaTime; + if (elapsed >= dt) + { + MainThreadDispatcher.UnsafeSend(action); + elapsed = 0; + } + } + } + } + + public DateTimeOffset Now + { + get { return Scheduler.Now; } + } + + void Schedule(object state) + { + var t = (Tuple)state; + if (!t.Item1.IsDisposed) + { + t.Item2(); + } + } + + public IDisposable Schedule(Action action) + { + var d = new BooleanDisposable(); + MainThreadDispatcher.Post(scheduleAction, Tuple.Create(d, action)); + return d; + } + + public IDisposable Schedule(DateTimeOffset dueTime, Action action) + { + return Schedule(dueTime - Now, action); + } + + public IDisposable Schedule(TimeSpan dueTime, Action action) + { + var d = new BooleanDisposable(); + var time = Scheduler.Normalize(dueTime); + + MainThreadDispatcher.SendStartCoroutine(DelayAction(time, action, d)); + + return d; + } + + public IDisposable SchedulePeriodic(TimeSpan period, Action action) + { + var d = new BooleanDisposable(); + var time = Scheduler.Normalize(period); + + MainThreadDispatcher.SendStartCoroutine(PeriodicAction(time, action, d)); + + return d; + } + + public void ScheduleQueueing(ICancelable cancel, T state, Action action) + { + MainThreadDispatcher.Post(QueuedAction.Instance, Tuple.Create(cancel, state, action)); + } + + static class QueuedAction + { + public static readonly Action Instance = new Action(Invoke); + + public static void Invoke(object state) + { + var t = (Tuple>)state; + + if (!t.Item1.IsDisposed) + { + t.Item3(t.Item2); + } + } + } + } + + class FixedUpdateMainThreadScheduler : IScheduler, ISchedulerPeriodic, ISchedulerQueueing + { + public FixedUpdateMainThreadScheduler() + { + MainThreadDispatcher.Initialize(); + } + + IEnumerator ImmediateAction(T state, Action action, ICancelable cancellation) + { + yield return null; + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action, state); + } + + IEnumerator DelayAction(TimeSpan dueTime, Action action, ICancelable cancellation) + { + if (dueTime == TimeSpan.Zero) + { + yield return null; + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action); + } + else + { + var startTime = Time.fixedTime; + var dt = (float)dueTime.TotalSeconds; + while (true) + { + yield return null; + if (cancellation.IsDisposed) break; + + var elapsed = Time.fixedTime - startTime; + if (elapsed >= dt) + { + MainThreadDispatcher.UnsafeSend(action); + break; + } + } + } + } + + IEnumerator PeriodicAction(TimeSpan period, Action action, ICancelable cancellation) + { + // zero == every frame + if (period == TimeSpan.Zero) + { + while (true) + { + yield return null; + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action); + } + } + else + { + var startTime = Time.fixedTime; + var dt = (float)period.TotalSeconds; + while (true) + { + yield return null; + if (cancellation.IsDisposed) break; + + var ft = Time.fixedTime; + var elapsed = ft - startTime; + if (elapsed >= dt) + { + MainThreadDispatcher.UnsafeSend(action); + startTime = ft; + } + } + } + } + + public DateTimeOffset Now + { + get { return Scheduler.Now; } + } + + public IDisposable Schedule(Action action) + { + return Schedule(TimeSpan.Zero, action); + } + + public IDisposable Schedule(DateTimeOffset dueTime, Action action) + { + return Schedule(dueTime - Now, action); + } + + public IDisposable Schedule(TimeSpan dueTime, Action action) + { + var d = new BooleanDisposable(); + var time = Scheduler.Normalize(dueTime); + + MainThreadDispatcher.StartFixedUpdateMicroCoroutine(DelayAction(time, action, d)); + + return d; + } + + public IDisposable SchedulePeriodic(TimeSpan period, Action action) + { + var d = new BooleanDisposable(); + var time = Scheduler.Normalize(period); + + MainThreadDispatcher.StartFixedUpdateMicroCoroutine(PeriodicAction(time, action, d)); + + return d; + } + + public void ScheduleQueueing(ICancelable cancel, T state, Action action) + { + MainThreadDispatcher.StartFixedUpdateMicroCoroutine(ImmediateAction(state, action, cancel)); + } + } + + class EndOfFrameMainThreadScheduler : IScheduler, ISchedulerPeriodic, ISchedulerQueueing + { + public EndOfFrameMainThreadScheduler() + { + MainThreadDispatcher.Initialize(); + } + + IEnumerator ImmediateAction(T state, Action action, ICancelable cancellation) + { + yield return null; + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action, state); + } + + IEnumerator DelayAction(TimeSpan dueTime, Action action, ICancelable cancellation) + { + if (dueTime == TimeSpan.Zero) + { + yield return null; + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action); + } + else + { + var elapsed = 0f; + var dt = (float)dueTime.TotalSeconds; + while (true) + { + yield return null; + if (cancellation.IsDisposed) break; + + elapsed += Time.deltaTime; + if (elapsed >= dt) + { + MainThreadDispatcher.UnsafeSend(action); + break; + } + } + } + } + + IEnumerator PeriodicAction(TimeSpan period, Action action, ICancelable cancellation) + { + // zero == every frame + if (period == TimeSpan.Zero) + { + while (true) + { + yield return null; + if (cancellation.IsDisposed) yield break; + + MainThreadDispatcher.UnsafeSend(action); + } + } + else + { + var elapsed = 0f; + var dt = (float)period.TotalSeconds; + while (true) + { + yield return null; + if (cancellation.IsDisposed) break; + + elapsed += Time.deltaTime; + if (elapsed >= dt) + { + MainThreadDispatcher.UnsafeSend(action); + elapsed = 0; + } + } + } + } + + public DateTimeOffset Now + { + get { return Scheduler.Now; } + } + + public IDisposable Schedule(Action action) + { + return Schedule(TimeSpan.Zero, action); + } + + public IDisposable Schedule(DateTimeOffset dueTime, Action action) + { + return Schedule(dueTime - Now, action); + } + + public IDisposable Schedule(TimeSpan dueTime, Action action) + { + var d = new BooleanDisposable(); + var time = Scheduler.Normalize(dueTime); + + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(DelayAction(time, action, d)); + + return d; + } + + public IDisposable SchedulePeriodic(TimeSpan period, Action action) + { + var d = new BooleanDisposable(); + var time = Scheduler.Normalize(period); + + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(PeriodicAction(time, action, d)); + + return d; + } + + public void ScheduleQueueing(ICancelable cancel, T state, Action action) + { + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(ImmediateAction(state, action, cancel)); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs.meta new file mode 100644 index 00000000..639fdcf7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/MainThreadScheduler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f141c5dc72b97084a85631367a946ee8 +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs new file mode 100644 index 00000000..9090a6f3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs @@ -0,0 +1,1168 @@ +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) +#define SupportCustomYieldInstruction +#endif + +using System; +using System.Collections; +using System.Collections.Generic; +using UniRx.InternalUtil; +using UniRx.Triggers; +using UnityEngine; +using System.Threading; + +#if !UniRxLibrary +using SchedulerUnity = UniRx.Scheduler; +#endif + +namespace UniRx +{ + public enum FrameCountType + { + Update, + FixedUpdate, + EndOfFrame, + } + + public enum MainThreadDispatchType + { + /// yield return null + Update, + FixedUpdate, + EndOfFrame, + GameObjectUpdate, + LateUpdate, + } + + public static class FrameCountTypeExtensions + { + public static YieldInstruction GetYieldInstruction(this FrameCountType frameCountType) + { + switch (frameCountType) + { + case FrameCountType.FixedUpdate: + return YieldInstructionCache.WaitForFixedUpdate; + case FrameCountType.EndOfFrame: + return YieldInstructionCache.WaitForEndOfFrame; + case FrameCountType.Update: + default: + return null; + } + } + } + + internal interface ICustomYieldInstructionErrorHandler + { + bool HasError { get; } + Exception Error { get; } + bool IsReThrowOnError { get; } + void ForceDisableRethrowOnError(); + void ForceEnableRethrowOnError(); + } + + public class ObservableYieldInstruction : IEnumerator, ICustomYieldInstructionErrorHandler + { + readonly IDisposable subscription; + readonly CancellationToken cancel; + bool reThrowOnError; + T current; + T result; + bool moveNext; + bool hasResult; + Exception error; + + public ObservableYieldInstruction(IObservable source, bool reThrowOnError, CancellationToken cancel) + { + this.moveNext = true; + this.reThrowOnError = reThrowOnError; + this.cancel = cancel; + try + { + this.subscription = source.Subscribe(new ToYieldInstruction(this)); + } + catch + { + moveNext = false; + throw; + } + } + + public bool HasError + { + get { return error != null; } + } + + public bool HasResult + { + get { return hasResult; } + } + + public bool IsCanceled + { + get + { + if (hasResult) return false; + if (error != null) return false; + return cancel.IsCancellationRequested; + } + } + + /// + /// HasResult || IsCanceled || HasError + /// + public bool IsDone + { + get + { + return HasResult || HasError || (cancel.IsCancellationRequested); + } + } + + public T Result + { + get { return result; } + } + + T IEnumerator.Current + { + get + { + return current; + } + } + + object IEnumerator.Current + { + get + { + return current; + } + } + + public Exception Error + { + get + { + return error; + } + } + + bool IEnumerator.MoveNext() + { + if (!moveNext) + { + if (reThrowOnError && HasError) + { + Error.Throw(); + } + + return false; + } + + if (cancel.IsCancellationRequested) + { + subscription.Dispose(); + return false; + } + + return true; + } + + bool ICustomYieldInstructionErrorHandler.IsReThrowOnError + { + get { return reThrowOnError; } + } + + void ICustomYieldInstructionErrorHandler.ForceDisableRethrowOnError() + { + this.reThrowOnError = false; + } + + void ICustomYieldInstructionErrorHandler.ForceEnableRethrowOnError() + { + this.reThrowOnError = true; + } + + public void Dispose() + { + subscription.Dispose(); + } + + void IEnumerator.Reset() + { + throw new NotSupportedException(); + } + + class ToYieldInstruction : IObserver + { + readonly ObservableYieldInstruction parent; + + public ToYieldInstruction(ObservableYieldInstruction parent) + { + this.parent = parent; + } + + public void OnNext(T value) + { + parent.current = value; + } + + public void OnError(Exception error) + { + parent.moveNext = false; + parent.error = error; + } + + public void OnCompleted() + { + parent.moveNext = false; + parent.hasResult = true; + parent.result = parent.current; + } + } + } + +#if UniRxLibrary + public static partial class ObservableUnity +#else + public static partial class Observable +#endif + { + readonly static HashSet YieldInstructionTypes = new HashSet + { + #if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + typeof(WWW), + #if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif + typeof(WaitForEndOfFrame), + typeof(WaitForFixedUpdate), + typeof(WaitForSeconds), + typeof(AsyncOperation), + typeof(Coroutine) + }; + +#if SupportCustomYieldInstruction + + class EveryAfterUpdateInvoker : IEnumerator + { + long count = -1; + readonly IObserver observer; + readonly CancellationToken cancellationToken; + + public EveryAfterUpdateInvoker(IObserver observer, CancellationToken cancellationToken) + { + this.observer = observer; + this.cancellationToken = cancellationToken; + } + + public bool MoveNext() + { + if (!cancellationToken.IsCancellationRequested) + { + if (count != -1) // ignore first/immediate invoke + { + observer.OnNext(count++); + } + else + { + count++; + } + return true; + } + else + { + return false; + } + } + + public object Current + { + get + { + return null; + } + } + + public void Reset() + { + throw new NotSupportedException(); + } + } + +#endif + + + + /// From has no callback coroutine to IObservable. If publishEveryYield = true then publish OnNext every yield return else return once on enumeration completed. + public static IObservable FromCoroutine(Func coroutine, bool publishEveryYield = false) + { + return FromCoroutine((observer, cancellationToken) => WrapEnumerator(coroutine(), observer, cancellationToken, publishEveryYield)); + } + + /// From has no callback coroutine to IObservable. If publishEveryYield = true then publish OnNext every yield return else return once on enumeration completed. + public static IObservable FromCoroutine(Func coroutine, bool publishEveryYield = false) + { + return FromCoroutine((observer, cancellationToken) => WrapEnumerator(coroutine(cancellationToken), observer, cancellationToken, publishEveryYield)); + } + + /// + /// MicroCoroutine is lightweight, fast coroutine dispatcher. + /// IEnumerator supports only yield return null. + /// If publishEveryYield = true then publish OnNext every yield return else return once on enumeration completed. + /// + public static IObservable FromMicroCoroutine(Func coroutine, bool publishEveryYield = false, FrameCountType frameCountType = FrameCountType.Update) + { + return FromMicroCoroutine((observer, cancellationToken) => WrapEnumerator(coroutine(), observer, cancellationToken, publishEveryYield), frameCountType); + } + + /// + /// MicroCoroutine is lightweight, fast coroutine dispatcher. + /// IEnumerator supports only yield return null. + /// If publishEveryYield = true then publish OnNext every yield return else return once on enumeration completed. + /// + public static IObservable FromMicroCoroutine(Func coroutine, bool publishEveryYield = false, FrameCountType frameCountType = FrameCountType.Update) + { + return FromMicroCoroutine((observer, cancellationToken) => WrapEnumerator(coroutine(cancellationToken), observer, cancellationToken, publishEveryYield), frameCountType); + } + + static IEnumerator WrapEnumerator(IEnumerator enumerator, IObserver observer, CancellationToken cancellationToken, bool publishEveryYield) + { + var hasNext = default(bool); + var raisedError = false; + do + { + try + { + hasNext = enumerator.MoveNext(); + } + catch (Exception ex) + { + try + { + raisedError = true; + observer.OnError(ex); + } + finally + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + } + yield break; + } + if (hasNext && publishEveryYield) + { + try + { + observer.OnNext(Unit.Default); + } + catch + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + throw; + } + } + if (hasNext) + { +#if SupportCustomYieldInstruction + var current = enumerator.Current; + var customHandler = current as ICustomYieldInstructionErrorHandler; + if (customHandler != null && customHandler.IsReThrowOnError) + { + // If throws exception in Custom YieldInsrtuction, can't handle parent coroutine. + // It is C# limitation. + // so store error info and retrieve from parent. + customHandler.ForceDisableRethrowOnError(); + yield return current; + customHandler.ForceEnableRethrowOnError(); + + if (customHandler.HasError) + { + try + { + raisedError = true; + observer.OnError(customHandler.Error); + } + finally + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + } + yield break; + } + } + else + { + yield return enumerator.Current; // yield inner YieldInstruction + } +#else + yield return enumerator.Current; // yield inner YieldInstruction +#endif + } + } while (hasNext && !cancellationToken.IsCancellationRequested); + + try + { + if (!raisedError && !cancellationToken.IsCancellationRequested) + { + observer.OnNext(Unit.Default); // last one + observer.OnCompleted(); + } + } + finally + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + } + } + + /// Convert coroutine to typed IObservable. If nullAsNextUpdate = true then yield return null when Enumerator.Current and no null publish observer.OnNext. + public static IObservable FromCoroutineValue(Func coroutine, bool nullAsNextUpdate = true) + { + return FromCoroutine((observer, cancellationToken) => WrapEnumeratorYieldValue(coroutine(), observer, cancellationToken, nullAsNextUpdate)); + } + + /// Convert coroutine to typed IObservable. If nullAsNextUpdate = true then yield return null when Enumerator.Current and no null publish observer.OnNext. + public static IObservable FromCoroutineValue(Func coroutine, bool nullAsNextUpdate = true) + { + return FromCoroutine((observer, cancellationToken) => WrapEnumeratorYieldValue(coroutine(cancellationToken), observer, cancellationToken, nullAsNextUpdate)); + } + + static IEnumerator WrapEnumeratorYieldValue(IEnumerator enumerator, IObserver observer, CancellationToken cancellationToken, bool nullAsNextUpdate) + { + var hasNext = default(bool); + var current = default(object); + var raisedError = false; + do + { + try + { + hasNext = enumerator.MoveNext(); + if (hasNext) current = enumerator.Current; + } + catch (Exception ex) + { + try + { + raisedError = true; + observer.OnError(ex); + } + finally + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + } + yield break; + } + + if (hasNext) + { + if (current != null && YieldInstructionTypes.Contains(current.GetType())) + { + yield return current; + } +#if SupportCustomYieldInstruction + else if (current is IEnumerator) + { + var customHandler = current as ICustomYieldInstructionErrorHandler; + if (customHandler != null && customHandler.IsReThrowOnError) + { + // If throws exception in Custom YieldInsrtuction, can't handle parent coroutine. + // It is C# limitation. + // so store error info and retrieve from parent. + customHandler.ForceDisableRethrowOnError(); + yield return current; + customHandler.ForceEnableRethrowOnError(); + + if (customHandler.HasError) + { + try + { + raisedError = true; + observer.OnError(customHandler.Error); + } + finally + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + } + yield break; + } + } + else + { + yield return current; + } + } +#endif + else if (current == null && nullAsNextUpdate) + { + yield return null; + } + else + { + try + { + observer.OnNext((T)current); + } + catch + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + throw; + } + } + } + } while (hasNext && !cancellationToken.IsCancellationRequested); + + try + { + if (!raisedError && !cancellationToken.IsCancellationRequested) + { + observer.OnCompleted(); + } + } + finally + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + } + } + + public static IObservable FromCoroutine(Func, IEnumerator> coroutine) + { + return FromCoroutine((observer, cancellationToken) => WrapToCancellableEnumerator(coroutine(observer), observer, cancellationToken)); + } + + /// + /// MicroCoroutine is lightweight, fast coroutine dispatcher. + /// IEnumerator supports only yield return null. + /// + public static IObservable FromMicroCoroutine(Func, IEnumerator> coroutine, FrameCountType frameCountType = FrameCountType.Update) + { + return FromMicroCoroutine((observer, cancellationToken) => WrapToCancellableEnumerator(coroutine(observer), observer, cancellationToken), frameCountType); + } + + static IEnumerator WrapToCancellableEnumerator(IEnumerator enumerator, IObserver observer, CancellationToken cancellationToken) + { + var hasNext = default(bool); + do + { + try + { + hasNext = enumerator.MoveNext(); + } + catch (Exception ex) + { + try + { + observer.OnError(ex); + } + finally + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + } + yield break; + } + + yield return enumerator.Current; // yield inner YieldInstruction + } while (hasNext && !cancellationToken.IsCancellationRequested); + + { + var d = enumerator as IDisposable; + if (d != null) + { + d.Dispose(); + } + } + } + + public static IObservable FromCoroutine(Func, CancellationToken, IEnumerator> coroutine) + { + return new UniRx.Operators.FromCoroutineObservable(coroutine); + } + + /// + /// MicroCoroutine is lightweight, fast coroutine dispatcher. + /// IEnumerator supports only yield return null. + /// + public static IObservable FromMicroCoroutine(Func, CancellationToken, IEnumerator> coroutine, FrameCountType frameCountType = FrameCountType.Update) + { + return new UniRx.Operators.FromMicroCoroutineObservable(coroutine, frameCountType); + } + + public static IObservable SelectMany(this IObservable source, IEnumerator coroutine, bool publishEveryYield = false) + { + return source.SelectMany(FromCoroutine(() => coroutine, publishEveryYield)); + } + + public static IObservable SelectMany(this IObservable source, Func selector, bool publishEveryYield = false) + { + return source.SelectMany(FromCoroutine(() => selector(), publishEveryYield)); + } + + /// + /// Note: publishEveryYield is always false. If you want to set true, use Observable.FromCoroutine(() => selector(x), true). This is workaround of Unity compiler's bug. + /// + public static IObservable SelectMany(this IObservable source, Func selector) + { + return source.SelectMany(x => FromCoroutine(() => selector(x), false)); + } + + public static IObservable ToObservable(this IEnumerator coroutine, bool publishEveryYield = false) + { + return FromCoroutine((observer, cancellationToken) => WrapEnumerator(coroutine, observer, cancellationToken, publishEveryYield)); + } + +#if SupportCustomYieldInstruction + + public static ObservableYieldInstruction ToYieldInstruction(this IEnumerator coroutine) + { + return ToObservable(coroutine, false).ToYieldInstruction(); + } + + public static ObservableYieldInstruction ToYieldInstruction(this IEnumerator coroutine, bool throwOnError) + { + return ToObservable(coroutine, false).ToYieldInstruction(throwOnError); + } + + public static ObservableYieldInstruction ToYieldInstruction(this IEnumerator coroutine, CancellationToken cancellationToken) + { + return ToObservable(coroutine, false).ToYieldInstruction(cancellationToken); + } + + public static ObservableYieldInstruction ToYieldInstruction(this IEnumerator coroutine, bool throwOnError, CancellationToken cancellationToken) + { + return ToObservable(coroutine, false).ToYieldInstruction(throwOnError, cancellationToken); + } + +#endif + + // variation of FromCoroutine + + /// + /// EveryUpdate calls coroutine's yield return null timing. It is after all Update and before LateUpdate. + /// + public static IObservable EveryUpdate() + { + return FromMicroCoroutine((observer, cancellationToken) => EveryCycleCore(observer, cancellationToken), FrameCountType.Update); + } + + public static IObservable EveryFixedUpdate() + { + return FromMicroCoroutine((observer, cancellationToken) => EveryCycleCore(observer, cancellationToken), FrameCountType.FixedUpdate); + } + + public static IObservable EveryEndOfFrame() + { + return FromMicroCoroutine((observer, cancellationToken) => EveryCycleCore(observer, cancellationToken), FrameCountType.EndOfFrame); + } + + static IEnumerator EveryCycleCore(IObserver observer, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) yield break; + var count = 0L; + while (true) + { + yield return null; + if (cancellationToken.IsCancellationRequested) yield break; + + observer.OnNext(count++); + } + } + + /// + /// EveryGameObjectUpdate calls from MainThreadDispatcher's Update. + /// + public static IObservable EveryGameObjectUpdate() + { + return MainThreadDispatcher.UpdateAsObservable().Scan(-1L, (x, y) => x + 1); + } + + /// + /// EveryLateUpdate calls from MainThreadDispatcher's OnLateUpdate. + /// + public static IObservable EveryLateUpdate() + { + return MainThreadDispatcher.LateUpdateAsObservable().Scan(-1L, (x, y) => x + 1); + } + +#if SupportCustomYieldInstruction + + /// + /// [Obsolete]Same as EveryUpdate. + /// + [Obsolete] + public static IObservable EveryAfterUpdate() + { + return FromCoroutine((observer, cancellationToken) => new EveryAfterUpdateInvoker(observer, cancellationToken)); + } + +#endif + + #region Observable.Time Frame Extensions + + // Interval, Timer, Delay, Sample, Throttle, Timeout + + public static IObservable NextFrame(FrameCountType frameCountType = FrameCountType.Update) + { + return FromMicroCoroutine((observer, cancellation) => NextFrameCore(observer, cancellation), frameCountType); + } + + static IEnumerator NextFrameCore(IObserver observer, CancellationToken cancellation) + { + yield return null; + + if (!cancellation.IsCancellationRequested) + { + observer.OnNext(Unit.Default); + observer.OnCompleted(); + } + } + + public static IObservable IntervalFrame(int intervalFrameCount, FrameCountType frameCountType = FrameCountType.Update) + { + return TimerFrame(intervalFrameCount, intervalFrameCount, frameCountType); + } + + public static IObservable TimerFrame(int dueTimeFrameCount, FrameCountType frameCountType = FrameCountType.Update) + { + return FromMicroCoroutine((observer, cancellation) => TimerFrameCore(observer, dueTimeFrameCount, cancellation), frameCountType); + } + + public static IObservable TimerFrame(int dueTimeFrameCount, int periodFrameCount, FrameCountType frameCountType = FrameCountType.Update) + { + return FromMicroCoroutine((observer, cancellation) => TimerFrameCore(observer, dueTimeFrameCount, periodFrameCount, cancellation), frameCountType); + } + + static IEnumerator TimerFrameCore(IObserver observer, int dueTimeFrameCount, CancellationToken cancel) + { + // normalize + if (dueTimeFrameCount <= 0) dueTimeFrameCount = 0; + + var currentFrame = 0; + + // initial phase + while (!cancel.IsCancellationRequested) + { + if (currentFrame++ == dueTimeFrameCount) + { + observer.OnNext(0); + observer.OnCompleted(); + break; + } + yield return null; + } + } + + static IEnumerator TimerFrameCore(IObserver observer, int dueTimeFrameCount, int periodFrameCount, CancellationToken cancel) + { + // normalize + if (dueTimeFrameCount <= 0) dueTimeFrameCount = 0; + if (periodFrameCount <= 0) periodFrameCount = 1; + + var sendCount = 0L; + var currentFrame = 0; + + // initial phase + while (!cancel.IsCancellationRequested) + { + if (currentFrame++ == dueTimeFrameCount) + { + observer.OnNext(sendCount++); + currentFrame = -1; + break; + } + yield return null; + } + + // period phase + while (!cancel.IsCancellationRequested) + { + if (++currentFrame == periodFrameCount) + { + observer.OnNext(sendCount++); + currentFrame = 0; + } + yield return null; + } + } + + public static IObservable DelayFrame(this IObservable source, int frameCount, FrameCountType frameCountType = FrameCountType.Update) + { + if (frameCount < 0) throw new ArgumentOutOfRangeException("frameCount"); + return new UniRx.Operators.DelayFrameObservable(source, frameCount, frameCountType); + } + + public static IObservable Sample(this IObservable source, IObservable sampler) + { + return new UniRx.Operators.SampleObservable(source, sampler); + } + + public static IObservable SampleFrame(this IObservable source, int frameCount, FrameCountType frameCountType = FrameCountType.Update) + { + if (frameCount < 0) throw new ArgumentOutOfRangeException("frameCount"); + return new UniRx.Operators.SampleFrameObservable(source, frameCount, frameCountType); + } + + public static IObservable ThrottleFrame(this IObservable source, int frameCount, FrameCountType frameCountType = FrameCountType.Update) + { + if (frameCount < 0) throw new ArgumentOutOfRangeException("frameCount"); + return new UniRx.Operators.ThrottleFrameObservable(source, frameCount, frameCountType); + } + + public static IObservable ThrottleFirstFrame(this IObservable source, int frameCount, FrameCountType frameCountType = FrameCountType.Update) + { + if (frameCount < 0) throw new ArgumentOutOfRangeException("frameCount"); + return new UniRx.Operators.ThrottleFirstFrameObservable(source, frameCount, frameCountType); + } + + public static IObservable TimeoutFrame(this IObservable source, int frameCount, FrameCountType frameCountType = FrameCountType.Update) + { + if (frameCount < 0) throw new ArgumentOutOfRangeException("frameCount"); + return new UniRx.Operators.TimeoutFrameObservable(source, frameCount, frameCountType); + } + + public static IObservable DelayFrameSubscription(this IObservable source, int frameCount, FrameCountType frameCountType = FrameCountType.Update) + { + if (frameCount < 0) throw new ArgumentOutOfRangeException("frameCount"); + return new UniRx.Operators.DelayFrameSubscriptionObservable(source, frameCount, frameCountType); + } + + #endregion + +#if SupportCustomYieldInstruction + + /// + /// Convert to yieldable IEnumerator. e.g. yield return source.ToYieldInstruction();. + /// If needs last result, you can take ObservableYieldInstruction.HasResult/Result property. + /// This overload throws exception if received OnError events(same as coroutine). + /// + public static ObservableYieldInstruction ToYieldInstruction(this IObservable source) + { + return new ObservableYieldInstruction(source, true, CancellationToken.None); + } + + /// + /// Convert to yieldable IEnumerator. e.g. yield return source.ToYieldInstruction();. + /// If needs last result, you can take ObservableYieldInstruction.HasResult/Result property. + /// This overload throws exception if received OnError events(same as coroutine). + /// + public static ObservableYieldInstruction ToYieldInstruction(this IObservable source, CancellationToken cancel) + { + return new ObservableYieldInstruction(source, true, cancel); + } + + /// + /// Convert to yieldable IEnumerator. e.g. yield return source.ToYieldInstruction();. + /// If needs last result, you can take ObservableYieldInstruction.HasResult/Result property. + /// If throwOnError = false, you can take ObservableYieldInstruction.HasError/Error property. + /// + public static ObservableYieldInstruction ToYieldInstruction(this IObservable source, bool throwOnError) + { + return new ObservableYieldInstruction(source, throwOnError, CancellationToken.None); + } + + /// + /// Convert to yieldable IEnumerator. e.g. yield return source.ToYieldInstruction();. + /// If needs last result, you can take ObservableYieldInstruction.HasResult/Result property. + /// If throwOnError = false, you can take ObservableYieldInstruction.HasError/Error property. + /// + public static ObservableYieldInstruction ToYieldInstruction(this IObservable source, bool throwOnError, CancellationToken cancel) + { + return new ObservableYieldInstruction(source, throwOnError, cancel); + } + +#endif + + /// Convert to awaitable IEnumerator. + public static IEnumerator ToAwaitableEnumerator(this IObservable source, CancellationToken cancel = default(CancellationToken)) + { + return ToAwaitableEnumerator(source, Stubs.Ignore, Stubs.Throw, cancel); + } + + /// Convert to awaitable IEnumerator. + public static IEnumerator ToAwaitableEnumerator(this IObservable source, Action onResult, CancellationToken cancel = default(CancellationToken)) + { + return ToAwaitableEnumerator(source, onResult, Stubs.Throw, cancel); + } + + /// Convert to awaitable IEnumerator. + public static IEnumerator ToAwaitableEnumerator(this IObservable source, Action onError, CancellationToken cancel = default(CancellationToken)) + { + return ToAwaitableEnumerator(source, Stubs.Ignore, onError, cancel); + } + + /// Convert to awaitable IEnumerator. + public static IEnumerator ToAwaitableEnumerator(this IObservable source, Action onResult, Action onError, CancellationToken cancel = default(CancellationToken)) + { + var enumerator = new ObservableYieldInstruction(source, false, cancel); + var e = (IEnumerator)enumerator; + while (e.MoveNext() && !cancel.IsCancellationRequested) + { + yield return null; + } + + if (cancel.IsCancellationRequested) + { + enumerator.Dispose(); + yield break; + } + + if (enumerator.HasResult) + { + onResult(enumerator.Result); + } + else if (enumerator.HasError) + { + onError(enumerator.Error); + } + } + + /// AutoStart observable as coroutine. + public static Coroutine StartAsCoroutine(this IObservable source, CancellationToken cancel = default(CancellationToken)) + { + return StartAsCoroutine(source, Stubs.Ignore, Stubs.Throw, cancel); + } + + /// AutoStart observable as coroutine. + public static Coroutine StartAsCoroutine(this IObservable source, Action onResult, CancellationToken cancel = default(CancellationToken)) + { + return StartAsCoroutine(source, onResult, Stubs.Throw, cancel); + } + + /// AutoStart observable as coroutine. + public static Coroutine StartAsCoroutine(this IObservable source, Action onError, CancellationToken cancel = default(CancellationToken)) + { + return StartAsCoroutine(source, Stubs.Ignore, onError, cancel); + } + + /// AutoStart observable as coroutine. + public static Coroutine StartAsCoroutine(this IObservable source, Action onResult, Action onError, CancellationToken cancel = default(CancellationToken)) + { + return MainThreadDispatcher.StartCoroutine(source.ToAwaitableEnumerator(onResult, onError, cancel)); + } + + public static IObservable ObserveOnMainThread(this IObservable source) + { + return source.ObserveOn(SchedulerUnity.MainThread); + } + + public static IObservable ObserveOnMainThread(this IObservable source, MainThreadDispatchType dispatchType) + { + switch (dispatchType) + { + case MainThreadDispatchType.Update: + return source.ObserveOnMainThread(); // faster path + + // others, bit slower + + case MainThreadDispatchType.FixedUpdate: + return source.SelectMany(_ => EveryFixedUpdate().Take(1), (x, _) => x); + case MainThreadDispatchType.EndOfFrame: + return source.SelectMany(_ => EveryEndOfFrame().Take(1), (x, _) => x); + case MainThreadDispatchType.GameObjectUpdate: + return source.SelectMany(_ => MainThreadDispatcher.UpdateAsObservable().Take(1), (x, _) => x); + case MainThreadDispatchType.LateUpdate: + return source.SelectMany(_ => MainThreadDispatcher.LateUpdateAsObservable().Take(1), (x, _) => x); + default: + throw new ArgumentException("type is invalid"); + } + } + + public static IObservable SubscribeOnMainThread(this IObservable source) + { + return source.SubscribeOn(SchedulerUnity.MainThread); + } + + // I can't avoid Unity 5.3's uNET weaver bug, pending... + + //public static IObservable SubscribeOnMainThread(this IObservable source, MainThreadDispatchType dispatchType) + //{ + // switch (dispatchType) + // { + // case MainThreadDispatchType.Update: + // return source.SubscribeOnMainThread(); // faster path + + // // others, bit slower + + // case MainThreadDispatchType.FixedUpdate: + // return new UniRx.Operators.SubscribeOnMainThreadObservable(source, EveryFixedUpdate().Take(1)); + // case MainThreadDispatchType.EndOfFrame: + // return new UniRx.Operators.SubscribeOnMainThreadObservable(source, EveryEndOfFrame().Take(1)); + // case MainThreadDispatchType.GameObjectUpdate: + // return new UniRx.Operators.SubscribeOnMainThreadObservable(source, MainThreadDispatcher.UpdateAsObservable().Select(_ => 0L).Take(1)); + // case MainThreadDispatchType.LateUpdate: + // return new UniRx.Operators.SubscribeOnMainThreadObservable(source, MainThreadDispatcher.LateUpdateAsObservable().Select(_ => 0L).Take(1)); + // case MainThreadDispatchType.AfterUpdate: + // return new UniRx.Operators.SubscribeOnMainThreadObservable(source, EveryAfterUpdate().Take(1)); + // default: + // throw new ArgumentException("type is invalid"); + // } + //} + + public static IObservable EveryApplicationPause() + { + return MainThreadDispatcher.OnApplicationPauseAsObservable().AsObservable(); + } + + public static IObservable EveryApplicationFocus() + { + return MainThreadDispatcher.OnApplicationFocusAsObservable().AsObservable(); + } + + /// publish OnNext(Unit) and OnCompleted() on application quit. + public static IObservable OnceApplicationQuit() + { + return MainThreadDispatcher.OnApplicationQuitAsObservable().Take(1); + } + + public static IObservable TakeUntilDestroy(this IObservable source, Component target) + { + return source.TakeUntil(target.OnDestroyAsObservable()); + } + + public static IObservable TakeUntilDestroy(this IObservable source, GameObject target) + { + return source.TakeUntil(target.OnDestroyAsObservable()); + } + + public static IObservable TakeUntilDisable(this IObservable source, Component target) + { + return source.TakeUntil(target.OnDisableAsObservable()); + } + + public static IObservable TakeUntilDisable(this IObservable source, GameObject target) + { + return source.TakeUntil(target.OnDisableAsObservable()); + } + + public static IObservable RepeatUntilDestroy(this IObservable source, GameObject target) + { + return RepeatUntilCore(RepeatInfinite(source), target.OnDestroyAsObservable(), target); + } + + public static IObservable RepeatUntilDestroy(this IObservable source, Component target) + { + return RepeatUntilCore(RepeatInfinite(source), target.OnDestroyAsObservable(), (target != null) ? target.gameObject : null); + } + + public static IObservable RepeatUntilDisable(this IObservable source, GameObject target) + { + return RepeatUntilCore(RepeatInfinite(source), target.OnDisableAsObservable(), target); + } + + public static IObservable RepeatUntilDisable(this IObservable source, Component target) + { + return RepeatUntilCore(RepeatInfinite(source), target.OnDisableAsObservable(), (target != null) ? target.gameObject : null); + } + + static IObservable RepeatUntilCore(this IEnumerable> sources, IObservable trigger, GameObject lifeTimeChecker) + { + return new UniRx.Operators.RepeatUntilObservable(sources, trigger, lifeTimeChecker); + } + + public static IObservable> FrameInterval(this IObservable source) + { + return new UniRx.Operators.FrameIntervalObservable(source); + } + + public static IObservable> FrameTimeInterval(this IObservable source, bool ignoreTimeScale = false) + { + return new UniRx.Operators.FrameTimeIntervalObservable(source, ignoreTimeScale); + } + + /// + /// Buffer elements in during target frame counts. Default raise same frame of end(frameCount = 0, frameCountType = EndOfFrame). + /// + public static IObservable> BatchFrame(this IObservable source) + { + // if use default argument, comiler errors ambiguous(Unity's limitation) + return BatchFrame(source, 0, FrameCountType.EndOfFrame); + } + + /// + /// Buffer elements in during target frame counts. + /// + public static IObservable> BatchFrame(this IObservable source, int frameCount, FrameCountType frameCountType) + { + if (frameCount < 0) throw new ArgumentException("frameCount must be >= 0, frameCount:" + frameCount); + return new UniRx.Operators.BatchFrameObservable(source, frameCount, frameCountType); + } + + /// + /// Wait command in during target frame counts. Default raise same frame of end(frameCount = 0, frameCountType = EndOfFrame). + /// + public static IObservable BatchFrame(this IObservable source) + { + return BatchFrame(source, 0, FrameCountType.EndOfFrame); + } + + /// + /// Wait command in during target frame counts. + /// + public static IObservable BatchFrame(this IObservable source, int frameCount, FrameCountType frameCountType) + { + if (frameCount < 0) throw new ArgumentException("frameCount must be >= 0, frameCount:" + frameCount); + return new UniRx.Operators.BatchFrameObservable(source, frameCount, frameCountType); + } + +#if UniRxLibrary + + static IEnumerable> RepeatInfinite(IObservable source) + { + while (true) + { + yield return source; + } + } + + internal static class Stubs + { + public static readonly Action Nop = () => { }; + public static readonly Action Throw = ex => { ex.Throw(); }; + + // Stubs.Ignore can't avoid iOS AOT problem. + public static void Ignore(T t) + { + } + + // marker for CatchIgnore and Catch avoid iOS AOT problem. + public static IObservable CatchIgnore(Exception ex) + { + return Observable.Empty(); + } + } +#endif + } +} diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs.meta new file mode 100644 index 00000000..a5cabe6f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Observable.Unity.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c6ef0a186b9ceaf41af7f2a9f4006216 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs new file mode 100644 index 00000000..e1bc7d7d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs @@ -0,0 +1,442 @@ +using System; +using System.Collections; +using UnityEngine; + +#if !UniRxLibrary +using ObservableUnity = UniRx.Observable; +#endif + +#if UNITY_2018_3_OR_NEWER +#pragma warning disable CS0618 +#endif + +namespace UniRx +{ + using System.Threading; +#if !(UNITY_METRO || UNITY_WP8) && (UNITY_4_4 || UNITY_4_3 || UNITY_4_2 || UNITY_4_1 || UNITY_4_0_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_2 || UNITY_3_1 || UNITY_3_0_0 || UNITY_3_0 || UNITY_2_6_1 || UNITY_2_6) + // Fallback for Unity versions below 4.5 + using Hash = System.Collections.Hashtable; + using HashEntry = System.Collections.DictionaryEntry; +#else + // Unity 4.5 release notes: + // WWW: deprecated 'WWW(string url, byte[] postData, Hashtable headers)', + // use 'public WWW(string url, byte[] postData, Dictionary headers)' instead. + using Hash = System.Collections.Generic.Dictionary; + using HashEntry = System.Collections.Generic.KeyValuePair; +#endif + +#if UNITY_2018_3_OR_NEWER + [Obsolete("Use UnityWebRequest, a fully featured replacement which is more efficient and has additional features")] +#endif + public static partial class ObservableWWW + { + public static IObservable Get(string url, Hash headers = null, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchText(new WWW(url, null, (headers ?? new Hash())), observer, progress, cancellation)); + } + + public static IObservable GetAndGetBytes(string url, Hash headers = null, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchBytes(new WWW(url, null, (headers ?? new Hash())), observer, progress, cancellation)); + } + public static IObservable GetWWW(string url, Hash headers = null, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => Fetch(new WWW(url, null, (headers ?? new Hash())), observer, progress, cancellation)); + } + + public static IObservable Post(string url, byte[] postData, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchText(new WWW(url, postData), observer, progress, cancellation)); + } + + public static IObservable Post(string url, byte[] postData, Hash headers, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchText(new WWW(url, postData, headers), observer, progress, cancellation)); + } + + public static IObservable Post(string url, WWWForm content, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchText(new WWW(url, content), observer, progress, cancellation)); + } + + public static IObservable Post(string url, WWWForm content, Hash headers, IProgress progress = null) + { + var contentHeaders = content.headers; + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchText(new WWW(url, content.data, MergeHash(contentHeaders, headers)), observer, progress, cancellation)); + } + + public static IObservable PostAndGetBytes(string url, byte[] postData, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchBytes(new WWW(url, postData), observer, progress, cancellation)); + } + + public static IObservable PostAndGetBytes(string url, byte[] postData, Hash headers, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchBytes(new WWW(url, postData, headers), observer, progress, cancellation)); + } + + public static IObservable PostAndGetBytes(string url, WWWForm content, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchBytes(new WWW(url, content), observer, progress, cancellation)); + } + + public static IObservable PostAndGetBytes(string url, WWWForm content, Hash headers, IProgress progress = null) + { + var contentHeaders = content.headers; + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchBytes(new WWW(url, content.data, MergeHash(contentHeaders, headers)), observer, progress, cancellation)); + } + + public static IObservable PostWWW(string url, byte[] postData, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => Fetch(new WWW(url, postData), observer, progress, cancellation)); + } + + public static IObservable PostWWW(string url, byte[] postData, Hash headers, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => Fetch(new WWW(url, postData, headers), observer, progress, cancellation)); + } + + public static IObservable PostWWW(string url, WWWForm content, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => Fetch(new WWW(url, content), observer, progress, cancellation)); + } + + public static IObservable PostWWW(string url, WWWForm content, Hash headers, IProgress progress = null) + { + var contentHeaders = content.headers; + return ObservableUnity.FromCoroutine((observer, cancellation) => Fetch(new WWW(url, content.data, MergeHash(contentHeaders, headers)), observer, progress, cancellation)); + } + + public static IObservable LoadFromCacheOrDownload(string url, int version, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchAssetBundle(WWW.LoadFromCacheOrDownload(url, version), observer, progress, cancellation)); + } + + public static IObservable LoadFromCacheOrDownload(string url, int version, uint crc, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchAssetBundle(WWW.LoadFromCacheOrDownload(url, version, crc), observer, progress, cancellation)); + } + + // over Unity5 supports Hash128 +#if !(UNITY_4_7 || UNITY_4_6 || UNITY_4_5 || UNITY_4_4 || UNITY_4_3 || UNITY_4_2 || UNITY_4_1 || UNITY_4_0_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_2 || UNITY_3_1 || UNITY_3_0_0 || UNITY_3_0 || UNITY_2_6_1 || UNITY_2_6) + public static IObservable LoadFromCacheOrDownload(string url, Hash128 hash128, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchAssetBundle(WWW.LoadFromCacheOrDownload(url, hash128), observer, progress, cancellation)); + } + + public static IObservable LoadFromCacheOrDownload(string url, Hash128 hash128, uint crc, IProgress progress = null) + { + return ObservableUnity.FromCoroutine((observer, cancellation) => FetchAssetBundle(WWW.LoadFromCacheOrDownload(url, hash128, crc), observer, progress, cancellation)); + } +#endif + + // over 4.5, Hash define is Dictionary. + // below Unity 4.5, WWW only supports Hashtable. + // Unity 4.5, 4.6 WWW supports Dictionary and [Obsolete]Hashtable but WWWForm.content is Hashtable. + // Unity 5.0 WWW only supports Dictionary and WWWForm.content is also Dictionary. +#if !(UNITY_METRO || UNITY_WP8) && (UNITY_4_5 || UNITY_4_6 || UNITY_4_7) + static Hash MergeHash(Hashtable wwwFormHeaders, Hash externalHeaders) + { + var newHeaders = new Hash(); + foreach (DictionaryEntry item in wwwFormHeaders) + { + newHeaders[item.Key.ToString()] = item.Value.ToString(); + } + foreach (HashEntry item in externalHeaders) + { + newHeaders[item.Key] = item.Value; + } + return newHeaders; + } +#else + static Hash MergeHash(Hash wwwFormHeaders, Hash externalHeaders) + { + foreach (HashEntry item in externalHeaders) + { + wwwFormHeaders[item.Key] = item.Value; + } + return wwwFormHeaders; + } +#endif + + static IEnumerator Fetch(WWW www, IObserver observer, IProgress reportProgress, CancellationToken cancel) + { + using (www) + { + if (reportProgress != null) + { + while (!www.isDone && !cancel.IsCancellationRequested) + { + try + { + reportProgress.Report(www.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + yield return null; + } + } + else + { + if (!www.isDone) + { + yield return www; + } + } + + if (cancel.IsCancellationRequested) + { + yield break; + } + + if (reportProgress != null) + { + try + { + reportProgress.Report(www.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + } + + if (!string.IsNullOrEmpty(www.error)) + { + observer.OnError(new WWWErrorException(www, www.text)); + } + else + { + observer.OnNext(www); + observer.OnCompleted(); + } + } + } + + static IEnumerator FetchText(WWW www, IObserver observer, IProgress reportProgress, CancellationToken cancel) + { + using (www) + { + if (reportProgress != null) + { + while (!www.isDone && !cancel.IsCancellationRequested) + { + try + { + reportProgress.Report(www.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + yield return null; + } + } + else + { + if (!www.isDone) + { + yield return www; + } + } + + if (cancel.IsCancellationRequested) + { + yield break; + } + + if (reportProgress != null) + { + try + { + reportProgress.Report(www.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + } + + if (!string.IsNullOrEmpty(www.error)) + { + observer.OnError(new WWWErrorException(www, www.text)); + } + else + { + observer.OnNext(www.text); + observer.OnCompleted(); + } + } + } + + static IEnumerator FetchBytes(WWW www, IObserver observer, IProgress reportProgress, CancellationToken cancel) + { + using (www) + { + if (reportProgress != null) + { + while (!www.isDone && !cancel.IsCancellationRequested) + { + try + { + reportProgress.Report(www.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + yield return null; + } + } + else + { + if (!www.isDone) + { + yield return www; + } + } + + if (cancel.IsCancellationRequested) + { + yield break; + } + + if (reportProgress != null) + { + try + { + reportProgress.Report(www.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + } + + if (!string.IsNullOrEmpty(www.error)) + { + observer.OnError(new WWWErrorException(www, www.text)); + } + else + { + observer.OnNext(www.bytes); + observer.OnCompleted(); + } + } + } + + static IEnumerator FetchAssetBundle(WWW www, IObserver observer, IProgress reportProgress, CancellationToken cancel) + { + using (www) + { + if (reportProgress != null) + { + while (!www.isDone && !cancel.IsCancellationRequested) + { + try + { + reportProgress.Report(www.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + yield return null; + } + } + else + { + if (!www.isDone) + { + yield return www; + } + } + + if (cancel.IsCancellationRequested) + { + yield break; + } + + if (reportProgress != null) + { + try + { + reportProgress.Report(www.progress); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + } + + if (!string.IsNullOrEmpty(www.error)) + { + observer.OnError(new WWWErrorException(www, "")); + } + else + { + observer.OnNext(www.assetBundle); + observer.OnCompleted(); + } + } + } + } + + public class WWWErrorException : Exception + { + public string RawErrorMessage { get; private set; } + public bool HasResponse { get; private set; } + public string Text { get; private set; } + public System.Net.HttpStatusCode StatusCode { get; private set; } + public System.Collections.Generic.Dictionary ResponseHeaders { get; private set; } + public WWW WWW { get; private set; } + + // cache the text because if www was disposed, can't access it. + public WWWErrorException(WWW www, string text) + { + this.WWW = www; + this.RawErrorMessage = www.error; + this.ResponseHeaders = www.responseHeaders; + this.HasResponse = false; + this.Text = text; + + var splitted = RawErrorMessage.Split(' ', ':'); + if (splitted.Length != 0) + { + int statusCode; + if (int.TryParse(splitted[0], out statusCode)) + { + this.HasResponse = true; + this.StatusCode = (System.Net.HttpStatusCode)statusCode; + } + } + } + + public override string ToString() + { + var text = this.Text; + if (string.IsNullOrEmpty(text)) + { + return RawErrorMessage; + } + else + { + return RawErrorMessage + " " + text; + } + } + } +} + +#if UNITY_2018_3_OR_NEWER +#pragma warning restore CS0618 +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs.meta new file mode 100644 index 00000000..a9707e9e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ba71e5544e233dd4b83d4c5a6c696d05 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs new file mode 100644 index 00000000..a2726232 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs @@ -0,0 +1,264 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using UniRx.InternalUtil; +using UniRx.Triggers; + +#if !UniRxLibrary +using ObservableUnity = UniRx.Observable; +#endif + +namespace UniRx +{ + public static partial class ObserveExtensions + { + /// + /// Publish target property when value is changed. If source is destroyed/destructed, publish OnCompleted. + /// + /// If true and target is UnityObject, use destroyed check by additional component. It is faster check for lifecycle but needs initial cost. + public static IObservable ObserveEveryValueChanged(this TSource source, Func propertySelector, FrameCountType frameCountType = FrameCountType.Update, bool fastDestroyCheck = false) + where TSource : class + { + return ObserveEveryValueChanged(source, propertySelector, frameCountType, UnityEqualityComparer.GetDefault(), fastDestroyCheck); + } + + /// + /// Publish target property when value is changed. If source is destroyed/destructed, publish OnCompleted. + /// + public static IObservable ObserveEveryValueChanged(this TSource source, Func propertySelector, FrameCountType frameCountType, IEqualityComparer comparer) + where TSource : class + { + return ObserveEveryValueChanged(source, propertySelector, frameCountType, comparer, false); + } + + /// + /// Publish target property when value is changed. If source is destroyed/destructed, publish OnCompleted. + /// + /// If true and target is UnityObject, use destroyed check by additional component. It is faster check for lifecycle but needs initial cost. + public static IObservable ObserveEveryValueChanged(this TSource source, Func propertySelector, FrameCountType frameCountType, IEqualityComparer comparer, bool fastDestroyCheck) + where TSource : class + { + if (source == null) return Observable.Empty(); + if (comparer == null) comparer = UnityEqualityComparer.GetDefault(); + + var unityObject = source as UnityEngine.Object; + var isUnityObject = source is UnityEngine.Object; + if (isUnityObject && unityObject == null) return Observable.Empty(); + + // MicroCoroutine does not publish value immediately, so publish value on subscribe. + if (isUnityObject) + { + return ObservableUnity.FromMicroCoroutine((observer, cancellationToken) => + { + if (unityObject != null) + { + var firstValue = default(TProperty); + try + { + firstValue = propertySelector((TSource)(object)unityObject); + } + catch (Exception ex) + { + observer.OnError(ex); + return EmptyEnumerator(); + } + + observer.OnNext(firstValue); + return PublishUnityObjectValueChanged(unityObject, firstValue, propertySelector, comparer, observer, cancellationToken, fastDestroyCheck); + } + else + { + observer.OnCompleted(); + return EmptyEnumerator(); + } + }, frameCountType); + } + else + { + var reference = new WeakReference(source); + source = null; + + return ObservableUnity.FromMicroCoroutine((observer, cancellationToken) => + { + var target = reference.Target; + if (target != null) + { + var firstValue = default(TProperty); + try + { + firstValue = propertySelector((TSource)target); + } + catch (Exception ex) + { + observer.OnError(ex); + return EmptyEnumerator(); + } + finally + { + target = null; + } + + observer.OnNext(firstValue); + return PublishPocoValueChanged(reference, firstValue, propertySelector, comparer, observer, cancellationToken); + } + else + { + observer.OnCompleted(); + return EmptyEnumerator(); + } + }, frameCountType); + } + } + + static IEnumerator EmptyEnumerator() + { + yield break; + } + + static IEnumerator PublishPocoValueChanged(WeakReference sourceReference, TProperty firstValue, Func propertySelector, IEqualityComparer comparer, IObserver observer, CancellationToken cancellationToken) + { + var currentValue = default(TProperty); + var prevValue = firstValue; + + while (!cancellationToken.IsCancellationRequested) + { + var target = sourceReference.Target; + if (target != null) + { + try + { + currentValue = propertySelector((TSource)target); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + finally + { + target = null; // remove reference(must need!) + } + } + else + { + observer.OnCompleted(); + yield break; + } + + if (!comparer.Equals(currentValue, prevValue)) + { + observer.OnNext(currentValue); + prevValue = currentValue; + } + + yield return null; + } + } + + static IEnumerator PublishUnityObjectValueChanged(UnityEngine.Object unityObject, TProperty firstValue, Func propertySelector, IEqualityComparer comparer, IObserver observer, CancellationToken cancellationToken, bool fastDestroyCheck) + { + var currentValue = default(TProperty); + var prevValue = firstValue; + + var source = (TSource)(object)unityObject; + + if (fastDestroyCheck) + { + ObservableDestroyTrigger destroyTrigger = null; + { + var gameObject = unityObject as UnityEngine.GameObject; + if (gameObject == null) + { + var comp = unityObject as UnityEngine.Component; + if (comp != null) + { + gameObject = comp.gameObject; + } + } + + // can't use faster path + if (gameObject == null) goto STANDARD_LOOP; + + destroyTrigger = GetOrAddDestroyTrigger(gameObject); + } + + // fast compare path + while (!cancellationToken.IsCancellationRequested) + { + var isDestroyed = destroyTrigger.IsActivated + ? !destroyTrigger.IsCalledOnDestroy + : (unityObject != null); + + if (isDestroyed) + { + try + { + currentValue = propertySelector(source); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + } + else + { + observer.OnCompleted(); + yield break; + } + + if (!comparer.Equals(currentValue, prevValue)) + { + observer.OnNext(currentValue); + prevValue = currentValue; + } + + yield return null; + } + + yield break; + } + + STANDARD_LOOP: + while (!cancellationToken.IsCancellationRequested) + { + if (unityObject != null) + { + try + { + currentValue = propertySelector(source); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + } + else + { + observer.OnCompleted(); + yield break; + } + + if (!comparer.Equals(currentValue, prevValue)) + { + observer.OnNext(currentValue); + prevValue = currentValue; + } + + yield return null; + } + } + + static ObservableDestroyTrigger GetOrAddDestroyTrigger(UnityEngine.GameObject go) + { + var dt = go.GetComponent(); + if (dt == null) + { + dt = go.AddComponent(); + } + return dt; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs.meta new file mode 100644 index 00000000..069346d7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8741793924a6c2f4ea22ba27031d531f +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators.meta new file mode 100644 index 00000000..d7a89eb5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4d126dc4a05228e418759d57f7661329 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs new file mode 100644 index 00000000..638d6f46 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs @@ -0,0 +1,282 @@ +using System; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class BatchFrameObservable : OperatorObservableBase> + { + readonly IObservable source; + readonly int frameCount; + readonly FrameCountType frameCountType; + + public BatchFrameObservable(IObservable source, int frameCount, FrameCountType frameCountType) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.frameCount = frameCount; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return new BatchFrame(this, observer, cancel).Run(); + } + + class BatchFrame : OperatorObserverBase> + { + readonly BatchFrameObservable parent; + readonly object gate = new object(); + readonly BooleanDisposable cancellationToken = new BooleanDisposable(); + readonly System.Collections.IEnumerator timer; + bool isRunning; + bool isCompleted; + List list; + + public BatchFrame(BatchFrameObservable parent, IObserver> observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.timer = new ReusableEnumerator(this); + } + + public IDisposable Run() + { + list = new List(); + var sourceSubscription = parent.source.Subscribe(this); + return StableCompositeDisposable.Create(sourceSubscription, cancellationToken); + } + + public override void OnNext(T value) + { + lock (gate) + { + if (isCompleted) return; + list.Add(value); + if (!isRunning) + { + isRunning = true; + timer.Reset(); // reuse + + switch (parent.frameCountType) + { + case FrameCountType.Update: + MainThreadDispatcher.StartUpdateMicroCoroutine(timer); + break; + case FrameCountType.FixedUpdate: + MainThreadDispatcher.StartFixedUpdateMicroCoroutine(timer); + break; + case FrameCountType.EndOfFrame: + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(timer); + break; + default: + break; + } + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + List currentList; + lock (gate) + { + isCompleted = true; + currentList = list; + } + if (currentList.Count != 0) + { + observer.OnNext(currentList); + } + try { observer.OnCompleted(); } finally { Dispose(); } + } + + // reuse, no gc allocate + class ReusableEnumerator : System.Collections.IEnumerator + { + readonly BatchFrame parent; + int currentFrame; + + public ReusableEnumerator(BatchFrame parent) + { + this.parent = parent; + } + + public object Current + { + get { return null; } + } + + public bool MoveNext() + { + if (parent.cancellationToken.IsDisposed) return false; + + List currentList; + lock (parent.gate) + { + if (currentFrame++ == parent.parent.frameCount) + { + if (parent.isCompleted) return false; + + currentList = parent.list; + parent.list = new List(); + parent.isRunning = false; + + // exit lock + } + else + { + return true; + } + } + + parent.observer.OnNext(currentList); + return false; + } + + public void Reset() + { + currentFrame = 0; + } + } + } + } + + internal class BatchFrameObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int frameCount; + readonly FrameCountType frameCountType; + + public BatchFrameObservable(IObservable source, int frameCount, FrameCountType frameCountType) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.frameCount = frameCount; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new BatchFrame(this, observer, cancel).Run(); + } + + class BatchFrame : OperatorObserverBase + { + readonly BatchFrameObservable parent; + readonly object gate = new object(); + readonly BooleanDisposable cancellationToken = new BooleanDisposable(); + readonly System.Collections.IEnumerator timer; + + bool isRunning; + bool isCompleted; + + public BatchFrame(BatchFrameObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + this.timer = new ReusableEnumerator(this); + } + + public IDisposable Run() + { + var sourceSubscription = parent.source.Subscribe(this); + return StableCompositeDisposable.Create(sourceSubscription, cancellationToken); + } + + public override void OnNext(Unit value) + { + lock (gate) + { + if (!isRunning) + { + isRunning = true; + timer.Reset(); // reuse + + switch (parent.frameCountType) + { + case FrameCountType.Update: + MainThreadDispatcher.StartUpdateMicroCoroutine(timer); + break; + case FrameCountType.FixedUpdate: + MainThreadDispatcher.StartFixedUpdateMicroCoroutine(timer); + break; + case FrameCountType.EndOfFrame: + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(timer); + break; + default: + break; + } + } + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + bool running; + lock (gate) + { + running = isRunning; + isCompleted = true; + } + if (running) + { + observer.OnNext(Unit.Default); + } + try { observer.OnCompleted(); } finally { Dispose(); } + } + + // reuse, no gc allocate + class ReusableEnumerator : System.Collections.IEnumerator + { + readonly BatchFrame parent; + int currentFrame; + + public ReusableEnumerator(BatchFrame parent) + { + this.parent = parent; + } + + public object Current + { + get { return null; } + } + + public bool MoveNext() + { + if (parent.cancellationToken.IsDisposed) return false; + + lock (parent.gate) + { + if (currentFrame++ == parent.parent.frameCount) + { + if (parent.isCompleted) return false; + parent.isRunning = false; + + // exit lock + } + else + { + return true; + } + } + + parent.observer.OnNext(Unit.Default); + return false; + } + + public void Reset() + { + currentFrame = 0; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs.meta new file mode 100644 index 00000000..6b63eb6a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/BatchFrame.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 74a2b6b8c63d1144f914c7f0d6719a36 +timeCreated: 1467771656 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs new file mode 100644 index 00000000..a934ea8a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs @@ -0,0 +1,260 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace UniRx.Operators +{ + internal class DelayFrameObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int frameCount; + readonly FrameCountType frameCountType; + + public DelayFrameObservable(IObservable source, int frameCount, FrameCountType frameCountType) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.frameCount = frameCount; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new DelayFrame(this, observer, cancel).Run(); + } + + class DelayFrame : OperatorObserverBase + { + readonly DelayFrameObservable parent; + readonly object gate = new object(); + readonly QueuePool pool = new QueuePool(); + int runningEnumeratorCount; + bool readyDrainEnumerator; + bool running; + IDisposable sourceSubscription; + Queue currentQueueReference; + bool calledCompleted; + bool hasError; + Exception error; + BooleanDisposable cancelationToken; + + public DelayFrame(DelayFrameObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + cancelationToken = new BooleanDisposable(); + + var _sourceSubscription = new SingleAssignmentDisposable(); + sourceSubscription = _sourceSubscription; + _sourceSubscription.Disposable = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(cancelationToken, sourceSubscription); + } + + IEnumerator DrainQueue(Queue q, int frameCount) + { + lock (gate) + { + readyDrainEnumerator = false; // use next queue. + running = false; + } + + while (!cancelationToken.IsDisposed && frameCount-- != 0) + { + yield return null; + } + + try + { + if (q != null) + { + while (q.Count > 0 && !hasError) + { + if (cancelationToken.IsDisposed) break; + + lock (gate) + { + running = true; + } + + var value = q.Dequeue(); + observer.OnNext(value); + + lock (gate) + { + running = false; + } + } + + if (q.Count == 0) + { + pool.Return(q); + } + } + + if (hasError) + { + if (!cancelationToken.IsDisposed) + { + cancelationToken.Dispose(); + + try { observer.OnError(error); } finally { Dispose(); } + } + } + else if (calledCompleted) + { + lock (gate) + { + // not self only + if (runningEnumeratorCount != 1) yield break; + } + + if (!cancelationToken.IsDisposed) + { + cancelationToken.Dispose(); + + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + finally + { + lock (gate) + { + runningEnumeratorCount--; + } + } + } + + public override void OnNext(T value) + { + if (cancelationToken.IsDisposed) return; + + Queue targetQueue = null; + lock (gate) + { + if (!readyDrainEnumerator) + { + readyDrainEnumerator = true; + runningEnumeratorCount++; + targetQueue = currentQueueReference = pool.Get(); + targetQueue.Enqueue(value); + } + else + { + if (currentQueueReference != null) // null - if doesn't start OnNext and start OnCompleted + { + currentQueueReference.Enqueue(value); + } + return; + } + } + + switch (parent.frameCountType) + { + case FrameCountType.Update: + MainThreadDispatcher.StartUpdateMicroCoroutine(DrainQueue(targetQueue, parent.frameCount)); + break; + case FrameCountType.FixedUpdate: + MainThreadDispatcher.StartFixedUpdateMicroCoroutine(DrainQueue(targetQueue, parent.frameCount)); + break; + case FrameCountType.EndOfFrame: + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(DrainQueue(targetQueue, parent.frameCount)); + break; + default: + throw new ArgumentException("Invalid FrameCountType:" + parent.frameCountType); + } + } + + public override void OnError(Exception error) + { + sourceSubscription.Dispose(); // stop subscription + + if (cancelationToken.IsDisposed) return; + + lock (gate) + { + if (running) + { + hasError = true; + this.error = error; + return; + } + } + + cancelationToken.Dispose(); + try { base.observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + sourceSubscription.Dispose(); // stop subscription + + if (cancelationToken.IsDisposed) return; + + lock (gate) + { + calledCompleted = true; + + if (!readyDrainEnumerator) + { + readyDrainEnumerator = true; + runningEnumeratorCount++; + } + else + { + return; + } + } + + switch (parent.frameCountType) + { + case FrameCountType.Update: + MainThreadDispatcher.StartUpdateMicroCoroutine(DrainQueue(null, parent.frameCount)); + break; + case FrameCountType.FixedUpdate: + MainThreadDispatcher.StartFixedUpdateMicroCoroutine(DrainQueue(null, parent.frameCount)); + break; + case FrameCountType.EndOfFrame: + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(DrainQueue(null, parent.frameCount)); + break; + default: + throw new ArgumentException("Invalid FrameCountType:" + parent.frameCountType); + } + } + } + + class QueuePool + { + readonly object gate = new object(); + readonly Queue> pool = new Queue>(2); + + public Queue Get() + { + lock (gate) + { + if (pool.Count == 0) + { + return new Queue(2); + } + else + { + return pool.Dequeue(); + } + } + } + + public void Return(Queue q) + { + lock (gate) + { + pool.Enqueue(q); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs.meta new file mode 100644 index 00000000..ea6fa661 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrame.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 868f75a703f1a944a801ab9c9b4512aa +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs new file mode 100644 index 00000000..2132b4a8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs @@ -0,0 +1,37 @@ +using System; + +#if UniRxLibrary +using UnityObservable = UniRx.ObservableUnity; +#else +using UnityObservable = UniRx.Observable; +#endif + +namespace UniRx.Operators +{ + internal class DelayFrameSubscriptionObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int frameCount; + readonly FrameCountType frameCountType; + + public DelayFrameSubscriptionObservable(IObservable source, int frameCount, FrameCountType frameCountType) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.frameCount = frameCount; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var d = new MultipleAssignmentDisposable(); + d.Disposable = UnityObservable.TimerFrame(frameCount, frameCountType) + .SubscribeWithState3(observer, d, source, (_, o, disp, s) => + { + disp.Disposable = s.Subscribe(o); + }); + + return d; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs.meta new file mode 100644 index 00000000..ea8341bf --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/DelayFrameSubscription.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ecfef95eedf36c2448944fb8932f682c +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs new file mode 100644 index 00000000..df0900d3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs @@ -0,0 +1,52 @@ +using System; + +namespace UniRx.Operators +{ + internal class FrameIntervalObservable : OperatorObservableBase> + { + readonly IObservable source; + + public FrameIntervalObservable(IObservable source) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return source.Subscribe(new FrameInterval(observer, cancel)); + } + + class FrameInterval : OperatorObserverBase> + { + int lastFrame; + + public FrameInterval(IObserver> observer, IDisposable cancel) + : base(observer, cancel) + { + this.lastFrame = UnityEngine.Time.frameCount; + } + + public override void OnNext(T value) + { + var now = UnityEngine.Time.frameCount; + var span = now - lastFrame; + lastFrame = now; + + base.observer.OnNext(new UniRx.FrameInterval(value, span)); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs.meta new file mode 100644 index 00000000..19755f94 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameInterval.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a731a1a74be20a04a9d7dedc5ceefab2 +timeCreated: 1467771656 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs new file mode 100644 index 00000000..0ebaf546 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs @@ -0,0 +1,60 @@ +using System; + +namespace UniRx.Operators +{ + internal class FrameTimeIntervalObservable : OperatorObservableBase> + { + readonly IObservable source; + readonly bool ignoreTimeScale; + + public FrameTimeIntervalObservable(IObservable source, bool ignoreTimeScale) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.ignoreTimeScale = ignoreTimeScale; + } + + protected override IDisposable SubscribeCore(IObserver> observer, IDisposable cancel) + { + return source.Subscribe(new FrameTimeInterval(this, observer, cancel)); + } + + class FrameTimeInterval : OperatorObserverBase> + { + readonly FrameTimeIntervalObservable parent; + float lastTime; + + public FrameTimeInterval(FrameTimeIntervalObservable parent, IObserver> observer, IDisposable cancel) + : base(observer, cancel) + { + this.parent = parent; + this.lastTime = (parent.ignoreTimeScale) + ? UnityEngine.Time.unscaledTime + : UnityEngine.Time.time; + } + + public override void OnNext(T value) + { + var now = (parent.ignoreTimeScale) + ? UnityEngine.Time.unscaledTime + : UnityEngine.Time.time; + var span = now - lastTime; + lastTime = now; + + base.observer.OnNext(new UniRx.TimeInterval(value, TimeSpan.FromSeconds(span))); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs.meta new file mode 100644 index 00000000..931fb598 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FrameTimeInterval.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a55cce9ef638364409d1227a25a32421 +timeCreated: 1467771656 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs new file mode 100644 index 00000000..39515f20 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections; +using System.Threading; + +namespace UniRx.Operators +{ + internal class FromCoroutineObservable : OperatorObservableBase + { + readonly Func, CancellationToken, IEnumerator> coroutine; + + public FromCoroutineObservable(Func, CancellationToken, IEnumerator> coroutine) + : base(false) + { + this.coroutine = coroutine; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var fromCoroutineObserver = new FromCoroutine(observer, cancel); + +#if (NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0) + var moreCancel = new CancellationDisposable(); + var token = moreCancel.Token; +#else + var moreCancel = new BooleanDisposable(); + var token = new CancellationToken(moreCancel); +#endif + + MainThreadDispatcher.SendStartCoroutine(coroutine(fromCoroutineObserver, token)); + + return moreCancel; + } + + class FromCoroutine : OperatorObserverBase + { + public FromCoroutine(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + + internal class FromMicroCoroutineObservable : OperatorObservableBase + { + readonly Func, CancellationToken, IEnumerator> coroutine; + readonly FrameCountType frameCountType; + + public FromMicroCoroutineObservable(Func, CancellationToken, IEnumerator> coroutine, FrameCountType frameCountType) + : base(false) + { + this.coroutine = coroutine; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var microCoroutineObserver = new FromMicroCoroutine(observer, cancel); + +#if (NETFX_CORE || NET_4_6 || NET_STANDARD_2_0 || UNITY_WSA_10_0) + var moreCancel = new CancellationDisposable(); + var token = moreCancel.Token; +#else + var moreCancel = new BooleanDisposable(); + var token = new CancellationToken(moreCancel); +#endif + + switch (frameCountType) + { + case FrameCountType.Update: + MainThreadDispatcher.StartUpdateMicroCoroutine(coroutine(microCoroutineObserver, token)); + break; + case FrameCountType.FixedUpdate: + MainThreadDispatcher.StartFixedUpdateMicroCoroutine(coroutine(microCoroutineObserver, token)); + break; + case FrameCountType.EndOfFrame: + MainThreadDispatcher.StartEndOfFrameMicroCoroutine(coroutine(microCoroutineObserver, token)); + break; + default: + throw new ArgumentException("Invalid FrameCountType:" + frameCountType); + } + + return moreCancel; + } + + class FromMicroCoroutine : OperatorObserverBase + { + public FromMicroCoroutine(IObserver observer, IDisposable cancel) : base(observer, cancel) + { + } + + public override void OnNext(T value) + { + try + { + base.observer.OnNext(value); + } + catch + { + Dispose(); + throw; + } + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs.meta new file mode 100644 index 00000000..e9dc996d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e83ddad992535fb4f8a68a1e7ef8be60 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs new file mode 100644 index 00000000..67dba77e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs @@ -0,0 +1,178 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace UniRx.Operators +{ + internal class RepeatUntilObservable : OperatorObservableBase + { + readonly IEnumerable> sources; + readonly IObservable trigger; + readonly GameObject lifeTimeChecker; + + public RepeatUntilObservable(IEnumerable> sources, IObservable trigger, GameObject lifeTimeChecker) + : base(true) + { + this.sources = sources; + this.trigger = trigger; + this.lifeTimeChecker = lifeTimeChecker; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new RepeatUntil(this, observer, cancel).Run(); + } + + class RepeatUntil : OperatorObserverBase + { + readonly RepeatUntilObservable parent; + readonly object gate = new object(); + + IEnumerator> e; + SerialDisposable subscription; + SingleAssignmentDisposable schedule; + Action nextSelf; + bool isStopped; + bool isDisposed; + bool isFirstSubscribe; + IDisposable stopper; + + public RepeatUntil(RepeatUntilObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + isFirstSubscribe = true; + isDisposed = false; + isStopped = false; + e = parent.sources.GetEnumerator(); + subscription = new SerialDisposable(); + schedule = new SingleAssignmentDisposable(); + + stopper = parent.trigger.Subscribe(_ => + { + lock (gate) + { + isStopped = true; + e.Dispose(); + subscription.Dispose(); + schedule.Dispose(); + observer.OnCompleted(); + } + }, observer.OnError); + + schedule.Disposable = Scheduler.CurrentThread.Schedule(RecursiveRun); + + return new CompositeDisposable(schedule, subscription, stopper, Disposable.Create(() => + { + lock (gate) + { + isDisposed = true; + e.Dispose(); + } + })); + } + + void RecursiveRun(Action self) + { + lock (gate) + { + this.nextSelf = self; + if (isDisposed) return; + if (isStopped) return; + + var current = default(IObservable); + var hasNext = false; + var ex = default(Exception); + + try + { + hasNext = e.MoveNext(); + if (hasNext) + { + current = e.Current; + if (current == null) throw new InvalidOperationException("sequence is null."); + } + else + { + e.Dispose(); + } + } + catch (Exception exception) + { + ex = exception; + e.Dispose(); + } + + if (ex != null) + { + stopper.Dispose(); + observer.OnError(ex); + return; + } + + if (!hasNext) + { + stopper.Dispose(); + observer.OnCompleted(); + return; + } + + var source = e.Current; + var d = new SingleAssignmentDisposable(); + subscription.Disposable = d; + + if (isFirstSubscribe) + { + isFirstSubscribe = false; + d.Disposable = source.Subscribe(this); + } + else + { + MainThreadDispatcher.SendStartCoroutine(SubscribeAfterEndOfFrame(d, source, this, parent.lifeTimeChecker)); + } + } + } + + static IEnumerator SubscribeAfterEndOfFrame(SingleAssignmentDisposable d, IObservable source, IObserver observer, GameObject lifeTimeChecker) + { + yield return YieldInstructionCache.WaitForEndOfFrame; + if (!d.IsDisposed && lifeTimeChecker != null) + { + d.Disposable = source.Subscribe(observer); + } + } + + public override void OnNext(T value) + { + base.observer.OnNext(value); + } + + public override void OnError(Exception error) + { + try { observer.OnError(error); } + finally { Dispose(); } + } + + public override void OnCompleted() + { + if (!isDisposed) + { + this.nextSelf(); + } + else + { + e.Dispose(); + if (!isDisposed) + { + try { observer.OnCompleted(); } + finally { Dispose(); } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs.meta new file mode 100644 index 00000000..7f3078ef --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/RepeatUntil.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 93507e8a72a71094f870c8dbe1e5bed8 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs new file mode 100644 index 00000000..aebfd65a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs @@ -0,0 +1,132 @@ +using System; + +#if UniRxLibrary +using UnityObservable = UniRx.ObservableUnity; +#else +using UnityObservable = UniRx.Observable; +#endif + +namespace UniRx.Operators +{ + internal class SampleFrameObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int frameCount; + readonly FrameCountType frameCountType; + + public SampleFrameObservable(IObservable source, int frameCount, FrameCountType frameCountType) : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.frameCount = frameCount; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new SampleFrame(this, observer, cancel).Run(); + } + + class SampleFrame : OperatorObserverBase + { + readonly SampleFrameObservable parent; + readonly object gate = new object(); + T latestValue = default(T); + bool isUpdated = false; + bool isCompleted = false; + SingleAssignmentDisposable sourceSubscription; + + public SampleFrame(SampleFrameObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + sourceSubscription = new SingleAssignmentDisposable(); + sourceSubscription.Disposable = parent.source.Subscribe(this); + + var scheduling = UnityObservable.IntervalFrame(parent.frameCount, parent.frameCountType) + .Subscribe(new SampleFrameTick(this)); + + return StableCompositeDisposable.Create(sourceSubscription, scheduling); + } + + void OnNextTick(long _) + { + lock (gate) + { + if (isUpdated) + { + var value = latestValue; + isUpdated = false; + observer.OnNext(value); + } + if (isCompleted) + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + } + + public override void OnNext(T value) + { + lock (gate) + { + latestValue = value; + isUpdated = true; + } + } + + public override void OnError(Exception error) + { + lock (gate) + { + try { base.observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + lock (gate) + { + isCompleted = true; + sourceSubscription.Dispose(); + } + } + class SampleFrameTick : IObserver + { + readonly SampleFrame parent; + + public SampleFrameTick(SampleFrame parent) + { + this.parent = parent; + } + + public void OnCompleted() + { + } + + public void OnError(Exception error) + { + } + + public void OnNext(long _) + { + lock (parent.gate) + { + if (parent.isUpdated) + { + var value = parent.latestValue; + parent.isUpdated = false; + parent.observer.OnNext(value); + } + if (parent.isCompleted) + { + try { parent.observer.OnCompleted(); } finally { parent.Dispose(); } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs.meta new file mode 100644 index 00000000..e59f954a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SampleFrame.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e04c7fc1929a3db458bf7ae31bcd9e55 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs new file mode 100644 index 00000000..ba6d06e9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs @@ -0,0 +1,31 @@ +using System; + +namespace UniRx.Operators +{ + internal class SubscribeOnMainThreadObservable : OperatorObservableBase + { + readonly IObservable source; + readonly IObservable subscribeTrigger; + + public SubscribeOnMainThreadObservable(IObservable source, IObservable subscribeTrigger) + : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.subscribeTrigger = subscribeTrigger; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + var m = new SingleAssignmentDisposable(); + var d = new SerialDisposable(); + d.Disposable = m; + + m.Disposable = subscribeTrigger.SubscribeWithState3(observer, d, source, (_, o, disp, s) => + { + disp.Disposable = s.Subscribe(o); + }); + + return d; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs.meta new file mode 100644 index 00000000..573172c7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/SubscribeOnMainThread.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: da3fd97518766ab43827991b7b5d4270 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs new file mode 100644 index 00000000..6b9ccbc2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs @@ -0,0 +1,123 @@ +using System; + +#if UniRxLibrary +using UnityObservable = UniRx.ObservableUnity; +#else +using UnityObservable = UniRx.Observable; +#endif + +namespace UniRx.Operators +{ + internal class ThrottleFirstFrameObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int frameCount; + readonly FrameCountType frameCountType; + + public ThrottleFirstFrameObservable(IObservable source, int frameCount, FrameCountType frameCountType) : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.frameCount = frameCount; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ThrottleFirstFrame(this, observer, cancel).Run(); + } + + class ThrottleFirstFrame : OperatorObserverBase + { + readonly ThrottleFirstFrameObservable parent; + readonly object gate = new object(); + bool open = true; + SerialDisposable cancelable; + + ThrottleFirstFrameTick tick; + + public ThrottleFirstFrame(ThrottleFirstFrameObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + tick = new ThrottleFirstFrameTick(this); + cancelable = new SerialDisposable(); + + var subscription = parent.source.Subscribe(this); + return StableCompositeDisposable.Create(cancelable, subscription); + } + + void OnNext() + { + lock (gate) + { + open = true; + } + } + + public override void OnNext(T value) + { + lock (gate) + { + if (!open) return; + observer.OnNext(value); + open = false; + } + + var d = new SingleAssignmentDisposable(); + cancelable.Disposable = d; + d.Disposable = UnityObservable.TimerFrame(parent.frameCount, parent.frameCountType) + .Subscribe(tick); + } + + public override void OnError(Exception error) + { + cancelable.Dispose(); + + lock (gate) + { + try { observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + cancelable.Dispose(); + + lock (gate) + { + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + // immutable, can share. + class ThrottleFirstFrameTick : IObserver + { + readonly ThrottleFirstFrame parent; + + public ThrottleFirstFrameTick(ThrottleFirstFrame parent) + { + this.parent = parent; + } + + public void OnCompleted() + { + } + + public void OnError(Exception error) + { + } + + public void OnNext(long _) + { + lock (parent.gate) + { + parent.open = true; + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs.meta new file mode 100644 index 00000000..0d6b5585 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFirstFrame.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3ec92e777b0b4d949967b0663ce8bee8 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs new file mode 100644 index 00000000..6e3634af --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs @@ -0,0 +1,129 @@ +using System; + +#if UniRxLibrary +using UnityObservable = UniRx.ObservableUnity; +#else +using UnityObservable = UniRx.Observable; +#endif + +namespace UniRx.Operators +{ + internal class ThrottleFrameObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int frameCount; + readonly FrameCountType frameCountType; + + public ThrottleFrameObservable(IObservable source, int frameCount, FrameCountType frameCountType) : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.frameCount = frameCount; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new ThrottleFrame(this, observer, cancel).Run(); + } + + class ThrottleFrame : OperatorObserverBase + { + readonly ThrottleFrameObservable parent; + readonly object gate = new object(); + T latestValue = default(T); + bool hasValue = false; + SerialDisposable cancelable; + ulong id = 0; + + public ThrottleFrame(ThrottleFrameObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + cancelable = new SerialDisposable(); + var subscription = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(cancelable, subscription); + } + + public override void OnNext(T value) + { + ulong currentid; + lock (gate) + { + hasValue = true; + latestValue = value; + id = unchecked(id + 1); + currentid = id; + } + + var d = new SingleAssignmentDisposable(); + cancelable.Disposable = d; + d.Disposable = UnityObservable.TimerFrame(parent.frameCount, parent.frameCountType) + .Subscribe(new ThrottleFrameTick(this, currentid)); + } + + public override void OnError(Exception error) + { + cancelable.Dispose(); + + lock (gate) + { + hasValue = false; + id = unchecked(id + 1); + try { observer.OnError(error); } finally { Dispose(); } + } + } + + public override void OnCompleted() + { + cancelable.Dispose(); + + lock (gate) + { + if (hasValue) + { + observer.OnNext(latestValue); + } + hasValue = false; + id = unchecked(id + 1); + try { observer.OnCompleted(); } finally { Dispose(); } + } + } + + class ThrottleFrameTick : IObserver + { + readonly ThrottleFrame parent; + readonly ulong currentid; + + public ThrottleFrameTick(ThrottleFrame parent, ulong currentid) + { + this.parent = parent; + this.currentid = currentid; + } + + public void OnCompleted() + { + } + + public void OnError(Exception error) + { + } + + public void OnNext(long _) + { + lock (parent.gate) + { + if (parent.hasValue && parent.id == currentid) + { + parent.observer.OnNext(parent.latestValue); + } + parent.hasValue = false; + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs.meta new file mode 100644 index 00000000..380407b7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/ThrottleFrame.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2c4ef0bfcfe787543999c7a6cda03c07 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs new file mode 100644 index 00000000..eada0e53 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs @@ -0,0 +1,142 @@ +using System; + +#if UniRxLibrary +using UnityObservable = UniRx.ObservableUnity; +#else +using UnityObservable = UniRx.Observable; +#endif + +namespace UniRx.Operators +{ + internal class TimeoutFrameObservable : OperatorObservableBase + { + readonly IObservable source; + readonly int frameCount; + readonly FrameCountType frameCountType; + + public TimeoutFrameObservable(IObservable source, int frameCount, FrameCountType frameCountType) : base(source.IsRequiredSubscribeOnCurrentThread()) + { + this.source = source; + this.frameCount = frameCount; + this.frameCountType = frameCountType; + } + + protected override IDisposable SubscribeCore(IObserver observer, IDisposable cancel) + { + return new TimeoutFrame(this, observer, cancel).Run(); + } + + class TimeoutFrame : OperatorObserverBase + { + readonly TimeoutFrameObservable parent; + readonly object gate = new object(); + ulong objectId = 0ul; + bool isTimeout = false; + SingleAssignmentDisposable sourceSubscription; + SerialDisposable timerSubscription; + + public TimeoutFrame(TimeoutFrameObservable parent, IObserver observer, IDisposable cancel) : base(observer, cancel) + { + this.parent = parent; + } + + public IDisposable Run() + { + sourceSubscription = new SingleAssignmentDisposable(); + timerSubscription = new SerialDisposable(); + timerSubscription.Disposable = RunTimer(objectId); + sourceSubscription.Disposable = parent.source.Subscribe(this); + + return StableCompositeDisposable.Create(timerSubscription, sourceSubscription); + } + + IDisposable RunTimer(ulong timerId) + { + return UnityObservable.TimerFrame(parent.frameCount, parent.frameCountType) + .Subscribe(new TimeoutFrameTick(this, timerId)); + } + + public override void OnNext(T value) + { + ulong useObjectId; + bool timeout; + lock (gate) + { + timeout = isTimeout; + objectId++; + useObjectId = objectId; + } + if (timeout) return; + + timerSubscription.Disposable = Disposable.Empty; // cancel old timer + observer.OnNext(value); + timerSubscription.Disposable = RunTimer(useObjectId); + } + + public override void OnError(Exception error) + { + bool timeout; + lock (gate) + { + timeout = isTimeout; + objectId++; + } + if (timeout) return; + + timerSubscription.Dispose(); + try { observer.OnError(error); } finally { Dispose(); } + } + + public override void OnCompleted() + { + bool timeout; + lock (gate) + { + timeout = isTimeout; + objectId++; + } + if (timeout) return; + + timerSubscription.Dispose(); + try { observer.OnCompleted(); } finally { Dispose(); } + } + + class TimeoutFrameTick : IObserver + { + readonly TimeoutFrame parent; + readonly ulong timerId; + + public TimeoutFrameTick(TimeoutFrame parent, ulong timerId) + { + this.parent = parent; + this.timerId = timerId; + } + + public void OnCompleted() + { + } + + public void OnError(Exception error) + { + } + + public void OnNext(long _) + { + + + lock (parent.gate) + { + if (parent.objectId == timerId) + { + parent.isTimeout = true; + } + } + if (parent.isTimeout) + { + try { parent.observer.OnError(new TimeoutException()); } finally { parent.Dispose(); } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs.meta new file mode 100644 index 00000000..108cb9c8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/TimeoutFrame.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c27be0a585d78a944bccd31b86ee6722 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs new file mode 100644 index 00000000..12471d06 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs @@ -0,0 +1,333 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace UniRx +{ + public struct CollectionAddEvent : IEquatable> + { + public int Index { get; private set; } + public T Value { get; private set; } + + public CollectionAddEvent(int index, T value) + :this() + { + Index = index; + Value = value; + } + + public override string ToString() + { + return string.Format("Index:{0} Value:{1}", Index, Value); + } + + public override int GetHashCode() + { + return Index.GetHashCode() ^ EqualityComparer.Default.GetHashCode(Value) << 2; + } + + public bool Equals(CollectionAddEvent other) + { + return Index.Equals(other.Index) && EqualityComparer.Default.Equals(Value, other.Value); + } + } + + public struct CollectionRemoveEvent : IEquatable> + { + public int Index { get; private set; } + public T Value { get; private set; } + + public CollectionRemoveEvent(int index, T value) + : this() + { + Index = index; + Value = value; + } + + public override string ToString() + { + return string.Format("Index:{0} Value:{1}", Index, Value); + } + + public override int GetHashCode() + { + return Index.GetHashCode() ^ EqualityComparer.Default.GetHashCode(Value) << 2; + } + + public bool Equals(CollectionRemoveEvent other) + { + return Index.Equals(other.Index) && EqualityComparer.Default.Equals(Value, other.Value); + } + } + + public struct CollectionMoveEvent : IEquatable> + { + public int OldIndex { get; private set; } + public int NewIndex { get; private set; } + public T Value { get; private set; } + + public CollectionMoveEvent(int oldIndex, int newIndex, T value) + : this() + { + OldIndex = oldIndex; + NewIndex = newIndex; + Value = value; + } + + public override string ToString() + { + return string.Format("OldIndex:{0} NewIndex:{1} Value:{2}", OldIndex, NewIndex, Value); + } + + public override int GetHashCode() + { + return OldIndex.GetHashCode() ^ NewIndex.GetHashCode() << 2 ^ EqualityComparer.Default.GetHashCode(Value) >> 2; + } + + public bool Equals(CollectionMoveEvent other) + { + return OldIndex.Equals(other.OldIndex) && NewIndex.Equals(other.NewIndex) && EqualityComparer.Default.Equals(Value, other.Value); + } + } + + public struct CollectionReplaceEvent : IEquatable> + { + public int Index { get; private set; } + public T OldValue { get; private set; } + public T NewValue { get; private set; } + + public CollectionReplaceEvent(int index, T oldValue, T newValue) + : this() + { + Index = index; + OldValue = oldValue; + NewValue = newValue; + } + + public override string ToString() + { + return string.Format("Index:{0} OldValue:{1} NewValue:{2}", Index, OldValue, NewValue); + } + + public override int GetHashCode() + { + return Index.GetHashCode() ^ EqualityComparer.Default.GetHashCode(OldValue) << 2 ^ EqualityComparer.Default.GetHashCode(NewValue) >> 2; + } + + public bool Equals(CollectionReplaceEvent other) + { + return Index.Equals(other.Index) + && EqualityComparer.Default.Equals(OldValue, other.OldValue) + && EqualityComparer.Default.Equals(NewValue, other.NewValue); + } + } + + // IReadOnlyList is from .NET 4.5 + public interface IReadOnlyReactiveCollection : IEnumerable + { + int Count { get; } + T this[int index] { get; } + IObservable> ObserveAdd(); + IObservable ObserveCountChanged(bool notifyCurrentCount = false); + IObservable> ObserveMove(); + IObservable> ObserveRemove(); + IObservable> ObserveReplace(); + IObservable ObserveReset(); + } + + public interface IReactiveCollection : IList, IReadOnlyReactiveCollection + { + new int Count { get; } + new T this[int index] { get; set; } + void Move(int oldIndex, int newIndex); + } + + [Serializable] + public class ReactiveCollection : Collection, IReactiveCollection, IDisposable + { + [NonSerialized] + bool isDisposed = false; + + public ReactiveCollection() + { + + } + + public ReactiveCollection(IEnumerable collection) + { + if (collection == null) throw new ArgumentNullException("collection"); + + foreach (var item in collection) + { + Add(item); + } + } + + public ReactiveCollection(List list) + : base(list != null ? new List(list) : null) + { + } + + protected override void ClearItems() + { + var beforeCount = Count; + base.ClearItems(); + + if (collectionReset != null) collectionReset.OnNext(Unit.Default); + if (beforeCount > 0) + { + if (countChanged != null) countChanged.OnNext(Count); + } + } + + protected override void InsertItem(int index, T item) + { + base.InsertItem(index, item); + + if (collectionAdd != null) collectionAdd.OnNext(new CollectionAddEvent(index, item)); + if (countChanged != null) countChanged.OnNext(Count); + } + + public void Move(int oldIndex, int newIndex) + { + MoveItem(oldIndex, newIndex); + } + + protected virtual void MoveItem(int oldIndex, int newIndex) + { + T item = this[oldIndex]; + base.RemoveItem(oldIndex); + base.InsertItem(newIndex, item); + + if (collectionMove != null) collectionMove.OnNext(new CollectionMoveEvent(oldIndex, newIndex, item)); + } + + protected override void RemoveItem(int index) + { + T item = this[index]; + base.RemoveItem(index); + + if (collectionRemove != null) collectionRemove.OnNext(new CollectionRemoveEvent(index, item)); + if (countChanged != null) countChanged.OnNext(Count); + } + + protected override void SetItem(int index, T item) + { + T oldItem = this[index]; + base.SetItem(index, item); + + if (collectionReplace != null) collectionReplace.OnNext(new CollectionReplaceEvent(index, oldItem, item)); + } + + + [NonSerialized] + Subject countChanged = null; + public IObservable ObserveCountChanged(bool notifyCurrentCount = false) + { + if (isDisposed) return Observable.Empty(); + + var subject = countChanged ?? (countChanged = new Subject()); + if (notifyCurrentCount) + { + return subject.StartWith(() => this.Count); + } + else + { + return subject; + } + } + + [NonSerialized] + Subject collectionReset = null; + public IObservable ObserveReset() + { + if (isDisposed) return Observable.Empty(); + return collectionReset ?? (collectionReset = new Subject()); + } + + [NonSerialized] + Subject> collectionAdd = null; + public IObservable> ObserveAdd() + { + if (isDisposed) return Observable.Empty>(); + return collectionAdd ?? (collectionAdd = new Subject>()); + } + + [NonSerialized] + Subject> collectionMove = null; + public IObservable> ObserveMove() + { + if (isDisposed) return Observable.Empty>(); + return collectionMove ?? (collectionMove = new Subject>()); + } + + [NonSerialized] + Subject> collectionRemove = null; + public IObservable> ObserveRemove() + { + if (isDisposed) return Observable.Empty>(); + return collectionRemove ?? (collectionRemove = new Subject>()); + } + + [NonSerialized] + Subject> collectionReplace = null; + public IObservable> ObserveReplace() + { + if (isDisposed) return Observable.Empty>(); + return collectionReplace ?? (collectionReplace = new Subject>()); + } + + void DisposeSubject(ref Subject subject) + { + if (subject != null) + { + try + { + subject.OnCompleted(); + } + finally + { + subject.Dispose(); + subject = null; + } + } + } + + #region IDisposable Support + + private bool disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + if (disposing) + { + DisposeSubject(ref collectionReset); + DisposeSubject(ref collectionAdd); + DisposeSubject(ref collectionMove); + DisposeSubject(ref collectionRemove); + DisposeSubject(ref collectionReplace); + DisposeSubject(ref countChanged); + } + + disposedValue = true; + } + } + + public void Dispose() + { + Dispose(true); + } + + #endregion + } + + public static partial class ReactiveCollectionExtensions + { + public static ReactiveCollection ToReactiveCollection(this IEnumerable source) + { + return new ReactiveCollection(source); + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs.meta new file mode 100644 index 00000000..a909b367 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCollection.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2e22185fb1dbcef42bc613efd4769011 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs new file mode 100644 index 00000000..18471bf7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs @@ -0,0 +1,487 @@ +using System; +using System.Collections.Generic; +using System.Threading; + +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +using System.Threading.Tasks; +using UniRx.InternalUtil; +#endif +namespace UniRx +{ + public interface IReactiveCommand : IObservable + { + IReadOnlyReactiveProperty CanExecute { get; } + bool Execute(T parameter); + } + + public interface IAsyncReactiveCommand + { + IReadOnlyReactiveProperty CanExecute { get; } + IDisposable Execute(T parameter); + IDisposable Subscribe(Func> asyncAction); + } + + /// + /// Represents ReactiveCommand<Unit> + /// + public class ReactiveCommand : ReactiveCommand + { + /// + /// CanExecute is always true. + /// + public ReactiveCommand() + : base() + { } + + /// + /// CanExecute is changed from canExecute sequence. + /// + public ReactiveCommand(IObservable canExecuteSource, bool initialValue = true) + : base(canExecuteSource, initialValue) + { + } + + /// Push null to subscribers. + public bool Execute() + { + return Execute(Unit.Default); + } + + /// Force push parameter to subscribers. + public void ForceExecute() + { + ForceExecute(Unit.Default); + } + } + + public class ReactiveCommand : IReactiveCommand, IDisposable + { + readonly Subject trigger = new Subject(); + readonly IDisposable canExecuteSubscription; + + ReactiveProperty canExecute; + public IReadOnlyReactiveProperty CanExecute + { + get + { + return canExecute; + } + } + + public bool IsDisposed { get; private set; } + + /// + /// CanExecute is always true. + /// + public ReactiveCommand() + { + this.canExecute = new ReactiveProperty(true); + this.canExecuteSubscription = Disposable.Empty; + } + + /// + /// CanExecute is changed from canExecute sequence. + /// + public ReactiveCommand(IObservable canExecuteSource, bool initialValue = true) + { + this.canExecute = new ReactiveProperty(initialValue); + this.canExecuteSubscription = canExecuteSource + .DistinctUntilChanged() + .SubscribeWithState(canExecute, (b, c) => c.Value = b); + } + + /// Push parameter to subscribers when CanExecute. + public bool Execute(T parameter) + { + if (canExecute.Value) + { + trigger.OnNext(parameter); + return true; + } + else + { + return false; + } + } + + /// Force push parameter to subscribers. + public void ForceExecute(T parameter) + { + trigger.OnNext(parameter); + } + + /// Subscribe execute. + public IDisposable Subscribe(IObserver observer) + { + return trigger.Subscribe(observer); + } + + /// + /// Stop all subscription and lock CanExecute is false. + /// + public void Dispose() + { + if (IsDisposed) return; + + IsDisposed = true; + canExecute.Dispose(); + trigger.OnCompleted(); + trigger.Dispose(); + canExecuteSubscription.Dispose(); + } + } + + /// + /// Variation of ReactiveCommand, when executing command then CanExecute = false after CanExecute = true. + /// + public class AsyncReactiveCommand : AsyncReactiveCommand + { + /// + /// CanExecute is automatically changed when executing to false and finished to true. + /// + public AsyncReactiveCommand() + : base() + { + + } + + /// + /// CanExecute is automatically changed when executing to false and finished to true. + /// + public AsyncReactiveCommand(IObservable canExecuteSource) + : base(canExecuteSource) + { + } + + /// + /// CanExecute is automatically changed when executing to false and finished to true. + /// The source is shared between other AsyncReactiveCommand. + /// + public AsyncReactiveCommand(IReactiveProperty sharedCanExecute) + : base(sharedCanExecute) + { + } + + public IDisposable Execute() + { + return base.Execute(Unit.Default); + } + } + + /// + /// Variation of ReactiveCommand, canExecute is changed when executing command then CanExecute = false after CanExecute = true. + /// + public class AsyncReactiveCommand : IAsyncReactiveCommand + { + UniRx.InternalUtil.ImmutableList>> asyncActions = UniRx.InternalUtil.ImmutableList>>.Empty; + + readonly object gate = new object(); + readonly IReactiveProperty canExecuteSource; + readonly IReadOnlyReactiveProperty canExecute; + + public IReadOnlyReactiveProperty CanExecute + { + get + { + return canExecute; + } + } + + public bool IsDisposed { get; private set; } + + /// + /// CanExecute is automatically changed when executing to false and finished to true. + /// + public AsyncReactiveCommand() + { + this.canExecuteSource = new ReactiveProperty(true); + this.canExecute = canExecuteSource; + } + + /// + /// CanExecute is automatically changed when executing to false and finished to true. + /// + public AsyncReactiveCommand(IObservable canExecuteSource) + { + this.canExecuteSource = new ReactiveProperty(true); + this.canExecute = this.canExecuteSource.CombineLatest(canExecuteSource, (x, y) => x && y).ToReactiveProperty(); + } + + /// + /// CanExecute is automatically changed when executing to false and finished to true. + /// The source is shared between other AsyncReactiveCommand. + /// + public AsyncReactiveCommand(IReactiveProperty sharedCanExecute) + { + this.canExecuteSource = sharedCanExecute; + this.canExecute = sharedCanExecute; + } + + /// Push parameter to subscribers when CanExecute. + public IDisposable Execute(T parameter) + { + if (canExecute.Value) + { + canExecuteSource.Value = false; + var a = asyncActions.Data; + if (a.Length == 1) + { + try + { + var asyncState = a[0].Invoke(parameter) ?? Observable.ReturnUnit(); + return asyncState.Finally(() => canExecuteSource.Value = true).Subscribe(); + } + catch + { + canExecuteSource.Value = true; + throw; + } + } + else + { + var xs = new IObservable[a.Length]; + try + { + for (int i = 0; i < a.Length; i++) + { + xs[i] = a[i].Invoke(parameter) ?? Observable.ReturnUnit(); + } + } + catch + { + canExecuteSource.Value = true; + throw; + } + + return Observable.WhenAll(xs).Finally(() => canExecuteSource.Value = true).Subscribe(); + } + } + else + { + return Disposable.Empty; + } + } + + /// Subscribe execute. + public IDisposable Subscribe(Func> asyncAction) + { + lock (gate) + { + asyncActions = asyncActions.Add(asyncAction); + } + + return new Subscription(this, asyncAction); + } + + /// + /// Stop all subscription and lock CanExecute is false. + /// + public void Dispose() + { + if (IsDisposed) return; + + IsDisposed = true; + asyncActions = UniRx.InternalUtil.ImmutableList>>.Empty; + } + class Subscription : IDisposable + { + readonly AsyncReactiveCommand parent; + readonly Func> asyncAction; + + public Subscription(AsyncReactiveCommand parent, Func> asyncAction) + { + this.parent = parent; + this.asyncAction = asyncAction; + } + + public void Dispose() + { + lock (parent.gate) + { + parent.asyncActions = parent.asyncActions.Remove(asyncAction); + } + } + } + } + + public static class ReactiveCommandExtensions + { + /// + /// Create non parameter commands. CanExecute is changed from canExecute sequence. + /// + public static ReactiveCommand ToReactiveCommand(this IObservable canExecuteSource, bool initialValue = true) + { + return new ReactiveCommand(canExecuteSource, initialValue); + } + + /// + /// Create parametered comamnds. CanExecute is changed from canExecute sequence. + /// + public static ReactiveCommand ToReactiveCommand(this IObservable canExecuteSource, bool initialValue = true) + { + return new ReactiveCommand(canExecuteSource, initialValue); + } + +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) + + static readonly Action Callback = CancelCallback; + + static void CancelCallback(object state) + { + var tuple = (Tuple)state; + tuple.Item2.Dispose(); + tuple.Item1.TrySetCanceled(); + } + + public static Task WaitUntilExecuteAsync(this IReactiveCommand source, CancellationToken cancellationToken = default(CancellationToken)) + { + var tcs = new CancellableTaskCompletionSource(); + + var disposable = new SingleAssignmentDisposable(); + disposable.Disposable = source.Subscribe(x => + { + disposable.Dispose(); // finish subscription. + tcs.TrySetResult(x); + }, ex => tcs.TrySetException(ex), () => tcs.TrySetCanceled()); + + cancellationToken.Register(Callback, Tuple.Create(tcs, disposable.Disposable), false); + + return tcs.Task; + } + + public static System.Runtime.CompilerServices.TaskAwaiter GetAwaiter(this IReactiveCommand command) + { + return command.WaitUntilExecuteAsync(CancellationToken.None).GetAwaiter(); + } + +#endif + +#if !UniRxLibrary + + // for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + + /// + /// Bind ReactiveCommand to button's interactable and onClick. + /// + public static IDisposable BindTo(this IReactiveCommand command, UnityEngine.UI.Button button) + { + var d1 = command.CanExecute.SubscribeToInteractable(button); + var d2 = button.OnClickAsObservable().SubscribeWithState(command, (x, c) => c.Execute(x)); + return StableCompositeDisposable.Create(d1, d2); + } + + /// + /// Bind ReactiveCommand to button's interactable and onClick and register onClick action to command. + /// + public static IDisposable BindToOnClick(this IReactiveCommand command, UnityEngine.UI.Button button, Action onClick) + { + var d1 = command.CanExecute.SubscribeToInteractable(button); + var d2 = button.OnClickAsObservable().SubscribeWithState(command, (x, c) => c.Execute(x)); + var d3 = command.Subscribe(onClick); + + return StableCompositeDisposable.Create(d1, d2, d3); + } + + /// + /// Bind canExecuteSource to button's interactable and onClick and register onClick action to command. + /// + public static IDisposable BindToButtonOnClick(this IObservable canExecuteSource, UnityEngine.UI.Button button, Action onClick, bool initialValue = true) + { + return ToReactiveCommand(canExecuteSource, initialValue).BindToOnClick(button, onClick); + } + +#endif + +#endif + } + + public static class AsyncReactiveCommandExtensions + { + public static AsyncReactiveCommand ToAsyncReactiveCommand(this IReactiveProperty sharedCanExecuteSource) + { + return new AsyncReactiveCommand(sharedCanExecuteSource); + } + + public static AsyncReactiveCommand ToAsyncReactiveCommand(this IReactiveProperty sharedCanExecuteSource) + { + return new AsyncReactiveCommand(sharedCanExecuteSource); + } + +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) + + static readonly Action Callback = CancelCallback; + + static void CancelCallback(object state) + { + var tuple = (Tuple)state; + tuple.Item2.Dispose(); + tuple.Item1.TrySetCanceled(); + } + + public static Task WaitUntilExecuteAsync(this IAsyncReactiveCommand source, CancellationToken cancellationToken = default(CancellationToken)) + { + var tcs = new CancellableTaskCompletionSource(); + + var subscription = source.Subscribe(x => { tcs.TrySetResult(x); return Observable.ReturnUnit(); }); + cancellationToken.Register(Callback, Tuple.Create(tcs, subscription), false); + + return tcs.Task; + } + + public static System.Runtime.CompilerServices.TaskAwaiter GetAwaiter(this IAsyncReactiveCommand command) + { + return command.WaitUntilExecuteAsync(CancellationToken.None).GetAwaiter(); + } + +#endif + + +#if !UniRxLibrary + + // for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + + /// + /// Bind AsyncRaectiveCommand to button's interactable and onClick. + /// + public static IDisposable BindTo(this IAsyncReactiveCommand command, UnityEngine.UI.Button button) + { + var d1 = command.CanExecute.SubscribeToInteractable(button); + var d2 = button.OnClickAsObservable().SubscribeWithState(command, (x, c) => c.Execute(x)); + + return StableCompositeDisposable.Create(d1, d2); + } + + /// + /// Bind AsyncRaectiveCommand to button's interactable and onClick and register async action to command. + /// + public static IDisposable BindToOnClick(this IAsyncReactiveCommand command, UnityEngine.UI.Button button, Func> asyncOnClick) + { + var d1 = command.CanExecute.SubscribeToInteractable(button); + var d2 = button.OnClickAsObservable().SubscribeWithState(command, (x, c) => c.Execute(x)); + var d3 = command.Subscribe(asyncOnClick); + + return StableCompositeDisposable.Create(d1, d2, d3); + } + + /// + /// Create AsyncReactiveCommand and bind to button's interactable and onClick and register async action to command. + /// + public static IDisposable BindToOnClick(this UnityEngine.UI.Button button, Func> asyncOnClick) + { + return new AsyncReactiveCommand().BindToOnClick(button, asyncOnClick); + } + + /// + /// Create AsyncReactiveCommand and bind sharedCanExecuteSource source to button's interactable and onClick and register async action to command. + /// + public static IDisposable BindToOnClick(this UnityEngine.UI.Button button, IReactiveProperty sharedCanExecuteSource, Func> asyncOnClick) + { + return sharedCanExecuteSource.ToAsyncReactiveCommand().BindToOnClick(button, asyncOnClick); + } +#endif + +#endif + } +} diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs.meta new file mode 100644 index 00000000..b9a3d296 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveCommand.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 939b249fde5252f45a4404e7648931ed +timeCreated: 1462927720 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs new file mode 100644 index 00000000..4b928e30 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs @@ -0,0 +1,520 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace UniRx +{ + public struct DictionaryAddEvent : IEquatable> + { + public TKey Key { get; private set; } + public TValue Value { get; private set; } + + public DictionaryAddEvent(TKey key, TValue value) + : this() + { + Key = key; + Value = value; + } + + public override string ToString() + { + return string.Format("Key:{0} Value:{1}", Key, Value); + } + + public override int GetHashCode() + { + return EqualityComparer.Default.GetHashCode(Key) ^ EqualityComparer.Default.GetHashCode(Value) << 2; + } + + public bool Equals(DictionaryAddEvent other) + { + return EqualityComparer.Default.Equals(Key, other.Key) && EqualityComparer.Default.Equals(Value, other.Value); + } + } + + public struct DictionaryRemoveEvent : IEquatable> + { + public TKey Key { get; private set; } + public TValue Value { get; private set; } + + public DictionaryRemoveEvent(TKey key, TValue value) + : this() + { + Key = key; + Value = value; + } + + public override string ToString() + { + return string.Format("Key:{0} Value:{1}", Key, Value); + } + + public override int GetHashCode() + { + return EqualityComparer.Default.GetHashCode(Key) ^ EqualityComparer.Default.GetHashCode(Value) << 2; + } + + public bool Equals(DictionaryRemoveEvent other) + { + return EqualityComparer.Default.Equals(Key, other.Key) && EqualityComparer.Default.Equals(Value, other.Value); + } + } + + public struct DictionaryReplaceEvent : IEquatable> + { + public TKey Key { get; private set; } + public TValue OldValue { get; private set; } + public TValue NewValue { get; private set; } + + public DictionaryReplaceEvent(TKey key, TValue oldValue, TValue newValue) + : this() + { + Key = key; + OldValue = oldValue; + NewValue = newValue; + } + + public override string ToString() + { + return string.Format("Key:{0} OldValue:{1} NewValue:{2}", Key, OldValue, NewValue); + } + + public override int GetHashCode() + { + return EqualityComparer.Default.GetHashCode(Key) ^ EqualityComparer.Default.GetHashCode(OldValue) << 2 ^ EqualityComparer.Default.GetHashCode(NewValue) >> 2; + } + + public bool Equals(DictionaryReplaceEvent other) + { + return EqualityComparer.Default.Equals(Key, other.Key) && EqualityComparer.Default.Equals(OldValue, other.OldValue) && EqualityComparer.Default.Equals(NewValue, other.NewValue); + } + } + + // IReadOnlyDictionary is from .NET 4.5 + public interface IReadOnlyReactiveDictionary : IEnumerable> + { + int Count { get; } + TValue this[TKey index] { get; } + bool ContainsKey(TKey key); + bool TryGetValue(TKey key, out TValue value); + + IObservable> ObserveAdd(); + IObservable ObserveCountChanged(bool notifyCurrentCount = false); + IObservable> ObserveRemove(); + IObservable> ObserveReplace(); + IObservable ObserveReset(); + } + + public interface IReactiveDictionary : IReadOnlyReactiveDictionary, IDictionary + { + } + + [Serializable] + public class ReactiveDictionary : IReactiveDictionary, IDictionary, IEnumerable, ICollection>, IEnumerable>, IDictionary, IDisposable +#if !UNITY_METRO + , ISerializable, IDeserializationCallback +#endif + { + [NonSerialized] + bool isDisposed = false; + +#if !UniRxLibrary + [UnityEngine.SerializeField] +#endif + readonly Dictionary inner; + + public ReactiveDictionary() + { + inner = new Dictionary(); + } + + public ReactiveDictionary(IEqualityComparer comparer) + { + inner = new Dictionary(comparer); + } + + public ReactiveDictionary(Dictionary innerDictionary) + { + inner = innerDictionary; + } + + public TValue this[TKey key] + { + get + { + return inner[key]; + } + + set + { + TValue oldValue; + if (TryGetValue(key, out oldValue)) + { + inner[key] = value; + if (dictionaryReplace != null) dictionaryReplace.OnNext(new DictionaryReplaceEvent(key, oldValue, value)); + } + else + { + inner[key] = value; + if (dictionaryAdd != null) dictionaryAdd.OnNext(new DictionaryAddEvent(key, value)); + if (countChanged != null) countChanged.OnNext(Count); + } + } + } + + public int Count + { + get + { + return inner.Count; + } + } + + public Dictionary.KeyCollection Keys + { + get + { + return inner.Keys; + } + } + + public Dictionary.ValueCollection Values + { + get + { + return inner.Values; + } + } + + public void Add(TKey key, TValue value) + { + inner.Add(key, value); + + if (dictionaryAdd != null) dictionaryAdd.OnNext(new DictionaryAddEvent(key, value)); + if (countChanged != null) countChanged.OnNext(Count); + } + + public void Clear() + { + var beforeCount = Count; + inner.Clear(); + + if (collectionReset != null) collectionReset.OnNext(Unit.Default); + if (beforeCount > 0) + { + if (countChanged != null) countChanged.OnNext(Count); + } + } + + public bool Remove(TKey key) + { + TValue oldValue; + if (inner.TryGetValue(key, out oldValue)) + { + var isSuccessRemove = inner.Remove(key); + if (isSuccessRemove) + { + if (dictionaryRemove != null) dictionaryRemove.OnNext(new DictionaryRemoveEvent(key, oldValue)); + if (countChanged != null) countChanged.OnNext(Count); + } + return isSuccessRemove; + } + else + { + return false; + } + } + + public bool ContainsKey(TKey key) + { + return inner.ContainsKey(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + return inner.TryGetValue(key, out value); + } + + public Dictionary.Enumerator GetEnumerator() + { + return inner.GetEnumerator(); + } + + void DisposeSubject(ref Subject subject) + { + if (subject != null) + { + try + { + subject.OnCompleted(); + } + finally + { + subject.Dispose(); + subject = null; + } + } + } + + #region IDisposable Support + + private bool disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + if (disposing) + { + DisposeSubject(ref countChanged); + DisposeSubject(ref collectionReset); + DisposeSubject(ref dictionaryAdd); + DisposeSubject(ref dictionaryRemove); + DisposeSubject(ref dictionaryReplace); + } + + disposedValue = true; + } + } + + public void Dispose() + { + Dispose(true); + } + + #endregion + + + #region Observe + + [NonSerialized] + Subject countChanged = null; + public IObservable ObserveCountChanged(bool notifyCurrentCount = false) + { + if (isDisposed) return Observable.Empty(); + + var subject = countChanged ?? (countChanged = new Subject()); + if (notifyCurrentCount) + { + return subject.StartWith(() => this.Count); + } + else + { + return subject; + } + } + + [NonSerialized] + Subject collectionReset = null; + public IObservable ObserveReset() + { + if (isDisposed) return Observable.Empty(); + return collectionReset ?? (collectionReset = new Subject()); + } + + [NonSerialized] + Subject> dictionaryAdd = null; + public IObservable> ObserveAdd() + { + if (isDisposed) return Observable.Empty>(); + return dictionaryAdd ?? (dictionaryAdd = new Subject>()); + } + + [NonSerialized] + Subject> dictionaryRemove = null; + public IObservable> ObserveRemove() + { + if (isDisposed) return Observable.Empty>(); + return dictionaryRemove ?? (dictionaryRemove = new Subject>()); + } + + [NonSerialized] + Subject> dictionaryReplace = null; + public IObservable> ObserveReplace() + { + if (isDisposed) return Observable.Empty>(); + return dictionaryReplace ?? (dictionaryReplace = new Subject>()); + } + + #endregion + + #region implement explicit + + object IDictionary.this[object key] + { + get + { + return this[(TKey)key]; + } + + set + { + this[(TKey)key] = (TValue)value; + } + } + + + bool IDictionary.IsFixedSize + { + get + { + return ((IDictionary)inner).IsFixedSize; + } + } + + bool IDictionary.IsReadOnly + { + get + { + return ((IDictionary)inner).IsReadOnly; + } + } + + bool ICollection.IsSynchronized + { + get + { + return ((IDictionary)inner).IsSynchronized; + } + } + + ICollection IDictionary.Keys + { + get + { + return ((IDictionary)inner).Keys; + } + } + + object ICollection.SyncRoot + { + get + { + return ((IDictionary)inner).SyncRoot; + } + } + + ICollection IDictionary.Values + { + get + { + return ((IDictionary)inner).Values; + } + } + + + bool ICollection>.IsReadOnly + { + get + { + return ((ICollection>)inner).IsReadOnly; + } + } + + ICollection IDictionary.Keys + { + get + { + return inner.Keys; + } + } + + ICollection IDictionary.Values + { + get + { + return inner.Values; + } + } + + void IDictionary.Add(object key, object value) + { + Add((TKey)key, (TValue)value); + } + + bool IDictionary.Contains(object key) + { + return ((IDictionary)inner).Contains(key); + } + + void ICollection.CopyTo(Array array, int index) + { + ((IDictionary)inner).CopyTo(array, index); + } + +#if !UNITY_METRO + + public void GetObjectData(SerializationInfo info, StreamingContext context) + { + ((ISerializable)inner).GetObjectData(info, context); + } + + public void OnDeserialization(object sender) + { + ((IDeserializationCallback)inner).OnDeserialization(sender); + } + +#endif + + void IDictionary.Remove(object key) + { + Remove((TKey)key); + } + + void ICollection>.Add(KeyValuePair item) + { + Add((TKey)item.Key, (TValue)item.Value); + } + + bool ICollection>.Contains(KeyValuePair item) + { + return ((ICollection>)inner).Contains(item); + } + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) + { + ((ICollection>)inner).CopyTo(array, arrayIndex); + } + + IEnumerator> IEnumerable>.GetEnumerator() + { + return ((ICollection>)inner).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return inner.GetEnumerator(); + } + + bool ICollection>.Remove(KeyValuePair item) + { + TValue v; + if (TryGetValue(item.Key, out v)) + { + if (EqualityComparer.Default.Equals(v, item.Value)) + { + Remove(item.Key); + return true; + } + } + + return false; + } + + IDictionaryEnumerator IDictionary.GetEnumerator() + { + return ((IDictionary)inner).GetEnumerator(); + } + + #endregion + } + + public static partial class ReactiveDictionaryExtensions + { + public static ReactiveDictionary ToReactiveDictionary(this Dictionary dictionary) + { + return new ReactiveDictionary(dictionary); + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs.meta new file mode 100644 index 00000000..4fdc3262 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveDictionary.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 12cd1079b0fe33f429f9f174c1f849af +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs new file mode 100644 index 00000000..d67a81e6 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs @@ -0,0 +1,610 @@ +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member +#endif + +using System; +using System.Collections.Generic; +using System.Threading; +using UniRx.InternalUtil; +#if !UniRxLibrary +using UnityEngine; +#endif +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +using System.Threading.Tasks; +#endif + +namespace UniRx +{ + public interface IReadOnlyReactiveProperty : IObservable + { + T Value { get; } + bool HasValue { get; } + } + + public interface IReactiveProperty : IReadOnlyReactiveProperty + { + new T Value { get; set; } + } + + internal interface IObserverLinkedList + { + void UnsubscribeNode(ObserverNode node); + } + + internal sealed class ObserverNode : IObserver, IDisposable + { + readonly IObserver observer; + IObserverLinkedList list; + + public ObserverNode Previous { get; internal set; } + public ObserverNode Next { get; internal set; } + + public ObserverNode(IObserverLinkedList list, IObserver observer) + { + this.list = list; + this.observer = observer; + } + + public void OnNext(T value) + { + observer.OnNext(value); + } + + public void OnError(Exception error) + { + observer.OnError(error); + } + + public void OnCompleted() + { + observer.OnCompleted(); + } + + public void Dispose() + { + var sourceList = Interlocked.Exchange(ref list, null); + if (sourceList != null) + { + sourceList.UnsubscribeNode(this); + sourceList = null; + } + } + } + + /// + /// Lightweight property broker. + /// + [Serializable] + public class ReactiveProperty : IReactiveProperty, IDisposable, IOptimizedObservable, IObserverLinkedList + { +#if !UniRxLibrary + static readonly IEqualityComparer defaultEqualityComparer = UnityEqualityComparer.GetDefault(); +#else + static readonly IEqualityComparer defaultEqualityComparer = EqualityComparer.Default; +#endif + +#if !UniRxLibrary + [SerializeField] +#endif + T value = default(T); + + [NonSerialized] + ObserverNode root; + + [NonSerialized] + ObserverNode last; + + [NonSerialized] + bool isDisposed = false; + + protected virtual IEqualityComparer EqualityComparer + { + get + { + return defaultEqualityComparer; + } + } + + public T Value + { + get + { + return value; + } + set + { + if (!EqualityComparer.Equals(this.value, value)) + { + SetValue(value); + if (isDisposed) + return; + + RaiseOnNext(ref value); + } + } + } + + // always true, allows empty constructor 'can' publish value on subscribe. + // because sometimes value is deserialized from UnityEngine. + public bool HasValue + { + get + { + return true; + } + } + + public ReactiveProperty() + : this(default(T)) + { + } + + public ReactiveProperty(T initialValue) + { + SetValue(initialValue); + } + + void RaiseOnNext(ref T value) + { + var node = root; + while (node != null) + { + node.OnNext(value); + node = node.Next; + } + } + + protected virtual void SetValue(T value) + { + this.value = value; + } + + public void SetValueAndForceNotify(T value) + { + SetValue(value); + if (isDisposed) + return; + + RaiseOnNext(ref value); + } + + public IDisposable Subscribe(IObserver observer) + { + if (isDisposed) + { + observer.OnCompleted(); + return Disposable.Empty; + } + + // raise latest value on subscribe + observer.OnNext(value); + + // subscribe node, node as subscription. + var next = new ObserverNode(this, observer); + if (root == null) + { + root = last = next; + } + else + { + last.Next = next; + next.Previous = last; + last = next; + } + return next; + } + + void IObserverLinkedList.UnsubscribeNode(ObserverNode node) + { + if (node == root) + { + root = node.Next; + } + if (node == last) + { + last = node.Previous; + } + + if (node.Previous != null) + { + node.Previous.Next = node.Next; + } + if (node.Next != null) + { + node.Next.Previous = node.Previous; + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (isDisposed) return; + + var node = root; + root = last = null; + isDisposed = true; + + while (node != null) + { + node.OnCompleted(); + node = node.Next; + } + } + + public override string ToString() + { + return (value == null) ? "(null)" : value.ToString(); + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + } + + /// + /// Lightweight property broker. + /// + public class ReadOnlyReactiveProperty : IReadOnlyReactiveProperty, IDisposable, IOptimizedObservable, IObserverLinkedList, IObserver + { +#if !UniRxLibrary + static readonly IEqualityComparer defaultEqualityComparer = UnityEqualityComparer.GetDefault(); +#else + static readonly IEqualityComparer defaultEqualityComparer = EqualityComparer.Default; +#endif + + readonly bool distinctUntilChanged = true; + bool canPublishValueOnSubscribe = false; + bool isDisposed = false; + bool isSourceCompleted = false; + + T latestValue = default(T); + Exception lastException = null; + IDisposable sourceConnection = null; + + ObserverNode root; + ObserverNode last; + + public T Value + { + get + { + return latestValue; + } + } + + public bool HasValue + { + get + { + return canPublishValueOnSubscribe; + } + } + + protected virtual IEqualityComparer EqualityComparer + { + get + { + return defaultEqualityComparer; + } + } + + public ReadOnlyReactiveProperty(IObservable source) + { + this.sourceConnection = source.Subscribe(this); + } + + public ReadOnlyReactiveProperty(IObservable source, bool distinctUntilChanged) + { + this.distinctUntilChanged = distinctUntilChanged; + this.sourceConnection = source.Subscribe(this); + } + + public ReadOnlyReactiveProperty(IObservable source, T initialValue) + { + this.latestValue = initialValue; + this.canPublishValueOnSubscribe = true; + this.sourceConnection = source.Subscribe(this); + } + + public ReadOnlyReactiveProperty(IObservable source, T initialValue, bool distinctUntilChanged) + { + this.distinctUntilChanged = distinctUntilChanged; + this.latestValue = initialValue; + this.canPublishValueOnSubscribe = true; + this.sourceConnection = source.Subscribe(this); + } + + public IDisposable Subscribe(IObserver observer) + { + if (lastException != null) + { + observer.OnError(lastException); + return Disposable.Empty; + } + + if (isSourceCompleted) + { + if (canPublishValueOnSubscribe) + { + observer.OnNext(latestValue); + observer.OnCompleted(); + return Disposable.Empty; + } + else + { + observer.OnCompleted(); + return Disposable.Empty; + } + } + + if (isDisposed) + { + observer.OnCompleted(); + return Disposable.Empty; + } + + if (canPublishValueOnSubscribe) + { + observer.OnNext(latestValue); + } + + // subscribe node, node as subscription. + var next = new ObserverNode(this, observer); + if (root == null) + { + root = last = next; + } + else + { + last.Next = next; + next.Previous = last; + last = next; + } + + return next; + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (isDisposed) return; + sourceConnection.Dispose(); + + var node = root; + root = last = null; + isDisposed = true; + + while (node != null) + { + node.OnCompleted(); + node = node.Next; + } + } + + void IObserverLinkedList.UnsubscribeNode(ObserverNode node) + { + if (node == root) + { + root = node.Next; + } + if (node == last) + { + last = node.Previous; + } + + if (node.Previous != null) + { + node.Previous.Next = node.Next; + } + if (node.Next != null) + { + node.Next.Previous = node.Previous; + } + } + + void IObserver.OnNext(T value) + { + if (isDisposed) return; + + if (canPublishValueOnSubscribe) + { + if (distinctUntilChanged && EqualityComparer.Equals(this.latestValue, value)) + { + return; + } + } + + canPublishValueOnSubscribe = true; + + // SetValue + this.latestValue = value; + + // call source.OnNext + var node = root; + while (node != null) + { + node.OnNext(value); + node = node.Next; + } + } + + void IObserver.OnError(Exception error) + { + lastException = error; + + // call source.OnError + var node = root; + while (node != null) + { + node.OnError(error); + node = node.Next; + } + + root = last = null; + } + + void IObserver.OnCompleted() + { + isSourceCompleted = true; + root = last = null; + } + + public override string ToString() + { + return (latestValue == null) ? "(null)" : latestValue.ToString(); + } + + public bool IsRequiredSubscribeOnCurrentThread() + { + return false; + } + } + + /// + /// Extension methods of ReactiveProperty<T> + /// + public static class ReactivePropertyExtensions + { + public static IReadOnlyReactiveProperty ToReactiveProperty(this IObservable source) + { + return new ReadOnlyReactiveProperty(source); + } + + public static IReadOnlyReactiveProperty ToReactiveProperty(this IObservable source, T initialValue) + { + return new ReadOnlyReactiveProperty(source, initialValue); + } + + public static ReadOnlyReactiveProperty ToReadOnlyReactiveProperty(this IObservable source) + { + return new ReadOnlyReactiveProperty(source); + } + +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) + + static readonly Action Callback = CancelCallback; + + static void CancelCallback(object state) + { + var tuple = (Tuple)state; + tuple.Item2.Dispose(); + tuple.Item1.TrySetCanceled(); + } + + public static Task WaitUntilValueChangedAsync(this IReadOnlyReactiveProperty source, CancellationToken cancellationToken = default(CancellationToken)) + { + var tcs = new CancellableTaskCompletionSource(); + + var disposable = new SingleAssignmentDisposable(); + if (source.HasValue) + { + // Skip first value + var isFirstValue = true; + disposable.Disposable = source.Subscribe(x => + { + if (isFirstValue) + { + isFirstValue = false; + return; + } + else + { + disposable.Dispose(); // finish subscription. + tcs.TrySetResult(x); + } + }, ex => tcs.TrySetException(ex), () => tcs.TrySetCanceled()); + } + else + { + disposable.Disposable = source.Subscribe(x => + { + disposable.Dispose(); // finish subscription. + tcs.TrySetResult(x); + }, ex => tcs.TrySetException(ex), () => tcs.TrySetCanceled()); + } + + cancellationToken.Register(Callback, Tuple.Create(tcs, disposable.Disposable), false); + + return tcs.Task; + } + + public static System.Runtime.CompilerServices.TaskAwaiter GetAwaiter(this IReadOnlyReactiveProperty source) + { + return source.WaitUntilValueChangedAsync(CancellationToken.None).GetAwaiter(); + } + +#endif + + /// + /// Create ReadOnlyReactiveProperty with distinctUntilChanged: false. + /// + public static ReadOnlyReactiveProperty ToSequentialReadOnlyReactiveProperty(this IObservable source) + { + return new ReadOnlyReactiveProperty(source, distinctUntilChanged: false); + } + + public static ReadOnlyReactiveProperty ToReadOnlyReactiveProperty(this IObservable source, T initialValue) + { + return new ReadOnlyReactiveProperty(source, initialValue); + } + + /// + /// Create ReadOnlyReactiveProperty with distinctUntilChanged: false. + /// + public static ReadOnlyReactiveProperty ToSequentialReadOnlyReactiveProperty(this IObservable source, T initialValue) + { + return new ReadOnlyReactiveProperty(source, initialValue, distinctUntilChanged: false); + } + + public static IObservable SkipLatestValueOnSubscribe(this IReadOnlyReactiveProperty source) + { + return source.HasValue ? source.Skip(1) : source; + } + + // for multiple toggle or etc.. + + /// + /// Lastest values of each sequence are all true. + /// + public static IObservable CombineLatestValuesAreAllTrue(this IEnumerable> sources) + { + return sources.CombineLatest().Select(xs => + { + foreach (var item in xs) + { + if (item == false) + return false; + } + return true; + }); + } + + + /// + /// Lastest values of each sequence are all false. + /// + public static IObservable CombineLatestValuesAreAllFalse(this IEnumerable> sources) + { + return sources.CombineLatest().Select(xs => + { + foreach (var item in xs) + { + if (item == true) + return false; + } + return true; + }); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs.meta new file mode 100644 index 00000000..a17fa6d0 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ReactiveProperty.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 88e12aa895fef434fbe3ea0cc8f57301 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs new file mode 100644 index 00000000..ba1b4ab5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs @@ -0,0 +1,84 @@ +#if UNITY_EDITOR + +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEngine; + +namespace UniRx +{ + [InitializeOnLoad] + public class ScenePlaybackDetector + { + private static bool _isPlaying = false; + + private static bool AboutToStartScene + { + get + { + return EditorPrefs.GetBool("AboutToStartScene"); + } + set + { + EditorPrefs.SetBool("AboutToStartScene", value); + } + } + + public static bool IsPlaying + { + get + { + return _isPlaying; + } + set + { + if (_isPlaying != value) + { + _isPlaying = value; + } + } + } + + // This callback is notified after scripts have been reloaded. + [DidReloadScripts] + public static void OnDidReloadScripts() + { + // Filter DidReloadScripts callbacks to the moment where playmodeState transitions into isPlaying. + if (AboutToStartScene) + { + IsPlaying = true; + } + } + + // InitializeOnLoad ensures that this constructor is called when the Unity Editor is started. + static ScenePlaybackDetector() + { +#if UNITY_2017_2_OR_NEWER + EditorApplication.playModeStateChanged += e => +#else + EditorApplication.playmodeStateChanged += () => +#endif + { + // Before scene start: isPlayingOrWillChangePlaymode = false; isPlaying = false + // Pressed Playback button: isPlayingOrWillChangePlaymode = true; isPlaying = false + // Playing: isPlayingOrWillChangePlaymode = false; isPlaying = true + // Pressed stop button: isPlayingOrWillChangePlaymode = true; isPlaying = true + if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) + { + AboutToStartScene = true; + } + else + { + AboutToStartScene = false; + } + + // Detect when playback is stopped. + if (!EditorApplication.isPlaying) + { + IsPlaying = false; + } + }; + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs.meta new file mode 100644 index 00000000..3e3e6d72 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ScenePlaybackDetector.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8d380d86e2ef6674c83ca983a1604273 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit.meta new file mode 100644 index 00000000..029446b8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 726595c7d6d85824887a77691e3ca50a +folderAsset: yes +timeCreated: 1468655394 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs new file mode 100644 index 00000000..52e91bc2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs @@ -0,0 +1,474 @@ +#if UNITY_5_3_OR_NEWER + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; + +namespace UniRx.Toolkit +{ + /// + /// Bass class of ObjectPool. + /// + public abstract class ObjectPool : IDisposable + where T : UnityEngine.Component + { + bool isDisposed = false; + Queue q; + + /// + /// Limit of instace count. + /// + protected int MaxPoolCount + { + get + { + return int.MaxValue; + } + } + + /// + /// Create instance when needed. + /// + protected abstract T CreateInstance(); + + /// + /// Called before return to pool, useful for set active object(it is default behavior). + /// + protected virtual void OnBeforeRent(T instance) + { + instance.gameObject.SetActive(true); + } + + /// + /// Called before return to pool, useful for set inactive object(it is default behavior). + /// + protected virtual void OnBeforeReturn(T instance) + { + instance.gameObject.SetActive(false); + } + + /// + /// Called when clear or disposed, useful for destroy instance or other finalize method. + /// + protected virtual void OnClear(T instance) + { + if (instance == null) return; + + var go = instance.gameObject; + if (go == null) return; + UnityEngine.Object.Destroy(go); + } + + /// + /// Current pooled object count. + /// + public int Count + { + get + { + if (q == null) return 0; + return q.Count; + } + } + + /// + /// Get instance from pool. + /// + public T Rent() + { + if (isDisposed) throw new ObjectDisposedException("ObjectPool was already disposed."); + if (q == null) q = new Queue(); + + var instance = (q.Count > 0) + ? q.Dequeue() + : CreateInstance(); + + OnBeforeRent(instance); + return instance; + } + + /// + /// Return instance to pool. + /// + public void Return(T instance) + { + if (isDisposed) throw new ObjectDisposedException("ObjectPool was already disposed."); + if (instance == null) throw new ArgumentNullException("instance"); + + if (q == null) q = new Queue(); + + if ((q.Count + 1) == MaxPoolCount) + { + throw new InvalidOperationException("Reached Max PoolSize"); + } + + OnBeforeReturn(instance); + q.Enqueue(instance); + } + + /// + /// Clear pool. + /// + public void Clear(bool callOnBeforeRent = false) + { + if (q == null) return; + while (q.Count != 0) + { + var instance = q.Dequeue(); + if (callOnBeforeRent) + { + OnBeforeRent(instance); + } + OnClear(instance); + } + } + + /// + /// Trim pool instances. + /// + /// 0.0f = clear all ~ 1.0f = live all. + /// Min pool count. + /// If true, call OnBeforeRent before OnClear. + public void Shrink(float instanceCountRatio, int minSize, bool callOnBeforeRent = false) + { + if (q == null) return; + + if (instanceCountRatio <= 0) instanceCountRatio = 0; + if (instanceCountRatio >= 1.0f) instanceCountRatio = 1.0f; + + var size = (int)(q.Count * instanceCountRatio); + size = Math.Max(minSize, size); + + while (q.Count > size) + { + var instance = q.Dequeue(); + if (callOnBeforeRent) + { + OnBeforeRent(instance); + } + OnClear(instance); + } + } + + /// + /// If needs shrink pool frequently, start check timer. + /// + /// Interval of call Shrink. + /// 0.0f = clearAll ~ 1.0f = live all. + /// Min pool count. + /// If true, call OnBeforeRent before OnClear. + public IDisposable StartShrinkTimer(TimeSpan checkInterval, float instanceCountRatio, int minSize, bool callOnBeforeRent = false) + { + return Observable.Interval(checkInterval) + .TakeWhile(_ => !isDisposed) + .Subscribe(_ => + { + Shrink(instanceCountRatio, minSize, callOnBeforeRent); + }); + } + + /// + /// Fill pool before rent operation. + /// + /// Pool instance count. + /// Create count per frame. + public IObservable PreloadAsync(int preloadCount, int threshold) + { + if (q == null) q = new Queue(preloadCount); + + return Observable.FromMicroCoroutine((observer, cancel) => PreloadCore(preloadCount, threshold, observer, cancel)); + } + + IEnumerator PreloadCore(int preloadCount, int threshold, IObserver observer, CancellationToken cancellationToken) + { + while (Count < preloadCount && !cancellationToken.IsCancellationRequested) + { + var requireCount = preloadCount - Count; + if (requireCount <= 0) break; + + var createCount = Math.Min(requireCount, threshold); + + for (int i = 0; i < createCount; i++) + { + try + { + var instance = CreateInstance(); + Return(instance); + } + catch (Exception ex) + { + observer.OnError(ex); + yield break; + } + } + yield return null; // next frame. + } + + observer.OnNext(Unit.Default); + observer.OnCompleted(); + } + + #region IDisposable Support + + protected virtual void Dispose(bool disposing) + { + if (!isDisposed) + { + if (disposing) + { + Clear(false); + } + + isDisposed = true; + } + } + + public void Dispose() + { + Dispose(true); + } + + #endregion + } + + /// + /// Bass class of ObjectPool. If needs asynchronous initialization, use this instead of standard ObjectPool. + /// + public abstract class AsyncObjectPool : IDisposable + where T : UnityEngine.Component + { + bool isDisposed = false; + Queue q; + + /// + /// Limit of instace count. + /// + protected int MaxPoolCount + { + get + { + return int.MaxValue; + } + } + + /// + /// Create instance when needed. + /// + protected abstract IObservable CreateInstanceAsync(); + + /// + /// Called before return to pool, useful for set active object(it is default behavior). + /// + protected virtual void OnBeforeRent(T instance) + { + instance.gameObject.SetActive(true); + } + + /// + /// Called before return to pool, useful for set inactive object(it is default behavior). + /// + protected virtual void OnBeforeReturn(T instance) + { + instance.gameObject.SetActive(false); + } + + /// + /// Called when clear or disposed, useful for destroy instance or other finalize method. + /// + protected virtual void OnClear(T instance) + { + if (instance == null) return; + + var go = instance.gameObject; + if (go == null) return; + UnityEngine.Object.Destroy(go); + } + + /// + /// Current pooled object count. + /// + public int Count + { + get + { + if (q == null) return 0; + return q.Count; + } + } + + /// + /// Get instance from pool. + /// + public IObservable RentAsync() + { + if (isDisposed) throw new ObjectDisposedException("ObjectPool was already disposed."); + if (q == null) q = new Queue(); + + if (q.Count > 0) + { + var instance = q.Dequeue(); + OnBeforeRent(instance); + return Observable.Return(instance); + } + else + { + var instance = CreateInstanceAsync(); + return instance.Do(x => OnBeforeRent(x)); + } + } + + /// + /// Return instance to pool. + /// + public void Return(T instance) + { + if (isDisposed) throw new ObjectDisposedException("ObjectPool was already disposed."); + if (instance == null) throw new ArgumentNullException("instance"); + + if (q == null) q = new Queue(); + + if ((q.Count + 1) == MaxPoolCount) + { + throw new InvalidOperationException("Reached Max PoolSize"); + } + + OnBeforeReturn(instance); + q.Enqueue(instance); + } + + /// + /// Trim pool instances. + /// + /// 0.0f = clear all ~ 1.0f = live all. + /// Min pool count. + /// If true, call OnBeforeRent before OnClear. + public void Shrink(float instanceCountRatio, int minSize, bool callOnBeforeRent = false) + { + if (q == null) return; + + if (instanceCountRatio <= 0) instanceCountRatio = 0; + if (instanceCountRatio >= 1.0f) instanceCountRatio = 1.0f; + + var size = (int)(q.Count * instanceCountRatio); + size = Math.Max(minSize, size); + + while (q.Count > size) + { + var instance = q.Dequeue(); + if (callOnBeforeRent) + { + OnBeforeRent(instance); + } + OnClear(instance); + } + } + + /// + /// If needs shrink pool frequently, start check timer. + /// + /// Interval of call Shrink. + /// 0.0f = clearAll ~ 1.0f = live all. + /// Min pool count. + /// If true, call OnBeforeRent before OnClear. + public IDisposable StartShrinkTimer(TimeSpan checkInterval, float instanceCountRatio, int minSize, bool callOnBeforeRent = false) + { + return Observable.Interval(checkInterval) + .TakeWhile(_ => !isDisposed) + .Subscribe(_ => + { + Shrink(instanceCountRatio, minSize, callOnBeforeRent); + }); + } + + /// + /// Clear pool. + /// + public void Clear(bool callOnBeforeRent = false) + { + if (q == null) return; + while (q.Count != 0) + { + var instance = q.Dequeue(); + if (callOnBeforeRent) + { + OnBeforeRent(instance); + } + OnClear(instance); + } + } + + /// + /// Fill pool before rent operation. + /// + /// Pool instance count. + /// Create count per frame. + public IObservable PreloadAsync(int preloadCount, int threshold) + { + if (q == null) q = new Queue(preloadCount); + + return Observable.FromMicroCoroutine((observer, cancel) => PreloadCore(preloadCount, threshold, observer, cancel)); + } + + IEnumerator PreloadCore(int preloadCount, int threshold, IObserver observer, CancellationToken cancellationToken) + { + while (Count < preloadCount && !cancellationToken.IsCancellationRequested) + { + var requireCount = preloadCount - Count; + if (requireCount <= 0) break; + + var createCount = Math.Min(requireCount, threshold); + + var loaders = new IObservable[createCount]; + for (int i = 0; i < createCount; i++) + { + var instanceFuture = CreateInstanceAsync(); + loaders[i] = instanceFuture.ForEachAsync(x => Return(x)); + } + + var awaiter = Observable.WhenAll(loaders).ToYieldInstruction(false, cancellationToken); + while (!(awaiter.HasResult || awaiter.IsCanceled || awaiter.HasError)) + { + yield return null; + } + + if (awaiter.HasError) + { + observer.OnError(awaiter.Error); + yield break; + } + else if (awaiter.IsCanceled) + { + yield break; // end. + } + } + + observer.OnNext(Unit.Default); + observer.OnCompleted(); + } + + #region IDisposable Support + + protected virtual void Dispose(bool disposing) + { + if (!isDisposed) + { + if (disposing) + { + Clear(false); + } + + isDisposed = true; + } + } + + public void Dispose() + { + Dispose(true); + } + + #endregion + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs.meta new file mode 100644 index 00000000..ec758de4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Toolkit/ObjectPool.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f4980e1e001c7e94fab3250ba284dc91 +timeCreated: 1468655394 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers.meta new file mode 100644 index 00000000..6565449c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5380144628ecdc74ab6778f80d103d51 +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs new file mode 100644 index 00000000..4628d03e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs @@ -0,0 +1,49 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableAnimatorTrigger : ObservableTriggerBase + { + Subject onAnimatorIK; + + /// Callback for setting up animation IK (inverse kinematics). + void OnAnimatorIK(int layerIndex) + { + if (onAnimatorIK != null) onAnimatorIK.OnNext(layerIndex); + } + + /// Callback for setting up animation IK (inverse kinematics). + public IObservable OnAnimatorIKAsObservable() + { + return onAnimatorIK ?? (onAnimatorIK = new Subject()); + } + + Subject onAnimatorMove; + + /// Callback for processing animation movements for modifying root motion. + void OnAnimatorMove() + { + if (onAnimatorMove != null) onAnimatorMove.OnNext(Unit.Default); + } + + /// Callback for processing animation movements for modifying root motion. + public IObservable OnAnimatorMoveAsObservable() + { + return onAnimatorMove ?? (onAnimatorMove = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onAnimatorIK != null) + { + onAnimatorIK.OnCompleted(); + } + if (onAnimatorMove != null) + { + onAnimatorMove.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs.meta new file mode 100644 index 00000000..f5ef20e5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableAnimatorTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e03f9257cc6667f4082439aa77d6f01e +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs new file mode 100644 index 00000000..fefc213b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableBeginDragTrigger : ObservableTriggerBase, IEventSystemHandler, IBeginDragHandler + { + Subject onBeginDrag; + + void IBeginDragHandler.OnBeginDrag(PointerEventData eventData) + { + if (onBeginDrag != null) onBeginDrag.OnNext(eventData); + } + + public IObservable OnBeginDragAsObservable() + { + return onBeginDrag ?? (onBeginDrag = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onBeginDrag != null) + { + onBeginDrag.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs.meta new file mode 100644 index 00000000..827f6f20 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableBeginDragTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3a81a9b6bec6b4f4fba7e0047cd989f6 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs new file mode 100644 index 00000000..dac84dac --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableCancelTrigger : ObservableTriggerBase, IEventSystemHandler, ICancelHandler + { + Subject onCancel; + + void ICancelHandler.OnCancel(BaseEventData eventData) + { + if (onCancel != null) onCancel.OnNext(eventData); + } + + public IObservable OnCancelAsObservable() + { + return onCancel ?? (onCancel = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onCancel != null) + { + onCancel.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs.meta new file mode 100644 index 00000000..105cc04b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCancelTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4c0a9070b7cc23746b2c0e2db3ec16cd +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs new file mode 100644 index 00000000..74b6b04e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs @@ -0,0 +1,36 @@ +// after uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableCanvasGroupChangedTrigger : ObservableTriggerBase + { + Subject onCanvasGroupChanged; + + // Callback that is sent if the canvas group is changed + void OnCanvasGroupChanged() + { + if (onCanvasGroupChanged != null) onCanvasGroupChanged.OnNext(Unit.Default); + } + + /// Callback that is sent if the canvas group is changed. + public IObservable OnCanvasGroupChangedAsObservable() + { + return onCanvasGroupChanged ?? (onCanvasGroupChanged = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onCanvasGroupChanged != null) + { + onCanvasGroupChanged.OnCompleted(); + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs.meta new file mode 100644 index 00000000..b24d785a --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCanvasGroupChangedTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 54095d3e740f7714085d0568207cbfe0 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs new file mode 100644 index 00000000..e4936f57 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs @@ -0,0 +1,67 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableCollision2DTrigger : ObservableTriggerBase + { + Subject onCollisionEnter2D; + + /// Sent when an incoming collider makes contact with this object's collider (2D physics only). + void OnCollisionEnter2D(Collision2D coll) + { + if (onCollisionEnter2D != null) onCollisionEnter2D.OnNext(coll); + } + + /// Sent when an incoming collider makes contact with this object's collider (2D physics only). + public IObservable OnCollisionEnter2DAsObservable() + { + return onCollisionEnter2D ?? (onCollisionEnter2D = new Subject()); + } + + Subject onCollisionExit2D; + + /// Sent when a collider on another object stops touching this object's collider (2D physics only). + void OnCollisionExit2D(Collision2D coll) + { + if (onCollisionExit2D != null) onCollisionExit2D.OnNext(coll); + } + + /// Sent when a collider on another object stops touching this object's collider (2D physics only). + public IObservable OnCollisionExit2DAsObservable() + { + return onCollisionExit2D ?? (onCollisionExit2D = new Subject()); + } + + Subject onCollisionStay2D; + + /// Sent each frame where a collider on another object is touching this object's collider (2D physics only). + void OnCollisionStay2D(Collision2D coll) + { + if (onCollisionStay2D != null) onCollisionStay2D.OnNext(coll); + } + + /// Sent each frame where a collider on another object is touching this object's collider (2D physics only). + public IObservable OnCollisionStay2DAsObservable() + { + return onCollisionStay2D ?? (onCollisionStay2D = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onCollisionEnter2D != null) + { + onCollisionEnter2D.OnCompleted(); + } + if (onCollisionExit2D != null) + { + onCollisionExit2D.OnCompleted(); + } + if (onCollisionStay2D != null) + { + onCollisionStay2D.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs.meta new file mode 100644 index 00000000..f98f99b1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollision2DTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1be7847b61f30f24daa5762db87a5b19 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs new file mode 100644 index 00000000..db7dd5e6 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs @@ -0,0 +1,67 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableCollisionTrigger : ObservableTriggerBase + { + Subject onCollisionEnter; + + /// OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. + void OnCollisionEnter(Collision collision) + { + if (onCollisionEnter != null) onCollisionEnter.OnNext(collision); + } + + /// OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. + public IObservable OnCollisionEnterAsObservable() + { + return onCollisionEnter ?? (onCollisionEnter = new Subject()); + } + + Subject onCollisionExit; + + /// OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider. + void OnCollisionExit(Collision collisionInfo) + { + if (onCollisionExit != null) onCollisionExit.OnNext(collisionInfo); + } + + /// OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider. + public IObservable OnCollisionExitAsObservable() + { + return onCollisionExit ?? (onCollisionExit = new Subject()); + } + + Subject onCollisionStay; + + /// OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. + void OnCollisionStay(Collision collisionInfo) + { + if (onCollisionStay != null) onCollisionStay.OnNext(collisionInfo); + } + + /// OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. + public IObservable OnCollisionStayAsObservable() + { + return onCollisionStay ?? (onCollisionStay = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onCollisionEnter != null) + { + onCollisionEnter.OnCompleted(); + } + if (onCollisionExit != null) + { + onCollisionExit.OnCompleted(); + } + if (onCollisionStay != null) + { + onCollisionStay.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs.meta new file mode 100644 index 00000000..f61184c2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableCollisionTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 10b917196cbfcf74898ce1686e205d04 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs new file mode 100644 index 00000000..91465c1f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableDeselectTrigger : ObservableTriggerBase, IEventSystemHandler, IDeselectHandler + { + Subject onDeselect; + + void IDeselectHandler.OnDeselect(BaseEventData eventData) + { + if (onDeselect != null) onDeselect.OnNext(eventData); + } + + public IObservable OnDeselectAsObservable() + { + return onDeselect ?? (onDeselect = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onDeselect != null) + { + onDeselect.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs.meta new file mode 100644 index 00000000..dd281cf5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDeselectTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9fe6f69c4d869c04e8a1924aab1d3694 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs new file mode 100644 index 00000000..3eceb9d1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs @@ -0,0 +1,67 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableDestroyTrigger : MonoBehaviour + { + bool calledDestroy = false; + Subject onDestroy; + CompositeDisposable disposablesOnDestroy; + + [Obsolete("Internal Use.")] + internal bool IsMonitoredActivate { get; set; } + + public bool IsActivated { get; private set; } + + /// + /// Check called OnDestroy. + /// This property does not guarantees GameObject was destroyed, + /// when gameObject is deactive, does not raise OnDestroy. + /// + public bool IsCalledOnDestroy { get { return calledDestroy; } } + + void Awake() + { + IsActivated = true; + } + + /// This function is called when the MonoBehaviour will be destroyed. + void OnDestroy() + { + if (!calledDestroy) + { + calledDestroy = true; + if (disposablesOnDestroy != null) disposablesOnDestroy.Dispose(); + if (onDestroy != null) { onDestroy.OnNext(Unit.Default); onDestroy.OnCompleted(); } + } + } + + /// This function is called when the MonoBehaviour will be destroyed. + public IObservable OnDestroyAsObservable() + { + if (this == null) return Observable.Return(Unit.Default); + if (calledDestroy) return Observable.Return(Unit.Default); + return onDestroy ?? (onDestroy = new Subject()); + } + + /// Invoke OnDestroy, this method is used on internal. + public void ForceRaiseOnDestroy() + { + OnDestroy(); + } + + public void AddDisposableOnDestroy(IDisposable disposable) + { + if (calledDestroy) + { + disposable.Dispose(); + return; + } + + if (disposablesOnDestroy == null) disposablesOnDestroy = new CompositeDisposable(); + disposablesOnDestroy.Add(disposable); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs.meta new file mode 100644 index 00000000..0899ccf0 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDestroyTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cb219b23cdf4b314f94a27bca3cc8012 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs new file mode 100644 index 00000000..6dff39f2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableDragTrigger : ObservableTriggerBase, IEventSystemHandler, IDragHandler + { + Subject onDrag; + + void IDragHandler.OnDrag(PointerEventData eventData) + { + if (onDrag != null) onDrag.OnNext(eventData); + } + + public IObservable OnDragAsObservable() + { + return onDrag ?? (onDrag = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onDrag != null) + { + onDrag.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs.meta new file mode 100644 index 00000000..3b63ae6e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDragTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 79db090dc9e4db245821e8b89b0e208e +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs new file mode 100644 index 00000000..7d263456 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableDropTrigger : ObservableTriggerBase, IEventSystemHandler, IDropHandler + { + Subject onDrop; + + void IDropHandler.OnDrop(PointerEventData eventData) + { + if (onDrop != null) onDrop.OnNext(eventData); + } + + public IObservable OnDropAsObservable() + { + return onDrop ?? (onDrop = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onDrop != null) + { + onDrop.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs.meta new file mode 100644 index 00000000..a6a9720c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableDropTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f2ffa8b5af3474446a310bb6aa0b180a +timeCreated: 1455373902 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs new file mode 100644 index 00000000..47df63ed --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs @@ -0,0 +1,49 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableEnableTrigger : ObservableTriggerBase + { + Subject onEnable; + + /// This function is called when the object becomes enabled and active. + void OnEnable() + { + if (onEnable != null) onEnable.OnNext(Unit.Default); + } + + /// This function is called when the object becomes enabled and active. + public IObservable OnEnableAsObservable() + { + return onEnable ?? (onEnable = new Subject()); + } + + Subject onDisable; + + /// This function is called when the behaviour becomes disabled () or inactive. + void OnDisable() + { + if (onDisable != null) onDisable.OnNext(Unit.Default); + } + + /// This function is called when the behaviour becomes disabled () or inactive. + public IObservable OnDisableAsObservable() + { + return onDisable ?? (onDisable = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onEnable != null) + { + onEnable.OnCompleted(); + } + if (onDisable != null) + { + onDisable.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs.meta new file mode 100644 index 00000000..37c5ea3b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEnableTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0d9c7eb607af1fd4aa0e15f52cc0543b +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs new file mode 100644 index 00000000..8d68135f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableEndDragTrigger : ObservableTriggerBase, IEventSystemHandler, IEndDragHandler + { + Subject onEndDrag; + + void IEndDragHandler.OnEndDrag(PointerEventData eventData) + { + if (onEndDrag != null) onEndDrag.OnNext(eventData); + } + + public IObservable OnEndDragAsObservable() + { + return onEndDrag ?? (onEndDrag = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onEndDrag != null) + { + onEndDrag.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs.meta new file mode 100644 index 00000000..e225db3b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEndDragTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b8ce8424f238d6842bd8b09c0cca1ac4 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs new file mode 100644 index 00000000..3c73eb10 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs @@ -0,0 +1,359 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableEventTrigger : ObservableTriggerBase, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler, IBeginDragHandler, IInitializePotentialDragHandler, IDragHandler, IEndDragHandler, IDropHandler, IScrollHandler, IUpdateSelectedHandler, ISelectHandler, IDeselectHandler, IMoveHandler, ISubmitHandler, ICancelHandler + { + #region IDeselectHandler + + Subject onDeselect; + + void IDeselectHandler.OnDeselect(BaseEventData eventData) + { + if (onDeselect != null) onDeselect.OnNext(eventData); + } + + public IObservable OnDeselectAsObservable() + { + return onDeselect ?? (onDeselect = new Subject()); + } + + #endregion + + #region IMoveHandler + + Subject onMove; + + void IMoveHandler.OnMove(AxisEventData eventData) + { + if (onMove != null) onMove.OnNext(eventData); + } + + public IObservable OnMoveAsObservable() + { + return onMove ?? (onMove = new Subject()); + } + + #endregion + + #region IPointerDownHandler + + Subject onPointerDown; + + void IPointerDownHandler.OnPointerDown(PointerEventData eventData) + { + if (onPointerDown != null) onPointerDown.OnNext(eventData); + } + + public IObservable OnPointerDownAsObservable() + { + return onPointerDown ?? (onPointerDown = new Subject()); + } + + #endregion + + #region IPointerEnterHandler + + Subject onPointerEnter; + + void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) + { + if (onPointerEnter != null) onPointerEnter.OnNext(eventData); + } + + public IObservable OnPointerEnterAsObservable() + { + return onPointerEnter ?? (onPointerEnter = new Subject()); + } + + #endregion + + #region IPointerExitHandler + + Subject onPointerExit; + + void IPointerExitHandler.OnPointerExit(PointerEventData eventData) + { + if (onPointerExit != null) onPointerExit.OnNext(eventData); + } + + public IObservable OnPointerExitAsObservable() + { + return onPointerExit ?? (onPointerExit = new Subject()); + } + + #endregion + + #region IPointerUpHandler + + Subject onPointerUp; + + void IPointerUpHandler.OnPointerUp(PointerEventData eventData) + { + if (onPointerUp != null) onPointerUp.OnNext(eventData); + } + + public IObservable OnPointerUpAsObservable() + { + return onPointerUp ?? (onPointerUp = new Subject()); + } + + #endregion + + #region ISelectHandler + + Subject onSelect; + + void ISelectHandler.OnSelect(BaseEventData eventData) + { + if (onSelect != null) onSelect.OnNext(eventData); + } + + public IObservable OnSelectAsObservable() + { + return onSelect ?? (onSelect = new Subject()); + } + + #endregion + + #region IPointerClickHandler + + Subject onPointerClick; + + void IPointerClickHandler.OnPointerClick(PointerEventData eventData) + { + if (onPointerClick != null) onPointerClick.OnNext(eventData); + } + + public IObservable OnPointerClickAsObservable() + { + return onPointerClick ?? (onPointerClick = new Subject()); + } + + #endregion + + #region ISubmitHandler + + Subject onSubmit; + + void ISubmitHandler.OnSubmit(BaseEventData eventData) + { + if (onSubmit != null) onSubmit.OnNext(eventData); + } + + public IObservable OnSubmitAsObservable() + { + return onSubmit ?? (onSubmit = new Subject()); + } + + #endregion + + #region IDragHandler + + Subject onDrag; + + void IDragHandler.OnDrag(PointerEventData eventData) + { + if (onDrag != null) onDrag.OnNext(eventData); + } + + public IObservable OnDragAsObservable() + { + return onDrag ?? (onDrag = new Subject()); + } + + #endregion + + #region IBeginDragHandler + + Subject onBeginDrag; + + void IBeginDragHandler.OnBeginDrag(PointerEventData eventData) + { + if (onBeginDrag != null) onBeginDrag.OnNext(eventData); + } + + public IObservable OnBeginDragAsObservable() + { + return onBeginDrag ?? (onBeginDrag = new Subject()); + } + + #endregion + + #region IEndDragHandler + + Subject onEndDrag; + + void IEndDragHandler.OnEndDrag(PointerEventData eventData) + { + if (onEndDrag != null) onEndDrag.OnNext(eventData); + } + + public IObservable OnEndDragAsObservable() + { + return onEndDrag ?? (onEndDrag = new Subject()); + } + + #endregion + + #region IDropHandler + + Subject onDrop; + + void IDropHandler.OnDrop(PointerEventData eventData) + { + if (onDrop != null) onDrop.OnNext(eventData); + } + + public IObservable OnDropAsObservable() + { + return onDrop ?? (onDrop = new Subject()); + } + + #endregion + + #region IUpdateSelectedHandler + + Subject onUpdateSelected; + + void IUpdateSelectedHandler.OnUpdateSelected(BaseEventData eventData) + { + if (onUpdateSelected != null) onUpdateSelected.OnNext(eventData); + } + + public IObservable OnUpdateSelectedAsObservable() + { + return onUpdateSelected ?? (onUpdateSelected = new Subject()); + } + + #endregion + + #region IInitializePotentialDragHandler + + Subject onInitializePotentialDrag; + + void IInitializePotentialDragHandler.OnInitializePotentialDrag(PointerEventData eventData) + { + if (onInitializePotentialDrag != null) onInitializePotentialDrag.OnNext(eventData); + } + + public IObservable OnInitializePotentialDragAsObservable() + { + return onInitializePotentialDrag ?? (onInitializePotentialDrag = new Subject()); + } + + #endregion + + #region ICancelHandler + + Subject onCancel; + + void ICancelHandler.OnCancel(BaseEventData eventData) + { + if (onCancel != null) onCancel.OnNext(eventData); + } + + public IObservable OnCancelAsObservable() + { + return onCancel ?? (onCancel = new Subject()); + } + + #endregion + + #region IScrollHandler + + Subject onScroll; + + void IScrollHandler.OnScroll(PointerEventData eventData) + { + if (onScroll != null) onScroll.OnNext(eventData); + } + + public IObservable OnScrollAsObservable() + { + return onScroll ?? (onScroll = new Subject()); + } + + #endregion + + protected override void RaiseOnCompletedOnDestroy() + { + if (onDeselect != null) + { + onDeselect.OnCompleted(); + } + if (onMove != null) + { + onMove.OnCompleted(); + } + if (onPointerDown != null) + { + onPointerDown.OnCompleted(); + } + if (onPointerEnter != null) + { + onPointerEnter.OnCompleted(); + } + if (onPointerExit != null) + { + onPointerExit.OnCompleted(); + } + if (onPointerUp != null) + { + onPointerUp.OnCompleted(); + } + if (onSelect != null) + { + onSelect.OnCompleted(); + } + if (onPointerClick != null) + { + onPointerClick.OnCompleted(); + } + if (onSubmit != null) + { + onSubmit.OnCompleted(); + } + if (onDrag != null) + { + onDrag.OnCompleted(); + } + if (onBeginDrag != null) + { + onBeginDrag.OnCompleted(); + } + if (onEndDrag != null) + { + onEndDrag.OnCompleted(); + } + if (onDrop != null) + { + onDrop.OnCompleted(); + } + if (onUpdateSelected != null) + { + onUpdateSelected.OnCompleted(); + } + if (onInitializePotentialDrag != null) + { + onInitializePotentialDrag.OnCompleted(); + } + if (onCancel != null) + { + onCancel.OnCompleted(); + } + if (onScroll != null) + { + onScroll.OnCompleted(); + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs.meta new file mode 100644 index 00000000..1574fefb --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableEventTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 48e93426b16d5454c89e8d47ccded1c5 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs new file mode 100644 index 00000000..897170c5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs @@ -0,0 +1,31 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableFixedUpdateTrigger : ObservableTriggerBase + { + Subject fixedUpdate; + + /// This function is called every fixed framerate frame, if the MonoBehaviour is enabled. + void FixedUpdate() + { + if (fixedUpdate != null) fixedUpdate.OnNext(Unit.Default); + } + + /// This function is called every fixed framerate frame, if the MonoBehaviour is enabled. + public IObservable FixedUpdateAsObservable() + { + return fixedUpdate ?? (fixedUpdate = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (fixedUpdate != null) + { + fixedUpdate.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs.meta new file mode 100644 index 00000000..6f6a5c8d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableFixedUpdateTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d525c42c11d945f4398061ed8f84e5f4 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs new file mode 100644 index 00000000..06db037f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableInitializePotentialDragTrigger : ObservableTriggerBase, IEventSystemHandler, IInitializePotentialDragHandler + { + Subject onInitializePotentialDrag; + + void IInitializePotentialDragHandler.OnInitializePotentialDrag(PointerEventData eventData) + { + if (onInitializePotentialDrag != null) onInitializePotentialDrag.OnNext(eventData); + } + + public IObservable OnInitializePotentialDragAsObservable() + { + return onInitializePotentialDrag ?? (onInitializePotentialDrag = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onInitializePotentialDrag != null) + { + onInitializePotentialDrag.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs.meta new file mode 100644 index 00000000..57ce1b26 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableInitializePotentialDragTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3f3148a9e1b8b21409f54d2b0c2c81de +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableJointTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableJointTrigger.cs new file mode 100644 index 00000000..8e4c39f9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableJointTrigger.cs @@ -0,0 +1,47 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableJointTrigger : ObservableTriggerBase + { + Subject onJointBreak; + + void OnJointBreak(float breakForce) + { + if (onJointBreak != null) onJointBreak.OnNext(breakForce); + } + + public IObservable OnJointBreakAsObservable() + { + return onJointBreak ?? (onJointBreak = new Subject()); + } + + + Subject onJointBreak2D; + + void OnJointBreak2D(Joint2D brokenJoint) + { + if (onJointBreak2D != null) onJointBreak2D.OnNext(brokenJoint); + } + + public IObservable OnJointBreak2DAsObservable() + { + return onJointBreak2D ?? (onJointBreak2D = new Subject()); + } + + + protected override void RaiseOnCompletedOnDestroy() + { + if (onJointBreak != null) + { + onJointBreak.OnCompleted(); + } + if (onJointBreak2D != null) + { + onJointBreak2D.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableJointTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableJointTrigger.cs.meta new file mode 100644 index 00000000..ed271317 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableJointTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 79b758631951cbc42b40ea87072e1ab3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs new file mode 100644 index 00000000..21c61c78 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs @@ -0,0 +1,31 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableLateUpdateTrigger : ObservableTriggerBase + { + Subject lateUpdate; + + /// LateUpdate is called every frame, if the Behaviour is enabled. + void LateUpdate() + { + if (lateUpdate != null) lateUpdate.OnNext(Unit.Default); + } + + /// LateUpdate is called every frame, if the Behaviour is enabled. + public IObservable LateUpdateAsObservable() + { + return lateUpdate ?? (lateUpdate = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (lateUpdate != null) + { + lateUpdate.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs.meta new file mode 100644 index 00000000..94d5398d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableLateUpdateTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 176ace24965d0c744bc61c8aad8b3fc7 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs new file mode 100644 index 00000000..89108b80 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs @@ -0,0 +1,143 @@ +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) + +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableMouseTrigger : ObservableTriggerBase + { + Subject onMouseDown; + + /// OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider. + void OnMouseDown() + { + if (onMouseDown != null) onMouseDown.OnNext(Unit.Default); + } + + /// OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider. + public IObservable OnMouseDownAsObservable() + { + return onMouseDown ?? (onMouseDown = new Subject()); + } + + Subject onMouseDrag; + + /// OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse. + void OnMouseDrag() + { + if (onMouseDrag != null) onMouseDrag.OnNext(Unit.Default); + } + + /// OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse. + public IObservable OnMouseDragAsObservable() + { + return onMouseDrag ?? (onMouseDrag = new Subject()); + } + + Subject onMouseEnter; + + /// OnMouseEnter is called when the mouse entered the GUIElement or Collider. + void OnMouseEnter() + { + if (onMouseEnter != null) onMouseEnter.OnNext(Unit.Default); + } + + /// OnMouseEnter is called when the mouse entered the GUIElement or Collider. + public IObservable OnMouseEnterAsObservable() + { + return onMouseEnter ?? (onMouseEnter = new Subject()); + } + + Subject onMouseExit; + + /// OnMouseExit is called when the mouse is not any longer over the GUIElement or Collider. + void OnMouseExit() + { + if (onMouseExit != null) onMouseExit.OnNext(Unit.Default); + } + + /// OnMouseExit is called when the mouse is not any longer over the GUIElement or Collider. + public IObservable OnMouseExitAsObservable() + { + return onMouseExit ?? (onMouseExit = new Subject()); + } + + Subject onMouseOver; + + /// OnMouseOver is called every frame while the mouse is over the GUIElement or Collider. + void OnMouseOver() + { + if (onMouseOver != null) onMouseOver.OnNext(Unit.Default); + } + + /// OnMouseOver is called every frame while the mouse is over the GUIElement or Collider. + public IObservable OnMouseOverAsObservable() + { + return onMouseOver ?? (onMouseOver = new Subject()); + } + + Subject onMouseUp; + + /// OnMouseUp is called when the user has released the mouse button. + void OnMouseUp() + { + if (onMouseUp != null) onMouseUp.OnNext(Unit.Default); + } + + /// OnMouseUp is called when the user has released the mouse button. + public IObservable OnMouseUpAsObservable() + { + return onMouseUp ?? (onMouseUp = new Subject()); + } + + Subject onMouseUpAsButton; + + /// OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed. + void OnMouseUpAsButton() + { + if (onMouseUpAsButton != null) onMouseUpAsButton.OnNext(Unit.Default); + } + + /// OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed. + public IObservable OnMouseUpAsButtonAsObservable() + { + return onMouseUpAsButton ?? (onMouseUpAsButton = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onMouseDown != null) + { + onMouseDown.OnCompleted(); + } + if (onMouseDrag != null) + { + onMouseDrag.OnCompleted(); + } + if (onMouseEnter != null) + { + onMouseEnter.OnCompleted(); + } + if (onMouseExit != null) + { + onMouseExit.OnCompleted(); + } + if (onMouseOver != null) + { + onMouseOver.OnCompleted(); + } + if (onMouseUp != null) + { + onMouseUp.OnCompleted(); + } + if (onMouseUpAsButton != null) + { + onMouseUpAsButton.OnCompleted(); + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs.meta new file mode 100644 index 00000000..ea9f707b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMouseTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c5f30958c5509bc4f9c14ea261a1567c +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs new file mode 100644 index 00000000..bd05d145 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableMoveTrigger : ObservableTriggerBase, IEventSystemHandler, IMoveHandler + { + Subject onMove; + + void IMoveHandler.OnMove(AxisEventData eventData) + { + if (onMove != null) onMove.OnNext(eventData); + } + + public IObservable OnMoveAsObservable() + { + return onMove ?? (onMove = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onMove != null) + { + onMove.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs.meta new file mode 100644 index 00000000..7545c17d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableMoveTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3e1feec0f10dcea4d9c779a81a0ee3dc +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs new file mode 100644 index 00000000..f8acc26e --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs @@ -0,0 +1,56 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableParticleTrigger : ObservableTriggerBase + { + Subject onParticleCollision; +#if UNITY_5_4_OR_NEWER + Subject onParticleTrigger; +#endif + + /// OnParticleCollision is called when a particle hits a collider. + void OnParticleCollision(GameObject other) + { + if (onParticleCollision != null) onParticleCollision.OnNext(other); + } + + /// OnParticleCollision is called when a particle hits a collider. + public IObservable OnParticleCollisionAsObservable() + { + return onParticleCollision ?? (onParticleCollision = new Subject()); + } + +#if UNITY_5_4_OR_NEWER + + /// OnParticleTrigger is called when any particles in a particle system meet the conditions in the trigger module. + void OnParticleTrigger() + { + if (onParticleTrigger != null) onParticleTrigger.OnNext(Unit.Default); + } + + /// OnParticleTrigger is called when any particles in a particle system meet the conditions in the trigger module. + public IObservable OnParticleTriggerAsObservable() + { + return onParticleTrigger ?? (onParticleTrigger = new Subject()); + } + +#endif + + protected override void RaiseOnCompletedOnDestroy() + { + if (onParticleCollision != null) + { + onParticleCollision.OnCompleted(); + } +#if UNITY_5_4_OR_NEWER + if (onParticleTrigger != null) + { + onParticleTrigger.OnCompleted(); + } +#endif + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs.meta new file mode 100644 index 00000000..d76755da --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableParticleTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9e6a20494274d5045a1b36a770ea76b4 +timeCreated: 1468669952 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs new file mode 100644 index 00000000..1cac1d91 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservablePointerClickTrigger : ObservableTriggerBase, IEventSystemHandler, IPointerClickHandler + { + Subject onPointerClick; + + void IPointerClickHandler.OnPointerClick(PointerEventData eventData) + { + if (onPointerClick != null) onPointerClick.OnNext(eventData); + } + + public IObservable OnPointerClickAsObservable() + { + return onPointerClick ?? (onPointerClick = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onPointerClick != null) + { + onPointerClick.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs.meta new file mode 100644 index 00000000..109913e6 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerClickTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: aa69c313aba23f945b760e79c45083ad +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs new file mode 100644 index 00000000..4ff2dff4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservablePointerDownTrigger : ObservableTriggerBase, IEventSystemHandler, IPointerDownHandler + { + Subject onPointerDown; + + void IPointerDownHandler.OnPointerDown(PointerEventData eventData) + { + if (onPointerDown != null) onPointerDown.OnNext(eventData); + } + + public IObservable OnPointerDownAsObservable() + { + return onPointerDown ?? (onPointerDown = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onPointerDown != null) + { + onPointerDown.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs.meta new file mode 100644 index 00000000..07df1191 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerDownTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c7ae5b5965df2344d99ef7792521b937 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs new file mode 100644 index 00000000..615a83c1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservablePointerEnterTrigger : ObservableTriggerBase, IEventSystemHandler, IPointerEnterHandler + { + Subject onPointerEnter; + + void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData) + { + if (onPointerEnter != null) onPointerEnter.OnNext(eventData); + } + + public IObservable OnPointerEnterAsObservable() + { + return onPointerEnter ?? (onPointerEnter = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onPointerEnter != null) + { + onPointerEnter.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs.meta new file mode 100644 index 00000000..3bb79c6c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerEnterTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3468b3db8d419c745b12124f6432696b +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs new file mode 100644 index 00000000..90d90457 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservablePointerExitTrigger : ObservableTriggerBase, IEventSystemHandler, IPointerExitHandler + { + Subject onPointerExit; + + void IPointerExitHandler.OnPointerExit(PointerEventData eventData) + { + if (onPointerExit != null) onPointerExit.OnNext(eventData); + } + + public IObservable OnPointerExitAsObservable() + { + return onPointerExit ?? (onPointerExit = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onPointerExit != null) + { + onPointerExit.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs.meta new file mode 100644 index 00000000..1ce197f9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerExitTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9643e74593988274bbed9adf40384e48 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs new file mode 100644 index 00000000..877e63aa --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservablePointerUpTrigger : ObservableTriggerBase, IEventSystemHandler, IPointerUpHandler + { + Subject onPointerUp; + + void IPointerUpHandler.OnPointerUp(PointerEventData eventData) + { + if (onPointerUp != null) onPointerUp.OnNext(eventData); + } + + public IObservable OnPointerUpAsObservable() + { + return onPointerUp ?? (onPointerUp = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onPointerUp != null) + { + onPointerUp.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs.meta new file mode 100644 index 00000000..c390c78b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservablePointerUpTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 41b0031b2e409894aacafa49d8583617 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs new file mode 100644 index 00000000..063015cb --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs @@ -0,0 +1,55 @@ +// after uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableRectTransformTrigger : ObservableTriggerBase + { + Subject onRectTransformDimensionsChange; + + // Callback that is sent if an associated RectTransform has it's dimensions changed + void OnRectTransformDimensionsChange() + { + if (onRectTransformDimensionsChange != null) onRectTransformDimensionsChange.OnNext(Unit.Default); + } + + /// Callback that is sent if an associated RectTransform has it's dimensions changed. + public IObservable OnRectTransformDimensionsChangeAsObservable() + { + return onRectTransformDimensionsChange ?? (onRectTransformDimensionsChange = new Subject()); + } + + Subject onRectTransformRemoved; + + // Callback that is sent if an associated RectTransform is removed + void OnRectTransformRemoved() + { + if (onRectTransformRemoved != null) onRectTransformRemoved.OnNext(Unit.Default); + } + + /// Callback that is sent if an associated RectTransform is removed. + public IObservable OnRectTransformRemovedAsObservable() + { + return onRectTransformRemoved ?? (onRectTransformRemoved = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onRectTransformDimensionsChange != null) + { + onRectTransformDimensionsChange.OnCompleted(); + } + if (onRectTransformRemoved != null) + { + onRectTransformRemoved.OnCompleted(); + } + } + + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs.meta new file mode 100644 index 00000000..d91b2507 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableRectTransformTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 20b97bcdd98f27346851c3a690ec7faf +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs new file mode 100644 index 00000000..dd60ffd1 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableScrollTrigger : ObservableTriggerBase, IEventSystemHandler, IScrollHandler + { + Subject onScroll; + + void IScrollHandler.OnScroll(PointerEventData eventData) + { + if (onScroll != null) onScroll.OnNext(eventData); + } + + public IObservable OnScrollAsObservable() + { + return onScroll ?? (onScroll = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onScroll != null) + { + onScroll.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs.meta new file mode 100644 index 00000000..ca981b3d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableScrollTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2231ec04e488f7443ae7acf609ac5f00 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs new file mode 100644 index 00000000..d80579b2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableSelectTrigger : ObservableTriggerBase, IEventSystemHandler, ISelectHandler + { + Subject onSelect; + + void ISelectHandler.OnSelect(BaseEventData eventData) + { + if (onSelect != null) onSelect.OnNext(eventData); + } + + public IObservable OnSelectAsObservable() + { + return onSelect ?? (onSelect = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onSelect != null) + { + onSelect.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs.meta new file mode 100644 index 00000000..a76ab32f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSelectTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1e4cb287d3ab8274885ed05748f26329 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs new file mode 100644 index 00000000..cd38afe7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs @@ -0,0 +1,143 @@ +// over Unity5 added StateMachineBehaviour +#if !(UNITY_4_7 || UNITY_4_6 || UNITY_4_5 || UNITY_4_4 || UNITY_4_3 || UNITY_4_2 || UNITY_4_1 || UNITY_4_0_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_2 || UNITY_3_1 || UNITY_3_0_0 || UNITY_3_0 || UNITY_2_6_1 || UNITY_2_6) + +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableStateMachineTrigger : StateMachineBehaviour + { + public class OnStateInfo + { + public Animator Animator { get; private set; } + public AnimatorStateInfo StateInfo { get; private set; } + public int LayerIndex { get; private set; } + + public OnStateInfo(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + Animator = animator; + StateInfo = stateInfo; + LayerIndex = layerIndex; + } + } + + public class OnStateMachineInfo + { + public Animator Animator { get; private set; } + public int StateMachinePathHash { get; private set; } + + public OnStateMachineInfo(Animator animator, int stateMachinePathHash) + { + Animator = animator; + StateMachinePathHash = stateMachinePathHash; + } + } + + // OnStateExit + + Subject onStateExit; + + public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + if (onStateExit != null) onStateExit.OnNext(new OnStateInfo(animator, stateInfo, layerIndex)); + } + + public IObservable OnStateExitAsObservable() + { + return onStateExit ?? (onStateExit = new Subject()); + } + + // OnStateEnter + + Subject onStateEnter; + + public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + if (onStateEnter != null) onStateEnter.OnNext(new OnStateInfo(animator, stateInfo, layerIndex)); + } + + public IObservable OnStateEnterAsObservable() + { + return onStateEnter ?? (onStateEnter = new Subject()); + } + + // OnStateIK + + Subject onStateIK; + + public override void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + if(onStateIK !=null) onStateIK.OnNext(new OnStateInfo(animator, stateInfo, layerIndex)); + } + + public IObservable OnStateIKAsObservable() + { + return onStateIK ?? (onStateIK = new Subject()); + } + + // Does not implments OnStateMove. + // ObservableStateMachine Trigger makes stop animating. + // By defining OnAnimatorMove, you are signifying that you want to intercept the movement of the root object and apply it yourself. + // http://fogbugz.unity3d.com/default.asp?700990_9jqaim4ev33i8e9h + + //// OnStateMove + + //Subject onStateMove; + + //public override void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + //{ + // if (onStateMove != null) onStateMove.OnNext(new OnStateInfo(animator, stateInfo, layerIndex)); + //} + + //public IObservable OnStateMoveAsObservable() + //{ + // return onStateMove ?? (onStateMove = new Subject()); + //} + + // OnStateUpdate + + Subject onStateUpdate; + + public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) + { + if (onStateUpdate != null) onStateUpdate.OnNext(new OnStateInfo(animator, stateInfo, layerIndex)); + } + + public IObservable OnStateUpdateAsObservable() + { + return onStateUpdate ?? (onStateUpdate = new Subject()); + } + + // OnStateMachineEnter + + Subject onStateMachineEnter; + + public override void OnStateMachineEnter(Animator animator, int stateMachinePathHash) + { + if (onStateMachineEnter != null) onStateMachineEnter.OnNext(new OnStateMachineInfo(animator, stateMachinePathHash)); + } + + public IObservable OnStateMachineEnterAsObservable() + { + return onStateMachineEnter ?? (onStateMachineEnter = new Subject()); + } + + // OnStateMachineExit + + Subject onStateMachineExit; + + public override void OnStateMachineExit(Animator animator, int stateMachinePathHash) + { + if (onStateMachineExit != null) onStateMachineExit.OnNext(new OnStateMachineInfo(animator, stateMachinePathHash)); + } + + public IObservable OnStateMachineExitAsObservable() + { + return onStateMachineExit ?? (onStateMachineExit = new Subject()); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs.meta new file mode 100644 index 00000000..7acb5cf8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableStateMachineTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1e29959e46c7ea7409560769cde085ae +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs new file mode 100644 index 00000000..8c3d6dd4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableSubmitTrigger : ObservableTriggerBase, IEventSystemHandler, ISubmitHandler + { + Subject onSubmit; + + void ISubmitHandler.OnSubmit(BaseEventData eventData) + { + if (onSubmit != null) onSubmit.OnNext(eventData); + } + + public IObservable OnSubmitAsObservable() + { + return onSubmit ?? (onSubmit = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onSubmit != null) + { + onSubmit.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs.meta new file mode 100644 index 00000000..6d8584c9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableSubmitTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 655296fedabd6004ab699ab9749e369c +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs new file mode 100644 index 00000000..c560241b --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs @@ -0,0 +1,72 @@ +// after uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableTransformChangedTrigger : ObservableTriggerBase + { + Subject onBeforeTransformParentChanged; + + // Callback sent to the graphic before a Transform parent change occurs + void OnBeforeTransformParentChanged() + { + if (onBeforeTransformParentChanged != null) onBeforeTransformParentChanged.OnNext(Unit.Default); + } + + /// Callback sent to the graphic before a Transform parent change occurs. + public IObservable OnBeforeTransformParentChangedAsObservable() + { + return onBeforeTransformParentChanged ?? (onBeforeTransformParentChanged = new Subject()); + } + + Subject onTransformParentChanged; + + // This function is called when the parent property of the transform of the GameObject has changed + void OnTransformParentChanged() + { + if (onTransformParentChanged != null) onTransformParentChanged.OnNext(Unit.Default); + } + + /// This function is called when the parent property of the transform of the GameObject has changed. + public IObservable OnTransformParentChangedAsObservable() + { + return onTransformParentChanged ?? (onTransformParentChanged = new Subject()); + } + + Subject onTransformChildrenChanged; + + // This function is called when the list of children of the transform of the GameObject has changed + void OnTransformChildrenChanged() + { + if (onTransformChildrenChanged != null) onTransformChildrenChanged.OnNext(Unit.Default); + } + + /// This function is called when the list of children of the transform of the GameObject has changed. + public IObservable OnTransformChildrenChangedAsObservable() + { + return onTransformChildrenChanged ?? (onTransformChildrenChanged = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onBeforeTransformParentChanged != null) + { + onBeforeTransformParentChanged.OnCompleted(); + } + if (onTransformParentChanged != null) + { + onTransformParentChanged.OnCompleted(); + } + if (onTransformChildrenChanged != null) + { + onTransformChildrenChanged.OnCompleted(); + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs.meta new file mode 100644 index 00000000..2fd5e6d8 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTransformChangedTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 835e244a602942c4c84a09c9bdedf229 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs new file mode 100644 index 00000000..565a40db --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs @@ -0,0 +1,67 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableTrigger2DTrigger : ObservableTriggerBase + { + Subject onTriggerEnter2D; + + /// Sent when another object enters a trigger collider attached to this object (2D physics only). + void OnTriggerEnter2D(Collider2D other) + { + if (onTriggerEnter2D != null) onTriggerEnter2D.OnNext(other); + } + + /// Sent when another object enters a trigger collider attached to this object (2D physics only). + public IObservable OnTriggerEnter2DAsObservable() + { + return onTriggerEnter2D ?? (onTriggerEnter2D = new Subject()); + } + + Subject onTriggerExit2D; + + /// Sent when another object leaves a trigger collider attached to this object (2D physics only). + void OnTriggerExit2D(Collider2D other) + { + if (onTriggerExit2D != null) onTriggerExit2D.OnNext(other); + } + + /// Sent when another object leaves a trigger collider attached to this object (2D physics only). + public IObservable OnTriggerExit2DAsObservable() + { + return onTriggerExit2D ?? (onTriggerExit2D = new Subject()); + } + + Subject onTriggerStay2D; + + /// Sent each frame where another object is within a trigger collider attached to this object (2D physics only). + void OnTriggerStay2D(Collider2D other) + { + if (onTriggerStay2D != null) onTriggerStay2D.OnNext(other); + } + + /// Sent each frame where another object is within a trigger collider attached to this object (2D physics only). + public IObservable OnTriggerStay2DAsObservable() + { + return onTriggerStay2D ?? (onTriggerStay2D = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onTriggerEnter2D != null) + { + onTriggerEnter2D.OnCompleted(); + } + if (onTriggerExit2D != null) + { + onTriggerExit2D.OnCompleted(); + } + if (onTriggerStay2D != null) + { + onTriggerStay2D.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs.meta new file mode 100644 index 00000000..b3c49184 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTrigger2DTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1aad3129752ef804999a880a7b2d72ef +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs new file mode 100644 index 00000000..ddda78f2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs @@ -0,0 +1,65 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + public abstract class ObservableTriggerBase : MonoBehaviour + { + bool calledAwake = false; + Subject awake; + + /// Awake is called when the script instance is being loaded. + void Awake() + { + calledAwake = true; + if (awake != null) { awake.OnNext(Unit.Default); awake.OnCompleted(); } + } + + /// Awake is called when the script instance is being loaded. + public IObservable AwakeAsObservable() + { + if (calledAwake) return Observable.Return(Unit.Default); + return awake ?? (awake = new Subject()); + } + + bool calledStart = false; + Subject start; + + /// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time. + void Start() + { + calledStart = true; + if (start != null) { start.OnNext(Unit.Default); start.OnCompleted(); } + } + + /// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time. + public IObservable StartAsObservable() + { + if (calledStart) return Observable.Return(Unit.Default); + return start ?? (start = new Subject()); + } + + + bool calledDestroy = false; + Subject onDestroy; + + /// This function is called when the MonoBehaviour will be destroyed. + void OnDestroy() + { + calledDestroy = true; + if (onDestroy != null) { onDestroy.OnNext(Unit.Default); onDestroy.OnCompleted(); } + + RaiseOnCompletedOnDestroy(); + } + + /// This function is called when the MonoBehaviour will be destroyed. + public IObservable OnDestroyAsObservable() + { + if (this == null) return Observable.Return(Unit.Default); + if (calledDestroy) return Observable.Return(Unit.Default); + return onDestroy ?? (onDestroy = new Subject()); + } + + protected abstract void RaiseOnCompletedOnDestroy(); + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs.meta new file mode 100644 index 00000000..22d4b87d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerBase.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 850bc951297608e4fb0722795c21ed16 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs new file mode 100644 index 00000000..1c90e2e5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs @@ -0,0 +1,461 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) +using UnityEngine.EventSystems; +#endif + +namespace UniRx.Triggers +{ + // for Component + public static partial class ObservableTriggerExtensions + { + #region ObservableAnimatorTrigger + + /// Callback for setting up animation IK (inverse kinematics). + public static IObservable OnAnimatorIKAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnAnimatorIKAsObservable(); + } + + /// Callback for processing animation movements for modifying root motion. + public static IObservable OnAnimatorMoveAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnAnimatorMoveAsObservable(); + } + + #endregion + + #region ObservableCollision2DTrigger + + /// Sent when an incoming collider makes contact with this object's collider (2D physics only). + public static IObservable OnCollisionEnter2DAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnCollisionEnter2DAsObservable(); + } + + + /// Sent when a collider on another object stops touching this object's collider (2D physics only). + public static IObservable OnCollisionExit2DAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnCollisionExit2DAsObservable(); + } + + /// Sent each frame where a collider on another object is touching this object's collider (2D physics only). + public static IObservable OnCollisionStay2DAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnCollisionStay2DAsObservable(); + } + + #endregion + + #region ObservableCollisionTrigger + + /// OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. + public static IObservable OnCollisionEnterAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnCollisionEnterAsObservable(); + } + + + /// OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider. + public static IObservable OnCollisionExitAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnCollisionExitAsObservable(); + } + + /// OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. + public static IObservable OnCollisionStayAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnCollisionStayAsObservable(); + } + + #endregion + + #region ObservableDestroyTrigger + + /// This function is called when the MonoBehaviour will be destroyed. + public static IObservable OnDestroyAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Return(Unit.Default); // send destroy message + return GetOrAddComponent(component.gameObject).OnDestroyAsObservable(); + } + + #endregion + + + #region ObservableEnableTrigger + + /// This function is called when the object becomes enabled and active. + public static IObservable OnEnableAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnEnableAsObservable(); + } + + /// This function is called when the behaviour becomes disabled () or inactive. + public static IObservable OnDisableAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnDisableAsObservable(); + } + + #endregion + + #region ObservableFixedUpdateTrigger + + /// This function is called every fixed framerate frame, if the MonoBehaviour is enabled. + public static IObservable FixedUpdateAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).FixedUpdateAsObservable(); + } + + #endregion + + #region ObservableLateUpdateTrigger + + /// LateUpdate is called every frame, if the Behaviour is enabled. + public static IObservable LateUpdateAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).LateUpdateAsObservable(); + } + + #endregion + +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) + + #region ObservableMouseTrigger + + /// OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider. + public static IObservable OnMouseDownAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnMouseDownAsObservable(); + } + + /// OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse. + public static IObservable OnMouseDragAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnMouseDragAsObservable(); + } + + /// OnMouseEnter is called when the mouse entered the GUIElement or Collider. + public static IObservable OnMouseEnterAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnMouseEnterAsObservable(); + } + + /// OnMouseExit is called when the mouse is not any longer over the GUIElement or Collider. + public static IObservable OnMouseExitAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnMouseExitAsObservable(); + } + + /// OnMouseOver is called every frame while the mouse is over the GUIElement or Collider. + public static IObservable OnMouseOverAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnMouseOverAsObservable(); + } + + /// OnMouseUp is called when the user has released the mouse button. + public static IObservable OnMouseUpAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnMouseUpAsObservable(); + } + + /// OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed. + public static IObservable OnMouseUpAsButtonAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnMouseUpAsButtonAsObservable(); + } + + #endregion + +#endif + + #region ObservableTrigger2DTrigger + + /// Sent when another object enters a trigger collider attached to this object (2D physics only). + public static IObservable OnTriggerEnter2DAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnTriggerEnter2DAsObservable(); + } + + + /// Sent when another object leaves a trigger collider attached to this object (2D physics only). + public static IObservable OnTriggerExit2DAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnTriggerExit2DAsObservable(); + } + + /// Sent each frame where another object is within a trigger collider attached to this object (2D physics only). + public static IObservable OnTriggerStay2DAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnTriggerStay2DAsObservable(); + } + + #endregion + + #region ObservableTriggerTrigger + + /// OnTriggerEnter is called when the Collider other enters the trigger. + public static IObservable OnTriggerEnterAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnTriggerEnterAsObservable(); + } + + + /// OnTriggerExit is called when the Collider other has stopped touching the trigger. + public static IObservable OnTriggerExitAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnTriggerExitAsObservable(); + } + + /// OnTriggerStay is called once per frame for every Collider other that is touching the trigger. + public static IObservable OnTriggerStayAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnTriggerStayAsObservable(); + } + + #endregion + + #region ObservableUpdateTrigger + + /// Update is called every frame, if the MonoBehaviour is enabled. + public static IObservable UpdateAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).UpdateAsObservable(); + } + + #endregion + + #region ObservableVisibleTrigger + + /// OnBecameInvisible is called when the renderer is no longer visible by any camera. + public static IObservable OnBecameInvisibleAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnBecameInvisibleAsObservable(); + } + + /// OnBecameVisible is called when the renderer became visible by any camera. + public static IObservable OnBecameVisibleAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnBecameVisibleAsObservable(); + } + + #endregion + +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + + #region ObservableTransformChangedTrigger + + /// Callback sent to the graphic before a Transform parent change occurs. + public static IObservable OnBeforeTransformParentChangedAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnBeforeTransformParentChangedAsObservable(); + } + + /// This function is called when the parent property of the transform of the GameObject has changed. + public static IObservable OnTransformParentChangedAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnTransformParentChangedAsObservable(); + } + + /// This function is called when the list of children of the transform of the GameObject has changed. + public static IObservable OnTransformChildrenChangedAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnTransformChildrenChangedAsObservable(); + } + + #endregion + + #region ObservableCanvasGroupChangedTrigger + + /// Callback that is sent if the canvas group is changed. + public static IObservable OnCanvasGroupChangedAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnCanvasGroupChangedAsObservable(); + } + + #endregion + + #region ObservableRectTransformTrigger + + /// Callback that is sent if an associated RectTransform has it's dimensions changed. + public static IObservable OnRectTransformDimensionsChangeAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnRectTransformDimensionsChangeAsObservable(); + } + + /// Callback that is sent if an associated RectTransform is removed. + public static IObservable OnRectTransformRemovedAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnRectTransformRemovedAsObservable(); + } + + #endregion + + // uGUI + + #region ObservableEventTrigger classes + + public static IObservable OnDeselectAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnDeselectAsObservable(); + } + + public static IObservable OnMoveAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnMoveAsObservable(); + } + + public static IObservable OnPointerDownAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnPointerDownAsObservable(); + } + + public static IObservable OnPointerEnterAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnPointerEnterAsObservable(); + } + + public static IObservable OnPointerExitAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnPointerExitAsObservable(); + } + + public static IObservable OnPointerUpAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnPointerUpAsObservable(); + } + + public static IObservable OnSelectAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnSelectAsObservable(); + } + + public static IObservable OnPointerClickAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnPointerClickAsObservable(); + } + + public static IObservable OnSubmitAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnSubmitAsObservable(); + } + + public static IObservable OnDragAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnDragAsObservable(); + } + + public static IObservable OnBeginDragAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnBeginDragAsObservable(); + } + + public static IObservable OnEndDragAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnEndDragAsObservable(); + } + + public static IObservable OnDropAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnDropAsObservable(); + } + + public static IObservable OnUpdateSelectedAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnUpdateSelectedAsObservable(); + } + + public static IObservable OnInitializePotentialDragAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnInitializePotentialDragAsObservable(); + } + + public static IObservable OnCancelAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnCancelAsObservable(); + } + + public static IObservable OnScrollAsObservable(this UIBehaviour component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnScrollAsObservable(); + } + + #endregion + +#endif + + #region ObservableParticleTrigger + + /// OnParticleCollision is called when a particle hits a collider. + public static IObservable OnParticleCollisionAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnParticleCollisionAsObservable(); + } + +#if UNITY_5_4_OR_NEWER + + /// OnParticleTrigger is called when any particles in a particle system meet the conditions in the trigger module. + public static IObservable OnParticleTriggerAsObservable(this Component component) + { + if (component == null || component.gameObject == null) return Observable.Empty(); + return GetOrAddComponent(component.gameObject).OnParticleTriggerAsObservable(); + } + +#endif + + #endregion + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs.meta new file mode 100644 index 00000000..b0192111 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d10150b3ca6f3924baae5bce4343f6c4 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs new file mode 100644 index 00000000..fd2009f2 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs @@ -0,0 +1,361 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + // for GameObject + public static partial class ObservableTriggerExtensions + { + #region ObservableAnimatorTrigger + + /// Callback for setting up animation IK (inverse kinematics). + public static IObservable OnAnimatorIKAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnAnimatorIKAsObservable(); + } + + /// Callback for processing animation movements for modifying root motion. + public static IObservable OnAnimatorMoveAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnAnimatorMoveAsObservable(); + } + + #endregion + + #region ObservableCollision2DTrigger + + /// Sent when an incoming collider makes contact with this object's collider (2D physics only). + public static IObservable OnCollisionEnter2DAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnCollisionEnter2DAsObservable(); + } + + + /// Sent when a collider on another object stops touching this object's collider (2D physics only). + public static IObservable OnCollisionExit2DAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnCollisionExit2DAsObservable(); + } + + /// Sent each frame where a collider on another object is touching this object's collider (2D physics only). + public static IObservable OnCollisionStay2DAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnCollisionStay2DAsObservable(); + } + + #endregion + + #region ObservableCollisionTrigger + + /// OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. + public static IObservable OnCollisionEnterAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnCollisionEnterAsObservable(); + } + + + /// OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider. + public static IObservable OnCollisionExitAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnCollisionExitAsObservable(); + } + + /// OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. + public static IObservable OnCollisionStayAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnCollisionStayAsObservable(); + } + + #endregion + + #region ObservableDestroyTrigger + + /// This function is called when the MonoBehaviour will be destroyed. + public static IObservable OnDestroyAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Return(Unit.Default); // send destroy message + return GetOrAddComponent(gameObject).OnDestroyAsObservable(); + } + + #endregion + + + #region ObservableEnableTrigger + + /// This function is called when the object becomes enabled and active. + public static IObservable OnEnableAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnEnableAsObservable(); + } + + /// This function is called when the behaviour becomes disabled () or inactive. + public static IObservable OnDisableAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnDisableAsObservable(); + } + + #endregion + + #region ObservableFixedUpdateTrigger + + /// This function is called every fixed framerate frame, if the MonoBehaviour is enabled. + public static IObservable FixedUpdateAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).FixedUpdateAsObservable(); + } + + #endregion + + #region ObservableLateUpdateTrigger + + /// LateUpdate is called every frame, if the Behaviour is enabled. + public static IObservable LateUpdateAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).LateUpdateAsObservable(); + } + + #endregion + +#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO) + + #region ObservableMouseTrigger + + /// OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider. + public static IObservable OnMouseDownAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnMouseDownAsObservable(); + } + + /// OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse. + public static IObservable OnMouseDragAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnMouseDragAsObservable(); + } + + /// OnMouseEnter is called when the mouse entered the GUIElement or Collider. + public static IObservable OnMouseEnterAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnMouseEnterAsObservable(); + } + + /// OnMouseExit is called when the mouse is not any longer over the GUIElement or Collider. + public static IObservable OnMouseExitAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnMouseExitAsObservable(); + } + + /// OnMouseOver is called every frame while the mouse is over the GUIElement or Collider. + public static IObservable OnMouseOverAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnMouseOverAsObservable(); + } + + /// OnMouseUp is called when the user has released the mouse button. + public static IObservable OnMouseUpAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnMouseUpAsObservable(); + } + + /// OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed. + public static IObservable OnMouseUpAsButtonAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnMouseUpAsButtonAsObservable(); + } + + #endregion + +#endif + + #region ObservableTrigger2DTrigger + + /// Sent when another object enters a trigger collider attached to this object (2D physics only). + public static IObservable OnTriggerEnter2DAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnTriggerEnter2DAsObservable(); + } + + + /// Sent when another object leaves a trigger collider attached to this object (2D physics only). + public static IObservable OnTriggerExit2DAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnTriggerExit2DAsObservable(); + } + + /// Sent each frame where another object is within a trigger collider attached to this object (2D physics only). + public static IObservable OnTriggerStay2DAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnTriggerStay2DAsObservable(); + } + + #endregion + + #region ObservableTriggerTrigger + + /// OnTriggerEnter is called when the Collider other enters the trigger. + public static IObservable OnTriggerEnterAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnTriggerEnterAsObservable(); + } + + + /// OnTriggerExit is called when the Collider other has stopped touching the trigger. + public static IObservable OnTriggerExitAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnTriggerExitAsObservable(); + } + + /// OnTriggerStay is called once per frame for every Collider other that is touching the trigger. + public static IObservable OnTriggerStayAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnTriggerStayAsObservable(); + } + + #endregion + + #region ObservableUpdateTrigger + + /// Update is called every frame, if the MonoBehaviour is enabled. + public static IObservable UpdateAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).UpdateAsObservable(); + } + + #endregion + + #region ObservableVisibleTrigger + + /// OnBecameInvisible is called when the renderer is no longer visible by any camera. + public static IObservable OnBecameInvisibleAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnBecameInvisibleAsObservable(); + } + + /// OnBecameVisible is called when the renderer became visible by any camera. + public static IObservable OnBecameVisibleAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnBecameVisibleAsObservable(); + } + + #endregion + +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + + #region ObservableTransformChangedTrigger + + /// Callback sent to the graphic before a Transform parent change occurs. + public static IObservable OnBeforeTransformParentChangedAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnBeforeTransformParentChangedAsObservable(); + } + + /// This function is called when the parent property of the transform of the GameObject has changed. + public static IObservable OnTransformParentChangedAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnTransformParentChangedAsObservable(); + } + + /// This function is called when the list of children of the transform of the GameObject has changed. + public static IObservable OnTransformChildrenChangedAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnTransformChildrenChangedAsObservable(); + } + + #endregion + + #region ObservableCanvasGroupChangedTrigger + + /// Callback that is sent if the canvas group is changed. + public static IObservable OnCanvasGroupChangedAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnCanvasGroupChangedAsObservable(); + } + + #endregion + + #region ObservableRectTransformTrigger + + /// Callback that is sent if an associated RectTransform has it's dimensions changed. + public static IObservable OnRectTransformDimensionsChangeAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnRectTransformDimensionsChangeAsObservable(); + } + + /// Callback that is sent if an associated RectTransform is removed. + public static IObservable OnRectTransformRemovedAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnRectTransformRemovedAsObservable(); + } + + #endregion +#endif + + #region ObservableParticleTrigger + + /// OnParticleCollision is called when a particle hits a collider. + public static IObservable OnParticleCollisionAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnParticleCollisionAsObservable(); + } + +#if UNITY_5_4_OR_NEWER + + /// OnParticleTrigger is called when any particles in a particle system meet the conditions in the trigger module. + public static IObservable OnParticleTriggerAsObservable(this GameObject gameObject) + { + if (gameObject == null) return Observable.Empty(); + return GetOrAddComponent(gameObject).OnParticleTriggerAsObservable(); + } + +#endif + + #endregion + + + static T GetOrAddComponent(GameObject gameObject) + where T : Component + { + var component = gameObject.GetComponent(); + if (component == null) + { + component = gameObject.AddComponent(); + } + + return component; + } + } +} diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs.meta new file mode 100644 index 00000000..70c9c188 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3ee4df960144b9042874516111cf2d6c +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs new file mode 100644 index 00000000..aa4ddea5 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs @@ -0,0 +1,67 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableTriggerTrigger : ObservableTriggerBase + { + Subject onTriggerEnter; + + /// OnTriggerEnter is called when the Collider other enters the trigger. + void OnTriggerEnter(Collider other) + { + if (onTriggerEnter != null) onTriggerEnter.OnNext(other); + } + + /// OnTriggerEnter is called when the Collider other enters the trigger. + public IObservable OnTriggerEnterAsObservable() + { + return onTriggerEnter ?? (onTriggerEnter = new Subject()); + } + + Subject onTriggerExit; + + /// OnTriggerExit is called when the Collider other has stopped touching the trigger. + void OnTriggerExit(Collider other) + { + if (onTriggerExit != null) onTriggerExit.OnNext(other); + } + + /// OnTriggerExit is called when the Collider other has stopped touching the trigger. + public IObservable OnTriggerExitAsObservable() + { + return onTriggerExit ?? (onTriggerExit = new Subject()); + } + + Subject onTriggerStay; + + /// OnTriggerStay is called once per frame for every Collider other that is touching the trigger. + void OnTriggerStay(Collider other) + { + if (onTriggerStay != null) onTriggerStay.OnNext(other); + } + + /// OnTriggerStay is called once per frame for every Collider other that is touching the trigger. + public IObservable OnTriggerStayAsObservable() + { + return onTriggerStay ?? (onTriggerStay = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onTriggerEnter != null) + { + onTriggerEnter.OnCompleted(); + } + if (onTriggerExit != null) + { + onTriggerExit.OnCompleted(); + } + if (onTriggerStay != null) + { + onTriggerStay.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs.meta new file mode 100644 index 00000000..1c9ddd23 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cadcfd987fed8a044b75709fc19ad0f7 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs new file mode 100644 index 00000000..bc9b6249 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs @@ -0,0 +1,36 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; // require keep for Windows Universal App +using UnityEngine; +using UnityEngine.EventSystems; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableUpdateSelectedTrigger : ObservableTriggerBase, IEventSystemHandler, IUpdateSelectedHandler + { + Subject onUpdateSelected; + + void IUpdateSelectedHandler.OnUpdateSelected(BaseEventData eventData) + { + if (onUpdateSelected != null) onUpdateSelected.OnNext(eventData); + } + + public IObservable OnUpdateSelectedAsObservable() + { + return onUpdateSelected ?? (onUpdateSelected = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onUpdateSelected != null) + { + onUpdateSelected.OnCompleted(); + } + } + } +} + + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs.meta new file mode 100644 index 00000000..64d22d27 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateSelectedTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4d207a04db328fd4d970c1457530deb3 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs new file mode 100644 index 00000000..cbafdba3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs @@ -0,0 +1,31 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableUpdateTrigger : ObservableTriggerBase + { + Subject update; + + /// Update is called every frame, if the MonoBehaviour is enabled. + void Update() + { + if (update != null) update.OnNext(Unit.Default); + } + + /// Update is called every frame, if the MonoBehaviour is enabled. + public IObservable UpdateAsObservable() + { + return update ?? (update = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (update != null) + { + update.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs.meta new file mode 100644 index 00000000..09f87a4c --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ceb5e5014f40d6948815a7be8b174ff2 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs new file mode 100644 index 00000000..f9e5b45d --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs @@ -0,0 +1,49 @@ +using System; // require keep for Windows Universal App +using UnityEngine; + +namespace UniRx.Triggers +{ + [DisallowMultipleComponent] + public class ObservableVisibleTrigger : ObservableTriggerBase + { + Subject onBecameInvisible; + + /// OnBecameInvisible is called when the renderer is no longer visible by any camera. + void OnBecameInvisible() + { + if (onBecameInvisible != null) onBecameInvisible.OnNext(Unit.Default); + } + + /// OnBecameInvisible is called when the renderer is no longer visible by any camera. + public IObservable OnBecameInvisibleAsObservable() + { + return onBecameInvisible ?? (onBecameInvisible = new Subject()); + } + + Subject onBecameVisible; + + /// OnBecameVisible is called when the renderer became visible by any camera. + void OnBecameVisible() + { + if (onBecameVisible != null) onBecameVisible.OnNext(Unit.Default); + } + + /// OnBecameVisible is called when the renderer became visible by any camera. + public IObservable OnBecameVisibleAsObservable() + { + return onBecameVisible ?? (onBecameVisible = new Subject()); + } + + protected override void RaiseOnCompletedOnDestroy() + { + if (onBecameInvisible != null) + { + onBecameInvisible.OnCompleted(); + } + if (onBecameVisible != null) + { + onBecameVisible.OnCompleted(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs.meta new file mode 100644 index 00000000..ea2f3677 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableVisibleTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 03515121745b2d74c8782ce92eb2a1a0 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs new file mode 100644 index 00000000..1476f4d4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs @@ -0,0 +1,58 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine.Events; + +namespace UniRx +{ + public static partial class UnityEventExtensions + { + public static IObservable AsObservable(this UnityEngine.Events.UnityEvent unityEvent) + { + return Observable.FromEvent(h => new UnityAction(h), h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)); + } + + public static IObservable AsObservable(this UnityEngine.Events.UnityEvent unityEvent) + { + return Observable.FromEvent, T>(h => new UnityAction(h), h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)); + } + + public static IObservable> AsObservable(this UnityEngine.Events.UnityEvent unityEvent) + { + return Observable.FromEvent, Tuple>(h => + { + return new UnityAction((t0, t1) => + { + h(Tuple.Create(t0, t1)); + }); + }, h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)); + } + + public static IObservable> AsObservable(this UnityEngine.Events.UnityEvent unityEvent) + { + return Observable.FromEvent, Tuple>(h => + { + return new UnityAction((t0, t1, t2) => + { + h(Tuple.Create(t0, t1, t2)); + }); + }, h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)); + } + + public static IObservable> AsObservable(this UnityEngine.Events.UnityEvent unityEvent) + { + return Observable.FromEvent, Tuple>(h => + { + return new UnityAction((t0, t1, t2, t3) => + { + h(Tuple.Create(t0, t1, t2, t3)); + }); + }, h => unityEvent.AddListener(h), h => unityEvent.RemoveListener(h)); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs.meta new file mode 100644 index 00000000..c911bbbc --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityEventExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e3c4861cc04ac524484d0730a3a5bd4a +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs new file mode 100644 index 00000000..3e5ef217 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs @@ -0,0 +1,44 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; +using UnityEngine.Events; +using UnityEngine.UI; + +namespace UniRx +{ + public static partial class UnityGraphicExtensions + { + public static IObservable DirtyLayoutCallbackAsObservable(this Graphic graphic) + { + return Observable.Create(observer => + { + UnityAction registerHandler = () => observer.OnNext(Unit.Default); + graphic.RegisterDirtyLayoutCallback(registerHandler); + return Disposable.Create(() => graphic.UnregisterDirtyLayoutCallback(registerHandler)); + }); + } + + public static IObservable DirtyMaterialCallbackAsObservable(this Graphic graphic) + { + return Observable.Create(observer => + { + UnityAction registerHandler = () => observer.OnNext(Unit.Default); + graphic.RegisterDirtyMaterialCallback(registerHandler); + return Disposable.Create(() => graphic.UnregisterDirtyMaterialCallback(registerHandler)); + }); + } + + public static IObservable DirtyVerticesCallbackAsObservable(this Graphic graphic) + { + return Observable.Create(observer => + { + UnityAction registerHandler = () => observer.OnNext(Unit.Default); + graphic.RegisterDirtyVerticesCallback(registerHandler); + return Disposable.Create(() => graphic.UnregisterDirtyVerticesCallback(registerHandler)); + }); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs.meta new file mode 100644 index 00000000..13a9fce3 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityGraphicExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 99be646df339108498ebb70efa1b7bd4 +timeCreated: 1455373900 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs new file mode 100644 index 00000000..8a02cb15 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs @@ -0,0 +1,123 @@ +// for uGUI(from 4.6) +#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) + +using System; +using UnityEngine; +using UnityEngine.UI; + +namespace UniRx +{ + public static partial class UnityUIComponentExtensions + { + public static IDisposable SubscribeToText(this IObservable source, Text text) + { + return source.SubscribeWithState(text, (x, t) => t.text = x); + } + + public static IDisposable SubscribeToText(this IObservable source, Text text) + { + return source.SubscribeWithState(text, (x, t) => t.text = x.ToString()); + } + + public static IDisposable SubscribeToText(this IObservable source, Text text, Func selector) + { + return source.SubscribeWithState2(text, selector, (x, t, s) => t.text = s(x)); + } + + public static IDisposable SubscribeToInteractable(this IObservable source, Selectable selectable) + { + return source.SubscribeWithState(selectable, (x, s) => s.interactable = x); + } + + /// Observe onClick event. + public static IObservable OnClickAsObservable(this Button button) + { + return button.onClick.AsObservable(); + } + + /// Observe onValueChanged with current `isOn` value on subscribe. + public static IObservable OnValueChangedAsObservable(this Toggle toggle) + { + // Optimized Defer + StartWith + return Observable.CreateWithState(toggle, (t, observer) => + { + observer.OnNext(t.isOn); + return t.onValueChanged.AsObservable().Subscribe(observer); + }); + } + + /// Observe onValueChanged with current `value` on subscribe. + public static IObservable OnValueChangedAsObservable(this Scrollbar scrollbar) + { + return Observable.CreateWithState(scrollbar, (s, observer) => + { + observer.OnNext(s.value); + return s.onValueChanged.AsObservable().Subscribe(observer); + }); + } + + /// Observe onValueChanged with current `normalizedPosition` value on subscribe. + public static IObservable OnValueChangedAsObservable(this ScrollRect scrollRect) + { + return Observable.CreateWithState(scrollRect, (s, observer) => + { + observer.OnNext(s.normalizedPosition); + return s.onValueChanged.AsObservable().Subscribe(observer); + }); + } + + /// Observe onValueChanged with current `value` on subscribe. + public static IObservable OnValueChangedAsObservable(this Slider slider) + { + return Observable.CreateWithState(slider, (s, observer) => + { + observer.OnNext(s.value); + return s.onValueChanged.AsObservable().Subscribe(observer); + }); + } + + /// Observe onEndEdit(Submit) event. + public static IObservable OnEndEditAsObservable(this InputField inputField) + { + return inputField.onEndEdit.AsObservable(); + } + +#if (UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) + /// Observe onValueChange with current `text` value on subscribe. + public static IObservable OnValueChangeAsObservable(this InputField inputField) + { + return Observable.CreateWithState(inputField, (i, observer) => + { + observer.OnNext(i.text); + return i.onValueChange.AsObservable().Subscribe(observer); + }); + } +#else + /// Observe onValueChanged with current `text` value on subscribe. + public static IObservable OnValueChangedAsObservable(this InputField inputField) + { + return Observable.CreateWithState(inputField, (i, observer) => + { + observer.OnNext(i.text); + return i.onValueChanged.AsObservable().Subscribe(observer); + }); + } +#endif + +#if UNITY_5_3_OR_NEWER + + /// Observe onValueChanged with current `value` on subscribe. + public static IObservable OnValueChangedAsObservable(this Dropdown dropdown) + { + return Observable.CreateWithState(dropdown, (d, observer) => + { + observer.OnNext(d.value); + return d.onValueChanged.AsObservable().Subscribe(observer); + }); + } + +#endif + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs.meta new file mode 100644 index 00000000..1cdffc49 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7645084659bc779448e384456805d251 +timeCreated: 1455373899 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs new file mode 100644 index 00000000..60d3a5e9 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace UniRx +{ + internal static class YieldInstructionCache + { + public static readonly WaitForEndOfFrame WaitForEndOfFrame = new WaitForEndOfFrame(); + public static readonly WaitForFixedUpdate WaitForFixedUpdate = new WaitForFixedUpdate(); + } +} \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs.meta new file mode 100644 index 00000000..a574f0a4 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityEngineBridge/YieldInstructionCache.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2493deaccf35b0542800b0851771e665 +timeCreated: 1455373897 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge.meta b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge.meta new file mode 100644 index 00000000..33c919c7 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2c03c70869bcd0240b96959097acc29d +folderAsset: yes +timeCreated: 1455373896 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs new file mode 100644 index 00000000..376d5f59 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs @@ -0,0 +1,26 @@ +#if UNITY_METRO + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; + +namespace UniRx +{ + public static class Thread + { + public static void Sleep(TimeSpan wait) + { + new System.Threading.ManualResetEvent(false).WaitOne(wait); + } + + public static void Sleep(int ms) + { + new System.Threading.ManualResetEvent(false).WaitOne(ms); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs.meta new file mode 100644 index 00000000..85c96d8f --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/Thread.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bf1175d5dd9b5904d898eb4c9dd7e0c5 +timeCreated: 1455373901 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs new file mode 100644 index 00000000..cdbd1d92 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs @@ -0,0 +1,100 @@ +#if UNITY_METRO + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; + +#if NETFX_CORE +using System.Threading.Tasks; +#endif + +namespace UniRx +{ + public static partial class Scheduler + { + public static readonly IScheduler ThreadPool = new ThreadPoolScheduler(); + + class ThreadPoolScheduler : IScheduler + { + public DateTimeOffset Now + { + get { return Scheduler.Now; } + } + + public IDisposable Schedule(Action action) + { + var d = new BooleanDisposable(); +#if NETFX_CORE + + Task.Run(()=> + { + if (!d.IsDisposed) + { + action(); + } + }); + +#else + Action act = () => + { + if (!d.IsDisposed) + { + action(); + } + }; + + act.BeginInvoke(ar => act.EndInvoke(ar), null); + +#endif + + return d; + } + + public IDisposable Schedule(TimeSpan dueTime, Action action) + { + var wait = Scheduler.Normalize(dueTime); + + var d = new BooleanDisposable(); + +#if NETFX_CORE + + Task.Run(()=> + { + if (!d.IsDisposed) + { + if (wait.Ticks > 0) + { + Thread.Sleep(wait); + } + action(); + } + }); + +#else + + Action act = () => + { + if (!d.IsDisposed) + { + if (wait.Ticks > 0) + { + Thread.Sleep(wait); + } + action(); + } + }; + + act.BeginInvoke(ar => act.EndInvoke(ar), null); + +#endif + + return d; + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs.meta b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs.meta new file mode 100644 index 00000000..72486f77 --- /dev/null +++ b/Assets/Plugins/UniRx/Scripts/UnityWinRTBridge/ThreadPoolScheduler_UnityWinRT.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2c36c9256c17bbb40854ef9b9e4d51c7 +timeCreated: 1455373898 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/BillingMode.json b/Assets/Resources/BillingMode.json new file mode 100644 index 00000000..6f4bfb71 --- /dev/null +++ b/Assets/Resources/BillingMode.json @@ -0,0 +1 @@ +{"androidStore":"GooglePlay"} \ No newline at end of file diff --git a/Assets/Resources/BillingMode.json.meta b/Assets/Resources/BillingMode.json.meta new file mode 100644 index 00000000..b431bb6a --- /dev/null +++ b/Assets/Resources/BillingMode.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 68da03dca348e454bad9bfe72e9590c8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Bosses/BossEnemyPrefabTemplate.prefab b/Assets/Resources/Bosses/BossEnemyPrefabTemplate.prefab index 31d731b7..4f8152df 100644 --- a/Assets/Resources/Bosses/BossEnemyPrefabTemplate.prefab +++ b/Assets/Resources/Bosses/BossEnemyPrefabTemplate.prefab @@ -265,7 +265,7 @@ NavMeshAgent: m_Radius: 0.5 m_Speed: 3 m_Acceleration: 45 - avoidancePriority: 50 + avoidancePriority: 80 m_AngularSpeed: 3600 m_StoppingDistance: 1.25 m_AutoTraverseOffMeshLink: 1 @@ -1283,7 +1283,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1063629724385205317, guid: 2e56f69e0872f744daa6c9080ecf3040, type: 3} propertyPath: m_fontSize - value: 294.65 + value: 200 objectReference: {fileID: 0} - target: {fileID: 4924407620164273521, guid: 2e56f69e0872f744daa6c9080ecf3040, type: 3} propertyPath: m_Pivot.x diff --git a/Assets/Resources/Bosses/SunDragonBossEnemyPrefabTemplate Variant.prefab b/Assets/Resources/Bosses/SunDragonBossEnemyPrefabTemplate Variant.prefab index 038e26e9..3e0ac28f 100644 --- a/Assets/Resources/Bosses/SunDragonBossEnemyPrefabTemplate Variant.prefab +++ b/Assets/Resources/Bosses/SunDragonBossEnemyPrefabTemplate Variant.prefab @@ -179,18 +179,10 @@ PrefabInstance: propertyPath: m_Radius value: 2.5 objectReference: {fileID: 0} - - target: {fileID: 5460205518301792031, guid: 4d5cd1124d0c47647899411ebcfe8b8a, type: 3} - propertyPath: avoidancePriority - value: 20 - objectReference: {fileID: 0} - target: {fileID: 5460205518301792031, guid: 4d5cd1124d0c47647899411ebcfe8b8a, type: 3} propertyPath: m_StoppingDistance value: 3.9 objectReference: {fileID: 0} - - target: {fileID: 5460205518301792031, guid: 4d5cd1124d0c47647899411ebcfe8b8a, type: 3} - propertyPath: m_ObstacleAvoidanceType - value: 0 - objectReference: {fileID: 0} - target: {fileID: 5909578744954783082, guid: 4d5cd1124d0c47647899411ebcfe8b8a, type: 3} propertyPath: m_Name value: SunDragonBossEnemyPrefabTemplate Variant diff --git a/Assets/Resources/Enemies/BasicEnemyPrefabTemplate.prefab b/Assets/Resources/Enemies/BasicEnemyPrefabTemplate.prefab index 9eb1a388..defdea75 100644 --- a/Assets/Resources/Enemies/BasicEnemyPrefabTemplate.prefab +++ b/Assets/Resources/Enemies/BasicEnemyPrefabTemplate.prefab @@ -11429,7 +11429,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0, g: 0.9, b: 0, a: 1} + m_Color: {r: 0.879, g: 0, b: 0, a: 1} m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 diff --git a/Assets/Resources/Interactables/FishingSpotInteractable.prefab b/Assets/Resources/Interactables/FishingSpotInteractable.prefab index e8934de6..d89f7bc6 100644 --- a/Assets/Resources/Interactables/FishingSpotInteractable.prefab +++ b/Assets/Resources/Interactables/FishingSpotInteractable.prefab @@ -68,7 +68,7 @@ MonoBehaviour: - drop: {fileID: 11400000, guid: a6c738232ec60474f8edc7718e576d07, type: 2} weight: 10 - drop: {fileID: 11400000, guid: e13615b0e101d6b47aa4e7b3ce678672, type: 2} - weight: 90 + weight: 5 interacted: 0 --- !u!135 &4977534290162099532 SphereCollider: diff --git a/Assets/Resources/Nameplate.prefab b/Assets/Resources/Nameplate.prefab index 8b2a1120..c83ee0cc 100644 --- a/Assets/Resources/Nameplate.prefab +++ b/Assets/Resources/Nameplate.prefab @@ -454,7 +454,7 @@ MonoBehaviour: m_FallbackScreenDPI: 96 m_DefaultSpriteDPI: 96 m_DynamicPixelsPerUnit: 1 - m_PresetInfoIsWorld: 0 + m_PresetInfoIsWorld: 1 --- !u!114 &6026277189427292417 MonoBehaviour: m_ObjectHideFlags: 0 @@ -694,7 +694,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0, g: 0.9, b: 0, a: 1} + m_Color: {r: 0.9019608, g: 0, b: 0, a: 1} m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 diff --git a/Assets/Resources/PlayableCharacters/PlayerPrefab_Barbarian Variant.prefab b/Assets/Resources/PlayableCharacters/PlayerPrefab_Barbarian Variant.prefab index 887185d4..03ee4629 100644 --- a/Assets/Resources/PlayableCharacters/PlayerPrefab_Barbarian Variant.prefab +++ b/Assets/Resources/PlayableCharacters/PlayerPrefab_Barbarian Variant.prefab @@ -350,19 +350,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.size - value: 6 + value: 7 objectReference: {fileID: 0} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[2] + value: + objectReference: {fileID: 5863544064020467362} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[3] value: - objectReference: {fileID: 4032381482603677540} + objectReference: {fileID: 5801968926982078561} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[4] value: - objectReference: {fileID: 1830776764180054666} + objectReference: {fileID: 4032381482603677540} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[5] value: + objectReference: {fileID: 1830776764180054666} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[6] + value: objectReference: {fileID: 1788221149024619301} - target: {fileID: 7726918647213528475, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: classTag @@ -440,6 +448,10 @@ PrefabInstance: propertyPath: maxValue value: 50 objectReference: {fileID: 0} + - target: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: maxValue + value: 150 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 9c432d220280f704684a6d5b9354c782, type: 3} --- !u!114 &1170972516368154780 stripped @@ -499,6 +511,28 @@ Transform: m_CorrespondingSourceObject: {fileID: 7445357712997283684, guid: 9c432d220280f704684a6d5b9354c782, type: 3} m_PrefabInstance: {fileID: 3315893290401286401} m_PrefabAsset: {fileID: 0} +--- !u!114 &5801968926982078561 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9115515025738910048, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 3315893290401286401} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 389de3cac2aa89247bd947ebc2fb91ac, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &5863544064020467362 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 3315893290401286401} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e27fb8d81ab0d814ca4415089c513fe3, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &6684603968718947663 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 8268627081631403086, guid: 9c432d220280f704684a6d5b9354c782, type: 3} diff --git a/Assets/Resources/PlayableCharacters/PlayerPrefab_Knight Variant.prefab b/Assets/Resources/PlayableCharacters/PlayerPrefab_Knight Variant.prefab index ad60c350..b5990e8c 100644 --- a/Assets/Resources/PlayableCharacters/PlayerPrefab_Knight Variant.prefab +++ b/Assets/Resources/PlayableCharacters/PlayerPrefab_Knight Variant.prefab @@ -97,19 +97,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.size - value: 6 + value: 7 objectReference: {fileID: 0} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[2] + value: + objectReference: {fileID: 3661498298690416707} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[3] value: - objectReference: {fileID: 6087418188798982533} + objectReference: {fileID: 3678179689714089600} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[4] value: - objectReference: {fileID: 8856054663210089579} + objectReference: {fileID: 6087418188798982533} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[5] value: + objectReference: {fileID: 8856054663210089579} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[6] + value: objectReference: {fileID: 5587652594478694127} - target: {fileID: 7726918647213528475, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: classTag @@ -187,6 +195,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: maxValue + value: 150 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 9c432d220280f704684a6d5b9354c782, type: 3} --- !u!4 &3087337436435136644 stripped @@ -194,6 +206,28 @@ Transform: m_CorrespondingSourceObject: {fileID: 7445357712997283684, guid: 9c432d220280f704684a6d5b9354c782, type: 3} m_PrefabInstance: {fileID: 5587652594317244384} m_PrefabAsset: {fileID: 0} +--- !u!114 &3661498298690416707 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 5587652594317244384} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e27fb8d81ab0d814ca4415089c513fe3, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &3678179689714089600 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9115515025738910048, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 5587652594317244384} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 389de3cac2aa89247bd947ebc2fb91ac, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &4560814825902521262 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 8268627081631403086, guid: 9c432d220280f704684a6d5b9354c782, type: 3} diff --git a/Assets/Resources/PlayableCharacters/PlayerPrefab_Mage Variant.prefab b/Assets/Resources/PlayableCharacters/PlayerPrefab_Mage Variant.prefab index bb8a332f..ccc645f3 100644 --- a/Assets/Resources/PlayableCharacters/PlayerPrefab_Mage Variant.prefab +++ b/Assets/Resources/PlayableCharacters/PlayerPrefab_Mage Variant.prefab @@ -358,19 +358,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.size - value: 6 + value: 7 objectReference: {fileID: 0} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[2] + value: + objectReference: {fileID: 3197801336946445289} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[3] value: - objectReference: {fileID: 5389195242245751343} + objectReference: {fileID: 3295257113280054570} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[4] value: - objectReference: {fileID: 7230415786316253121} + objectReference: {fileID: 5389195242245751343} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[5] value: + objectReference: {fileID: 7230415786316253121} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[6] + value: objectReference: {fileID: 6192144265892874537} - target: {fileID: 7726918647213528475, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: classTag @@ -440,6 +448,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: maxValue + value: 100 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 9c432d220280f704684a6d5b9354c782, type: 3} --- !u!114 &2448791587830153220 stripped @@ -453,6 +465,28 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fc68399598b8f0e4bbfcacc0f270b054, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &3197801336946445289 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 5997609963189718090} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e27fb8d81ab0d814ca4415089c513fe3, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &3295257113280054570 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9115515025738910048, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 5997609963189718090} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 389de3cac2aa89247bd947ebc2fb91ac, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!4 &3776535574399073070 stripped Transform: m_CorrespondingSourceObject: {fileID: 7445357712997283684, guid: 9c432d220280f704684a6d5b9354c782, type: 3} diff --git a/Assets/Resources/PlayableCharacters/PlayerPrefab_Necromancer Variant.prefab b/Assets/Resources/PlayableCharacters/PlayerPrefab_Necromancer Variant.prefab index 0411386b..3d9e4f6d 100644 --- a/Assets/Resources/PlayableCharacters/PlayerPrefab_Necromancer Variant.prefab +++ b/Assets/Resources/PlayableCharacters/PlayerPrefab_Necromancer Variant.prefab @@ -149,15 +149,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.size - value: 6 + value: 7 objectReference: {fileID: 0} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[2] + value: + objectReference: {fileID: 7020976738236272906} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[3] + value: + objectReference: {fileID: 6968265545910050761} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[4] value: - objectReference: {fileID: 2979345162832780578} + objectReference: {fileID: 559887811447380172} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[5] value: + objectReference: {fileID: 2979345162832780578} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[6] + value: objectReference: {fileID: 2747273072329540181} - target: {fileID: 7726918647213528475, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: classTag @@ -227,8 +239,23 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: maxValue + value: 100 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 9c432d220280f704684a6d5b9354c782, type: 3} +--- !u!114 &559887811447380172 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1869432520870514277, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 2176522877944764073} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b337f6af01e751c44b6fb3a810398498, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &2337608085390909236 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 4486792688999778717, guid: 9c432d220280f704684a6d5b9354c782, type: 3} @@ -251,6 +278,28 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6cb53fadb6be8254587f5d0ad1c57778, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &6968265545910050761 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9115515025738910048, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 2176522877944764073} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 389de3cac2aa89247bd947ebc2fb91ac, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &7020976738236272906 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 2176522877944764073} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e27fb8d81ab0d814ca4415089c513fe3, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &7851041350907075303 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 8268627081631403086, guid: 9c432d220280f704684a6d5b9354c782, type: 3} diff --git a/Assets/Resources/PlayableCharacters/PlayerPrefab_Priest Variant.prefab b/Assets/Resources/PlayableCharacters/PlayerPrefab_Priest Variant.prefab index 4e1d9103..c2880954 100644 --- a/Assets/Resources/PlayableCharacters/PlayerPrefab_Priest Variant.prefab +++ b/Assets/Resources/PlayableCharacters/PlayerPrefab_Priest Variant.prefab @@ -97,19 +97,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.size - value: 6 + value: 7 objectReference: {fileID: 0} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[2] + value: + objectReference: {fileID: 6413872799929113776} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[3] value: - objectReference: {fileID: 4586982804749702518} + objectReference: {fileID: 6402257099963093619} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[4] value: - objectReference: {fileID: 1240144468001624216} + objectReference: {fileID: 4586982804749702518} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[5] value: + objectReference: {fileID: 1240144468001624216} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[6] + value: objectReference: {fileID: 8112063480741076945} - target: {fileID: 7726918647213528475, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: classTag @@ -175,6 +183,10 @@ PrefabInstance: propertyPath: maxValue value: 150 objectReference: {fileID: 0} + - target: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: maxValue + value: 80 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 9c432d220280f704684a6d5b9354c782, type: 3} --- !u!114 &1240144468001624216 stripped @@ -226,6 +238,28 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fc68399598b8f0e4bbfcacc0f270b054, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &6402257099963093619 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9115515025738910048, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 2763436073792215827} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 389de3cac2aa89247bd947ebc2fb91ac, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &6413872799929113776 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 2763436073792215827} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e27fb8d81ab0d814ca4415089c513fe3, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &3150237142380810807 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/PlayableCharacters/PlayerPrefab_Vampire Variant.prefab b/Assets/Resources/PlayableCharacters/PlayerPrefab_Vampire Variant.prefab index 0757264f..63cd0e4f 100644 --- a/Assets/Resources/PlayableCharacters/PlayerPrefab_Vampire Variant.prefab +++ b/Assets/Resources/PlayableCharacters/PlayerPrefab_Vampire Variant.prefab @@ -236,7 +236,7 @@ PrefabInstance: objectReference: {fileID: 11400000, guid: f2c34fbff4781f84aa75dcc83f2fe57b, type: 2} - target: {fileID: 3411510181381743576, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: abilityPriorityList.Array.data[0].castConditions.Array.size - value: 4 + value: 2 objectReference: {fileID: 0} - target: {fileID: 3411510181381743576, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: abilityPriorityList.Array.data[0].castConditions.Array.data[0].conditionType @@ -244,11 +244,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3411510181381743576, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: abilityPriorityList.Array.data[0].castConditions.Array.data[1].conditionType - value: 0 + value: 3 objectReference: {fileID: 0} - target: {fileID: 3411510181381743576, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: abilityPriorityList.Array.data[0].castConditions.Array.data[2].conditionType - value: 1 + value: 3 objectReference: {fileID: 0} - target: {fileID: 3411510181381743576, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: abilityPriorityList.Array.data[0].castConditions.Array.data[3].conditionType @@ -370,10 +370,26 @@ PrefabInstance: propertyPath: ObservedComponents.Array.size value: 6 objectReference: {fileID: 0} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[2] + value: + objectReference: {fileID: 6141481539429568872} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[3] + value: + objectReference: {fileID: 3624186641255110253} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[4] + value: + objectReference: {fileID: 2077970117864674179} - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: ObservedComponents.Array.data[5] value: objectReference: {fileID: 4660903209845300574} + - target: {fileID: 7687765528848249431, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: ObservedComponents.Array.data[6] + value: + objectReference: {fileID: 4660903209845300574} - target: {fileID: 7726918647213528475, guid: 9c432d220280f704684a6d5b9354c782, type: 3} propertyPath: classTag value: @@ -446,6 +462,10 @@ PrefabInstance: propertyPath: maxValue value: 60 objectReference: {fileID: 0} + - target: {fileID: 9176951908243474339, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + propertyPath: maxValue + value: 100 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 9c432d220280f704684a6d5b9354c782, type: 3} --- !u!114 &1584834242516357525 stripped @@ -459,6 +479,28 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2c6abf9a75ef8c04cbbe3bed12b7bc9f, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &2077970117864674179 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 3993657840148777867, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 3150897364617058312} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6cb53fadb6be8254587f5d0ad1c57778, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &3624186641255110253 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1869432520870514277, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 3150897364617058312} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b337f6af01e751c44b6fb3a810398498, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!4 &5541966391078039404 stripped Transform: m_CorrespondingSourceObject: {fileID: 7445357712997283684, guid: 9c432d220280f704684a6d5b9354c782, type: 3} @@ -469,6 +511,17 @@ Transform: m_CorrespondingSourceObject: {fileID: 8785094005405139760, guid: 9c432d220280f704684a6d5b9354c782, type: 3} m_PrefabInstance: {fileID: 3150897364617058312} m_PrefabAsset: {fileID: 0} +--- !u!114 &6141481539429568872 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 9115515025738910048, guid: 9c432d220280f704684a6d5b9354c782, type: 3} + m_PrefabInstance: {fileID: 3150897364617058312} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 389de3cac2aa89247bd947ebc2fb91ac, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!114 &6447515229888074822 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 8268627081631403086, guid: 9c432d220280f704684a6d5b9354c782, type: 3} diff --git a/Assets/Resources/PlayerPrefab.prefab b/Assets/Resources/PlayerPrefab.prefab index 7db667bf..9a8c693e 100644 --- a/Assets/Resources/PlayerPrefab.prefab +++ b/Assets/Resources/PlayerPrefab.prefab @@ -206,7 +206,7 @@ GameObject: - component: {fileID: 4486792688999778717} - component: {fileID: 8867901703884003658} - component: {fileID: 8273564744905798527} - - component: {fileID: 4996700579829439174} + - component: {fileID: 9176951908243474339} - component: {fileID: 9115515025738910048} - component: {fileID: 1869432520870514277} - component: {fileID: 4217372937522934288} @@ -283,7 +283,7 @@ MonoBehaviour: observableSearch: 2 ObservedComponents: - {fileID: 7931791360169622515} - - {fileID: 4996700579829439174} + - {fileID: 9176951908243474339} - {fileID: 9115515025738910048} - {fileID: 1869432520870514277} - {fileID: 3993657840148777867} @@ -486,7 +486,7 @@ MonoBehaviour: player: {fileID: 0} AllocatedStatPoints: AvailablePointsToAllocate: 0 ---- !u!114 &4996700579829439174 +--- !u!114 &9176951908243474339 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -495,7 +495,7 @@ MonoBehaviour: m_GameObject: {fileID: 480331571121010796} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1417a51a6386efd4796dc90cd5e9b625, type: 3} + m_Script: {fileID: 11500000, guid: e27fb8d81ab0d814ca4415089c513fe3, type: 3} m_Name: m_EditorClassIdentifier: currentValue: 0 @@ -3692,6 +3692,18 @@ PrefabInstance: propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} + - target: {fileID: 8700913270241287885, guid: 2e56f69e0872f744daa6c9080ecf3040, type: 3} + propertyPath: m_Color.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8700913270241287885, guid: 2e56f69e0872f744daa6c9080ecf3040, type: 3} + propertyPath: m_Color.g + value: 0.85800004 + objectReference: {fileID: 0} + - target: {fileID: 8700913270241287885, guid: 2e56f69e0872f744daa6c9080ecf3040, type: 3} + propertyPath: m_Color.r + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8700913270241287885, guid: 2e56f69e0872f744daa6c9080ecf3040, type: 3} propertyPath: m_FillAmount value: 1 diff --git a/Assets/Resources/Vendors/Vendor_Template_ShadowDancer_Variant.prefab b/Assets/Resources/Vendors/Vendor_Template_ShadowDancer_Variant.prefab new file mode 100644 index 00000000..e7884542 --- /dev/null +++ b/Assets/Resources/Vendors/Vendor_Template_ShadowDancer_Variant.prefab @@ -0,0 +1,179 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &4745473432424238815 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.size + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[0].item + value: + objectReference: {fileID: 11400000, guid: 4a240cac70c0c094d8f6007217d69375, type: 2} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[1].item + value: + objectReference: {fileID: 11400000, guid: 401d2aad3ed8f084bbdb8ffd68d76586, type: 2} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[2].item + value: + objectReference: {fileID: 11400000, guid: cb6346f6b4ec6db4badc66102423cfa5, type: 2} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[3].item + value: + objectReference: {fileID: 11400000, guid: d50aed42782ec0c488ef7894b1d098a5, type: 2} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[4].item + value: + objectReference: {fileID: 11400000, guid: a23e689a08611f744a06f523e099e951, type: 2} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[5].item + value: + objectReference: {fileID: 11400000, guid: 0f62bde05c15c9047bdd0528ef43c019, type: 2} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[0].soldMultipleTimes + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[1].soldMultipleTimes + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[2].soldMultipleTimes + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[3].soldMultipleTimes + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[4].soldMultipleTimes + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525333, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: vendorData.items.Array.data[5].soldMultipleTimes + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1303668238710525335, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_Name + value: Vendor_Template_ShadowDancer_Variant + objectReference: {fileID: 0} + - target: {fileID: 5414032201186326505, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + propertyPath: m_text + value: Shadowdancer Vendor + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} +--- !u!4 &6038414138835698505 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 1303668238710525334, guid: 2917f88fe47ef314b99fb469b1e46824, type: 3} + m_PrefabInstance: {fileID: 4745473432424238815} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &4745473433426399578 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 6038414138835698505} + m_Modifications: + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6091832650452064618, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6899894139217904592, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + propertyPath: m_Name + value: Vamp + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 1235672432261282576, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + - {fileID: 7716045718905858460, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} + m_SourcePrefab: {fileID: 100100000, guid: cfa80d1224dc4bf46adaf48681a6080c, type: 3} diff --git a/Assets/Resources/Vendors/Vendor_Template_ShadowDancer_Variant.prefab.meta b/Assets/Resources/Vendors/Vendor_Template_ShadowDancer_Variant.prefab.meta new file mode 100644 index 00000000..e8d86986 --- /dev/null +++ b/Assets/Resources/Vendors/Vendor_Template_ShadowDancer_Variant.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 953fdfa9e893aae4d881f391dc1e5c1c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Dev/Vendors.unity b/Assets/Scenes/Dev/Vendors.unity index c370ae97..a62086dc 100644 --- a/Assets/Scenes/Dev/Vendors.unity +++ b/Assets/Scenes/Dev/Vendors.unity @@ -817,6 +817,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 4896368327666212497, guid: 05b4e18c8a347fe43ad2bea127a88198, type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: ff1860c2ed83e1847840dcb9a3845883, type: 2} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 05b4e18c8a347fe43ad2bea127a88198, type: 3} --- !u!4 &215759932791529216 @@ -1826,6 +1830,10 @@ PrefabInstance: propertyPath: m_Name value: PlayerPrefab_Priest objectReference: {fileID: 0} + - target: {fileID: 2374462924831859583, guid: 7ae408e39ee037540820907a6d7cff45, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 5542203205462305092, guid: 7ae408e39ee037540820907a6d7cff45, type: 3} propertyPath: sceneViewId value: 6 @@ -2520,6 +2528,63 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1001 &4745473432807152710 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 6038414138835698504, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_Name + value: Vendor_Template_ShadowDancer_Variant + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_RootOrder + value: 19 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6038414138835698505, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 953fdfa9e893aae4d881f391dc1e5c1c, type: 3} --- !u!1 &4766716239609746616 GameObject: m_ObjectHideFlags: 0 @@ -2897,6 +2962,10 @@ PrefabInstance: propertyPath: m_Name value: PlayerPrefab_Knight objectReference: {fileID: 0} + - target: {fileID: 5413660362937667468, guid: 55ce24071777a5b429f53775f21b20fe, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 55ce24071777a5b429f53775f21b20fe, type: 3} --- !u!1 &5688729993743920423 diff --git a/Assets/Scriptables/Data/2-Jobs/JobTemplates/MultiJobTemplate/MultiJob_Template_01.asset b/Assets/Scriptables/Data/2-Jobs/JobTemplates/MultiJobTemplate/MultiJob_Template_01.asset index a450e25e..461dd54a 100644 --- a/Assets/Scriptables/Data/2-Jobs/JobTemplates/MultiJobTemplate/MultiJob_Template_01.asset +++ b/Assets/Scriptables/Data/2-Jobs/JobTemplates/MultiJobTemplate/MultiJob_Template_01.asset @@ -18,9 +18,9 @@ MonoBehaviour: zoneName: levelName: isHostileZone: 0 - baseCoinReward: 150 - baseExperienceFinalReward: 600 - baseReputationFinalReward: 3 - percentCoinReward: 0.2 - percentExperienceFinalReward: 0.2 - percentReputationFinalReward: 0.1 + baseCoinReward: 550 + baseExperienceFinalReward: 1200 + baseReputationFinalReward: 6 + percentCoinReward: 0.75 + percentExperienceFinalReward: 0.75 + percentReputationFinalReward: 0.25 diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/1-BloodBath_AoEWithImpactEvent.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/1-BloodBath_AoEWithImpactEvent.asset index 35f5d34f..b99cb8eb 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/1-BloodBath_AoEWithImpactEvent.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/1-BloodBath_AoEWithImpactEvent.asset @@ -25,7 +25,7 @@ MonoBehaviour: abilityEffects: - {fileID: 11400000, guid: 6fe02d03bd1c0de4084f9818353b7027, type: 2} castTime: 0.5 - manaCost: 5 + manaCost: 15 healthCost: 0 classResourceCost: 0 cooldown: 1 diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/2-BloodRose_AoEOverTime.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/2-BloodRose_AoEOverTime.asset index ef5a3f1a..e294e3f4 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/2-BloodRose_AoEOverTime.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/2-BloodRose_AoEOverTime.asset @@ -25,7 +25,7 @@ MonoBehaviour: abilityEffects: - {fileID: 11400000, guid: 15e27cf15aabe9f47bd69e637e4ab879, type: 2} castTime: 0.5 - manaCost: 10 + manaCost: 30 healthCost: 0 classResourceCost: 0 cooldown: 4 diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/3-VampSpeed.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/3-VampSpeed.asset index 9bdd4576..c2052821 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/3-VampSpeed.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/3-VampSpeed.asset @@ -25,7 +25,7 @@ MonoBehaviour: - {fileID: 11400000, guid: d74142cb88f65fa4da58fe90bd2d7d23, type: 2} - {fileID: 11400000, guid: 529847434d8ad9943bcf329c94e1e48d, type: 2} castTime: 0.25 - manaCost: 5 + manaCost: 20 healthCost: 0 classResourceCost: 0 cooldown: 10 diff --git a/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/C-BloodVacuum_AoEOverTimeWithTickEvent.asset b/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/C-BloodVacuum_AoEOverTimeWithTickEvent.asset index 6617fd00..f5bbf8e7 100644 --- a/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/C-BloodVacuum_AoEOverTimeWithTickEvent.asset +++ b/Assets/Scriptables/Data/Abilities/Debug/Player/Vampire/C-BloodVacuum_AoEOverTimeWithTickEvent.asset @@ -27,9 +27,9 @@ MonoBehaviour: - {fileID: 11400000, guid: 653bdd7e27d762a4a826faa0fba4aef8, type: 2} - {fileID: 11400000, guid: bb92d18643e5f254d87a907329ecf88e, type: 2} castTime: 0.5 - manaCost: 5 - healthCost: 5 - classResourceCost: 20 + manaCost: 0 + healthCost: 0 + classResourceCost: 30 cooldown: 6 castableWhileMoving: 0 animationType: 1 diff --git a/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_Bite_InstantEffect.asset b/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_Bite_InstantEffect.asset index 4a83ad94..e2cbbaaf 100644 --- a/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_Bite_InstantEffect.asset +++ b/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_Bite_InstantEffect.asset @@ -15,7 +15,7 @@ MonoBehaviour: tags: - {fileID: 11400000, guid: 4e6f036fb4aad9b428694360fcc62f88, type: 2} influencingStats: [] - baseValue: 200 + baseValue: 20000 AlliedTargetMultiplier: 1 EnemyTargetMultiplier: 1 applyToClassResourceInstead: 0 diff --git a/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_MeteorShower_BurnEffect.asset b/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_MeteorShower_BurnEffect.asset index 19af9d7c..d5ad9357 100644 --- a/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_MeteorShower_BurnEffect.asset +++ b/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_MeteorShower_BurnEffect.asset @@ -19,6 +19,6 @@ MonoBehaviour: duration: 3 applyToTargetsHit: 1 applyToSelf: 0 - baseDamagePerTick: 5 + baseDamagePerTick: 100 tickRate: 1 damageType: 0 diff --git a/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_MeteorShower_InstantTickEffect.asset b/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_MeteorShower_InstantTickEffect.asset index 600751bc..6ba4c6a4 100644 --- a/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_MeteorShower_InstantTickEffect.asset +++ b/Assets/Scriptables/Data/Effects/Debug/NPC/--Dragons/SunDragon/SunDragon_MeteorShower_InstantTickEffect.asset @@ -15,7 +15,7 @@ MonoBehaviour: tags: - {fileID: 11400000, guid: 4e6f036fb4aad9b428694360fcc62f88, type: 2} influencingStats: [] - baseValue: 25 + baseValue: 1000 AlliedTargetMultiplier: 1 EnemyTargetMultiplier: 1 applyToClassResourceInstead: 0 diff --git a/Assets/Scripts/Difficulty/GameDifficultyController.cs b/Assets/Scripts/Difficulty/GameDifficultyController.cs index 71f56cb8..ca1752b1 100644 --- a/Assets/Scripts/Difficulty/GameDifficultyController.cs +++ b/Assets/Scripts/Difficulty/GameDifficultyController.cs @@ -113,7 +113,7 @@ public class GameDifficultyController : MonoBehaviour, IPunObservable public int GetCurrentDifficultyLevel() { - return (currentDifficultyIndex + 1); + return currentDifficultyIndex; } public void InitializeDifficultyLevel() diff --git a/Assets/Scripts/Drops/DropTable.cs b/Assets/Scripts/Drops/DropTable.cs index 46cda36a..7cfb50a3 100644 --- a/Assets/Scripts/Drops/DropTable.cs +++ b/Assets/Scripts/Drops/DropTable.cs @@ -38,7 +38,7 @@ public class DropTable : MonoBehaviour public bool CalculateLootDrop() { - return Random.Range(0, 100) < (extraDropChance + 10 * GameDifficultyController.Instance.GetCurrentDifficultyLevel()); + return Random.Range(0, 100) < (extraDropChance * (1 + GameConstants.GameBalancing.IncreasedItemDropBasedOnDifficultyMultiplier * GameDifficultyController.Instance.GetCurrentDifficultyLevel())); } public void DropLoot(bool lootDrop) @@ -49,7 +49,7 @@ public class DropTable : MonoBehaviour instantiatedCoinDrop = Instantiate(coinPrefab, spawnPosition, this.transform.rotation); coinDrop = instantiatedCoinDrop.GetComponent(); - finalCoinAmount = coinAmount * GameDifficultyController.Instance.GetCurrentDifficultyLevel(); + finalCoinAmount = Mathf.RoundToInt(coinAmount * (1 + GameConstants.GameBalancing.IncreasedCoinDropBasedOnDifficultyMultiplier * GameDifficultyController.Instance.GetCurrentDifficultyLevel())); coinDrop.Init(finalCoinAmount); diff --git a/Assets/Scripts/Game/GameConstants.cs b/Assets/Scripts/Game/GameConstants.cs index 39a024bf..7552b1af 100644 --- a/Assets/Scripts/Game/GameConstants.cs +++ b/Assets/Scripts/Game/GameConstants.cs @@ -63,6 +63,17 @@ public static class GameConstants public static class CharacterBalancing { + public const float BaseMaxHealthGrowthPerLevel = 0.2f; + + public const float VitalityToHealthRate = 10f; + public const float IntelligenceToManaRate = 2f; + + public const float BonusStrengthToFlatRegenRate = 0.5f; + public const float BonusVitalityToPercentRegenRate = 0.01f; + + public const float BonusSpiritToFlatRegenRate = 0.5f; + public const float BonusSpiritToPercentRegenRate = 0.01f; + public const int StatPointsPerLevel = 1; public const float SoloCheatDeathHealthPercent = 0.5f; @@ -79,6 +90,9 @@ public static class GameConstants } public static class GameBalancing { + public const float IncreasedCoinDropBasedOnDifficultyMultiplier = 1f; + public const float IncreasedItemDropBasedOnDifficultyMultiplier = 1f; + public const float MinimumFindFishWaitTime = 2.5f; public const float MaximumFindFishWaitTime = 4f; diff --git a/Assets/Scripts/Health.cs b/Assets/Scripts/Health.cs index 12058a26..abd0deae 100644 --- a/Assets/Scripts/Health.cs +++ b/Assets/Scripts/Health.cs @@ -154,7 +154,7 @@ public class Health : Resource public virtual void CalculateMaxValueBasedOnStat() { - maxValue = baseMaxValue + character.Vitality.Value * 10f; + maxValue = baseMaxValue + character.Vitality.Value * GameConstants.CharacterBalancing.VitalityToHealthRate; CalculateRegenValueBasedOnStat(); @@ -162,8 +162,8 @@ public class Health : Resource } public void CalculateRegenValueBasedOnStat() { - flatRegen = baseFlatRegen + (character.Strength.Value - character.Strength.BaseValue) * 0.5f; - percentRegen = (character.Vitality.Value - character.Vitality.BaseValue) * 0.01f; + flatRegen = baseFlatRegen + (character.Strength.Value - character.Strength.BaseValue) * GameConstants.CharacterBalancing.BonusStrengthToFlatRegenRate; + percentRegen = (character.Vitality.Value - character.Vitality.BaseValue) * GameConstants.CharacterBalancing.BonusVitalityToPercentRegenRate; //Debug.Log(this.gameObject.name + " regens health " + flatRegen + " " + percentRegen + " = " + flatRegen + (maxValue * percentRegen / 100f)); } diff --git a/Assets/Scripts/Mana.cs b/Assets/Scripts/Mana.cs index 00bbe4ab..e7f89e29 100644 --- a/Assets/Scripts/Mana.cs +++ b/Assets/Scripts/Mana.cs @@ -87,7 +87,7 @@ public class Mana : Resource public void CalculateMaxValueBasedOnStat() { - maxValue = baseMaxValue + character.Intelligence.Value * 10f; + maxValue = baseMaxValue + character.Intelligence.Value * GameConstants.CharacterBalancing.IntelligenceToManaRate; CalculateRegenValueBasedOnStat(); @@ -95,8 +95,8 @@ public class Mana : Resource } public void CalculateRegenValueBasedOnStat() { - flatRegen = baseFlatRegen + (character.Spirit.Value - character.Spirit.BaseValue) * 0.5f; - percentRegen = (character.Spirit.Value - character.Spirit.BaseValue) * 0.01f; + flatRegen = baseFlatRegen + (character.Spirit.Value - character.Spirit.BaseValue) * GameConstants.CharacterBalancing.BonusSpiritToFlatRegenRate; + percentRegen = (character.Spirit.Value - character.Spirit.BaseValue) * GameConstants.CharacterBalancing.BonusSpiritToPercentRegenRate; } public override void SetMaxValue(float value) diff --git a/Assets/Scripts/PlayerResources/PlayerHealth.cs b/Assets/Scripts/PlayerResources/PlayerHealth.cs index 5ddf858a..34627d7b 100644 --- a/Assets/Scripts/PlayerResources/PlayerHealth.cs +++ b/Assets/Scripts/PlayerResources/PlayerHealth.cs @@ -5,19 +5,21 @@ using UnityEngine; public class PlayerHealth : Health { + int currentLevel; protected override void Awake() { base.Awake(); } - /*public override void CalculateMaxValueBasedOnStat() + public override void CalculateMaxValueBasedOnStat() { - maxValue = baseMaxValue + character.Vitality.Value * 10f; + currentLevel = ((PlayerCharacterStats)character).level.currentLevel - 1; - maxValue *= ((((PlayerCharacterStats)character).level.currentLevel - 1) * 0.2f); + maxValue = (baseMaxValue + (baseMaxValue * currentLevel * GameConstants.CharacterBalancing.BaseMaxHealthGrowthPerLevel)) + character.Vitality.Value * GameConstants.CharacterBalancing.VitalityToHealthRate; CalculateRegenValueBasedOnStat(); onMaxHealthChanged.Invoke(maxValue); - }*/ + } + } diff --git a/Assets/Scripts/RiftSystem/ZoneData/JobInstance.cs b/Assets/Scripts/RiftSystem/ZoneData/JobInstance.cs index de00acdf..77c1141e 100644 --- a/Assets/Scripts/RiftSystem/ZoneData/JobInstance.cs +++ b/Assets/Scripts/RiftSystem/ZoneData/JobInstance.cs @@ -45,9 +45,9 @@ public class JobInstance public void UpdateRewardsBasedOnTemplateAndDifficulty(JobTemplate usedTemplate) { - coinReward = Mathf.RoundToInt(usedTemplate.baseCoinReward + usedTemplate.baseCoinReward * usedTemplate.percentCoinReward * (GameDifficultyController.Instance.GetCurrentDifficultyLevel() - 1)); - experienceReward = usedTemplate.baseExperienceFinalReward + usedTemplate.baseExperienceFinalReward * usedTemplate.percentExperienceFinalReward * (GameDifficultyController.Instance.GetCurrentDifficultyLevel() - 1); - reputationReward = usedTemplate.baseReputationFinalReward + usedTemplate.baseReputationFinalReward * usedTemplate.percentReputationFinalReward * (GameDifficultyController.Instance.GetCurrentDifficultyLevel() - 1); + coinReward = Mathf.RoundToInt(usedTemplate.baseCoinReward + usedTemplate.baseCoinReward * usedTemplate.percentCoinReward * GameDifficultyController.Instance.GetCurrentDifficultyLevel()); + experienceReward = usedTemplate.baseExperienceFinalReward + usedTemplate.baseExperienceFinalReward * usedTemplate.percentExperienceFinalReward * GameDifficultyController.Instance.GetCurrentDifficultyLevel(); + reputationReward = usedTemplate.baseReputationFinalReward + usedTemplate.baseReputationFinalReward * usedTemplate.percentReputationFinalReward * GameDifficultyController.Instance.GetCurrentDifficultyLevel(); } public JobInstance() diff --git a/Assets/Scripts/UI/ClassResourceUIManager.cs b/Assets/Scripts/UI/ClassResourceUIManager.cs index a5f30d73..a3281b4b 100644 --- a/Assets/Scripts/UI/ClassResourceUIManager.cs +++ b/Assets/Scripts/UI/ClassResourceUIManager.cs @@ -26,6 +26,11 @@ public class ClassResourceUIManager : MonoBehaviour { if (!photonView.Owner.IsLocal) return; + for (int i = 0; i < uiElements.Count; i++) + { + uiElements[i].gameObject.SetActive(false); + } + player = photonView.GetComponent(); localClassResource = photonView.GetComponent(); diff --git a/Assets/Scripts/UI/PartyFramesController.cs b/Assets/Scripts/UI/PartyFramesController.cs index e802097f..2d896fd4 100644 --- a/Assets/Scripts/UI/PartyFramesController.cs +++ b/Assets/Scripts/UI/PartyFramesController.cs @@ -85,6 +85,7 @@ public class PartyFramesController : MonoBehaviour if (riftPlayer.classTag == classTags[i]) { partyFrameButtons[photonView.Owner].button.image.sprite = classImages[i]; + partyFrameButtons[photonView.Owner].playerName.text = photonView.Owner.NickName; partyVoteFrames[photonView.Owner].avatarIcon.sprite = classImages[i]; partyVoteFrames[photonView.Owner].votedCheck.gameObject.SetActive(false); } diff --git a/Assets/SharpUI.meta b/Assets/SharpUI.meta new file mode 100644 index 00000000..9b7d36c8 --- /dev/null +++ b/Assets/SharpUI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 969f9b9cc76d70548904b3db7bbe0cf6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Documentation.meta b/Assets/SharpUI/Documentation.meta new file mode 100644 index 00000000..e4ed8afe --- /dev/null +++ b/Assets/SharpUI/Documentation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5a9ff3dbbd3454d06a08ac8c275cc144 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Documentation/SharpUI_Documentation.pdf b/Assets/SharpUI/Documentation/SharpUI_Documentation.pdf new file mode 100644 index 00000000..0fe2c70b Binary files /dev/null and b/Assets/SharpUI/Documentation/SharpUI_Documentation.pdf differ diff --git a/Assets/SharpUI/Documentation/SharpUI_Documentation.pdf.meta b/Assets/SharpUI/Documentation/SharpUI_Documentation.pdf.meta new file mode 100644 index 00000000..d1287576 --- /dev/null +++ b/Assets/SharpUI/Documentation/SharpUI_Documentation.pdf.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bcd9b9558baeb480e87285b8078c5e71 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs.meta b/Assets/SharpUI/Libs.meta new file mode 100644 index 00000000..9c83190c --- /dev/null +++ b/Assets/SharpUI/Libs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ff456ad5c6df4ae8a26fada82aa2e26e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/CastleCore.meta b/Assets/SharpUI/Libs/CastleCore.meta new file mode 100644 index 00000000..c0b5aec2 --- /dev/null +++ b/Assets/SharpUI/Libs/CastleCore.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b09b05eae58f346de998d05e49e486e1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/CastleCore/Castle.Core.dll b/Assets/SharpUI/Libs/CastleCore/Castle.Core.dll new file mode 100644 index 00000000..dbc4b29d Binary files /dev/null and b/Assets/SharpUI/Libs/CastleCore/Castle.Core.dll differ diff --git a/Assets/SharpUI/Libs/CastleCore/Castle.Core.dll.meta b/Assets/SharpUI/Libs/CastleCore/Castle.Core.dll.meta new file mode 100644 index 00000000..b3f46c6a --- /dev/null +++ b/Assets/SharpUI/Libs/CastleCore/Castle.Core.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 05d40665a16df4977b88de7cff5f67a7 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/CastleCore/LICENSE.txt b/Assets/SharpUI/Libs/CastleCore/LICENSE.txt new file mode 100644 index 00000000..ebb9ac9f --- /dev/null +++ b/Assets/SharpUI/Libs/CastleCore/LICENSE.txt @@ -0,0 +1,13 @@ +Copyright 2004-2016 Castle Project - http://www.castleproject.org/ + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/Assets/SharpUI/Libs/CastleCore/LICENSE.txt.meta b/Assets/SharpUI/Libs/CastleCore/LICENSE.txt.meta new file mode 100644 index 00000000..c0c295b2 --- /dev/null +++ b/Assets/SharpUI/Libs/CastleCore/LICENSE.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ed47f68a5afc34caf8c94b94dcd91e88 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/CastleCore/README.md b/Assets/SharpUI/Libs/CastleCore/README.md new file mode 100644 index 00000000..ca198265 --- /dev/null +++ b/Assets/SharpUI/Libs/CastleCore/README.md @@ -0,0 +1,75 @@ +# Castle Core + + + +Castle Core provides common Castle Project abstractions including logging services. It also features **Castle DynamicProxy** a lightweight runtime proxy generator, and **Castle DictionaryAdapter**. + +See the [documentation](docs/README.md). + +## Releases + +[![NuGet](https://img.shields.io/nuget/v/Castle.Core.svg)](https://www.nuget.org/packages/Castle.Core/) + +See the [Releases](https://github.com/castleproject/Core/releases). + +Debugging symbols are available in symbol packages in the AppVeyor build artifacts since version 4.1.0. For example, [here are the artifacts for 4.1.0](https://ci.appveyor.com/project/castleproject/core/build/4.1.0/artifacts). + +## License + +Castle Core is © 2004-2020 Castle Project. It is free software, and may be redistributed under the terms of the [Apache 2.0](http://opensource.org/licenses/Apache-2.0) license. + +## Contributing + +Browse the [contributing section](https://github.com/castleproject/Home#its-community-driven) of our _Home_ repository to get involved. + +## Building + +| Platforms | Build Status | NuGet Feed | +|-----------------|-------------:|------------| +| Windows & Linux | [![Build status](https://ci.appveyor.com/api/projects/status/49a6i0ydiku56r5b/branch/master?svg=true)](https://ci.appveyor.com/project/castleproject/core/branch/master) | [Preview Feed](https://ci.appveyor.com/nuget/core-0mhe40ifodk8) + +### On Windows + +``` +build.cmd +``` + +Compilation requires an up-to-date .NET Core SDK and MSBuild 15+ (which should be included in the former). + +Running the unit tests additionally requires the .NET Framework 4.6.1+ as well as the .NET Core 3.1 runtime to be installed. + +Most of these requirements should be covered by Visual Studio 2019. + +### On Linux + +``` +./build.sh +``` + +Compilation requires an up-to-date .NET Core SDK. + +Running the unit tests additionally requires the .NET Core 3.1 runtime to be installed, as well as either Docker or Mono. For the latter, we recommend Mono 5.10+, though older versions (4.6.1+) might still work as well. + +:information_source: **Mono runtime support:** Castle Core runs with minor limitations and defects on Mono 4.0.2+ (however 4.6.1+ is highly recommended, or 5.10+ if your code uses new C# 7.x language features such as `in` parameters). + +We test against up-to-date Mono versions in order to fix known defects as soon as possible. Because of this, if you are using an older Mono version than our Continuous Integration (CI) build, you might see some unit tests fail. + +For known Mono defects, check [our issue tracker](https://github.com/castleproject/Core/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20mono), as well as unit tests marked with `[ExcludeOnFramework(Framework.Mono, ...)]` in the source code. + +### Conditional Compilation Symbols + +The following conditional compilation symbols (vertical) are currently defined for each of the build configurations (horizontal): + +Symbol | .NET 4.5 | .NET Standard 2.x +----------------------------------- | ------------------ | ------------------ +`FEATURE_APPDOMAIN` | :white_check_mark: | :no_entry_sign: +`FEATURE_ASSEMBLYBUILDER_SAVE` | :white_check_mark: | :no_entry_sign: +`FEATURE_SERIALIZATION` | :white_check_mark: | :no_entry_sign: +`FEATURE_SYSTEM_CONFIGURATION` | :white_check_mark: | :no_entry_sign: +--- | | +`DOTNET45` | :white_check_mark: | :no_entry_sign: + +* `FEATURE_APPDOMAIN` - enables support for features that make use of an AppDomain in the host. +* `FEATURE_ASSEMBLYBUILDER_SAVE` - enabled support for saving the dynamically generated proxy assembly. +* `FEATURE_SERIALIZATION` - enables support for serialization of dynamic proxies and other types. +* `FEATURE_SYSTEM_CONFIGURATION` - enables features that use System.Configuration and the ConfigurationManager. diff --git a/Assets/SharpUI/Libs/CastleCore/README.md.meta b/Assets/SharpUI/Libs/CastleCore/README.md.meta new file mode 100644 index 00000000..489db119 --- /dev/null +++ b/Assets/SharpUI/Libs/CastleCore/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 545f3bf8480dd4329ada00f6e347b28d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/NSubstitute.meta b/Assets/SharpUI/Libs/NSubstitute.meta new file mode 100644 index 00000000..44f62ac2 --- /dev/null +++ b/Assets/SharpUI/Libs/NSubstitute.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f2a9abaf2c5090479d89acbf36fee47 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/NSubstitute/LICENSE.txt b/Assets/SharpUI/Libs/NSubstitute/LICENSE.txt new file mode 100644 index 00000000..14f2ea66 --- /dev/null +++ b/Assets/SharpUI/Libs/NSubstitute/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2009 Anthony Egerton (nsubstitute@delfish.com) and David Tchepak (dave@davesquared.net) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[ https://www.opensource.org/licenses/bsd-license.php ] \ No newline at end of file diff --git a/Assets/SharpUI/Libs/NSubstitute/LICENSE.txt.meta b/Assets/SharpUI/Libs/NSubstitute/LICENSE.txt.meta new file mode 100644 index 00000000..49493a30 --- /dev/null +++ b/Assets/SharpUI/Libs/NSubstitute/LICENSE.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3840781da155d412a8a32efcfd11b085 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/NSubstitute/NSubstitute.dll b/Assets/SharpUI/Libs/NSubstitute/NSubstitute.dll new file mode 100644 index 00000000..20be198a Binary files /dev/null and b/Assets/SharpUI/Libs/NSubstitute/NSubstitute.dll differ diff --git a/Assets/SharpUI/Libs/NSubstitute/NSubstitute.dll.meta b/Assets/SharpUI/Libs/NSubstitute/NSubstitute.dll.meta new file mode 100644 index 00000000..d80c1606 --- /dev/null +++ b/Assets/SharpUI/Libs/NSubstitute/NSubstitute.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: d0424a22acb2446838f5d5fbeff0c3be +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/NSubstitute/README.md b/Assets/SharpUI/Libs/NSubstitute/README.md new file mode 100644 index 00000000..dc6ff07a --- /dev/null +++ b/Assets/SharpUI/Libs/NSubstitute/README.md @@ -0,0 +1,139 @@ +NSubstitute +======== +[![Build status](https://ci.appveyor.com/api/projects/status/ipe7ephhy6f9bbgp/branch/master?svg=true)](https://ci.appveyor.com/project/NSubstitute/nsubstitute/branch/master) [![Travis Build Status](https://travis-ci.com/nsubstitute/NSubstitute.svg?branch=master)](https://travis-ci.com/nsubstitute/NSubstitute) +[![Nuget](https://img.shields.io/nuget/v/NSubstitute.svg)](https://www.nuget.org/packages/NSubstitute) + +Visit the [NSubstitute website](https://nsubstitute.github.io) for more information. + +### What is it? + +NSubstitute is designed as a friendly substitute for .NET mocking libraries. + +It is an attempt to satisfy our craving for a mocking library with a succinct syntax that helps us keep the focus on the intention of our tests, rather than on the configuration of our test doubles. We've tried to make the most frequently required operations obvious and easy to use, keeping less usual scenarios discoverable and accessible, and all the while maintaining as much natural language as possible. + +Perfect for those new to testing, and for others who would just like to to get their tests written with less noise and fewer lambdas. + +### Installation + +* [NSubstitute package](https://nuget.org/List/Packages/NSubstitute) +* Optional Roslyn analysers (recommended): + * For C# projects: [NSubstitute.Analyzers.CSharp](https://www.nuget.org/packages/NSubstitute.Analyzers.CSharp/) + * For VB projects: [NSubstitute.Analyzers.VisualBasic](https://www.nuget.org/packages/NSubstitute.Analyzers.VisualBasic/) + +### Getting help + +If you have questions, feature requests or feedback on NSubstitute please [raise an issue](https://github.com/nsubstitute/NSubstitute/issues) on our project site. All questions are welcome via our project site, but for "how-to"-style questions you can also try [StackOverflow with the \[nsubstitute\] tag](https://stackoverflow.com/tags/nsubstitute), which often leads to very good answers from the larger programming community. StackOverflow is especially useful if your question also relates to other libraries that our team may not be as familiar with (e.g. NSubstitute with Entity Framework). You can also head on over to the [NSubstitute discussion group](https://groups.google.com/group/nsubstitute) if you prefer. + +### Basic use + +Let's say we have a basic calculator interface: + +```csharp +public interface ICalculator +{ + int Add(int a, int b); + string Mode { get; set; } + event Action PoweringUp; +} +``` + + +We can ask NSubstitute to create a substitute instance for this type. We could ask for a stub, mock, fake, spy, test double etc., but why bother when we just want to substitute an instance we have some control over? + +```csharp +_calculator = Substitute.For(); +``` + +⚠️ **Note**: NSubstitute will only work properly with interfaces or with `virtual` members of classes. Be careful substituting for classes with non-virtual members. See [Creating a substitute](https://nsubstitute.github.io/help/creating-a-substitute/#substituting_infrequently_and_carefully_for_classes) for more information. + +Now we can tell our substitute to return a value for a call: + +```csharp +_calculator.Add(1, 2).Returns(3); +Assert.That(_calculator.Add(1, 2), Is.EqualTo(3)); +``` + +We can check that our substitute received a call, and did not receive others: + +```csharp +_calculator.Add(1, 2); +_calculator.Received().Add(1, 2); +_calculator.DidNotReceive().Add(5, 7); +``` + +If our Received() assertion fails, NSubstitute tries to give us some help as to what the problem might be: + + + NSubstitute.Exceptions.ReceivedCallsException : Expected to receive a call matching: + Add(1, 2) + Actually received no matching calls. + Received 2 non-matching calls (non-matching arguments indicated with '*' characters): + Add(1, *5*) + Add(*4*, *7*) + +We can also work with properties using the Returns syntax we use for methods, or just stick with plain old property setters (for read/write properties): + +```csharp +_calculator.Mode.Returns("DEC"); +Assert.That(_calculator.Mode, Is.EqualTo("DEC")); + +_calculator.Mode = "HEX"; +Assert.That(_calculator.Mode, Is.EqualTo("HEX")); +``` + +NSubstitute supports argument matching for setting return values and asserting a call was received: + +```csharp +_calculator.Add(10, -5); +_calculator.Received().Add(10, Arg.Any()); +_calculator.Received().Add(10, Arg.Is(x => x < 0)); +``` + +We can use argument matching as well as passing a function to Returns() to get some more behaviour out of our substitute (possibly too much, but that's your call): + +```csharp +_calculator + .Add(Arg.Any(), Arg.Any()) + .Returns(x => (int)x[0] + (int)x[1]); +Assert.That(_calculator.Add(5, 10), Is.EqualTo(15)); +``` + +Returns() can also be called with multiple arguments to set up a sequence of return values. + +```csharp +_calculator.Mode.Returns("HEX", "DEC", "BIN"); +Assert.That(_calculator.Mode, Is.EqualTo("HEX")); +Assert.That(_calculator.Mode, Is.EqualTo("DEC")); +Assert.That(_calculator.Mode, Is.EqualTo("BIN")); +``` + +Finally, we can raise events on our substitutes (unfortunately C# dramatically restricts the extent to which this syntax can be cleaned up): + +```csharp +bool eventWasRaised = false; +_calculator.PoweringUp += () => eventWasRaised = true; + +_calculator.PoweringUp += Raise.Event(); +Assert.That(eventWasRaised); +``` + +### Building + +NSubstitute and its tests can be compiled and run using Visual Studio and Visual Studio for Mac. Note that some tests are marked `[Pending]` and are not meant to pass at present, so it is a good idea to exclude tests in the Pending category from test runs. + +There are also build scripts in the `./build` directory for command line builds, and CI configurations in the project root. + +To do [full builds](https://github.com/nsubstitute/NSubstitute/wiki/Release-procedure) you'll also need Ruby, as the jekyll gem is used to generate the website. + +### Other libraries you may be interested in + +* [Moq](https://github.com/Moq/moq4/wiki/Quickstart): the original Arrange-Act-Assert mocking library for .NET, and a big source of inspiration for NSubstitute. +* [FakeItEasy](https://fakeiteasy.github.io/): another modern mocking library for .NET. If you're not sold on NSubstitute's syntax, try FIE! +* [substitute.js](https://github.com/ffMathy/FluffySpoon.JavaScript.Testing): a mocking library for TypeScript inspired by NSubstitute's syntax (`@fluffy-spoon/substitute` on NPM) + diff --git a/Assets/SharpUI/Libs/NSubstitute/README.md.meta b/Assets/SharpUI/Libs/NSubstitute/README.md.meta new file mode 100644 index 00000000..afb87e3a --- /dev/null +++ b/Assets/SharpUI/Libs/NSubstitute/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dc1af6fd0fd26463d99216e1a91a0160 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Libs/System.Threading.Tasks.Extensions.dll b/Assets/SharpUI/Libs/System.Threading.Tasks.Extensions.dll new file mode 100644 index 00000000..a1234ce8 Binary files /dev/null and b/Assets/SharpUI/Libs/System.Threading.Tasks.Extensions.dll differ diff --git a/Assets/SharpUI/Libs/System.Threading.Tasks.Extensions.dll.meta b/Assets/SharpUI/Libs/System.Threading.Tasks.Extensions.dll.meta new file mode 100644 index 00000000..7a71f036 --- /dev/null +++ b/Assets/SharpUI/Libs/System.Threading.Tasks.Extensions.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 961bcc8c47c714b62bb63b7ac96114e7 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs.meta b/Assets/SharpUI/Prefabs.meta new file mode 100644 index 00000000..9eee7b0f --- /dev/null +++ b/Assets/SharpUI/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a75139a911673944ca82382563cffcb7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI.meta b/Assets/SharpUI/Prefabs/UI.meta new file mode 100644 index 00000000..75faa412 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dee79751ef3c71949bce84845fc81968 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Button.meta b/Assets/SharpUI/Prefabs/UI/Button.meta new file mode 100644 index 00000000..01eaac0a --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 72a7e7af465e863489319ed9ba6974bf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Button/ActionBarButton.prefab b/Assets/SharpUI/Prefabs/UI/Button/ActionBarButton.prefab new file mode 100644 index 00000000..2a5200b7 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/ActionBarButton.prefab @@ -0,0 +1,1228 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2093719101363490062 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719101363490063} + - component: {fileID: 2093719101363490061} + - component: {fileID: 2093719101363490060} + m_Layer: 5 + m_Name: AbilityContainer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719101363490063 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101363490062} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1550495965612559015} + - {fileID: 2093719102089307966} + - {fileID: 2093719101541866599} + m_Father: {fileID: 2093719103163087761} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -8, y: -8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719101363490061 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101363490062} + m_CullTransparentMesh: 0 +--- !u!114 &2093719101363490060 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101363490062} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.6981132, g: 0.6981132, b: 0.6981132, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 4 +--- !u!1 &2093719101541866598 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719101541866599} + - component: {fileID: 2093719101541866597} + - component: {fileID: 2093719101541866596} + - component: {fileID: 2093719101541866594} + - component: {fileID: 4110919526173911662} + m_Layer: 5 + m_Name: AbilityIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719101541866599 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101541866598} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719101363490063} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -6.799999, y: -6.799999} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719101541866597 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101541866598} + m_CullTransparentMesh: 0 +--- !u!114 &2093719101541866596 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101541866598} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e30d7baabfb292c4f9687033f726d8a4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2093719101541866594 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101541866598} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 0.6698113, g: 0.6698113, b: 0.6698113, a: 1} + selectedColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + hoverColor: {r: 0.8207547, g: 0.8207547, b: 0.8207547, a: 1} +--- !u!114 &4110919526173911662 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101541866598} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c9a508816d3b43409c607a07028be87f, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + scaleType: 0 + decoratorMode: 0 + defaultScale: 1 + activeScale: 0.98 +--- !u!1 &2093719101545732195 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719101545732192} + - component: {fileID: 2093719101545732206} + - component: {fileID: 2093719101545732193} + m_Layer: 5 + m_Name: CooldownText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &2093719101545732192 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101545732195} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719103343812328} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719101545732206 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101545732195} + m_CullTransparentMesh: 0 +--- !u!114 &2093719101545732193 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101545732195} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 12s + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4293326328 + m_fontColor: {r: 0.9716981, g: 0.9602146, b: 0.9029459, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 33 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 2093719101545732193} + characterCount: 3 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &2093719101671810780 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719101671810781} + - component: {fileID: 2093719101671810779} + - component: {fileID: 2093719101671810778} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719101671810781 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101671810780} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719103163087761} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -6, y: -6} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719101671810779 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101671810780} + m_CullTransparentMesh: 0 +--- !u!114 &2093719101671810778 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101671810780} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.4433962, g: 0.4433962, b: 0.4433962, a: 0.2} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2093719101933508057 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719101933508038} + - component: {fileID: 2093719101933508036} + - component: {fileID: 2093719101933508039} + m_Layer: 5 + m_Name: CooldownFill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &2093719101933508038 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101933508057} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719103343812328} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719101933508036 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101933508057} + m_CullTransparentMesh: 0 +--- !u!114 &2093719101933508039 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719101933508057} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.9019608} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 0.813 + m_FillClockwise: 0 + m_FillOrigin: 2 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2093719102089307953 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719102089307966} + - component: {fileID: 2093719102089307964} + - component: {fileID: 2093719102089307967} + m_Layer: 5 + m_Name: AbilityIconBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719102089307966 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102089307953} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719101363490063} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -6.799999, y: -6.799999} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719102089307964 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102089307953} + m_CullTransparentMesh: 0 +--- !u!114 &2093719102089307967 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102089307953} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.14328942, g: 0.21814556, b: 0.26415092, a: 0.8} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2093719102232258971 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719102232258968} + - component: {fileID: 2093719102232258950} + - component: {fileID: 2093719102232258969} + m_Layer: 5 + m_Name: TextBottomLeft + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719102232258968 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102232258971} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719103163087761} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -8, y: -8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719102232258950 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102232258971} + m_CullTransparentMesh: 0 +--- !u!114 &2093719102232258969 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102232258971} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Bot + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4292469479 + m_fontColor: {r: 0.9056604, g: 0.88439006, b: 0.8501246, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 16 + m_fontSizeBase: 16 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 1025 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 6, y: 0, z: 6, w: 3} + m_textInfo: + textComponent: {fileID: 2093719102232258969} + characterCount: 3 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &2093719102835036881 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719102835036894} + - component: {fileID: 2093719102835036892} + - component: {fileID: 2093719102835036895} + m_Layer: 5 + m_Name: TextTopRight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719102835036894 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102835036881} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719103163087761} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -8, y: -8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719102835036892 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102835036881} + m_CullTransparentMesh: 0 +--- !u!114 &2093719102835036895 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102835036881} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Top + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4292469479 + m_fontColor: {r: 0.9056604, g: 0.88439006, b: 0.8501246, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 16 + m_fontSizeBase: 16 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 260 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 6, y: 3, z: 6, w: 0} + m_textInfo: + textComponent: {fileID: 2093719102835036895} + characterCount: 3 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &2093719102911844180 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719102911844181} + - component: {fileID: 2093719102911844179} + - component: {fileID: 2093719102911844178} + m_Layer: 5 + m_Name: BackgroundFrame + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719102911844181 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102911844180} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719103163087761} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719102911844179 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102911844180} + m_CullTransparentMesh: 0 +--- !u!114 &2093719102911844178 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719102911844180} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.39, g: 0.39, b: 0.39, a: 0.8} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 3 +--- !u!1 &2093719103163087760 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719103163087761} + - component: {fileID: 2093719103163087775} + - component: {fileID: 2093719103163087772} + - component: {fileID: 2093719103163087774} + m_Layer: 5 + m_Name: ActionBarButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719103163087761 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719103163087760} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2093719101671810781} + - {fileID: 2093719102911844181} + - {fileID: 2093719101363490063} + - {fileID: 2093719102232258968} + - {fileID: 2093719102835036894} + - {fileID: 2093719103343812328} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 74, y: 74} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719103163087775 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719103163087760} + m_CullTransparentMesh: 0 +--- !u!114 &2093719103163087772 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719103163087760} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 0} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2093719103163087774 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719103163087760} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 004184e198fa473489a2376582ec2309, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 0 + isSelected: 0 + iconImage: {fileID: 2093719101541866596} + cooldownFillImage: {fileID: 2093719101933508039} + cooldownText: {fileID: 2093719101545732193} + topText: {fileID: 2093719102835036895} + bottomText: {fileID: 2093719102232258969} + fillMethod: 4 + canOverrideCooldown: 0 +--- !u!1 &2093719103343812331 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093719103343812328} + - component: {fileID: 2093719103343812246} + - component: {fileID: 2093719103343812329} + m_Layer: 5 + m_Name: CooldownOverlay + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2093719103343812328 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719103343812331} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2093719101933508038} + - {fileID: 2093719101545732192} + m_Father: {fileID: 2093719103163087761} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -15, y: -15} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2093719103343812246 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719103343812331} + m_CullTransparentMesh: 0 +--- !u!114 &2093719103343812329 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093719103343812331} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.8} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2965049454893769463 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1550495965612559015} + - component: {fileID: 3379508086037290115} + - component: {fileID: 5862742491571719109} + - component: {fileID: 8289197469990621812} + m_Layer: 5 + m_Name: AbilityIconFrame + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1550495965612559015 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2965049454893769463} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2093719101363490063} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3379508086037290115 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2965049454893769463} + m_CullTransparentMesh: 0 +--- !u!114 &5862742491571719109 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2965049454893769463} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.6981132, g: 0.6981132, b: 0.6981132, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 4 +--- !u!114 &8289197469990621812 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2965049454893769463} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c9a508816d3b43409c607a07028be87f, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + scaleType: 0 + decoratorMode: 0 + defaultScale: 1 + activeScale: 0.96 diff --git a/Assets/SharpUI/Prefabs/UI/Button/ActionBarButton.prefab.meta b/Assets/SharpUI/Prefabs/UI/Button/ActionBarButton.prefab.meta new file mode 100644 index 00000000..d7fbcec9 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/ActionBarButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1d55b9ddd958f1b4d91e4ac5305410cb +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Button/ArrowButton.prefab b/Assets/SharpUI/Prefabs/UI/Button/ArrowButton.prefab new file mode 100644 index 00000000..211d7278 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/ArrowButton.prefab @@ -0,0 +1,154 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2706427404842019701 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2706427404842019706} + - component: {fileID: 2706427404842019711} + - component: {fileID: 2706427404842019710} + - component: {fileID: 2706427404842019705} + - component: {fileID: 2706427404842019704} + - component: {fileID: 2706427404842019707} + m_Layer: 5 + m_Name: ArrowButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2706427404842019706 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2706427404842019701} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 33, y: 65.5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2706427404842019711 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2706427404842019701} + m_CullTransparentMesh: 0 +--- !u!114 &2706427404842019710 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2706427404842019701} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 73b16d40ad0b2114ab7b1899ca96b714, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2706427404842019705 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2706427404842019701} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2706427404842019710} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2706427404842019704 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2706427404842019701} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb98c87ed3f24487ab7f939a7bee4b43, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 0 + isSelected: 0 +--- !u!114 &2706427404842019707 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2706427404842019701} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 0.894, g: 0.76332337, b: 0.481866, a: 1} + selectedColor: {r: 0.89411765, g: 0.7647059, b: 0.48235294, a: 1} + hoverColor: {r: 1, g: 0.94509804, b: 0.81960785, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/Button/ArrowButton.prefab.meta b/Assets/SharpUI/Prefabs/UI/Button/ArrowButton.prefab.meta new file mode 100644 index 00000000..e6bc885c --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/ArrowButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a40a4981420030447b6664817a46ebc5 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Button/IconButton.prefab b/Assets/SharpUI/Prefabs/UI/Button/IconButton.prefab new file mode 100644 index 00000000..94185980 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/IconButton.prefab @@ -0,0 +1,265 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &5288479832558942388 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5288479832558942389} + - component: {fileID: 5288479832558942391} + - component: {fileID: 5288479832558942390} + - component: {fileID: 5288479832558942392} + m_Layer: 5 + m_Name: IconImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5288479832558942389 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832558942388} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5288479832656351099} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -14, y: -14} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5288479832558942391 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832558942388} + m_CullTransparentMesh: 0 +--- !u!114 &5288479832558942390 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832558942388} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 72a5b884f12dfe04cbfb9b61a4c78532, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5288479832558942392 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832558942388} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 1, b: 1, a: 1} + selectedColor: {r: 1, g: 1, b: 1, a: 1} + hoverColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &5288479832656351098 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5288479832656351099} + - component: {fileID: 5288479832656351102} + - component: {fileID: 5288479832656351101} + - component: {fileID: 5288479832656351100} + - component: {fileID: 5288479832656351103} + - component: {fileID: 5288479832656351040} + - component: {fileID: 5288479832656351041} + m_Layer: 5 + m_Name: IconButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5288479832656351099 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832656351098} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5288479832558942389} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 80, y: 80} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5288479832656351102 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832656351098} + m_CullTransparentMesh: 0 +--- !u!114 &5288479832656351101 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832656351098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + m_Type: 0 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5288479832656351100 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832656351098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 5288479832656351101} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &5288479832656351103 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832656351098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8ee3b09d769841f6823e1585a54e4337, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 1 + isSelected: 0 + iconImage: {fileID: 5288479832558942390} +--- !u!114 &5288479832656351040 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832656351098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fffcae0ee53a4c80b40b7ca2a902c0fc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalSprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + disabledSprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + pressedSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} + selectedSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} + hoverSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} +--- !u!114 &5288479832656351041 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5288479832656351098} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 0.9, g: 0.8678571, b: 0.80357134, a: 1} + selectedColor: {r: 0.75, g: 0.72321427, b: 0.6696428, a: 1} + hoverColor: {r: 0.65, g: 0.6267857, b: 0.5803571, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/Button/IconButton.prefab.meta b/Assets/SharpUI/Prefabs/UI/Button/IconButton.prefab.meta new file mode 100644 index 00000000..77e41c75 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/IconButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4ae8a9d3a5de27648bee5528c5ec1e69 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Button/LinkButton.prefab b/Assets/SharpUI/Prefabs/UI/Button/LinkButton.prefab new file mode 100644 index 00000000..44bfd75e --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/LinkButton.prefab @@ -0,0 +1,236 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1901246923663269038 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1901246923663269039} + - component: {fileID: 1901246923663269034} + - component: {fileID: 1901246923663269033} + - component: {fileID: 1901246923663269032} + - component: {fileID: 8989373365172923708} + - component: {fileID: 6816670457396482515} + m_Layer: 5 + m_Name: LinkButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1901246923663269039 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901246923663269038} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1901246923663269034 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901246923663269038} + m_CullTransparentMesh: 0 +--- !u!114 &1901246923663269033 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901246923663269038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Link button + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288529888 + m_fontColor: {r: 0.8784314, g: 0.77254903, b: 0.6156863, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 1901246923663269033} + characterCount: 11 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &1901246923663269032 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901246923663269038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 0.92156863, g: 0.8980392, b: 0.8745098, a: 1} + m_HighlightedColor: {r: 1, g: 0.827451, b: 0.5882353, a: 1} + m_PressedColor: {r: 0.8773585, g: 0.68485993, b: 0.41798684, a: 1} + m_SelectedColor: {r: 0.92156863, g: 0.8980392, b: 0.8745098, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1901246923663269033} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &8989373365172923708 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901246923663269038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb98c87ed3f24487ab7f939a7bee4b43, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 1 + isSelected: 0 +--- !u!114 &6816670457396482515 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901246923663269038} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.8784314, g: 0.77254903, b: 0.6156863, a: 1} + disabledColor: {r: 0.8784314, g: 0.77254903, b: 0.6156863, a: 0.5019608} + pressedColor: {r: 0.8784314, g: 0.54901963, b: 0.08627451, a: 1} + selectedColor: {r: 0.8784314, g: 0.60784316, b: 0.21960784, a: 1} + hoverColor: {r: 0.8784314, g: 0.69411767, b: 0.4392157, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/Button/LinkButton.prefab.meta b/Assets/SharpUI/Prefabs/UI/Button/LinkButton.prefab.meta new file mode 100644 index 00000000..1eede50e --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/LinkButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b30c8e27fbb8f894d8b46b4e2366cb58 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Button/RectButton.prefab b/Assets/SharpUI/Prefabs/UI/Button/RectButton.prefab new file mode 100644 index 00000000..b7160f98 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/RectButton.prefab @@ -0,0 +1,328 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6632141325075871604 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6632141325075871603} + - component: {fileID: 6632141325075871601} + - component: {fileID: 6632141325075871602} + - component: {fileID: 8218320972983475345} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6632141325075871603 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141325075871604} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6632141326068229368} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6632141325075871601 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141325075871604} + m_CullTransparentMesh: 0 +--- !u!114 &6632141325075871602 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141325075871604} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Button + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288132815 + m_fontColor: {r: 0.8113208, g: 0.7123744, b: 0.5931827, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 6632141325075871602} + characterCount: 6 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &8218320972983475345 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141325075871604} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + disabledColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + pressedColor: {r: 0.8117647, g: 0.5564706, b: 0.24352942, a: 1} + selectedColor: {r: 0.8117647, g: 0.61162275, b: 0.3652941, a: 1} + hoverColor: {r: 0.8117647, g: 0.6862745, b: 0.5294118, a: 1} +--- !u!1 &6632141326068229369 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6632141326068229368} + - component: {fileID: 6632141326068229317} + - component: {fileID: 6632141326068229318} + - component: {fileID: 878572639324223981} + - component: {fileID: 7224983615695812697} + - component: {fileID: 1283533084550540068} + m_Layer: 5 + m_Name: RectButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6632141326068229368 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141326068229369} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 6632141325075871603} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 44} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6632141326068229317 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141326068229369} + m_CullTransparentMesh: 0 +--- !u!114 &6632141326068229318 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141326068229369} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: a78e1df9d391117438f8c74cbfd2a93d, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 4 +--- !u!114 &878572639324223981 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141326068229369} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb98c87ed3f24487ab7f939a7bee4b43, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 1 + isSelected: 0 +--- !u!114 &7224983615695812697 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141326068229369} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 6632141326068229318} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &1283533084550540068 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6632141326068229369} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + pressedColor: {r: 1, g: 0.73, b: 0.14999998, a: 1} + selectedColor: {r: 1, g: 0.7679328, b: 0.2688679, a: 1} + hoverColor: {r: 1, g: 0.94509804, b: 0.81960785, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/Button/RectButton.prefab.meta b/Assets/SharpUI/Prefabs/UI/Button/RectButton.prefab.meta new file mode 100644 index 00000000..dc084d43 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/RectButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7a7207825d33c4b4aa8c774285d0c5e6 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Button/RoundButton.prefab b/Assets/SharpUI/Prefabs/UI/Button/RoundButton.prefab new file mode 100644 index 00000000..9b88b7c7 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/RoundButton.prefab @@ -0,0 +1,353 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &5285266285038120685 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5285266285038120684} + - component: {fileID: 5285266285038120681} + - component: {fileID: 5285266285038120686} + - component: {fileID: 5285266285038120687} + m_Layer: 5 + m_Name: IconImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5285266285038120684 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285038120685} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5285266285960850013} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5285266285038120681 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285038120685} + m_CullTransparentMesh: 0 +--- !u!114 &5285266285038120686 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285038120685} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 72a5b884f12dfe04cbfb9b61a4c78532, type: 3} + m_Type: 0 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5285266285038120687 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285038120685} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 1, b: 1, a: 1} + selectedColor: {r: 1, g: 1, b: 1, a: 1} + hoverColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &5285266285048780471 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5285266285048780470} + - component: {fileID: 5285266285048780428} + - component: {fileID: 5285266285048780429} + - component: {fileID: 5285266285048780466} + - component: {fileID: 1081579990051204140} + - component: {fileID: 5285266285048780464} + - component: {fileID: 5285266285048780465} + m_Layer: 5 + m_Name: RoundButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5285266285048780470 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285048780471} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5285266285960850013} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 80, y: 80} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5285266285048780428 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285048780471} + m_CullTransparentMesh: 0 +--- !u!114 &5285266285048780429 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285048780471} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 1631b774c445a534099e3f1ddae2f949, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5285266285048780466 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285048780471} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 5285266285048780429} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &1081579990051204140 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285048780471} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f86ee4e5715346038fbd413997a9cbb0, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 1 + isSelected: 0 + iconImage: {fileID: 0} +--- !u!114 &5285266285048780464 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285048780471} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fffcae0ee53a4c80b40b7ca2a902c0fc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalSprite: {fileID: 21300000, guid: 1631b774c445a534099e3f1ddae2f949, type: 3} + disabledSprite: {fileID: 21300000, guid: 1631b774c445a534099e3f1ddae2f949, type: 3} + pressedSprite: {fileID: 21300000, guid: 0bfd9b1f92738a04da6adeec5da546a1, type: 3} + selectedSprite: {fileID: 21300000, guid: 0bfd9b1f92738a04da6adeec5da546a1, type: 3} + hoverSprite: {fileID: 21300000, guid: 0bfd9b1f92738a04da6adeec5da546a1, type: 3} +--- !u!114 &5285266285048780465 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285048780471} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 0.7631579, b: 0.100000024, a: 1} + selectedColor: {r: 1, g: 0.84210527, b: 0.39999998, a: 1} + hoverColor: {r: 1, g: 0.9213974, b: 0.7, a: 1} +--- !u!1 &5285266285960849986 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5285266285960850013} + - component: {fileID: 5285266285960850014} + - component: {fileID: 5285266285960850015} + - component: {fileID: 5285266285960850012} + m_Layer: 5 + m_Name: CircleMask + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5285266285960850013 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285960849986} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5285266285038120684} + m_Father: {fileID: 5285266285048780470} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -8, y: -8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5285266285960850014 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285960849986} + m_CullTransparentMesh: 0 +--- !u!114 &5285266285960850015 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285960849986} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b13a69945a280a46bc2eb7763cf77a8, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5285266285960850012 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5285266285960849986} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 0 diff --git a/Assets/SharpUI/Prefabs/UI/Button/RoundButton.prefab.meta b/Assets/SharpUI/Prefabs/UI/Button/RoundButton.prefab.meta new file mode 100644 index 00000000..41608e64 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/RoundButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b4a2c11b1ea9c2d4f923427740ac03c3 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Button/TabButton.prefab b/Assets/SharpUI/Prefabs/UI/Button/TabButton.prefab new file mode 100644 index 00000000..0e2544ba --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/TabButton.prefab @@ -0,0 +1,435 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1051670295210444383 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1051670295210444382} + - component: {fileID: 1051670295210444355} + - component: {fileID: 1051670295210444352} + - component: {fileID: 1051670295210444353} + - component: {fileID: 4690894512785978868} + m_Layer: 5 + m_Name: Pointer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1051670295210444382 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295210444383} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1051670295709312782} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: -2.28} + m_SizeDelta: {x: 7, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1051670295210444355 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295210444383} + m_CullTransparentMesh: 0 +--- !u!114 &1051670295210444352 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295210444383} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7647059, g: 0.7372549, b: 0.67058825, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: fcd669d7406d5cc45abe0908138db13e, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1051670295210444353 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295210444383} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.35686275, g: 0.39607844, b: 0.46666667, a: 0.67058825} + disabledColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5019608} + pressedColor: {r: 0.6784314, g: 0.60784316, b: 0.49803922, a: 1} + selectedColor: {r: 0.7647059, g: 0.7372549, b: 0.67058825, a: 1} + hoverColor: {r: 0.7647059, g: 0.7372549, b: 0.67058825, a: 1} +--- !u!114 &4690894512785978868 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295210444383} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ccecbd869d224e15b8c0dda2e2bd269a, type: 3} + m_Name: + m_EditorClassIdentifier: + visibleWhenSelected: 1 +--- !u!1 &1051670295558183878 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1051670295558183881} + - component: {fileID: 1051670295558183883} + - component: {fileID: 1051670295558183880} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1051670295558183881 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295558183878} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1051670295709312782} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1051670295558183883 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295558183878} + m_CullTransparentMesh: 0 +--- !u!114 &1051670295558183880 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295558183878} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Tab + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4289514971 + m_fontColor: {r: 0.8584906, g: 0.80421144, b: 0.6762638, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 22 + m_fontSizeBase: 22 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 1051670295558183880} + characterCount: 3 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1051670295709312783 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1051670295709312782} + - component: {fileID: 1051670295709312884} + - component: {fileID: 1051670295709312885} + - component: {fileID: 1051670295709312882} + - component: {fileID: 1051670295709312880} + - component: {fileID: 1051670295709312881} + - component: {fileID: 2749736766749590591} + m_Layer: 5 + m_Name: TabButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1051670295709312782 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295709312783} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1051670295558183881} + - {fileID: 1051670295210444382} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 180, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1051670295709312884 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295709312783} + m_CullTransparentMesh: 0 +--- !u!114 &1051670295709312885 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295709312783} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 12 +--- !u!114 &1051670295709312882 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295709312783} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1051670295709312885} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &1051670295709312880 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295709312783} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5019608} + pressedColor: {r: 0.9529412, g: 0.88235295, b: 0.78039217, a: 1} + selectedColor: {r: 1, g: 1, b: 1, a: 1} + hoverColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!114 &1051670295709312881 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295709312783} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fffcae0ee53a4c80b40b7ca2a902c0fc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalSprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + disabledSprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + pressedSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} + selectedSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} + hoverSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} +--- !u!114 &2749736766749590591 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051670295709312783} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a9938e31ceb440d2ae34ff2a178baa61, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 1 + isSelected: 0 + content: {fileID: 0} diff --git a/Assets/SharpUI/Prefabs/UI/Button/TabButton.prefab.meta b/Assets/SharpUI/Prefabs/UI/Button/TabButton.prefab.meta new file mode 100644 index 00000000..4b314f15 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Button/TabButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5184c24abfa12ba489b7b3d7c62060f5 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Dialog.meta b/Assets/SharpUI/Prefabs/UI/Dialog.meta new file mode 100644 index 00000000..1dc9e53e --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Dialog.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 331c08da185d03a4780c20317cc252cd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Dialog/DialogDefault.prefab b/Assets/SharpUI/Prefabs/UI/Dialog/DialogDefault.prefab new file mode 100644 index 00000000..236d440a --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Dialog/DialogDefault.prefab @@ -0,0 +1,1949 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1587547756 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1587547757} + - component: {fileID: 1587547758} + - component: {fileID: 1587547759} + m_Layer: 5 + m_Name: DefaultDialogButtons + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1587547757 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1587547756} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4731082648640767751} + - {fileID: 4731082649196686915} + - {fileID: 4731082649460662912} + m_Father: {fileID: 2135330745397898528} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 300, y: -63} + m_SizeDelta: {x: 0, y: 26} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1587547758 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1587547756} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 20 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 0 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 +--- !u!114 &1587547759 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1587547756} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 0 +--- !u!1 &1188162122802288229 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5113241445032320170} + - component: {fileID: 3776596185882412462} + - component: {fileID: 3355703712414384715} + - component: {fileID: 1435629319099229955} + m_Layer: 5 + m_Name: DescriptionText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5113241445032320170 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188162122802288229} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2135330745397898528} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 300, y: -50} + m_SizeDelta: {x: 560, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3776596185882412462 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188162122802288229} + m_CullTransparentMesh: 0 +--- !u!114 &3355703712414384715 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188162122802288229} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Description text ' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4287935173 + m_fontColor: {r: 0.7735849, g: 0.69670856, b: 0.5801887, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 16 + m_fontSizeBase: 16 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 258 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 10, z: 0, w: 20} + m_textInfo: + textComponent: {fileID: 3355703712414384715} + characterCount: 17 + spriteCount: 0 + spaceCount: 2 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &1435629319099229955 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1188162122802288229} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!1 &2135330743889267321 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135330743889267326} + - component: {fileID: 2135330743889267324} + - component: {fileID: 2135330743889267327} + - component: {fileID: 2135330743889267325} + m_Layer: 5 + m_Name: FadeLineImageTop + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135330743889267326 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330743889267321} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2135330744960611676} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0.000030517578, y: -11} + m_SizeDelta: {x: -25.4, y: 6} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2135330743889267324 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330743889267321} + m_CullTransparentMesh: 0 +--- !u!114 &2135330743889267327 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330743889267321} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 747cf0b76adcf4848811096362a05091, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2135330743889267325 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330743889267321} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!1 &2135330744544446727 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135330744544446724} + - component: {fileID: 2135330744544446731} + - component: {fileID: 2135330744544446730} + - component: {fileID: 2135330744544446725} + - component: {fileID: 2135330744544446728} + m_Layer: 5 + m_Name: IconCloseButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135330744544446724 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744544446727} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2135330744960611676} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -25.5, y: -26} + m_SizeDelta: {x: 28, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2135330744544446731 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744544446727} + m_CullTransparentMesh: 0 +--- !u!114 &2135330744544446730 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744544446727} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: c7335382e71321b4a94c68fbffb5e85b, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2135330744544446725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744544446727} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2135330744544446730} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2135330744544446728 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744544446727} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!1 &2135330744960611679 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135330744960611676} + - component: {fileID: 2135330744960611650} + - component: {fileID: 2135330744960611677} + - component: {fileID: 2135330744960611648} + - component: {fileID: 2135330744960611651} + - component: {fileID: 2135330744960611649} + m_Layer: 5 + m_Name: DialogDefault + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135330744960611676 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744960611679} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2135330745904472156} + - {fileID: 2135330743889267326} + - {fileID: 2135330745337345035} + - {fileID: 2135330745870535717} + - {fileID: 2135330745765712072} + - {fileID: 2135330744544446724} + - {fileID: 2135330745397898528} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 600, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2135330744960611650 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744960611679} + m_CullTransparentMesh: 0 +--- !u!114 &2135330744960611677 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744960611679} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4e669f22e6bb3a04189282086d3b677e, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2135330744960611648 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744960611679} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!114 &2135330744960611651 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744960611679} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 +--- !u!114 &2135330744960611649 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330744960611679} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e19c1788aa2b42daa0990f6c8197156c, type: 3} + m_Name: + m_EditorClassIdentifier: + spriteInfo: {fileID: 21300000, guid: e12aeb8f85d8f534c924037f7e3baa74, type: 3} + spriteQuestion: {fileID: 21300000, guid: 72a5b884f12dfe04cbfb9b61a4c78532, type: 3} + spriteWarning: {fileID: 21300000, guid: b6d41c56108027f43a47a807df3af3a2, type: 3} + spriteCustom: {fileID: 0} + titleText: {fileID: 2135330745870535722} + descriptionText: {fileID: 3355703712414384715} + iconImage: {fileID: 2135330745765712073} + closeIconButton: {fileID: 2135330744544446725} + contentTransform: {fileID: 2135330745397898528} + defaultButtonsContainer: {fileID: 1587547756} + buttonPositive: {fileID: 1266468992198859282} + buttonNegative: {fileID: 1266468992622654294} + buttonNeutral: {fileID: 1266468992351862677} +--- !u!1 &2135330745337345034 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135330745337345035} + - component: {fileID: 2135330745337345033} + - component: {fileID: 2135330745337345032} + - component: {fileID: 2135330745337345038} + m_Layer: 5 + m_Name: FadeLineImageBottom + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135330745337345035 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745337345034} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2135330744960611676} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 11.5} + m_SizeDelta: {x: -20, y: 6} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2135330745337345033 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745337345034} + m_CullTransparentMesh: 0 +--- !u!114 &2135330745337345032 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745337345034} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 747cf0b76adcf4848811096362a05091, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2135330745337345038 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745337345034} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!1 &2135330745397898531 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135330745397898528} + - component: {fileID: 2135330745397898534} + m_Layer: 5 + m_Name: Content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135330745397898528 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745397898531} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5113241445032320170} + - {fileID: 1587547757} + m_Father: {fileID: 2135330744960611676} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2135330745397898534 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745397898531} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 20 + m_Right: 20 + m_Top: 50 + m_Bottom: 24 + m_ChildAlignment: 1 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 1 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 +--- !u!1 &2135330745765712075 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135330745765712072} + - component: {fileID: 2135330745765712078} + - component: {fileID: 2135330745765712073} + - component: {fileID: 2135330745765712079} + m_Layer: 5 + m_Name: IconImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135330745765712072 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745765712075} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2135330744960611676} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 12.730011, y: -12.219971} + m_SizeDelta: {x: 45, y: 45} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2135330745765712078 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745765712075} + m_CullTransparentMesh: 0 +--- !u!114 &2135330745765712073 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745765712075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e12aeb8f85d8f534c924037f7e3baa74, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2135330745765712079 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745765712075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!1 &2135330745870535716 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135330745870535717} + - component: {fileID: 2135330745870535723} + - component: {fileID: 2135330745870535722} + - component: {fileID: 2135330745870535720} + m_Layer: 5 + m_Name: DialogHeaderText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135330745870535717 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745870535716} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2135330744960611676} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -25.5} + m_SizeDelta: {x: -20, y: 24} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2135330745870535723 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745870535716} + m_CullTransparentMesh: 0 +--- !u!114 &2135330745870535722 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745870535716} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: New Info + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4292013055 + m_fontColor: {r: 1, g: 0.9209821, b: 0.823, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 16 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 2135330745870535722} + characterCount: 8 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &2135330745870535720 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745870535716} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!1 &2135330745904472159 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2135330745904472156} + - component: {fileID: 2135330745904472130} + - component: {fileID: 2135330745904472157} + - component: {fileID: 2135330745904472131} + m_Layer: 5 + m_Name: HeaderBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2135330745904472156 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745904472159} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2135330744960611676} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -25.861023} + m_SizeDelta: {x: -25.4, y: 27.279} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2135330745904472130 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745904472159} + m_CullTransparentMesh: 0 +--- !u!114 &2135330745904472157 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745904472159} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 52372e41d43225843ac11da166feeb1c, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2135330745904472131 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2135330745904472159} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!1001 &2135330743885456383 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1587547757} + m_Modifications: + - target: {fileID: 878572639324223981, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: isSelectable + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: normalColor.r + value: 0.6 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: normalColor.b + value: 0.6 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: disabledColor.r + value: 0.6 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: disabledColor.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: disabledColor.b + value: 0.6 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: disabledColor.a + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: pressedColor.r + value: 0.13018866 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: pressedColor.g + value: 0.8679245 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: pressedColor.b + value: 0.13018866 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: selectedColor.r + value: 0.2611765 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: selectedColor.g + value: 0.87058824 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: selectedColor.b + value: 0.2611765 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: hoverColor.r + value: 0.5658824 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: hoverColor.g + value: 0.87058824 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: hoverColor.b + value: 0.5658824 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.characterCount + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.wordCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.lineCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.pageCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontSize + value: 16 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontSizeBase + value: 16 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_text + value: Yes + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontStyle + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229318, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Color.r + value: 0.6 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229318, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Color.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229318, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Color.b + value: 0.6 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_SizeDelta.x + value: 120 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229369, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Name + value: RectButtonYes + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229369, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 7a7207825d33c4b4aa8c774285d0c5e6, type: 3} +--- !u!224 &4731082648640767751 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + m_PrefabInstance: {fileID: 2135330743885456383} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1266468992198859282 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 878572639324223981, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + m_PrefabInstance: {fileID: 2135330743885456383} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb98c87ed3f24487ab7f939a7bee4b43, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &2135330744436640443 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1587547757} + m_Modifications: + - target: {fileID: 878572639324223981, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: isSelectable + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: normalColor.g + value: 0.60784316 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: normalColor.b + value: 0.60784316 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: disabledColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: disabledColor.g + value: 0.60784316 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: disabledColor.b + value: 0.60784316 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: disabledColor.a + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: pressedColor.r + value: 0.8584906 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: pressedColor.g + value: 0.12877357 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: pressedColor.b + value: 0.12877357 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: selectedColor.r + value: 0.85882354 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: selectedColor.g + value: 0.25764707 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: selectedColor.b + value: 0.25764707 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: hoverColor.r + value: 0.85882354 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: hoverColor.g + value: 0.5582353 + objectReference: {fileID: 0} + - target: {fileID: 1283533084550540068, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: hoverColor.b + value: 0.5582353 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.characterCount + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.wordCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.lineCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.pageCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontSize + value: 16 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontSizeBase + value: 16 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_text + value: No + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontStyle + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229318, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Color.g + value: 0.60784316 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229318, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Color.b + value: 0.60784316 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_SizeDelta.x + value: 120 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229369, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Name + value: RectButtonNo + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229369, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 7a7207825d33c4b4aa8c774285d0c5e6, type: 3} +--- !u!224 &4731082649196686915 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + m_PrefabInstance: {fileID: 2135330744436640443} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1266468992622654294 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 878572639324223981, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + m_PrefabInstance: {fileID: 2135330744436640443} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb98c87ed3f24487ab7f939a7bee4b43, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &2135330744709531256 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1587547757} + m_Modifications: + - target: {fileID: 878572639324223981, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: isSelectable + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.characterCount + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.wordCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.lineCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.pageCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontSize + value: 16 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontSizeBase + value: 16 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_text + value: 'OK + +' + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_fontStyle + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_textInfo.spaceCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871602, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_firstOverflowCharacterIndex + value: -1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871603, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871603, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871603, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871603, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871603, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871603, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871603, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141325075871604, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229318, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Type + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229318, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_FillCenter + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_SizeDelta.x + value: 120 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229369, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_Name + value: RectButtonOk + objectReference: {fileID: 0} + - target: {fileID: 6632141326068229369, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 7a7207825d33c4b4aa8c774285d0c5e6, type: 3} +--- !u!224 &4731082649460662912 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 6632141326068229368, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + m_PrefabInstance: {fileID: 2135330744709531256} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1266468992351862677 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 878572639324223981, guid: 7a7207825d33c4b4aa8c774285d0c5e6, + type: 3} + m_PrefabInstance: {fileID: 2135330744709531256} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb98c87ed3f24487ab7f939a7bee4b43, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/SharpUI/Prefabs/UI/Dialog/DialogDefault.prefab.meta b/Assets/SharpUI/Prefabs/UI/Dialog/DialogDefault.prefab.meta new file mode 100644 index 00000000..d1103010 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Dialog/DialogDefault.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6003f4d8a25742a4e982e449717a3202 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Factory.meta b/Assets/SharpUI/Prefabs/UI/Factory.meta new file mode 100644 index 00000000..488d68a0 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Factory.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 825118546e94866498eaf2eb81538d23 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Factory/CharacterIconFactory.prefab b/Assets/SharpUI/Prefabs/UI/Factory/CharacterIconFactory.prefab new file mode 100644 index 00000000..5500deb3 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Factory/CharacterIconFactory.prefab @@ -0,0 +1,48 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &36071988438615906 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 36071988438615908} + - component: {fileID: 36071988438615907} + m_Layer: 0 + m_Name: CharacterIconFactory + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &36071988438615908 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 36071988438615906} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &36071988438615907 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 36071988438615906} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0adb6e426267a7a4daa63292d887b921, type: 3} + m_Name: + m_EditorClassIdentifier: + iconWarriorPrefab: {fileID: 21300000, guid: 9fec9b531ee671a499b9ed48fd5da361, type: 3} + iconHunterPrefab: {fileID: 21300000, guid: 5198335602a80b14690b9a5b63e8a74e, type: 3} + iconCasterPrefab: {fileID: 21300000, guid: 2140eb696087f504fb45b4434b31ee9f, type: 3} diff --git a/Assets/SharpUI/Prefabs/UI/Factory/CharacterIconFactory.prefab.meta b/Assets/SharpUI/Prefabs/UI/Factory/CharacterIconFactory.prefab.meta new file mode 100644 index 00000000..0de8e83d --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Factory/CharacterIconFactory.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 83e907edb04d44f4e9b933fe3b845ec7 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Factory/ListItemFactory.prefab b/Assets/SharpUI/Prefabs/UI/Factory/ListItemFactory.prefab new file mode 100644 index 00000000..8dedd084 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Factory/ListItemFactory.prefab @@ -0,0 +1,53 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7333782689139719047 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3694149667998792570} + - component: {fileID: 2812406363937223435} + m_Layer: 0 + m_Name: ListItemFactory + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3694149667998792570 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7333782689139719047} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2812406363937223435 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7333782689139719047} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 87afb496b407430483aced5aafbe0aec, type: 3} + m_Name: + m_EditorClassIdentifier: + listItemPrefab: {fileID: 99044400211064942, guid: e6dd7bd374e00e643bab8239d6a1f289, + type: 3} + listItemDescriptionPrefab: {fileID: 229017258028097706, guid: 0e421a6fbe258164992a3630ca5cb25d, + type: 3} + listItemImagePrefab: {fileID: 3423007468724120475, guid: f9cbc0a9a2636504ea151e5a90efc25c, + type: 3} + listItemCustom: {fileID: 2985651140807402569, guid: 43a9fbd992ad96744ba90160c1aa553d, + type: 3} diff --git a/Assets/SharpUI/Prefabs/UI/Factory/ListItemFactory.prefab.meta b/Assets/SharpUI/Prefabs/UI/Factory/ListItemFactory.prefab.meta new file mode 100644 index 00000000..25de56ea --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Factory/ListItemFactory.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a9755cc3bfa1b2c4084070c09a5ab24a +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Factory/UISpriteFactory.prefab b/Assets/SharpUI/Prefabs/UI/Factory/UISpriteFactory.prefab new file mode 100644 index 00000000..b4ca2d0c --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Factory/UISpriteFactory.prefab @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7880598793338569202 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7016385251706880982} + - component: {fileID: 5047772866971946319} + m_Layer: 0 + m_Name: UISpriteFactory + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7016385251706880982 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7880598793338569202} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5047772866971946319 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7880598793338569202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 99fdbef2aaee00a4b95cda686128edc7, type: 3} + m_Name: + m_EditorClassIdentifier: + listItemBackground: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + listItemBackgroundSelected: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, + type: 3} + squareButtonNeutral: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, + type: 3} + squareButtonSelected: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, + type: 3} diff --git a/Assets/SharpUI/Prefabs/UI/Factory/UISpriteFactory.prefab.meta b/Assets/SharpUI/Prefabs/UI/Factory/UISpriteFactory.prefab.meta new file mode 100644 index 00000000..a2bcaeaa --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Factory/UISpriteFactory.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e4c33622d053c4f499708874b08f38b3 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/FadeLine.prefab b/Assets/SharpUI/Prefabs/UI/FadeLine.prefab new file mode 100644 index 00000000..8f27b3f8 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/FadeLine.prefab @@ -0,0 +1,75 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2217354625531912410 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2217354625531912409} + - component: {fileID: 2217354625531912407} + - component: {fileID: 2217354625531912408} + m_Layer: 5 + m_Name: FadeLine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2217354625531912409 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2217354625531912410} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2217354625531912407 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2217354625531912410} + m_CullTransparentMesh: 0 +--- !u!114 &2217354625531912408 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2217354625531912410} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e1dec67342323c047860e06717826090, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/SharpUI/Prefabs/UI/FadeLine.prefab.meta b/Assets/SharpUI/Prefabs/UI/FadeLine.prefab.meta new file mode 100644 index 00000000..e7d07c7a --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/FadeLine.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cfded225af68b504384be88af9988c78 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Input.meta b/Assets/SharpUI/Prefabs/UI/Input.meta new file mode 100644 index 00000000..91b08303 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8dc764b29d51714aaa1bbdc18c871ca +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Input/CheckBoxCheckmark.prefab b/Assets/SharpUI/Prefabs/UI/Input/CheckBoxCheckmark.prefab new file mode 100644 index 00000000..fc1fd687 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/CheckBoxCheckmark.prefab @@ -0,0 +1,466 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &5721486163724944125 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5721486163724944124} + - component: {fileID: 5721486163724944122} + - component: {fileID: 5721486163724944123} + - component: {fileID: 1074047438327279953} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5721486163724944124 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486163724944125} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5721486163961490227} + m_Father: {fileID: 5721486164347402528} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 14, y: -14} + m_SizeDelta: {x: 28, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5721486163724944122 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486163724944125} + m_CullTransparentMesh: 0 +--- !u!114 &5721486163724944123 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486163724944125} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: a1c619ba266d8f343a7c27c3752bdcb1, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1074047438327279953 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486163724944125} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 0.73, b: 0.14999998, a: 1} + selectedColor: {r: 1, g: 0.7679328, b: 0.2688679, a: 1} + hoverColor: {r: 1, g: 0.94509804, b: 0.81960785, a: 1} +--- !u!1 &5721486163961490228 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5721486163961490227} + - component: {fileID: 5721486163961490225} + - component: {fileID: 5721486163961490226} + - component: {fileID: 2389506484311749775} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5721486163961490227 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486163961490228} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5721486163724944124} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 28, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5721486163961490225 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486163961490228} + m_CullTransparentMesh: 0 +--- !u!114 &5721486163961490226 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486163961490228} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 7a839466c6a6a5c44a4eed23394edb93, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2389506484311749775 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486163961490228} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 0.73, b: 0.14999998, a: 1} + selectedColor: {r: 1, g: 0.7679328, b: 0.2688679, a: 1} + hoverColor: {r: 1, g: 0.94509804, b: 0.81960785, a: 1} +--- !u!1 &5721486164347402529 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5721486164347402528} + - component: {fileID: 6608009159746749577} + - component: {fileID: 770257414600589217} + - component: {fileID: 8677154545388200777} + m_Layer: 5 + m_Name: CheckBoxCheckmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5721486164347402528 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486164347402529} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5721486163724944124} + - {fileID: 7249290336039530331} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &6608009159746749577 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486164347402529} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 0} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &770257414600589217 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486164347402529} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 590ccb8f6fcc40c28435925102a6a9a1, type: 3} + m_Name: + m_EditorClassIdentifier: + isClickable: 1 + isSelectable: 1 + isSelected: 0 + checkedImage: {fileID: 5721486163961490226} + isOn: 0 +--- !u!222 &8677154545388200777 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5721486164347402529} + m_CullTransparentMesh: 0 +--- !u!1 &8275588645424130597 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7249290336039530331} + - component: {fileID: 5603239383544888535} + - component: {fileID: 484645565809024296} + - component: {fileID: 170013430821685759} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7249290336039530331 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8275588645424130597} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5721486164347402528} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 16, y: 0} + m_SizeDelta: {x: -32, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5603239383544888535 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8275588645424130597} + m_CullTransparentMesh: 0 +--- !u!114 &484645565809024296 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8275588645424130597} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Check me checkmark + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288132815 + m_fontColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 484645565809024296} + characterCount: 18 + spriteCount: 0 + spaceCount: 2 + wordCount: 3 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &170013430821685759 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8275588645424130597} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + disabledColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + pressedColor: {r: 0.8117647, g: 0.5564706, b: 0.24352942, a: 1} + selectedColor: {r: 0.8117647, g: 0.61162275, b: 0.3652941, a: 1} + hoverColor: {r: 0.8117647, g: 0.6862745, b: 0.5294118, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/Input/CheckBoxCheckmark.prefab.meta b/Assets/SharpUI/Prefabs/UI/Input/CheckBoxCheckmark.prefab.meta new file mode 100644 index 00000000..caf6fa94 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/CheckBoxCheckmark.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e3248600b3d9bc84b968c1d4ebe08549 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Input/CheckBoxSquare.prefab b/Assets/SharpUI/Prefabs/UI/Input/CheckBoxSquare.prefab new file mode 100644 index 00000000..7988f122 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/CheckBoxSquare.prefab @@ -0,0 +1,458 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &598791197034524181 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2489223850251996883} + - component: {fileID: 3649516190321479908} + - component: {fileID: 7470117736420749168} + - component: {fileID: 6002934350936598924} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2489223850251996883 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598791197034524181} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1542245040241647403} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 16, y: 0} + m_SizeDelta: {x: -32, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3649516190321479908 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598791197034524181} + m_CullTransparentMesh: 0 +--- !u!114 &7470117736420749168 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598791197034524181} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Check me square + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288132815 + m_fontColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 7470117736420749168} + characterCount: 15 + spriteCount: 0 + spaceCount: 2 + wordCount: 3 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &6002934350936598924 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598791197034524181} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + disabledColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + pressedColor: {r: 0.8117647, g: 0.5564706, b: 0.24352942, a: 1} + selectedColor: {r: 0.8117647, g: 0.61162275, b: 0.3652941, a: 1} + hoverColor: {r: 0.8117647, g: 0.6862745, b: 0.5294118, a: 1} +--- !u!1 &1542245038918677905 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1542245038918677904} + - component: {fileID: 1542245038918677906} + - component: {fileID: 1542245038918677907} + - component: {fileID: 723679448302485676} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1542245038918677904 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245038918677905} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1542245039765885567} + m_Father: {fileID: 1542245040241647403} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 14, y: -14} + m_SizeDelta: {x: 28, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1542245038918677906 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245038918677905} + m_CullTransparentMesh: 0 +--- !u!114 &1542245038918677907 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245038918677905} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: a1c619ba266d8f343a7c27c3752bdcb1, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &723679448302485676 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245038918677905} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 0.73, b: 0.14999998, a: 1} + selectedColor: {r: 1, g: 0.7679328, b: 0.2688679, a: 1} + hoverColor: {r: 1, g: 0.94509804, b: 0.81960785, a: 1} +--- !u!1 &1542245039765885564 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1542245039765885567} + - component: {fileID: 1542245039765885561} + - component: {fileID: 1542245039765885566} + - component: {fileID: 8456486433141605392} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1542245039765885567 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245039765885564} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1542245038918677904} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 28, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1542245039765885561 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245039765885564} + m_CullTransparentMesh: 0 +--- !u!114 &1542245039765885566 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245039765885564} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 5e9974bc805781d47a0eed44e7dd73ab, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8456486433141605392 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245039765885564} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 0.73, b: 0.14999998, a: 1} + selectedColor: {r: 1, g: 0.7679328, b: 0.2688679, a: 1} + hoverColor: {r: 1, g: 0.94509804, b: 0.81960785, a: 1} +--- !u!1 &1542245040241647400 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1542245040241647403} + - component: {fileID: 4599903138769410511} + - component: {fileID: 1256067653222771487} + m_Layer: 5 + m_Name: CheckBoxSquare + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1542245040241647403 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245040241647400} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1542245038918677904} + - {fileID: 2489223850251996883} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &4599903138769410511 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245040241647400} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 0} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &1256067653222771487 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1542245040241647400} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 590ccb8f6fcc40c28435925102a6a9a1, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 1 + isSelected: 1 + checkedImage: {fileID: 1542245039765885566} + isOn: 1 diff --git a/Assets/SharpUI/Prefabs/UI/Input/CheckBoxSquare.prefab.meta b/Assets/SharpUI/Prefabs/UI/Input/CheckBoxSquare.prefab.meta new file mode 100644 index 00000000..955ffe7e --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/CheckBoxSquare.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 574c05ea3fca9284dbae3e34fccf9d7b +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Input/Dropdown.prefab b/Assets/SharpUI/Prefabs/UI/Input/Dropdown.prefab new file mode 100644 index 00000000..58d1526c --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/Dropdown.prefab @@ -0,0 +1,1226 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7149235113448057723 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235113448057716} + - component: {fileID: 7149235113448057718} + - component: {fileID: 7149235113448057717} + m_Layer: 5 + m_Name: Item Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235113448057716 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113448057723} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7149235114983915907} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7149235113448057718 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113448057723} + m_CullTransparentMesh: 0 +--- !u!114 &7149235113448057717 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113448057723} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 20 +--- !u!1 &7149235113621307545 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235113621307546} + - component: {fileID: 7149235113621307540} + - component: {fileID: 7149235113621307547} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235113621307546 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113621307545} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7149235113964297758} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7149235113621307540 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113621307545} + m_CullTransparentMesh: 0 +--- !u!114 &7149235113621307547 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113621307545} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.990566, g: 0.91734546, b: 0.81768423, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 8fd7febb455068b4599dda0c61d40341, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7149235113632897671 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235113632897664} + - component: {fileID: 7149235113632897667} + - component: {fileID: 7149235113632897666} + - component: {fileID: 7149235113632897665} + m_Layer: 5 + m_Name: Viewport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235113632897664 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113632897671} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7149235114358966696} + m_Father: {fileID: 7149235114492412759} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -17, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!114 &7149235113632897667 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113632897671} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 0 +--- !u!222 &7149235113632897666 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113632897671} + m_CullTransparentMesh: 0 +--- !u!114 &7149235113632897665 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113632897671} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7149235113821179845 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235113821179846} + - component: {fileID: 7149235113821179840} + - component: {fileID: 7149235113821179847} + m_Layer: 5 + m_Name: Item Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235113821179846 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113821179845} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7149235114983915907} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 5, y: -0.5} + m_SizeDelta: {x: -30, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7149235113821179840 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113821179845} + m_CullTransparentMesh: 0 +--- !u!114 &7149235113821179847 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113821179845} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Option A + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281557666 + m_fontColor: {r: 0.63529414, g: 0.38431376, b: 0.20000002, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 7149235113821179847} + characterCount: 8 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &7149235113964297757 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235113964297758} + m_Layer: 5 + m_Name: Sliding Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235113964297758 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235113964297757} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7149235113621307546} + m_Father: {fileID: 7149235114142052533} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: -20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &7149235114064738043 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235114064738036} + - component: {fileID: 7149235114064738038} + - component: {fileID: 7149235114064738037} + m_Layer: 5 + m_Name: Item Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235114064738036 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114064738043} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7149235114983915907} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 10, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7149235114064738038 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114064738043} + m_CullTransparentMesh: 0 +--- !u!114 &7149235114064738037 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114064738043} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 7a839466c6a6a5c44a4eed23394edb93, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7149235114089042006 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235114089042007} + - component: {fileID: 7149235114089042001} + - component: {fileID: 7149235114089042000} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235114089042007 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114089042006} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7149235115105662759} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -7.5, y: -0.5} + m_SizeDelta: {x: -35, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7149235114089042001 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114089042006} + m_CullTransparentMesh: 0 +--- !u!114 &7149235114089042000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114089042006} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Option A + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4285047247 + m_fontColor: {r: 0.8117647, g: 0.6313726, b: 0.40784314, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 7149235114089042000} + characterCount: 8 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &7149235114142052532 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235114142052533} + - component: {fileID: 7149235114142052528} + - component: {fileID: 7149235114142052535} + - component: {fileID: 7149235114142052534} + m_Layer: 5 + m_Name: Scrollbar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235114142052533 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114142052532} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7149235113964297758} + m_Father: {fileID: 7149235114492412759} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 0} + m_Pivot: {x: 1, y: 1} +--- !u!222 &7149235114142052528 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114142052532} + m_CullTransparentMesh: 0 +--- !u!114 &7149235114142052535 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114142052532} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.9339623, g: 0.91308516, b: 0.885502, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: ec4e46f7b0a59f44581cb894a3e10de8, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7149235114142052534 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114142052532} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 7149235113621307547} + m_HandleRect: {fileID: 7149235113621307546} + m_Direction: 2 + m_Value: 0 + m_Size: 1 + m_NumberOfSteps: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &7149235114358966703 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235114358966696} + m_Layer: 5 + m_Name: Content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235114358966696 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114358966703} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7149235114983915907} + m_Father: {fileID: 7149235113632897664} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 44} + m_Pivot: {x: 0.5, y: 1} +--- !u!1 &7149235114492412758 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235114492412759} + - component: {fileID: 7149235114492412754} + - component: {fileID: 7149235114492412753} + - component: {fileID: 7149235114492412752} + m_Layer: 5 + m_Name: Template + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &7149235114492412759 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114492412758} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7149235113632897664} + - {fileID: 7149235114142052533} + m_Father: {fileID: 7149235115105662759} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 2} + m_SizeDelta: {x: 0, y: 150} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &7149235114492412754 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114492412758} + m_CullTransparentMesh: 0 +--- !u!114 &7149235114492412753 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114492412758} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 45d19e450bae6d647aada7729ee88538, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 20 +--- !u!114 &7149235114492412752 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114492412758} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 7149235114358966696} + m_Horizontal: 0 + m_Vertical: 1 + m_MovementType: 2 + m_Elasticity: 0.1 + m_Inertia: 1 + m_DecelerationRate: 0.135 + m_ScrollSensitivity: 30 + m_Viewport: {fileID: 7149235113632897664} + m_HorizontalScrollbar: {fileID: 0} + m_VerticalScrollbar: {fileID: 7149235114142052534} + m_HorizontalScrollbarVisibility: 0 + m_VerticalScrollbarVisibility: 2 + m_HorizontalScrollbarSpacing: 0 + m_VerticalScrollbarSpacing: -3 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &7149235114983915906 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235114983915907} + - component: {fileID: 7149235114983915932} + m_Layer: 5 + m_Name: Item + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235114983915907 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114983915906} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7149235113448057716} + - {fileID: 7149235114064738036} + - {fileID: 7149235113821179846} + m_Father: {fileID: 7149235114358966696} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 44} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &7149235114983915932 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235114983915906} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 0.5188679, g: 0.48885795, b: 0.46747062, a: 1} + m_HighlightedColor: {r: 0.3207547, g: 0.3207547, b: 0.3207547, a: 1} + m_PressedColor: {r: 0.13207549, g: 0.12844823, b: 0.12522252, a: 1} + m_SelectedColor: {r: 0.5, g: 0.37994912, b: 0.2948113, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 5 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 7149235113448057717} + toggleTransition: 1 + graphic: {fileID: 7149235114064738037} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &7149235115105662758 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235115105662759} + - component: {fileID: 7149235115105662754} + - component: {fileID: 7149235115105662753} + - component: {fileID: 7149235115105662752} + - component: {fileID: 7149235115105662755} + m_Layer: 5 + m_Name: Dropdown + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235115105662759 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235115105662758} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7149235114089042007} + - {fileID: 7149235115169290955} + - {fileID: 7149235114492412759} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 240, y: 44} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7149235115105662754 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235115105662758} + m_CullTransparentMesh: 0 +--- !u!114 &7149235115105662753 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235115105662758} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 8 +--- !u!114 &7149235115105662752 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235115105662758} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7b743370ac3e4ec2a1668f5455a8ef8a, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 7149235115105662753} + m_Template: {fileID: 7149235114492412759} + m_CaptionText: {fileID: 7149235114089042000} + m_CaptionImage: {fileID: 0} + m_ItemText: {fileID: 7149235113821179847} + m_ItemImage: {fileID: 0} + m_Value: 0 + m_Options: + m_Options: + - m_Text: Option A + m_Image: {fileID: 0} + - m_Text: Option B + m_Image: {fileID: 0} + - m_Text: Option C + m_Image: {fileID: 0} + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &7149235115105662755 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235115105662758} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5b428c36e6014cde8f2a3f90ebc1085b, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &7149235115169290954 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7149235115169290955} + - component: {fileID: 7149235115169290949} + - component: {fileID: 7149235115169290948} + m_Layer: 5 + m_Name: Arrow + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7149235115169290955 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235115169290954} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7149235115105662759} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} + m_AnchorMin: {x: 1, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: -20, y: 0} + m_SizeDelta: {x: 10, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7149235115169290949 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235115169290954} + m_CullTransparentMesh: 0 +--- !u!114 &7149235115169290948 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7149235115169290954} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 73b16d40ad0b2114ab7b1899ca96b714, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/SharpUI/Prefabs/UI/Input/Dropdown.prefab.meta b/Assets/SharpUI/Prefabs/UI/Input/Dropdown.prefab.meta new file mode 100644 index 00000000..16265fd4 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/Dropdown.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cdff8f2318c525b4b81e9c38c89cd42a +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Input/InputField.prefab b/Assets/SharpUI/Prefabs/UI/Input/InputField.prefab new file mode 100644 index 00000000..b68843e9 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/InputField.prefab @@ -0,0 +1,533 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8308377967988601113 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8308377967988601118} + - component: {fileID: 8308377967988601116} + - component: {fileID: 8308377967988601119} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8308377967988601118 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377967988601113} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8308377968792271357} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8308377967988601116 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377967988601113} + m_CullTransparentMesh: 0 +--- !u!114 &8308377967988601119 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377967988601113} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Input Text + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4282603628 + m_fontColor: {r: 0.4245283, g: 0.3444731, b: 0.26232645, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 2 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 1 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 8308377967988601119} + characterCount: 10 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &8308377968792271356 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8308377968792271357} + - component: {fileID: 8308377968792271346} + m_Layer: 5 + m_Name: Text Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8308377968792271357 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377968792271356} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8308377967988601118} + - {fileID: 8308377969178869359} + m_Father: {fileID: 8308377969479965818} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &8308377968792271346 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377968792271356} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &8308377969178869358 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8308377969178869359} + - component: {fileID: 8308377969178869357} + - component: {fileID: 8308377969178869356} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8308377969178869359 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377969178869358} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8308377968792271357} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8308377969178869357 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377969178869358} + m_CullTransparentMesh: 0 +--- !u!114 &8308377969178869356 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377969178869358} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "\u200B" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288132815 + m_fontColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 1 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 8308377969178869356} + characterCount: 1 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &8308377969479965797 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8308377969479965818} + - component: {fileID: 8308377969479965817} + - component: {fileID: 8308377969479965816} + - component: {fileID: 8308377969479965819} + m_Layer: 5 + m_Name: InputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8308377969479965818 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377969479965797} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8308377968792271357} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.4474792, y: 0.48000002} + m_AnchorMax: {x: 0.55200005, y: 0.52000004} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8308377969479965817 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377969479965797} + m_CullTransparentMesh: 0 +--- !u!114 &8308377969479965816 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377969479965797} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 5a5d5dc99836d2b4797a19ecf2b6faaf, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8308377969479965819 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8308377969479965797} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2da0c512f12947e489f739169773d7ca, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 1, g: 0.8257359, b: 0.5896226, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 8308377969479965816} + m_TextViewport: {fileID: 8308377968792271357} + m_TextComponent: {fileID: 8308377969178869356} + m_Placeholder: {fileID: 8308377967988601119} + m_VerticalScrollbar: {fileID: 0} + m_VerticalScrollbarEventHandler: {fileID: 0} + m_ScrollSensitivity: 1 + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_HideSoftKeyboard: 0 + m_CharacterValidation: 0 + m_RegexValue: + m_GlobalPointSize: 14 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_OnSubmit: + m_PersistentCalls: + m_Calls: [] + m_OnSelect: + m_PersistentCalls: + m_Calls: [] + m_OnDeselect: + m_PersistentCalls: + m_Calls: [] + m_OnTextSelection: + m_PersistentCalls: + m_Calls: [] + m_OnEndTextSelection: + m_PersistentCalls: + m_Calls: [] + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_OnTouchScreenKeyboardStatusChanged: + m_PersistentCalls: + m_Calls: [] + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.5686275, g: 0.36078432, b: 0.09019608, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 + m_RichText: 1 + m_GlobalFontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_OnFocusSelectAll: 1 + m_ResetOnDeActivation: 1 + m_RestoreOriginalTextOnEscape: 1 + m_isRichTextEditingAllowed: 0 + m_LineLimit: 0 + m_InputValidator: {fileID: 0} diff --git a/Assets/SharpUI/Prefabs/UI/Input/InputField.prefab.meta b/Assets/SharpUI/Prefabs/UI/Input/InputField.prefab.meta new file mode 100644 index 00000000..2f966e54 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/InputField.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1e6e640fc50432b4293ed4781659d890 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Input/SimpleSlider.prefab b/Assets/SharpUI/Prefabs/UI/Input/SimpleSlider.prefab new file mode 100644 index 00000000..365d4863 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/SimpleSlider.prefab @@ -0,0 +1,591 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &9110153114946636072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9110153114946636055} + - component: {fileID: 9110153114946636053} + - component: {fileID: 9110153114946636054} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9110153114946636055 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153114946636072} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9110153115625551426} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 16, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9110153114946636053 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153114946636072} + m_CullTransparentMesh: 0 +--- !u!114 &9110153114946636054 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153114946636072} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 8fd7febb455068b4599dda0c61d40341, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9110153115625551427 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9110153115625551426} + m_Layer: 5 + m_Name: Handle Slide Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9110153115625551426 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153115625551427} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9110153114946636055} + m_Father: {fileID: 9110153115633879281} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &9110153115633879282 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9110153115633879281} + - component: {fileID: 9110153115633879280} + m_Layer: 5 + m_Name: Slider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9110153115633879281 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153115633879282} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9110153116100094574} + - {fileID: 9110153116133403308} + - {fileID: 9110153115625551426} + m_Father: {fileID: 9110153115755694791} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -21, y: 0} + m_SizeDelta: {x: -42, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &9110153115633879280 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153115633879282} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 9110153114946636054} + m_FillRect: {fileID: 9110153116104882946} + m_HandleRect: {fileID: 9110153114946636055} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 1 + m_WholeNumbers: 0 + m_Value: 0.4 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &9110153115755694808 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9110153115755694791} + - component: {fileID: 9110153115755694790} + m_Layer: 5 + m_Name: SimpleSlider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9110153115755694791 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153115755694808} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9110153115633879281} + - {fileID: 9110153116613606336} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 280, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &9110153115755694790 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153115755694808} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 23e0793da1984c9493e03514824cb577, type: 3} + m_Name: + m_EditorClassIdentifier: + slider: {fileID: 9110153115633879280} + handle: {fileID: 9110153114946636072} + percentageText: {fileID: 9110153116613606351} + textDisplayType: 0 +--- !u!1 &9110153116100094575 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9110153116100094574} + - component: {fileID: 9110153116100094572} + - component: {fileID: 9110153116100094573} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9110153116100094574 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116100094575} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9110153115633879281} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9110153116100094572 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116100094575} + m_CullTransparentMesh: 0 +--- !u!114 &9110153116100094573 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116100094575} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: ec4e46f7b0a59f44581cb894a3e10de8, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9110153116104882947 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9110153116104882946} + - component: {fileID: 9110153116104882944} + - component: {fileID: 9110153116104882945} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9110153116104882946 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116104882947} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9110153116133403308} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 2, y: 0} + m_SizeDelta: {x: 4, y: -6} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9110153116104882944 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116104882947} + m_CullTransparentMesh: 0 +--- !u!114 &9110153116104882945 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116104882947} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 3628ef74d72c2b542a804664f4d4b101, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9110153116133403309 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9110153116133403308} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9110153116133403308 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116133403309} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 9110153116104882946} + m_Father: {fileID: 9110153115633879281} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: -2.5, y: 0} + m_SizeDelta: {x: -15, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &9110153116613606337 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9110153116613606336} + - component: {fileID: 9110153116613606350} + - component: {fileID: 9110153116613606351} + m_Layer: 5 + m_Name: PercentageText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9110153116613606336 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116613606337} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9110153115755694791} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 119, y: 0.44} + m_SizeDelta: {x: 42, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9110153116613606350 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116613606337} + m_CullTransparentMesh: 0 +--- !u!114 &9110153116613606351 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9110153116613606337} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 100.0 % + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4286757861 + m_fontColor: {r: 0.8962264, g: 0.7334206, b: 0.51152545, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 10 + m_fontSizeBase: 10 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 516 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 9110153116613606351} + characterCount: 7 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/SharpUI/Prefabs/UI/Input/SimpleSlider.prefab.meta b/Assets/SharpUI/Prefabs/UI/Input/SimpleSlider.prefab.meta new file mode 100644 index 00000000..e670b88a --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Input/SimpleSlider.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d8165f8fd7b6d784da7c30a9652565fc +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/List.meta b/Assets/SharpUI/Prefabs/UI/List.meta new file mode 100644 index 00000000..2f49728e --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 53051d4ed30dafd4bb7ce393f2ec3c30 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/List/ArrowList.prefab b/Assets/SharpUI/Prefabs/UI/List/ArrowList.prefab new file mode 100644 index 00000000..445ffa9c --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ArrowList.prefab @@ -0,0 +1,661 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2490296646725028614 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 278058153612806782} + - component: {fileID: 4095305249712910858} + m_Layer: 5 + m_Name: ArrowList + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &278058153612806782 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2490296646725028614} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7017603231015737521} + - {fileID: 5097656742095116234} + - {fileID: 8773139241245360901} + - {fileID: 5447137292530568087} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 455.8, y: 129.4} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &4095305249712910858 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2490296646725028614} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ac0d31b723c8450fa3b5003c4a6bebc1, type: 3} + m_Name: + m_EditorClassIdentifier: + leftButton: {fileID: 5097656742095116232} + rightButton: {fileID: 8773139241245360903} + itemText: {fileID: 7163952948270648137} +--- !u!1 &7064882354547247828 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7017603231015737521} + - component: {fileID: 1292136460698914752} + - component: {fileID: 2887671285682700831} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7017603231015737521 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7064882354547247828} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 278058153612806782} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 340, y: 160} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1292136460698914752 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7064882354547247828} + m_CullTransparentMesh: 0 +--- !u!114 &2887671285682700831 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7064882354547247828} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.14117648} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 747cf0b76adcf4848811096362a05091, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &9117355706137607850 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5447137292530568087} + - component: {fileID: 2344114066530508486} + - component: {fileID: 7163952948270648137} + m_Layer: 5 + m_Name: ValueText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5447137292530568087 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9117355706137607850} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 278058153612806782} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 320, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2344114066530508486 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9117355706137607850} + m_CullTransparentMesh: 0 +--- !u!114 &7163952948270648137 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9117355706137607850} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Value + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4285047247 + m_fontColor: {r: 0.8117647, g: 0.6316544, b: 0.40831766, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 32 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: -0.00012207031, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 7163952948270648137} + characterCount: 5 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1001 &6651635001710733439 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 278058153612806782} + m_Modifications: + - target: {fileID: 2706427404842019701, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_Name + value: ArrowButtonRight + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalRotation.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalRotation.w + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 180 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 171.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_SizeDelta.x + value: 21 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_SizeDelta.y + value: 42 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: disabledColor.r + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: disabledColor.g + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: disabledColor.b + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019710, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 6d0973c1e56c266458a98a4e140605e7, + type: 3} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: a40a4981420030447b6664817a46ebc5, type: 3} +--- !u!224 &8773139241245360901 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + m_PrefabInstance: {fileID: 6651635001710733439} + m_PrefabAsset: {fileID: 0} +--- !u!114 &8773139241245360903 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 2706427404842019704, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + m_PrefabInstance: {fileID: 6651635001710733439} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb98c87ed3f24487ab7f939a7bee4b43, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &7147681751279205552 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 278058153612806782} + m_Modifications: + - target: {fileID: 2706427404842019701, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_Name + value: ArrowButtonLeft + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchoredPosition.x + value: -170.8 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_SizeDelta.x + value: 21 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_SizeDelta.y + value: 42 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: disabledColor.r + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: disabledColor.g + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: disabledColor.b + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: disabledColor.a + value: 0.5019608 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: pressedColor.r + value: 0.894 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: pressedColor.g + value: 0.76332337 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: pressedColor.b + value: 0.481866 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: selectedColor.r + value: 0.89411765 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: selectedColor.g + value: 0.7647059 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: selectedColor.b + value: 0.48235294 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: hoverColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: hoverColor.g + value: 0.94509804 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019707, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: hoverColor.b + value: 0.81960785 + objectReference: {fileID: 0} + - target: {fileID: 2706427404842019710, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 6d0973c1e56c266458a98a4e140605e7, + type: 3} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: a40a4981420030447b6664817a46ebc5, type: 3} +--- !u!224 &5097656742095116234 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 2706427404842019706, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + m_PrefabInstance: {fileID: 7147681751279205552} + m_PrefabAsset: {fileID: 0} +--- !u!114 &5097656742095116232 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 2706427404842019704, guid: a40a4981420030447b6664817a46ebc5, + type: 3} + m_PrefabInstance: {fileID: 7147681751279205552} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bb98c87ed3f24487ab7f939a7bee4b43, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/SharpUI/Prefabs/UI/List/ArrowList.prefab.meta b/Assets/SharpUI/Prefabs/UI/List/ArrowList.prefab.meta new file mode 100644 index 00000000..9c16a54d --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ArrowList.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a2b4e86cae1150148837f38936e0dae6 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/List/ListItemCustom.prefab b/Assets/SharpUI/Prefabs/UI/List/ListItemCustom.prefab new file mode 100644 index 00000000..da2e495f --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ListItemCustom.prefab @@ -0,0 +1,507 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2985651140188465408 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2985651140188465407} + - component: {fileID: 2985651140188465405} + - component: {fileID: 2985651140188465406} + - component: {fileID: 4026676665396660129} + m_Layer: 5 + m_Name: TextLeft + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2985651140188465407 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140188465408} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2985651140807402568} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -96.26, y: 0} + m_SizeDelta: {x: -222.51, y: -16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2985651140188465405 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140188465408} + m_CullTransparentMesh: 0 +--- !u!114 &2985651140188465406 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140188465408} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Left text + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288404479 + m_fontColor: {r: 1, g: 0.86019176, b: 0.6084906, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 257 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 2985651140188465406} + characterCount: 9 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &4026676665396660129 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140188465408} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 1} + pressedColor: {r: 1, g: 1, b: 1, a: 1} + selectedColor: {r: 1, g: 0.78431374, b: 0.4, a: 1} + hoverColor: {r: 1, g: 0.784, b: 0.39999998, a: 1} +--- !u!1 &2985651140807402569 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2985651140807402568} + - component: {fileID: 2985651140807402565} + - component: {fileID: 2985651140807402566} + - component: {fileID: 2985651140807402567} + - component: {fileID: 8697082110982867953} + - component: {fileID: 1374561090254581563} + m_Layer: 5 + m_Name: ListItemCustom + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2985651140807402568 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140807402569} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2985651140188465407} + - {fileID: 1227113263335885875} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 406, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2985651140807402565 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140807402569} + m_CullTransparentMesh: 0 +--- !u!114 &2985651140807402566 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140807402569} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: a78e1df9d391117438f8c74cbfd2a93d, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2985651140807402567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140807402569} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: 40 + m_FlexibleWidth: 1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &8697082110982867953 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140807402569} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 66ea24f89fb64f3eab4534f15da62dfd, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 0 + isSelected: 0 + leftText: {fileID: 2985651140188465406} + rightText: {fileID: 1526170391557698208} +--- !u!114 &1374561090254581563 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2985651140807402569} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2985651140807402566} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &9023054485599917007 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1227113263335885875} + - component: {fileID: 5721937305211254368} + - component: {fileID: 1526170391557698208} + - component: {fileID: 399725176588658234} + m_Layer: 5 + m_Name: TextRight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1227113263335885875 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9023054485599917007} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2985651140807402568} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 91.742, y: 0} + m_SizeDelta: {x: -213.48, y: -16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5721937305211254368 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9023054485599917007} + m_CullTransparentMesh: 0 +--- !u!114 &1526170391557698208 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9023054485599917007} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Right text + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288404479 + m_fontColor: {r: 1, g: 0.86019176, b: 0.6084906, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 257 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 1526170391557698208} + characterCount: 10 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &399725176588658234 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9023054485599917007} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 1} + pressedColor: {r: 1, g: 1, b: 1, a: 1} + selectedColor: {r: 0.01201493, g: 0.32393962, b: 0.8490566, a: 1} + hoverColor: {r: 0.050000012, g: 0.4332467, b: 1, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/List/ListItemCustom.prefab.meta b/Assets/SharpUI/Prefabs/UI/List/ListItemCustom.prefab.meta new file mode 100644 index 00000000..ab977a82 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ListItemCustom.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 43a9fbd992ad96744ba90160c1aa553d +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/List/ListItemDescription.prefab b/Assets/SharpUI/Prefabs/UI/List/ListItemDescription.prefab new file mode 100644 index 00000000..f0bfc12b --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ListItemDescription.prefab @@ -0,0 +1,548 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &229017258028097706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3598675941881917841} + - component: {fileID: 4022261065062113472} + - component: {fileID: 118373313222390650} + - component: {fileID: 1000093904487158279} + - component: {fileID: 5525510589526946981} + - component: {fileID: -5494474275820683138} + - component: {fileID: 5923886188533937481} + - component: {fileID: 4381449447448221625} + m_Layer: 5 + m_Name: ListItemDescription + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3598675941881917841 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 229017258028097706} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7351535161331825962} + - {fileID: 4102838403495359025} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 406, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4022261065062113472 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 229017258028097706} + m_CullTransparentMesh: 0 +--- !u!114 &118373313222390650 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 229017258028097706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1000093904487158279 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 229017258028097706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: 90 + m_FlexibleWidth: 1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &5525510589526946981 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 229017258028097706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9d6f2ad1c64045579f3090671a12287c, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 0 + isSelected: 0 + textTitle: {fileID: 1593830725535666205} + textDescription: {fileID: 5400391194802704952} +--- !u!114 &-5494474275820683138 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 229017258028097706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 1, g: 0.627451, b: 0, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, + type: 3} + m_PressedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + m_SelectedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 118373313222390650} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &5923886188533937481 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 229017258028097706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 1, b: 1, a: 1} + selectedColor: {r: 1, g: 1, b: 1, a: 1} + hoverColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!114 &4381449447448221625 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 229017258028097706} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fffcae0ee53a4c80b40b7ca2a902c0fc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalSprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + disabledSprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + pressedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + selectedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + hoverSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} +--- !u!1 &478394263817674842 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4102838403495359025} + - component: {fileID: 5898142806292377328} + - component: {fileID: 5400391194802704952} + - component: {fileID: 4495020719562571012} + m_Layer: 5 + m_Name: Description + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4102838403495359025 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 478394263817674842} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3598675941881917841} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -61.9} + m_SizeDelta: {x: -30, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5898142806292377328 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 478394263817674842} + m_CullTransparentMesh: 0 +--- !u!114 &5400391194802704952 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 478394263817674842} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Description: Vivamus id posuere augue. Pellentesque eget ex laoreet, tincidunt + elit sit amet, varius lacus. Quisque faucibus feugiat felis eu porta. Praesent + feugiat tincidunt magna.' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288132815 + m_fontColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 257 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 1 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 1 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 5400391194802704952} + characterCount: 177 + spriteCount: 0 + spaceCount: 24 + wordCount: 24 + linkCount: 0 + lineCount: 3 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &4495020719562571012 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 478394263817674842} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + disabledColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 0.5019608} + pressedColor: {r: 0.8117647, g: 0.5206491, b: 0.16235293, a: 1} + selectedColor: {r: 0.8117647, g: 0.5942433, b: 0.32470587, a: 1} + hoverColor: {r: 0.8117647, g: 0.6668067, b: 0.48705882, a: 1} +--- !u!1 &6603365043616727016 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7351535161331825962} + - component: {fileID: 3562498788207664892} + - component: {fileID: 1593830725535666205} + - component: {fileID: 8609703959283884338} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7351535161331825962 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6603365043616727016} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3598675941881917841} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -20.8} + m_SizeDelta: {x: -30, y: 22} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3562498788207664892 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6603365043616727016} + m_CullTransparentMesh: 0 +--- !u!114 &1593830725535666205 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6603365043616727016} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Title: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus + id posuere augue. Pellentesque eget ex laoreet, tincidunt elit sit amet, varius + lacus. Quisque faucibus feugiat felis eu porta. Praesent feugiat tincidunt magna.' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4291224819 + m_fontColor: {r: 0.9529412, g: 0.89411765, b: 0.7764706, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 1 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 1 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 1593830725535666205} + characterCount: 45 + spriteCount: 0 + spaceCount: 6 + wordCount: 7 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &8609703959283884338 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6603365043616727016} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.9529412, g: 0.89411765, b: 0.7764706, a: 1} + disabledColor: {r: 0.9529412, g: 0.89411765, b: 0.7764706, a: 0.5019608} + pressedColor: {r: 0.9529412, g: 0.697083, b: 0.19058822, a: 1} + selectedColor: {r: 0.9529412, g: 0.7592027, b: 0.38117644, a: 1} + hoverColor: {r: 0.9529412, g: 0.8258824, b: 0.5717647, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/List/ListItemDescription.prefab.meta b/Assets/SharpUI/Prefabs/UI/List/ListItemDescription.prefab.meta new file mode 100644 index 00000000..99a483eb --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ListItemDescription.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0e421a6fbe258164992a3630ca5cb25d +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/List/ListItemImage.prefab b/Assets/SharpUI/Prefabs/UI/List/ListItemImage.prefab new file mode 100644 index 00000000..eb9ae23c --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ListItemImage.prefab @@ -0,0 +1,734 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &367427457404784296 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3048262909581660958} + - component: {fileID: 910059157264470473} + - component: {fileID: 2237059993614767914} + - component: {fileID: 7817151608366325769} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3048262909581660958 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367427457404784296} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 724958338469092696} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 76, y: -8} + m_SizeDelta: {x: -84, y: 22} + m_Pivot: {x: 0, y: 1} +--- !u!222 &910059157264470473 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367427457404784296} + m_CullTransparentMesh: 0 +--- !u!114 &2237059993614767914 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367427457404784296} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Header: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus + id posuere augue. Pellentesque eget ex laoreet, tincidunt elit sit amet, varius + lacus. Quisque faucibus feugiat felis eu porta. Praesent feugiat tincidunt magna.' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4291224819 + m_fontColor: {r: 0.9528302, g: 0.8944019, b: 0.7775454, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 1 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 1 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 2237059993614767914} + characterCount: 34 + spriteCount: 0 + spaceCount: 5 + wordCount: 6 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &7817151608366325769 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 367427457404784296} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.9529412, g: 0.89411765, b: 0.7764706, a: 1} + disabledColor: {r: 0.9529412, g: 0.89411765, b: 0.7764706, a: 0.5019608} + pressedColor: {r: 0.9529412, g: 0.697083, b: 0.19058822, a: 1} + selectedColor: {r: 0.9529412, g: 0.7592027, b: 0.38117644, a: 1} + hoverColor: {r: 0.9529412, g: 0.8258824, b: 0.5717647, a: 1} +--- !u!1 &823999807174074112 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3228436760030379287} + - component: {fileID: 2704609525144358502} + - component: {fileID: 6008882428189445381} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3228436760030379287 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 823999807174074112} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3495212438338480713} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -10, y: -10} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2704609525144358502 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 823999807174074112} + m_CullTransparentMesh: 0 +--- !u!114 &6008882428189445381 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 823999807174074112} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 72a5b884f12dfe04cbfb9b61a4c78532, type: 3} + m_Type: 0 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1099533230374413908 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3495212438338480713} + - component: {fileID: 2626611927549824445} + - component: {fileID: 232717634811549240} + - component: {fileID: 3788828151135337268} + - component: {fileID: 9168802357169423073} + m_Layer: 5 + m_Name: ImageContainer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3495212438338480713 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1099533230374413908} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3228436760030379287} + m_Father: {fileID: 724958338469092696} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 8, y: -8} + m_SizeDelta: {x: 60, y: 60} + m_Pivot: {x: 0, y: 1} +--- !u!222 &2626611927549824445 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1099533230374413908} + m_CullTransparentMesh: 0 +--- !u!114 &232717634811549240 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1099533230374413908} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &3788828151135337268 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1099533230374413908} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fffcae0ee53a4c80b40b7ca2a902c0fc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalSprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + disabledSprite: {fileID: 21300000, guid: 107a3b99d9e7aee488e658ffc76cbcb4, type: 3} + pressedSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} + selectedSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} + hoverSprite: {fileID: 21300000, guid: 544c7658577bb184c87949ec3c93d319, type: 3} +--- !u!114 &9168802357169423073 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1099533230374413908} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 1, b: 1, a: 1} + selectedColor: {r: 1, g: 1, b: 1, a: 1} + hoverColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &3423007468724120475 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 724958338469092696} + - component: {fileID: 4177583341978904317} + - component: {fileID: 1750452538795874179} + - component: {fileID: 8345063136495003776} + - component: {fileID: 3481496516729508040} + - component: {fileID: 1153189092023256937} + - component: {fileID: 2362118043338630645} + - component: {fileID: 769908046138027203} + m_Layer: 5 + m_Name: ListItemImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &724958338469092696 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3423007468724120475} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3495212438338480713} + - {fileID: 3048262909581660958} + - {fileID: 1301256770983622479} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 406, y: 80} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4177583341978904317 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3423007468724120475} + m_CullTransparentMesh: 0 +--- !u!114 &1750452538795874179 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3423007468724120475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8345063136495003776 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3423007468724120475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: 80 + m_FlexibleWidth: 1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &3481496516729508040 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3423007468724120475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 437c55041a984d6da166ebc4dea55efa, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 0 + isSelected: 0 + textTitle: {fileID: 2237059993614767914} + textDescription: {fileID: 5530016420733362421} + iconBackground: {fileID: 232717634811549240} + imageIcon: {fileID: 6008882428189445381} +--- !u!114 &1153189092023256937 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3423007468724120475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 1, g: 0.627451, b: 0, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, + type: 3} + m_PressedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + m_SelectedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1750452538795874179} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2362118043338630645 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3423007468724120475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fffcae0ee53a4c80b40b7ca2a902c0fc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalSprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + disabledSprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + pressedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + selectedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + hoverSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} +--- !u!114 &769908046138027203 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3423007468724120475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 1, b: 1, a: 1} + selectedColor: {r: 1, g: 1, b: 1, a: 1} + hoverColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!1 &3597930457818659869 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1301256770983622479} + - component: {fileID: 5653626756362706003} + - component: {fileID: 5530016420733362421} + - component: {fileID: 2192866570207666243} + m_Layer: 5 + m_Name: Description + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1301256770983622479 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3597930457818659869} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 724958338469092696} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 76, y: -31.3} + m_SizeDelta: {x: -84, y: 34} + m_Pivot: {x: 0, y: 1} +--- !u!222 &5653626756362706003 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3597930457818659869} + m_CullTransparentMesh: 0 +--- !u!114 &5530016420733362421 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3597930457818659869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Description: Vivamus id posuere augue. Pellentesque eget ex laoreet, tincidunt + elit sit amet, varius lacus. Quisque faucibus feugiat felis eu porta. Praesent + feugiat tincidunt magna.' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288132815 + m_fontColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 1 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 1 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 5530016420733362421} + characterCount: 91 + spriteCount: 0 + spaceCount: 12 + wordCount: 13 + linkCount: 0 + lineCount: 2 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &2192866570207666243 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3597930457818659869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + disabledColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 0.5019608} + pressedColor: {r: 0.8117647, g: 0.5206491, b: 0.16235293, a: 1} + selectedColor: {r: 0.8117647, g: 0.5942433, b: 0.32470587, a: 1} + hoverColor: {r: 0.8117647, g: 0.6668067, b: 0.48705882, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/List/ListItemImage.prefab.meta b/Assets/SharpUI/Prefabs/UI/List/ListItemImage.prefab.meta new file mode 100644 index 00000000..c3042a23 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ListItemImage.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f9cbc0a9a2636504ea151e5a90efc25c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/List/ListItemText.prefab b/Assets/SharpUI/Prefabs/UI/List/ListItemText.prefab new file mode 100644 index 00000000..040ff216 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ListItemText.prefab @@ -0,0 +1,371 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &99044400211064942 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4830218956430399578} + - component: {fileID: 7153737750652808091} + - component: {fileID: 246138233081252820} + - component: {fileID: 7393495831661313202} + - component: {fileID: 8582146393274219857} + - component: {fileID: -1836677606987139425} + - component: {fileID: 5083161872284274383} + - component: {fileID: 1289136038277350235} + m_Layer: 5 + m_Name: ListItemText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4830218956430399578 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99044400211064942} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1259645816584217283} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 406, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7153737750652808091 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99044400211064942} + m_CullTransparentMesh: 0 +--- !u!114 &246138233081252820 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99044400211064942} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7393495831661313202 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99044400211064942} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: 40 + m_FlexibleWidth: 1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &8582146393274219857 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99044400211064942} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1e84099ddb2c40658de7254f8d1a6d2f, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 0 + isSelected: 0 + textTitle: {fileID: 8102325113570021428} +--- !u!114 &-1836677606987139425 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99044400211064942} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 1, g: 0.627451, b: 0, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, + type: 3} + m_PressedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + m_SelectedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 246138233081252820} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &5083161872284274383 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99044400211064942} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 1, g: 1, b: 1, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 1, g: 1, b: 1, a: 1} + selectedColor: {r: 1, g: 1, b: 1, a: 1} + hoverColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!114 &1289136038277350235 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 99044400211064942} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fffcae0ee53a4c80b40b7ca2a902c0fc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalSprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + disabledSprite: {fileID: 21300000, guid: 01b9ac53d33b3e348ac3f829b220ca6a, type: 3} + pressedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + selectedSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} + hoverSprite: {fileID: 21300000, guid: 15f8ecd19bc987d4a855e3b2f78473bc, type: 3} +--- !u!1 &473188178310384841 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1259645816584217283} + - component: {fileID: 5620862684494537049} + - component: {fileID: 8102325113570021428} + - component: {fileID: 3024542414525434338} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1259645816584217283 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 473188178310384841} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4830218956430399578} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -30, y: -16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5620862684494537049 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 473188178310384841} + m_CullTransparentMesh: 0 +--- !u!114 &8102325113570021428 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 473188178310384841} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Item text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus + id posuere augue. Pellentesque eget ex laoreet, tincidunt elit sit amet, varius + lacus. Quisque faucibus feugiat felis eu porta. Praesent feugiat tincidunt magna.' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4291224819 + m_fontColor: {r: 0.9529412, g: 0.89411765, b: 0.7764706, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 1 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 1 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 8102325113570021428} + characterCount: 45 + spriteCount: 0 + spaceCount: 7 + wordCount: 8 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &3024542414525434338 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 473188178310384841} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.9529412, g: 0.89411765, b: 0.7764706, a: 1} + disabledColor: {r: 0.9529412, g: 0.89411765, b: 0.7764706, a: 0.5019608} + pressedColor: {r: 0.9529412, g: 0.697083, b: 0.19058822, a: 1} + selectedColor: {r: 0.9529412, g: 0.7592027, b: 0.38117644, a: 1} + hoverColor: {r: 0.9529412, g: 0.8258824, b: 0.5717647, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/List/ListItemText.prefab.meta b/Assets/SharpUI/Prefabs/UI/List/ListItemText.prefab.meta new file mode 100644 index 00000000..8ad15748 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/ListItemText.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e6dd7bd374e00e643bab8239d6a1f289 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/List/SharpList.prefab b/Assets/SharpUI/Prefabs/UI/List/SharpList.prefab new file mode 100644 index 00000000..77abb0e2 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/SharpList.prefab @@ -0,0 +1,694 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8180809737096213159 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8180809737096213156} + - component: {fileID: 8180809737096213155} + - component: {fileID: 8180809737096213154} + - component: {fileID: 8180809737096213157} + m_Layer: 5 + m_Name: Scroll View + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8180809737096213156 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737096213159} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8180809737392901768} + - {fileID: 8180809737878266029} + m_Father: {fileID: 8180809738033677643} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -12, y: -16} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8180809737096213155 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737096213159} + m_CullTransparentMesh: 0 +--- !u!114 &8180809737096213154 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737096213159} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8180809737096213157 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737096213159} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 8180809737608044385} + m_Horizontal: 0 + m_Vertical: 1 + m_MovementType: 2 + m_Elasticity: 0.1 + m_Inertia: 1 + m_DecelerationRate: 0.135 + m_ScrollSensitivity: 30 + m_Viewport: {fileID: 8180809737392901768} + m_HorizontalScrollbar: {fileID: 0} + m_VerticalScrollbar: {fileID: 8180809737878266026} + m_HorizontalScrollbarVisibility: 2 + m_VerticalScrollbarVisibility: 2 + m_HorizontalScrollbarSpacing: -3 + m_VerticalScrollbarSpacing: 2 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &8180809737154627291 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8180809737154627288} + - component: {fileID: 8180809737154627286} + - component: {fileID: 8180809737154627289} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8180809737154627288 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737154627291} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8180809738235927585} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 6, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8180809737154627286 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737154627291} + m_CullTransparentMesh: 0 +--- !u!114 &8180809737154627289 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737154627291} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 8fd7febb455068b4599dda0c61d40341, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8180809737392901771 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8180809737392901768} + - component: {fileID: 8180809737392901767} + - component: {fileID: 8180809737392901766} + - component: {fileID: 8180809737392901769} + m_Layer: 5 + m_Name: Viewport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8180809737392901768 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737392901771} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8180809737608044385} + m_Father: {fileID: 8180809737096213156} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!222 &8180809737392901767 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737392901771} + m_CullTransparentMesh: 0 +--- !u!114 &8180809737392901766 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737392901771} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8180809737392901769 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737392901771} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 0 +--- !u!1 &8180809737608044384 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8180809737608044385} + - component: {fileID: 8180809737608044412} + - component: {fileID: 8180809737608044415} + - component: {fileID: 8180809737608044414} + - component: {fileID: 8180809737608044413} + - component: {fileID: 3834020475358839744} + m_Layer: 5 + m_Name: Container + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8180809737608044385 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737608044384} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8180809737392901768} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0.000011384487, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!222 &8180809737608044412 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737608044384} + m_CullTransparentMesh: 0 +--- !u!114 &8180809737608044415 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737608044384} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8180809737608044414 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737608044384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 0 + m_VerticalFit: 2 +--- !u!114 &8180809737608044413 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737608044384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 5 + m_Right: 5 + m_Top: 5 + m_Bottom: 5 + m_ChildAlignment: 0 + m_Spacing: 2 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 1 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 +--- !u!114 &3834020475358839744 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737608044384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AllowSwitchOff: 0 +--- !u!1 &8180809737878266028 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8180809737878266029} + - component: {fileID: 8180809737878266024} + - component: {fileID: 8180809737878266027} + - component: {fileID: 8180809737878266026} + m_Layer: 5 + m_Name: Scrollbar Vertical + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8180809737878266029 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737878266028} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8180809738235927585} + m_Father: {fileID: 8180809737096213156} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -6} + m_SizeDelta: {x: 14, y: -12} + m_Pivot: {x: 1, y: 1} +--- !u!222 &8180809737878266024 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737878266028} + m_CullTransparentMesh: 0 +--- !u!114 &8180809737878266027 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737878266028} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: ec4e46f7b0a59f44581cb894a3e10de8, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8180809737878266026 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809737878266028} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 8180809737154627289} + m_HandleRect: {fileID: 8180809737154627288} + m_Direction: 2 + m_Value: 0 + m_Size: 1 + m_NumberOfSteps: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &8180809738033677642 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8180809738033677643} + - component: {fileID: 8180809738033677641} + - component: {fileID: 8180809738033677640} + - component: {fileID: 8180809738033677639} + - component: {fileID: 8180809738033677638} + - component: {fileID: 4026561262460859291} + m_Layer: 5 + m_Name: SharpList + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8180809738033677643 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809738033677642} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8180809737096213156} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -370, y: 110} + m_SizeDelta: {x: -740, y: -220} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8180809738033677641 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809738033677642} + m_CullTransparentMesh: 0 +--- !u!114 &8180809738033677640 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809738033677642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4e669f22e6bb3a04189282086d3b677e, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 4 +--- !u!114 &8180809738033677639 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809738033677642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 1 +--- !u!114 &8180809738033677638 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809738033677642} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 8180809737608044385} + m_Horizontal: 0 + m_Vertical: 1 + m_MovementType: 2 + m_Elasticity: 0.1 + m_Inertia: 1 + m_DecelerationRate: 0.135 + m_ScrollSensitivity: 28 + m_Viewport: {fileID: 0} + m_HorizontalScrollbar: {fileID: 0} + m_VerticalScrollbar: {fileID: 0} + m_HorizontalScrollbarVisibility: 0 + m_VerticalScrollbarVisibility: 0 + m_HorizontalScrollbarSpacing: 0 + m_VerticalScrollbarSpacing: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &4026561262460859291 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809738033677642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5c8a3437e8aaf7b44bc0d1e62b7de955, type: 3} + m_Name: + m_EditorClassIdentifier: + container: {fileID: 8180809737608044384} + enableItems: 1 + canClickItems: 1 + canSelectItems: 1 + selectionType: 0 + selectionAmount: 0 +--- !u!1 &8180809738235927584 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8180809738235927585} + m_Layer: 5 + m_Name: Sliding Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8180809738235927585 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8180809738235927584} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8180809737154627288} + m_Father: {fileID: 8180809737878266029} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -8, y: -21} + m_Pivot: {x: 0.5, y: 0.5} diff --git a/Assets/SharpUI/Prefabs/UI/List/SharpList.prefab.meta b/Assets/SharpUI/Prefabs/UI/List/SharpList.prefab.meta new file mode 100644 index 00000000..3dbb9029 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/List/SharpList.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 331fe615980514e4f809a4bf7b1b7c48 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/ModalView.prefab b/Assets/SharpUI/Prefabs/UI/ModalView.prefab new file mode 100644 index 00000000..d4b5c788 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/ModalView.prefab @@ -0,0 +1,1397 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2483414459286756614 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2483414459286756615} + - component: {fileID: 2483414459286756613} + - component: {fileID: 2483414459286756612} + m_Layer: 5 + m_Name: Content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2483414459286756615 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459286756614} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2483414459521206206} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -20} + m_SizeDelta: {x: 0, y: -40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2483414459286756613 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459286756614} + m_CullTransparentMesh: 0 +--- !u!114 &2483414459286756612 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459286756614} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.754717, g: 0.5383602, b: 0.2171591, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &2483414459321834896 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2483414459321834897} + - component: {fileID: 2483414459321834903} + - component: {fileID: 2483414459321834902} + - component: {fileID: 2483414459321834900} + m_Layer: 5 + m_Name: Header + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2483414459321834897 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459321834896} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2483414460113696524} + - {fileID: 2483414460258542089} + - {fileID: 7715414001393348333} + - {fileID: 7715414003406875931} + m_Father: {fileID: 2483414459521206206} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -20} + m_SizeDelta: {x: 0, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2483414459321834903 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459321834896} + m_CullTransparentMesh: 0 +--- !u!114 &2483414459321834902 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459321834896} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7264151, g: 0.47999018, b: 0.16104485, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2483414459321834900 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459321834896} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!1 &2483414459521206201 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2483414459521206206} + - component: {fileID: 2483414459521206204} + - component: {fileID: 2483414459521206205} + m_Layer: 5 + m_Name: ModalView + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2483414459521206206 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459521206201} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2483414460729659186} + - {fileID: 2483414459321834897} + - {fileID: 2483414459286756615} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 800, y: 600} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2483414459521206204 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459521206201} + m_CullTransparentMesh: 0 +--- !u!114 &2483414459521206205 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414459521206201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 99be0233461e4b8fb16ae5ccb8ef0bd4, type: 3} + m_Name: + m_EditorClassIdentifier: + closeButton: {fileID: 7715414001393348329} + collapseButton: {fileID: 7715414003406875935} + headerRectTransform: {fileID: 2483414459321834897} + contentRectTransform: {fileID: 2483414459286756615} + backgroundRectTransform: {fileID: 2483414460729659186} + isCollapsed: 0 + isDraggable: 1 + showBackground: 1 +--- !u!1 &2483414460113696527 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2483414460113696524} + - component: {fileID: 2483414460113696514} + - component: {fileID: 2483414460113696525} + m_Layer: 5 + m_Name: HeaderFrame + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2483414460113696524 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460113696527} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2483414459321834897} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0.25, y: -20} + m_SizeDelta: {x: 2.73, y: 44} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2483414460113696514 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460113696527} + m_CullTransparentMesh: 0 +--- !u!114 &2483414460113696525 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460113696527} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.8773585, g: 0.68529147, b: 0.38487893, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 4 +--- !u!1 &2483414460258542088 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2483414460258542089} + - component: {fileID: 2483414460258542095} + - component: {fileID: 2483414460258542094} + m_Layer: 5 + m_Name: TitleText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2483414460258542089 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460258542088} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2483414459321834897} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2483414460258542095 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460258542088} + m_CullTransparentMesh: 0 +--- !u!114 &2483414460258542094 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460258542088} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Modal view Title + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4283217378 + m_fontColor: {r: 0.8867924, g: 0.7098522, b: 0.29699183, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 33 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 2483414460258542094} + characterCount: 16 + spriteCount: 0 + spaceCount: 2 + wordCount: 3 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &2483414460268842448 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2483414460268842449} + - component: {fileID: 2483414460268842455} + - component: {fileID: 2483414460268842454} + - component: {fileID: 2483414460268842452} + m_Layer: 5 + m_Name: BackgroundInner + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2483414460268842449 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460268842448} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2483414460729659186} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2483414460268842455 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460268842448} + m_CullTransparentMesh: 0 +--- !u!114 &2483414460268842454 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460268842448} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.9019608} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4e669f22e6bb3a04189282086d3b677e, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 6 +--- !u!114 &2483414460268842452 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460268842448} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!1 &2483414460729659197 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2483414460729659186} + - component: {fileID: 2483414460729659184} + - component: {fileID: 2483414460729659187} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2483414460729659186 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460729659197} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2483414460268842449} + m_Father: {fileID: 2483414459521206206} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2483414460729659184 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460729659197} + m_CullTransparentMesh: 0 +--- !u!114 &2483414460729659187 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2483414460729659197} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0.78921854, b: 0.504717, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4037f1d5675a198458a8fa101437438b, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1001 &2483414459681907296 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2483414459321834897} + m_Modifications: + - target: {fileID: 5288479832558942388, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Name + value: IconCollapse + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.z + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: -90 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_SizeDelta.x + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_SizeDelta.y + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: b72b9c6e8bdeb3347a6c3e9b5273364b, + type: 3} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.r + value: 0.8962264 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.g + value: 0.6262692 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.b + value: 0.29169634 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.r + value: 0.8980392 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.g + value: 0.627451 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.b + value: 0.29411766 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.g + value: 0.5536723 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.r + value: 0.8392157 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.g + value: 0.5294118 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.b + value: 0.14509805 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.r + value: 0.83699995 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.g + value: 0.5257339 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.b + value: 0.14229001 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.r + value: 0.8980392 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.g + value: 0.627451 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.b + value: 0.29411766 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.g + value: 0.5536723 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.r + value: 0.8392157 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.g + value: 0.5294118 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.b + value: 0.14509805 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.r + value: 0.83699995 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.g + value: 0.5257339 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.b + value: 0.14229001 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351098, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Name + value: ButtonCollapse + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchoredPosition.x + value: -56.4 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0.39996338 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_SizeDelta.x + value: 32 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_SizeDelta.y + value: 32 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMin.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, + type: 3} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Type + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_PixelsPerUnitMultiplier + value: 2.6 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.r + value: 0.8980392 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.g + value: 0.627451 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.b + value: 0.29411766 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351103, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: isSelectable + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 5288479832656351040, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, type: 3} + m_SourcePrefab: {fileID: 100100000, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, type: 3} +--- !u!224 &7715414003406875931 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + m_PrefabInstance: {fileID: 2483414459681907296} + m_PrefabAsset: {fileID: 0} +--- !u!114 &7715414003406875935 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5288479832656351103, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + m_PrefabInstance: {fileID: 2483414459681907296} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8ee3b09d769841f6823e1585a54e4337, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &2483414460890128790 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 2483414459321834897} + m_Modifications: + - target: {fileID: 5288479832558942388, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Name + value: IconClose + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_SizeDelta.x + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_SizeDelta.y + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942389, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 90bb2e95161250447abd94a555ad789c, + type: 3} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_PreserveAspect + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_UseSpriteMesh + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Type + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_PixelsPerUnitMultiplier + value: 2.6 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.r + value: 0.8980392 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.g + value: 0.627451 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942390, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.b + value: 0.29411766 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.r + value: 0.8980392 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.g + value: 0.627451 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.b + value: 0.29411766 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.g + value: 0.5536723 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.r + value: 0.8392157 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.g + value: 0.5294118 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.b + value: 0.14509805 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.r + value: 0.83699995 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.g + value: 0.5257339 + objectReference: {fileID: 0} + - target: {fileID: 5288479832558942392, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.b + value: 0.14229001 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.r + value: 0.8980392 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.g + value: 0.627451 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: normalColor.b + value: 0.29411766 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.g + value: 0.5536723 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: pressedColor.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.r + value: 0.8392157 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.g + value: 0.5294118 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: selectedColor.b + value: 0.14509805 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.r + value: 0.83699995 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.b + value: 0.14229001 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351041, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: hoverColor.g + value: 0.5257339 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351098, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Name + value: ButtonClose + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchoredPosition.x + value: -21.4 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0.4 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_SizeDelta.x + value: 32 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_SizeDelta.y + value: 32 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMin.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_PreserveAspect + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.r + value: 0.8980392 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.g + value: 0.627451 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Color.b + value: 0.29411766 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, + type: 3} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Type + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351101, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_PixelsPerUnitMultiplier + value: 2.8 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351103, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: isSelectable + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5288479832656351103, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 5288479832656351040, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, type: 3} + m_SourcePrefab: {fileID: 100100000, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, type: 3} +--- !u!224 &7715414001393348333 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 5288479832656351099, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + m_PrefabInstance: {fileID: 2483414460890128790} + m_PrefabAsset: {fileID: 0} +--- !u!114 &7715414001393348329 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5288479832656351103, guid: 4ae8a9d3a5de27648bee5528c5ec1e69, + type: 3} + m_PrefabInstance: {fileID: 2483414460890128790} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8ee3b09d769841f6823e1585a54e4337, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/SharpUI/Prefabs/UI/ModalView.prefab.meta b/Assets/SharpUI/Prefabs/UI/ModalView.prefab.meta new file mode 100644 index 00000000..3b2c5e63 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/ModalView.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 59e0b2eed596126498d96bf88aae9790 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Notification.prefab b/Assets/SharpUI/Prefabs/UI/Notification.prefab new file mode 100644 index 00000000..3d9c96be --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Notification.prefab @@ -0,0 +1,612 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1678249394075558671 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1678249394075558664} + - component: {fileID: 1678249394075558666} + - component: {fileID: 1678249394075558665} + m_Layer: 5 + m_Name: TextSubtitle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1678249394075558664 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394075558671} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1678249394519105833} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -13.5} + m_SizeDelta: {x: 480, y: 57} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1678249394075558666 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394075558671} + m_CullTransparentMesh: 0 +--- !u!114 &1678249394075558665 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394075558671} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Subtitle + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4285640686 + m_fontColor: {r: 0.9339623, g: 0.6850995, b: 0.44495374, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 42 + m_fontSizeBase: 42 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 33 + m_textAlignment: 258 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 1678249394075558665} + characterCount: 8 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1678249394111075975 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1678249394111075968} + - component: {fileID: 1678249394111075970} + - component: {fileID: 1678249394111075969} + m_Layer: 5 + m_Name: TextTitle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1678249394111075968 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394111075975} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1678249394519105833} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -21.592} + m_SizeDelta: {x: 480, y: 26.815} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1678249394111075970 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394111075975} + m_CullTransparentMesh: 0 +--- !u!114 &1678249394111075969 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394111075975} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Title + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4283004082 + m_fontColor: {r: 0.6981132, g: 0.45598182, b: 0.28648987, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 1026 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 1678249394111075969} + characterCount: 5 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1678249394307984498 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1678249394307984499} + - component: {fileID: 1678249394307984509} + - component: {fileID: 1678249394307984508} + m_Layer: 5 + m_Name: LineTop + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1678249394307984499 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394307984498} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1678249394519105833} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -4} + m_SizeDelta: {x: 0, y: 8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1678249394307984509 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394307984498} + m_CullTransparentMesh: 0 +--- !u!114 &1678249394307984508 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394307984498} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.72156864} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: d379c3f0279e4fe4c87742b7479f7609, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1678249394519105832 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1678249394519105833} + - component: {fileID: 1678249394519105835} + - component: {fileID: 1678249394519105834} + - component: {fileID: 8888795671525478289} + m_Layer: 5 + m_Name: Notification + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1678249394519105833 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394519105832} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1678249395502694553} + - {fileID: 1678249394307984499} + - {fileID: 1678249395519522346} + - {fileID: 1678249394111075968} + - {fileID: 1678249394075558664} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 480, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1678249394519105835 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394519105832} + m_CullTransparentMesh: 0 +--- !u!114 &1678249394519105834 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394519105832} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 91c3699c12184711937c7f16c88334f0, type: 3} + m_Name: + m_EditorClassIdentifier: + textTitle: {fileID: 1678249394111075969} + textSubtitle: {fileID: 1678249394075558665} + autoFadeout: 0 + hideOnStart: 0 + closeWhenClicked: 0 + hideDelayMillis: 0 +--- !u!225 &8888795671525478289 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249394519105832} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!1 &1678249395502694552 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1678249395502694553} + - component: {fileID: 1678249395502694555} + - component: {fileID: 1678249395502694554} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1678249395502694553 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249395502694552} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1678249394519105833} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 200} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1678249395502694555 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249395502694552} + m_CullTransparentMesh: 0 +--- !u!114 &1678249395502694554 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249395502694552} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.2784314} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 747cf0b76adcf4848811096362a05091, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1678249395519522345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1678249395519522346} + - component: {fileID: 1678249395519522324} + - component: {fileID: 1678249395519522347} + m_Layer: 5 + m_Name: LineBottom + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1678249395519522346 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249395519522345} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1678249394519105833} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 4} + m_SizeDelta: {x: 0, y: 8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1678249395519522324 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249395519522345} + m_CullTransparentMesh: 0 +--- !u!114 &1678249395519522347 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1678249395519522345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.72156864} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: d379c3f0279e4fe4c87742b7479f7609, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/SharpUI/Prefabs/UI/Notification.prefab.meta b/Assets/SharpUI/Prefabs/UI/Notification.prefab.meta new file mode 100644 index 00000000..9646141c --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Notification.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8310e94394ad4f247ab2740a6fd43e51 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Progress.meta b/Assets/SharpUI/Prefabs/UI/Progress.meta new file mode 100644 index 00000000..3bbc96b4 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Progress.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2cfe748cafe81640b482196c21390a8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Progress/LoadingBar.prefab b/Assets/SharpUI/Prefabs/UI/Progress/LoadingBar.prefab new file mode 100644 index 00000000..0e9c5a8b --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Progress/LoadingBar.prefab @@ -0,0 +1,396 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8649193213920734407 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8649193213920734406} + - component: {fileID: 8649193213920734404} + - component: {fileID: 8649193213920734405} + m_Layer: 5 + m_Name: Pivot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8649193213920734406 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193213920734407} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8649193215168828112} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 686, y: 0} + m_SizeDelta: {x: 32, y: 74} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8649193213920734404 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193213920734407} + m_CullTransparentMesh: 0 +--- !u!114 &8649193213920734405 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193213920734407} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 5d92ffc10889f23458f996c748acfd26, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8649193214538258248 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8649193214538258255} + - component: {fileID: 8649193214538258253} + - component: {fileID: 8649193214538258254} + m_Layer: 5 + m_Name: BarText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8649193214538258255 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193214538258248} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8649193215483900208} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8649193214538258253 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193214538258248} + m_CullTransparentMesh: 0 +--- !u!114 &8649193214538258254 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193214538258248} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 50.0 % + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4291553791 + m_fontColor: {r: 1, g: 0.915411, b: 0.7971698, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 8649193214538258254} + characterCount: 6 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &8649193215168828113 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8649193215168828112} + - component: {fileID: 8649193215168828118} + - component: {fileID: 8649193215168828119} + m_Layer: 5 + m_Name: Bar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8649193215168828112 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193215168828113} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8649193213920734406} + m_Father: {fileID: 8649193215483900208} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -29, y: -28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8649193215168828118 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193215168828113} + m_CullTransparentMesh: 0 +--- !u!114 &8649193215168828119 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193215168828113} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 02d508b28c1f1494ab2ecfeb5e16713d, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 0.5 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8649193215483900209 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8649193215483900208} + - component: {fileID: 8649193215483900214} + - component: {fileID: 8649193215483900215} + - component: {fileID: 8649193215483900213} + m_Layer: 5 + m_Name: LoadingBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8649193215483900208 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193215483900209} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 8649193215168828112} + - {fileID: 8649193214538258255} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 1400, y: 52} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8649193215483900214 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193215483900209} + m_CullTransparentMesh: 0 +--- !u!114 &8649193215483900215 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193215483900209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 548bbf24e96e3dd438c23bc9bc21be16, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8649193215483900213 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8649193215483900209} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 401a1256649342f8aca499223167a07f, type: 3} + m_Name: + m_EditorClassIdentifier: + backgroundImage: {fileID: 8649193215483900215} + barImage: {fileID: 8649193215168828119} + pivotImage: {fileID: 8649193213920734405} + barText: {fileID: 8649193214538258254} diff --git a/Assets/SharpUI/Prefabs/UI/Progress/LoadingBar.prefab.meta b/Assets/SharpUI/Prefabs/UI/Progress/LoadingBar.prefab.meta new file mode 100644 index 00000000..e62b2475 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Progress/LoadingBar.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ea0d628912789fe44a7b19b3bbce4136 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Progress/ResourceBar.prefab b/Assets/SharpUI/Prefabs/UI/Progress/ResourceBar.prefab new file mode 100644 index 00000000..1fd09139 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Progress/ResourceBar.prefab @@ -0,0 +1,429 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7810130316266088557 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7810130316266088556} + - component: {fileID: 7810130316266088554} + - component: {fileID: 7810130316266088555} + m_Layer: 5 + m_Name: ResourceText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7810130316266088556 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130316266088557} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7810130316584933018} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7810130316266088554 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130316266088557} + m_CullTransparentMesh: 0 +--- !u!114 &7810130316266088555 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130316266088557} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 47% / 15,800 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4291552753 + m_fontColor: {r: 0.9433962, g: 0.89754087, b: 0.7965468, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 12 + m_fontSizeBase: 12 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 7810130316266088555} + characterCount: 12 + spriteCount: 0 + spaceCount: 2 + wordCount: 3 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &7810130316584933019 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7810130316584933018} + m_Layer: 5 + m_Name: ResourceBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7810130316584933018 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130316584933019} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7810130317273721480} + - {fileID: 7810130317213386248} + - {fileID: 7810130316266088556} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 400, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &7810130317213386249 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7810130317213386248} + - component: {fileID: 7810130317213386246} + - component: {fileID: 7810130317213386247} + m_Layer: 5 + m_Name: ResourceFrame + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7810130317213386248 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317213386249} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7810130316584933018} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7810130317213386246 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317213386249} + m_CullTransparentMesh: 0 +--- !u!114 &7810130317213386247 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317213386249} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7294118, g: 0.7294118, b: 0.7294118, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 3026511ff623dae45b55d6e8c69db974, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 2 +--- !u!1 &7810130317273721481 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7810130317273721480} + - component: {fileID: 7810130317273721477} + - component: {fileID: 7810130317273721478} + - component: {fileID: 7810130317273721479} + m_Layer: 5 + m_Name: ResourceBarMask + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7810130317273721480 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317273721481} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7810130317307454868} + m_Father: {fileID: 7810130316584933018} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7810130317273721477 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317273721481} + m_CullTransparentMesh: 0 +--- !u!114 &7810130317273721478 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317273721481} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: fdfca4c8a41331a48b005ad18b939196, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 2 +--- !u!114 &7810130317273721479 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317273721481} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 0 +--- !u!1 &7810130317307454869 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7810130317307454868} + - component: {fileID: 7810130317307454866} + - component: {fileID: 7810130317307454867} + m_Layer: 5 + m_Name: ResourceBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7810130317307454868 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317307454869} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7810130317273721480} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7810130317307454866 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317307454869} + m_CullTransparentMesh: 0 +--- !u!114 &7810130317307454867 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7810130317307454869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19166073, g: 0.6886792, b: 0.19487654, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: ec5d8e847ee5dab4793020c5bb9b87f5, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 0.47 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/SharpUI/Prefabs/UI/Progress/ResourceBar.prefab.meta b/Assets/SharpUI/Prefabs/UI/Progress/ResourceBar.prefab.meta new file mode 100644 index 00000000..e4881124 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Progress/ResourceBar.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3efb5928cc43adb4f8d87dad992c38a2 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Progress/SkillBar.prefab b/Assets/SharpUI/Prefabs/UI/Progress/SkillBar.prefab new file mode 100644 index 00000000..71bcc35e --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Progress/SkillBar.prefab @@ -0,0 +1,631 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1412798825993179334 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1412798825993179333} + - component: {fileID: 1412798825993179331} + - component: {fileID: 1412798825993179332} + m_Layer: 5 + m_Name: SpellName + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1412798825993179333 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798825993179334} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1412798826881812348} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1412798825993179331 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798825993179334} + m_CullTransparentMesh: 0 +--- !u!114 &1412798825993179332 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798825993179334} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Ability Name + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4291091697 + m_fontColor: {r: 0.9433962, g: 0.86111766, b: 0.7698469, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 15 + m_fontSizeBase: 15 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 1412798825993179332} + characterCount: 12 + spriteCount: 0 + spaceCount: 1 + wordCount: 2 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1412798826541704768 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1412798826541704783} + - component: {fileID: 1412798826541704781} + - component: {fileID: 1412798826541704782} + m_Layer: 5 + m_Name: SkillIcon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1412798826541704783 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826541704768} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1412798827101633515} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1412798826541704781 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826541704768} + m_CullTransparentMesh: 0 +--- !u!114 &1412798826541704782 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826541704768} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7264151, g: 0.21586864, b: 0.21586864, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 8f8e130d3d0c9c247b78be9804308002, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1412798826757328460 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1412798826757328459} + - component: {fileID: 1412798826757328457} + - component: {fileID: 1412798826757328458} + m_Layer: 5 + m_Name: SkillBarFill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1412798826757328459 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826757328460} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1412798826881812348} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -4, y: -3.9999998} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1412798826757328457 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826757328460} + m_CullTransparentMesh: 0 +--- !u!114 &1412798826757328458 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826757328460} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.3443841, g: 0.6111587, b: 0.6698113, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 2855beda86fcd8d4b831e4dd52d35952, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 3 +--- !u!1 &1412798826881812349 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1412798826881812348} + - component: {fileID: 1412798826881812346} + - component: {fileID: 1412798826881812347} + - component: {fileID: 1412798826881812345} + m_Layer: 5 + m_Name: SkillBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1412798826881812348 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826881812349} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1412798826757328459} + - {fileID: 1412798827101633515} + - {fileID: 1412798827016640956} + - {fileID: 1412798825993179333} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 400, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1412798826881812346 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826881812349} + m_CullTransparentMesh: 0 +--- !u!114 &1412798826881812347 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826881812349} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.764151, g: 0.7343459, b: 0.7028747, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 6.5 +--- !u!114 &1412798826881812345 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798826881812349} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7b66ed70cbe84f44803672cfad57e77c, type: 3} + m_Name: + m_EditorClassIdentifier: + skillBarImage: {fileID: 1412798826757328458} + skillIconImage: {fileID: 1412798826541704782} + skillNameText: {fileID: 1412798825993179332} + skillRemainingCooldownText: {fileID: 1412798827016640955} + skillCooldown: 4 + skillCooldownRemaining: 4 + skillName: Divine Heal + consumeType: 0 + depleteWhenCompleted: 0 +--- !u!1 &1412798827016640957 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1412798827016640956} + - component: {fileID: 1412798827016640954} + - component: {fileID: 1412798827016640955} + m_Layer: 5 + m_Name: TextRemainingCooldown + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1412798827016640956 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798827016640957} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1412798826881812348} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1412798827016640954 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798827016640957} + m_CullTransparentMesh: 0 +--- !u!114 &1412798827016640955 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798827016640957} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 1.4 sec + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4291157233 + m_fontColor: {r: 0.94509804, g: 0.8627451, b: 0.77254903, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 13 + m_fontSizeBase: 13 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 32 + m_textAlignment: 516 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 10, w: 0} + m_textInfo: + textComponent: {fileID: 1412798827016640955} + characterCount: 7 + spriteCount: 0 + spaceCount: 1 + wordCount: 3 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1412798827101633516 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1412798827101633515} + - component: {fileID: 1412798827101633512} + - component: {fileID: 1412798827101633513} + m_Layer: 5 + m_Name: SkillIconContainer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1412798827101633515 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798827101633516} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1412798826541704783} + m_Father: {fileID: 1412798826881812348} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 14, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1412798827101633512 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798827101633516} + m_CullTransparentMesh: 0 +--- !u!114 &1412798827101633513 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1412798827101633516} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.7490196} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/SharpUI/Prefabs/UI/Progress/SkillBar.prefab.meta b/Assets/SharpUI/Prefabs/UI/Progress/SkillBar.prefab.meta new file mode 100644 index 00000000..82aeeef4 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Progress/SkillBar.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f216e352df976104ca5fa15e63963660 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree.meta b/Assets/SharpUI/Prefabs/UI/SkillTree.meta new file mode 100644 index 00000000..aa929727 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9d6b4908c4c48a64bad67ba1ba30b412 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAbilityAmount.prefab b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAbilityAmount.prefab new file mode 100644 index 00000000..9a992e05 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAbilityAmount.prefab @@ -0,0 +1,533 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7806910978214006141 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7806910978214006138} + - component: {fileID: 7806910978214006136} + - component: {fileID: 7806910978214006137} + m_Layer: 5 + m_Name: SkillTreeAbilityAmount + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7806910978214006138 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978214006141} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7806910978684950844} + - {fileID: 7806910979777720241} + - {fileID: 7806910978767875489} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 32, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7806910978214006136 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978214006141} + m_CullTransparentMesh: 0 +--- !u!114 &7806910978214006137 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978214006141} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3b479eb38991469eb4b1a1925045b6e5, type: 3} + m_Name: + m_EditorClassIdentifier: + levelMaxText: {fileID: 7806910978767875518} + currentLevelText: {fileID: 7806910978684950845} + initialMaxLevel: 5 + initialCurrentLevel: 0 + activeTextColor: {r: 0.3026856, g: 0.6981132, b: 0.26673195, a: 1} + disabledTextColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1} +--- !u!1 &7806910978684950847 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7806910978684950844} + - component: {fileID: 7806910978684950842} + - component: {fileID: 7806910978684950845} + m_Layer: 5 + m_Name: AbilityAmountSelected + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7806910978684950844 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978684950847} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7806910978214006138} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 5.5, y: 0} + m_SizeDelta: {x: 11, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7806910978684950842 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978684950847} + m_CullTransparentMesh: 0 +--- !u!114 &7806910978684950845 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978684950847} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 0 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4286611584 + m_fontColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: 0 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 7806910978684950845} + characterCount: 1 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &7806910978767875488 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7806910978767875489} + - component: {fileID: 7806910978767875519} + - component: {fileID: 7806910978767875518} + m_Layer: 5 + m_Name: AbilityAmountTotal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7806910978767875489 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978767875488} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7806910978214006138} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 26.5, y: 0} + m_SizeDelta: {x: 11, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7806910978767875519 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978767875488} + m_CullTransparentMesh: 0 +--- !u!114 &7806910978767875518 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910978767875488} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 5 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4286611584 + m_fontColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: 0 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 7806910978767875518} + characterCount: 1 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &7806910979777720240 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7806910979777720241} + - component: {fileID: 7806910979777720207} + - component: {fileID: 7806910979777720206} + m_Layer: 5 + m_Name: AbilityAmountSeparator + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7806910979777720241 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910979777720240} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7806910978214006138} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 8, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7806910979777720207 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910979777720240} + m_CullTransparentMesh: 0 +--- !u!114 &7806910979777720206 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7806910979777720240} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: / + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4286611584 + m_fontColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: 0 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 7806910979777720206} + characterCount: 1 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAbilityAmount.prefab.meta b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAbilityAmount.prefab.meta new file mode 100644 index 00000000..ca5ac759 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAbilityAmount.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 450f385d6c4828f49927eb19b982b073 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAmountLimit.prefab b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAmountLimit.prefab new file mode 100644 index 00000000..35b69144 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAmountLimit.prefab @@ -0,0 +1,976 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4775096192582865323 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096192582865332} + - component: {fileID: 4775096192582865334} + - component: {fileID: 4775096192582865333} + m_Layer: 5 + m_Name: AvailableLabel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096192582865332 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096192582865323} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4775096193498380810} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -66.1, y: 14.09} + m_SizeDelta: {x: 106.100006, y: 21.83} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4775096192582865334 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096192582865323} + m_CullTransparentMesh: 0 +--- !u!114 &4775096192582865333 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096192582865323} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Available + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4286623951 + m_fontColor: {r: 0.8113208, g: 0.6915778, b: 0.501335, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 17 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 4775096192582865333} + characterCount: 9 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4775096192839870914 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096192839870915} + - component: {fileID: 4775096192839870925} + - component: {fileID: 4775096192839870924} + m_Layer: 5 + m_Name: SpentBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096192839870915 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096192839870914} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4775096194251938698} + - {fileID: 4775096193695785467} + m_Father: {fileID: 4775096193498380810} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 66.2, y: -14.9} + m_SizeDelta: {x: 55, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4775096192839870925 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096192839870914} + m_CullTransparentMesh: 0 +--- !u!114 &4775096192839870924 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096192839870914} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: f6299e83740fe8f4fbe5130ebe788b53, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4775096193389884253 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096193389884254} + - component: {fileID: 4775096193389884248} + - component: {fileID: 4775096193389884255} + m_Layer: 5 + m_Name: AvailableBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096193389884254 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193389884253} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4775096194492406264} + - {fileID: 4775096193814028449} + m_Father: {fileID: 4775096193498380810} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -65, y: -14.9} + m_SizeDelta: {x: 55, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4775096193389884248 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193389884253} + m_CullTransparentMesh: 0 +--- !u!114 &4775096193389884255 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193389884253} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: f6299e83740fe8f4fbe5130ebe788b53, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &4775096193498380809 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096193498380810} + - component: {fileID: 4775096193498380811} + m_Layer: 5 + m_Name: SkillTreeAmountLimit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096193498380810 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193498380809} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4775096192582865332} + - {fileID: 4775096193613720044} + - {fileID: 4775096193389884254} + - {fileID: 4775096192839870915} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 240, y: 80} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &4775096193498380811 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193498380809} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1e826a7d6b0a416fbe96061f631e78d9, type: 3} + m_Name: + m_EditorClassIdentifier: + totalAvailable: 28 + totalSpent: 0 + availableText: {fileID: 4775096193814028450} + spentText: {fileID: 4775096193695785220} +--- !u!1 &4775096193613720035 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096193613720044} + - component: {fileID: 4775096193613720046} + - component: {fileID: 4775096193613720045} + m_Layer: 5 + m_Name: SpentLabel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096193613720044 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193613720035} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4775096193498380810} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 66.2, y: 14.09} + m_SizeDelta: {x: 106.100006, y: 21.83} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4775096193613720046 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193613720035} + m_CullTransparentMesh: 0 +--- !u!114 &4775096193613720045 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193613720035} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Spent + +' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4286624207 + m_fontColor: {r: 0.8117647, g: 0.69411767, b: 0.5019608, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 17 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 4775096193613720045} + characterCount: 6 + spriteCount: 0 + spaceCount: 1 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4775096193695785466 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096193695785467} + - component: {fileID: 4775096193695785221} + - component: {fileID: 4775096193695785220} + m_Layer: 5 + m_Name: SpentAmount + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096193695785467 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193695785466} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4775096192839870915} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0.000015258789, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4775096193695785221 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193695785466} + m_CullTransparentMesh: 0 +--- !u!114 &4775096193695785220 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193695785466} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 0 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4279853509 + m_fontColor: {r: 0.7735849, g: 0.37862262, b: 0.09852261, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 17 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 4775096193695785220} + characterCount: 1 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4775096193814028448 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096193814028449} + - component: {fileID: 4775096193814028451} + - component: {fileID: 4775096193814028450} + m_Layer: 5 + m_Name: AvailableAmount + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096193814028449 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193814028448} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4775096193389884254} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4775096193814028451 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193814028448} + m_CullTransparentMesh: 0 +--- !u!114 &4775096193814028450 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096193814028448} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 0 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4279853509 + m_fontColor: {r: 0.7735849, g: 0.37862262, b: 0.09852261, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 18 + m_fontSizeBase: 18 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 17 + m_textAlignment: 514 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 4775096193814028450} + characterCount: 1 + spriteCount: 0 + spaceCount: 0 + wordCount: 1 + linkCount: 0 + lineCount: 1 + pageCount: 1 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4775096194251938697 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096194251938698} + - component: {fileID: 4775096194251938708} + - component: {fileID: 4775096194251938699} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096194251938698 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096194251938697} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4775096192839870915} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4775096194251938708 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096194251938697} + m_CullTransparentMesh: 0 +--- !u!114 &4775096194251938699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096194251938697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7735849, g: 0.40878102, b: 0.16420436, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 5 +--- !u!1 &4775096194492406271 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4775096194492406264} + - component: {fileID: 4775096194492406266} + - component: {fileID: 4775096194492406265} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4775096194492406264 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096194492406271} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4775096193389884254} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4775096194492406266 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096194492406271} + m_CullTransparentMesh: 0 +--- !u!114 &4775096194492406265 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4775096194492406271} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.7735849, g: 0.40878102, b: 0.16420436, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 5 diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAmountLimit.prefab.meta b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAmountLimit.prefab.meta new file mode 100644 index 00000000..f5f18028 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeAmountLimit.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3ef9d725dae653342b1573ce79c4f06a +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeArrowLine.prefab b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeArrowLine.prefab new file mode 100644 index 00000000..3eccff2c --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeArrowLine.prefab @@ -0,0 +1,293 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3659974744796025772 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3659974744796025763} + - component: {fileID: 3659974744796025761} + - component: {fileID: 3659974744796025762} + m_Layer: 5 + m_Name: Triangle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3659974744796025763 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974744796025772} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3659974744865911592} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 9.5, y: 18.5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3659974744796025761 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974744796025772} + m_CullTransparentMesh: 0 +--- !u!114 &3659974744796025762 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974744796025772} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.40392157, g: 0.37254903, b: 0.34509805, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: f2ef1d500d79f9f448cfb7a350bfd9a8, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &3659974744865911593 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3659974744865911592} + - component: {fileID: 3659974744865911599} + m_Layer: 5 + m_Name: SkillTreeArrowLine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3659974744865911592 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974744865911593} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3659974745346511555} + - {fileID: 3659974744796025763} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 88.35, y: 20.07} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &3659974744865911599 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974744865911593} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84c90f93ab7043dfb1acd10ddcd077cb, type: 3} + m_Name: + m_EditorClassIdentifier: + progressBar: {fileID: 3659974745346511552} + triangleImage: {fileID: 3659974744796025762} + nodeOwner: {fileID: 0} + activeColor: {r: 0.7529412, g: 0.5058824, b: 0.3019608, a: 1} + disabledColor: {r: 0.40392157, g: 0.37254903, b: 0.34509805, a: 1} +--- !u!1 &3659974745346511564 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3659974745346511555} + - component: {fileID: 3659974745346511553} + - component: {fileID: 3659974745346511554} + - component: {fileID: 3659974745346511552} + m_Layer: 5 + m_Name: LineProgress + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3659974745346511555 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974745346511564} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 3659974746533238495} + m_Father: {fileID: 3659974744865911592} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 2.25, y: 0} + m_SizeDelta: {x: -4.5, y: 6} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3659974745346511553 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974745346511564} + m_CullTransparentMesh: 0 +--- !u!114 &3659974745346511554 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974745346511564} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.4056604, g: 0.3731643, b: 0.34634212, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4037f1d5675a198458a8fa101437438b, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &3659974745346511552 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974745346511564} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e2329df688044318967a969c0d05b772, type: 3} + m_Name: + m_EditorClassIdentifier: + backgroundImage: {fileID: 3659974745346511554} + barImage: {fileID: 3659974746533238494} + barText: {fileID: 0} +--- !u!1 &3659974746533238488 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3659974746533238495} + - component: {fileID: 3659974746533238493} + - component: {fileID: 3659974746533238494} + m_Layer: 5 + m_Name: LineFill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3659974746533238495 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974746533238488} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3659974745346511555} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3659974746533238493 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974746533238488} + m_CullTransparentMesh: 0 +--- !u!114 &3659974746533238494 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3659974746533238488} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.754717, g: 0.5040608, b: 0.3025988, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 0 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeArrowLine.prefab.meta b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeArrowLine.prefab.meta new file mode 100644 index 00000000..bb748b75 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeArrowLine.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4d77421260b47384e94d9e2b11c33bb4 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeButton.prefab b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeButton.prefab new file mode 100644 index 00000000..81590185 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeButton.prefab @@ -0,0 +1,311 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2226075553293871640 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2226075553293871623} + - component: {fileID: 2226075553293871620} + - component: {fileID: 2226075553293871621} + m_Layer: 5 + m_Name: IconImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2226075553293871623 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2226075553293871640} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6305302848055340176} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -14, y: -14} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2226075553293871620 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2226075553293871640} + m_CullTransparentMesh: 0 +--- !u!114 &2226075553293871621 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2226075553293871640} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e30d7baabfb292c4f9687033f726d8a4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &6305302848055340177 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6305302848055340176} + - component: {fileID: 6305302848055340181} + - component: {fileID: 6305302848055340182} + - component: {fileID: 6305302848055340183} + - component: {fileID: 2226075551677342925} + m_Layer: 5 + m_Name: SkillTreeButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6305302848055340176 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848055340177} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 6305302848761125726} + - {fileID: 2226075553293871623} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 68, y: 68} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6305302848055340181 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848055340177} + m_CullTransparentMesh: 0 +--- !u!114 &6305302848055340182 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848055340177} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.1839244, g: 0.2735849, b: 0.1509879, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 04d207d34845c4f0f9b36b9c050cd158, type: 3} + m_Type: 1 + m_PreserveAspect: 1 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 2 +--- !u!114 &6305302848055340183 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848055340177} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 6305302848055340182} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2226075551677342925 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848055340177} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9072bfb5cca24f01a4acdc2ebc1db8a6, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 1 + isSelectable: 0 + isSelected: 0 + iconImage: {fileID: 2226075553293871621} + frameImage: {fileID: 6305302848055340182} + skillLevel: {fileID: 0} + skillLimit: {fileID: 0} + nodeOwner: {fileID: 0} + activeFrameColor: {r: 0.32885972, g: 0.8301887, b: 0.23887502, a: 1} + disabledFrameColor: {r: 0.18431373, g: 0.27450982, b: 0.15294118, a: 1} + activeIconColor: {r: 0.25907797, g: 0.5237879, b: 0.7735849, a: 1} + disabledIconColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1} +--- !u!1 &6305302848761125727 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6305302848761125726} + - component: {fileID: 6305302848761125724} + - component: {fileID: 6305302848761125725} + - component: {fileID: 6305302848761125715} + m_Layer: 5 + m_Name: IconBackground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6305302848761125726 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848761125727} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6305302848055340176} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -14, y: -14} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6305302848761125724 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848761125727} + m_CullTransparentMesh: 0 +--- !u!114 &6305302848761125725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848761125727} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.30598074, g: 0.3223495, b: 0.33962262, a: 0.6} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &6305302848761125715 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6305302848761125727} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.30588236, g: 0.32156864, b: 0.34117648, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 0.30588236, g: 0.32156864, b: 0.34117648, a: 1} + selectedColor: {r: 0.30588236, g: 0.32156864, b: 0.34117648, a: 1} + hoverColor: {r: 0.30588236, g: 0.32156864, b: 0.34117648, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeButton.prefab.meta b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeButton.prefab.meta new file mode 100644 index 00000000..0ae8f09f --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeButton.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cfb8047f54186c84ab5c082a3faf89fe +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeNode.prefab b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeNode.prefab new file mode 100644 index 00000000..8bd21648 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeNode.prefab @@ -0,0 +1,458 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &678240600236244401 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 678240600236244400} + - component: {fileID: 678240600236244402} + - component: {fileID: 678240600236244403} + - component: {fileID: 1586877944290936972} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &678240600236244400 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240600236244401} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 678240601620453983} + m_Father: {fileID: 678240602096736011} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 14, y: -14} + m_SizeDelta: {x: 28, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &678240600236244402 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240600236244401} + m_CullTransparentMesh: 0 +--- !u!114 &678240600236244403 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240600236244401} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.9245283, g: 0.9245283, b: 0.9245283, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: a1c619ba266d8f343a7c27c3752bdcb1, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1586877944290936972 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240600236244401} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} + selectedColor: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} + hoverColor: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} +--- !u!1 &678240601620453980 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 678240601620453983} + - component: {fileID: 678240601620453977} + - component: {fileID: 678240601620453982} + - component: {fileID: 7590190526865853488} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &678240601620453983 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240601620453980} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 678240600236244400} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 28, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &678240601620453977 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240601620453980} + m_CullTransparentMesh: 0 +--- !u!114 &678240601620453982 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240601620453980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 5e9974bc805781d47a0eed44e7dd73ab, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7590190526865853488 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240601620453980} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a03f8144ee14deb94df842abd5aabdc, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} + disabledColor: {r: 1, g: 1, b: 1, a: 0.5019608} + pressedColor: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} + selectedColor: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} + hoverColor: {r: 0.9254902, g: 0.9254902, b: 0.9254902, a: 1} +--- !u!1 &678240602096736008 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 678240602096736011} + - component: {fileID: 2582985919229399535} + - component: {fileID: 963996178498495295} + m_Layer: 5 + m_Name: SkillTreeNode + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &678240602096736011 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240602096736008} + m_LocalRotation: {x: 0, y: 0, z: 0.38268343, w: 0.92387956} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 678240600236244400} + - {fileID: 4505218580207126259} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 45} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 28, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2582985919229399535 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240602096736008} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 0} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &963996178498495295 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 678240602096736008} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 590ccb8f6fcc40c28435925102a6a9a1, type: 3} + m_Name: + m_EditorClassIdentifier: + isEnabled: 1 + isClickable: 0 + isSelectable: 0 + isSelected: 0 + checkedImage: {fileID: 678240601620453982} + isOn: 0 +--- !u!1 &1459706007504594485 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4505218580207126259} + - component: {fileID: 3362799315212376260} + - component: {fileID: 8909684711634970448} + - component: {fileID: 5710576929638179244} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &4505218580207126259 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1459706007504594485} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 678240602096736011} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 16, y: 0} + m_SizeDelta: {x: -32, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3362799315212376260 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1459706007504594485} + m_CullTransparentMesh: 0 +--- !u!114 &8909684711634970448 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1459706007504594485} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Check me square + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4288132815 + m_fontColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_outlineColor: + serializedVersion: 2 + rgba: 4278190080 + m_fontSize: 14 + m_fontSizeBase: 14 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_textAlignment: 513 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_firstOverflowCharacterIndex: -1 + m_linkedTextComponent: {fileID: 0} + m_isLinkedTextComponent: 0 + m_isTextTruncated: 0 + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_ignoreRectMaskCulling: 0 + m_ignoreCulling: 1 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_VertexBufferAutoSizeReduction: 1 + m_firstVisibleCharacter: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_textInfo: + textComponent: {fileID: 8909684711634970448} + characterCount: 0 + spriteCount: 0 + spaceCount: 0 + wordCount: 0 + linkCount: 0 + lineCount: 0 + pageCount: 0 + materialCount: 1 + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_spriteAnimator: {fileID: 0} + m_hasFontAssetChanged: 0 + m_subTextObjects: + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + - {fileID: 0} + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!114 &5710576929638179244 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1459706007504594485} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a771616732fd4f90adc670eb508f6907, type: 3} + m_Name: + m_EditorClassIdentifier: + normalColor: {r: 0.8117647, g: 0.7137255, b: 0.5921569, a: 1} + disabledColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + pressedColor: {r: 0.8117647, g: 0.5564706, b: 0.24352942, a: 1} + selectedColor: {r: 0.8117647, g: 0.61162275, b: 0.3652941, a: 1} + hoverColor: {r: 0.8117647, g: 0.6862745, b: 0.5294118, a: 1} diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeNode.prefab.meta b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeNode.prefab.meta new file mode 100644 index 00000000..67099e8f --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeNode.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7540d4d98e0dc774588c3ad2f93c85c6 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeProgressLine.prefab b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeProgressLine.prefab new file mode 100644 index 00000000..f82bbe25 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeProgressLine.prefab @@ -0,0 +1,168 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7396669354777306064 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7396669354777306065} + - component: {fileID: 7396669354777306079} + - component: {fileID: 7396669354777306078} + - component: {fileID: 7396669354777306076} + m_Layer: 5 + m_Name: SkillTreeProgressLine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7396669354777306065 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7396669354777306064} + m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7396669355366164907} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 168.26, y: 10} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7396669354777306079 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7396669354777306064} + m_CullTransparentMesh: 0 +--- !u!114 &7396669354777306078 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7396669354777306064} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.3019608, b: 0.28235295, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4037f1d5675a198458a8fa101437438b, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7396669354777306076 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7396669354777306064} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f55155a472947af87fe5984b5033990, type: 3} + m_Name: + m_EditorClassIdentifier: + backgroundImage: {fileID: 7396669354777306078} + barImage: {fileID: 7396669355366164904} + barText: {fileID: 0} + parent: {fileID: 0} + checkPointToggle: {fileID: 0} + requiredLevelsAmount: 5 +--- !u!1 &7396669355366164906 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7396669355366164907} + - component: {fileID: 7396669355366164905} + - component: {fileID: 7396669355366164904} + m_Layer: 5 + m_Name: LineFill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7396669355366164907 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7396669355366164906} + m_LocalRotation: {x: 0, y: 0, z: 1, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7396669354777306065} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: -2} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7396669355366164905 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7396669355366164906} + m_CullTransparentMesh: 0 +--- !u!114 &7396669355366164904 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7396669355366164906} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.3372549, g: 0.8862745, b: 0.76862746, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 4b0cca04c685b4d02969d137528985e4, type: 3} + m_Type: 3 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 0 + m_FillAmount: 0 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeProgressLine.prefab.meta b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeProgressLine.prefab.meta new file mode 100644 index 00000000..82a8debb --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/SkillTree/SkillTreeProgressLine.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2fd5035cba4086c449fbad1efc96afad +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Prefabs/UI/Tooltip.prefab b/Assets/SharpUI/Prefabs/UI/Tooltip.prefab new file mode 100644 index 00000000..9a6ab49a --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Tooltip.prefab @@ -0,0 +1,969 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1431789741523601936 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789741523601939} + - component: {fileID: 1431789741523601940} + - component: {fileID: 1431789741523601941} + - component: {fileID: 1431789741523601938} + m_Layer: 5 + m_Name: Tooltip + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789741523601939 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741523601936} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1431789742673852075} + - {fileID: 1431789742918586730} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 280, y: 160} + m_Pivot: {x: 0, y: 0} +--- !u!222 &1431789741523601940 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741523601936} + m_CullTransparentMesh: 0 +--- !u!114 &1431789741523601941 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741523601936} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 45d19e450bae6d647aada7729ee88538, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 3.4 +--- !u!114 &1431789741523601938 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741523601936} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4a12eea389a468eb4eab8610e8ed94a, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1431789741604128707 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789741604128706} + - component: {fileID: 1431789741604128711} + - component: {fileID: 1431789741604128708} + - component: {fileID: 1431789741604128709} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1431789741604128706 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741604128707} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1431789742186382566} + - {fileID: 1431789742166067998} + m_Father: {fileID: 1431789742918586730} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!223 &1431789741604128711 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741604128707} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &1431789741604128708 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741604128707} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!114 &1431789741604128709 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741604128707} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!1 &1431789741772420055 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789741772420054} + m_Layer: 5 + m_Name: Content + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789741772420054 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789741772420055} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1431789742244868506} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 300} + m_Pivot: {x: 0, y: 1} +--- !u!1 &1431789742166067999 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742166067998} + - component: {fileID: 1431789742166067987} + - component: {fileID: 1431789742166067984} + - component: {fileID: 1431789742166067985} + m_Layer: 5 + m_Name: Scrollbar Vertical + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742166067998 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742166067999} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1431789742751726093} + m_Father: {fileID: 1431789741604128706} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: -17} + m_Pivot: {x: 1, y: 1} +--- !u!222 &1431789742166067987 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742166067999} + m_CullTransparentMesh: 0 +--- !u!114 &1431789742166067984 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742166067999} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1431789742166067985 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742166067999} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1431789742804106732} + m_HandleRect: {fileID: 1431789742804106733} + m_Direction: 2 + m_Value: 1 + m_Size: 0.45 + m_NumberOfSteps: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &1431789742186382567 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742186382566} + - component: {fileID: 1431789742186382587} + - component: {fileID: 1431789742186382584} + - component: {fileID: 1431789742186382585} + m_Layer: 5 + m_Name: Scrollbar Horizontal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742186382566 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742186382567} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1431789742241763492} + m_Father: {fileID: 1431789741604128706} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -17, y: 20} + m_Pivot: {x: 0, y: 0} +--- !u!222 &1431789742186382587 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742186382567} + m_CullTransparentMesh: 0 +--- !u!114 &1431789742186382584 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742186382567} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1431789742186382585 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742186382567} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1431789742281485090} + m_HandleRect: {fileID: 1431789742281485091} + m_Direction: 0 + m_Value: 0 + m_Size: 1 + m_NumberOfSteps: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &1431789742241763493 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742241763492} + m_Layer: 5 + m_Name: Sliding Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742241763492 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742241763493} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1431789742281485091} + m_Father: {fileID: 1431789742186382566} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: -20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1431789742244868507 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742244868506} + - component: {fileID: 1431789742244868511} + - component: {fileID: 1431789742244868508} + - component: {fileID: 1431789742244868509} + m_Layer: 5 + m_Name: Viewport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742244868506 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742244868507} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1431789741772420054} + m_Father: {fileID: 1431789742918586730} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -17, y: -17} + m_Pivot: {x: 0, y: 1} +--- !u!222 &1431789742244868511 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742244868507} + m_CullTransparentMesh: 0 +--- !u!114 &1431789742244868508 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742244868507} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1431789742244868509 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742244868507} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 0 +--- !u!1 &1431789742281485088 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742281485091} + - component: {fileID: 1431789742281485093} + - component: {fileID: 1431789742281485090} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742281485091 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742281485088} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1431789742241763492} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1431789742281485093 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742281485088} + m_CullTransparentMesh: 0 +--- !u!114 &1431789742281485090 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742281485088} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1431789742673852072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742673852075} + - component: {fileID: 1431789742673852076} + - component: {fileID: 1431789742673852077} + - component: {fileID: 1431789742673852074} + m_Layer: 5 + m_Name: TooltipPointer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742673852075 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742673852072} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1431789741523601939} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 14.25, y: 28} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1431789742673852076 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742673852072} + m_CullTransparentMesh: 0 +--- !u!114 &1431789742673852077 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742673852072} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 995466ea7471711458fc978ea4bd2890, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1431789742673852074 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742673852072} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0479d451c8ca4c3aa39dde86464e0afd, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1431789742751726090 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742751726093} + m_Layer: 5 + m_Name: Sliding Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742751726093 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742751726090} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1431789742804106733} + m_Father: {fileID: 1431789742166067998} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -20, y: -20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1431789742804106730 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742804106733} + - component: {fileID: 1431789742804106735} + - component: {fileID: 1431789742804106732} + m_Layer: 5 + m_Name: Handle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742804106733 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742804106730} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1431789742751726093} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1431789742804106735 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742804106730} + m_CullTransparentMesh: 0 +--- !u!114 &1431789742804106732 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742804106730} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1431789742918586731 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1431789742918586730} + - component: {fileID: 1431789742918586735} + - component: {fileID: 1431789742918586732} + - component: {fileID: 1431789742918586733} + m_Layer: 5 + m_Name: Scroll View + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1431789742918586730 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742918586731} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1431789742244868506} + - {fileID: 1431789741604128706} + m_Father: {fileID: 1431789741523601939} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -8, y: -8} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1431789742918586735 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742918586731} + m_CullTransparentMesh: 0 +--- !u!114 &1431789742918586732 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742918586731} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1431789742918586733 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1431789742918586731} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 1431789741772420054} + m_Horizontal: 1 + m_Vertical: 1 + m_MovementType: 1 + m_Elasticity: 0.1 + m_Inertia: 1 + m_DecelerationRate: 0.135 + m_ScrollSensitivity: 1 + m_Viewport: {fileID: 1431789742244868506} + m_HorizontalScrollbar: {fileID: 1431789742186382585} + m_VerticalScrollbar: {fileID: 1431789742166067985} + m_HorizontalScrollbarVisibility: 2 + m_VerticalScrollbarVisibility: 2 + m_HorizontalScrollbarSpacing: -3 + m_VerticalScrollbarSpacing: -3 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/SharpUI/Prefabs/UI/Tooltip.prefab.meta b/Assets/SharpUI/Prefabs/UI/Tooltip.prefab.meta new file mode 100644 index 00000000..530ec0b5 --- /dev/null +++ b/Assets/SharpUI/Prefabs/UI/Tooltip.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5885732f0218a44b6ab8e4ed323cdfd2 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source.meta b/Assets/SharpUI/Source.meta new file mode 100644 index 00000000..e6098c7a --- /dev/null +++ b/Assets/SharpUI/Source.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: abe4c4ff66348ab4a9c85c1cbfcdfe03 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Client.meta b/Assets/SharpUI/Source/Client.meta new file mode 100644 index 00000000..03f49148 --- /dev/null +++ b/Assets/SharpUI/Source/Client.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df87e31eaff76410ebe220bd0ec35610 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Client/UI.meta b/Assets/SharpUI/Source/Client/UI.meta new file mode 100644 index 00000000..14dfa64c --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a0c0407fd1e8a7640acc8980375d51b5 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Client/UI/Game.meta b/Assets/SharpUI/Source/Client/UI/Game.meta new file mode 100644 index 00000000..64ef1a65 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: aa332b0689b24ab68d8c81034339ca55 +timeCreated: 1585226062 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen.meta b/Assets/SharpUI/Source/Client/UI/Game/GameScreen.meta new file mode 100644 index 00000000..ea6c41ab --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c19d328452874512b6bde806cb18d0f3 +timeCreated: 1598817238 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneComponent.cs b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneComponent.cs new file mode 100644 index 00000000..1a7466d8 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneComponent.cs @@ -0,0 +1,375 @@ +using System; +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Elements.ActionBars; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.SkillBars; +using SharpUI.Source.Common.UI.Util.Keyboard; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; +using Notification = SharpUI.Source.Common.UI.Elements.Notifications.Notification; + +namespace SharpUI.Source.Client.UI.Game.GameScreen +{ + public class GameSceneComponent : MonoBehaviourComponent, + IGameSceneComponent + { + [SerializeField] public GameObject skillBarPrefab; + [SerializeField] public Notification notificationAchievement; + [SerializeField] public Notification notificationSkills; + [SerializeField] public GameObject castingSkillBarContainer; + + // Settings + [SerializeField] public IconButton settingsButton; + [SerializeField] public IconButton vendorButton; + [SerializeField] public IconButton skillsButton; + + // Debuffs + [SerializeField] public SkillBar queensVenom; + [SerializeField] public SkillBar deadlyPoison; + [SerializeField] public SkillBar thunderstruck; + [SerializeField] public SkillBar backstab; + + // Action bar top buttons + [SerializeField] public ActionBarButton actionBarTop1; + [SerializeField] public ActionBarButton actionBarTop2; + [SerializeField] public ActionBarButton actionBarTop3; + [SerializeField] public ActionBarButton actionBarTop4; + [SerializeField] public ActionBarButton actionBarTop5; + [SerializeField] public ActionBarButton actionBarTop6; + [SerializeField] public ActionBarButton actionBarTop7; + [SerializeField] public ActionBarButton actionBarTop8; + [SerializeField] public ActionBarButton actionBarTop9; + [SerializeField] public ActionBarButton actionBarTop0; + + // Action bar bottom buttons + [SerializeField] public ActionBarButton actionBarBottom1; + [SerializeField] public ActionBarButton actionBarBottom2; + [SerializeField] public ActionBarButton actionBarBottom3; + [SerializeField] public ActionBarButton actionBarBottom4; + [SerializeField] public ActionBarButton actionBarBottom5; + [SerializeField] public ActionBarButton actionBarBottom6; + [SerializeField] public ActionBarButton actionBarBottom7; + [SerializeField] public ActionBarButton actionBarBottom8; + [SerializeField] public ActionBarButton actionBarBottom9; + [SerializeField] public ActionBarButton actionBarBottom0; + + protected override GameSceneComponent GetComponent() => this; + [CanBeNull] private IGameScenePresenter _presenter; + private SkillBar _activeSkillBar; + + public void SetupComponent() + { + _presenter = GetPresenter(); + + notificationAchievement.SetTitle("Achievement"); + notificationAchievement.SetSubtitle("Reckless & Furious"); + notificationAchievement.ObserveOnClick().SubscribeWith(this, + _ => { /* Show achievements */ }); + + notificationSkills.SetTitle("Click to open Skills"); + notificationSkills.SetSubtitle("New Skills Unlocked!"); + notificationSkills.ObserveOnClick().SubscribeWith(this, + _ => _presenter?.OnSkillsClicked()); + + settingsButton.GetEventListener().ObserveOnClicked().SubscribeWith(this, + _ => _presenter?.OnSettingsClicked()); + vendorButton.GetEventListener().ObserveOnClicked().SubscribeWith(this, + _ => _presenter?.OnVendorClicked()); + skillsButton.GetEventListener().ObserveOnClicked().SubscribeWith(this, + _ => _presenter?.OnSkillsClicked()); + + StartDebuffs(); + ObserveKeysAndCoolDownBottom(); + ObserveKeysAndCoolDownTop(); + ObserveEscapeKey(); + } + + private void StartDebuffs() + { + queensVenom.ObserveCooldownFinished().SubscribeWith(this, _ => queensVenom.RestartCooldown()); + deadlyPoison.ObserveCooldownFinished().SubscribeWith(this, _ => deadlyPoison.RestartCooldown()); + thunderstruck.ObserveCooldownFinished().SubscribeWith(this, _ => thunderstruck.RestartCooldown()); + backstab.ObserveCooldownFinished().SubscribeWith(this, _ => backstab.RestartCooldown()); + + queensVenom.StartCooldown(); + deadlyPoison.StartCooldown(); + thunderstruck.StartCooldown(); + backstab.StartCooldown(); + } + + private void ShowSkillBarCast( + string skillName, + float castTime, + Color skillColor, + Sprite skillSprite, + Action action) + { + // If already casting this skill, don't restart :-) + if (_activeSkillBar && _activeSkillBar.skillName == skillName) + return; + + if (_activeSkillBar) + CancelActiveSkillBarCast(); + + castingSkillBarContainer.SetActive(false); + _activeSkillBar = Instantiate(skillBarPrefab, castingSkillBarContainer.transform).GetComponent(); + _activeSkillBar.skillName = skillName; + _activeSkillBar.skillCooldown = castTime; + _activeSkillBar.skillCooldownRemaining = castTime; + _activeSkillBar.skillBarImage.color = skillColor; + _activeSkillBar.skillIconImage.sprite = skillSprite; + _activeSkillBar.skillIconImage.color = skillColor; + _activeSkillBar.consumeType = SkillBar.CooldownConsumeType.Fill; + _activeSkillBar.depleteWhenCompleted = true; + _activeSkillBar.ObserveCooldownFinished().SubscribeWith(this, _ => action.Invoke()); + castingSkillBarContainer.SetActive(true); + _activeSkillBar.StartCooldown(); + } + + private void CancelActiveSkillBarCast() + { + if (_activeSkillBar) _activeSkillBar.Cancel(); + } + + private void ObserveEscapeKey() + { + var escKeyListener = new GameObject().AddComponent(); + escKeyListener.ListenToKey(KeyCode.Escape); + escKeyListener.ObserveDown().SubscribeWith(this, _ => CancelActiveSkillBarCast()); + } + + private void ObserveKeysAndCoolDownBottom() + { + ObserveActionBarBottom1(); + ObserveActionBarBottom2(); + ObserveActionBarBottom3(); + ObserveActionBarBottom4(); + ObserveActionBarBottom5(); + ObserveActionBarBottom6(); + ObserveActionBarBottom7(); + ObserveActionBarBottom8(); + ObserveActionBarBottom9(); + ObserveActionBarBottom0(); + } + + private void ObserveKeysAndCoolDownTop() + { + ObserveActionBarTop1(); + ObserveActionBarTop2(); + ObserveActionBarTop3(); + ObserveActionBarTop4(); + ObserveActionBarTop5(); + ObserveActionBarTop6(); + ObserveActionBarTop7(); + ObserveActionBarTop8(); + ObserveActionBarTop9(); + ObserveActionBarTop0(); + } + + private void ObserveActionBarBottom1() + { + actionBarBottom1.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + if (actionBarBottom1.IsCoolingDown()) return; + ShowSkillBarCast("Quick Stab", 1f, actionBarBottom1.iconImage.color, + actionBarBottom1.iconImage.sprite, () => actionBarBottom1.CoolDown(3.8f)); + }); + actionBarBottom1.GetKeyListener().ListenToKey(KeyCode.Alpha1); + } + + private void ObserveActionBarBottom2() + { + actionBarBottom2.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + if (actionBarBottom2.IsCoolingDown()) return; + ShowSkillBarCast("Fireball", 3.7f, actionBarBottom2.iconImage.color, + actionBarBottom2.iconImage.sprite, () => actionBarBottom2.CoolDown(9.6f)); + }); + actionBarBottom2.GetKeyListener().ListenToKey(KeyCode.Alpha2); + } + + private void ObserveActionBarBottom3() + { + actionBarBottom3.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + if (actionBarBottom3.IsCoolingDown()) return; + ShowSkillBarCast("North Wind", 2.8f, actionBarBottom3.iconImage.color, + actionBarBottom3.iconImage.sprite, () => actionBarBottom3.CoolDown(180f)); + }); + actionBarBottom3.GetKeyListener().ListenToKey(KeyCode.Alpha3); + } + + private void ObserveActionBarBottom4() + { + actionBarBottom4.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + if (actionBarBottom4.IsCoolingDown()) return; + ShowSkillBarCast("Lightning Coil", 1f, actionBarBottom4.iconImage.color, + actionBarBottom4.iconImage.sprite, () => actionBarBottom4.CoolDown(45f)); + }); + actionBarBottom4.GetKeyListener().ListenToKey(KeyCode.Alpha4); + } + + private void ObserveActionBarBottom5() + { + actionBarBottom5.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + if (actionBarBottom5.IsCoolingDown()) return; + ShowSkillBarCast("On Guard", 6f, actionBarBottom5.iconImage.color, + actionBarBottom5.iconImage.sprite, () => actionBarBottom5.CoolDown(120f)); + }); + actionBarBottom5.GetKeyListener().ListenToKey(KeyCode.Alpha5); + } + + private void ObserveActionBarBottom6() + { + actionBarBottom6.GetKeyListener().ListenToKey(KeyCode.Alpha6); + } + + private void ObserveActionBarBottom7() + { + actionBarBottom7.GetKeyListener().ListenToKey(KeyCode.Alpha7); + } + + private void ObserveActionBarBottom8() + { + actionBarBottom8.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarBottom8.CoolDown(120f); + }); + actionBarBottom8.GetKeyListener().ListenToKey(KeyCode.Alpha8); + } + + private void ObserveActionBarBottom9() + { + actionBarBottom9.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarBottom9.CoolDown(60f); + }); + actionBarBottom9.GetKeyListener().ListenToKey(KeyCode.Alpha9); + } + + private void ObserveActionBarBottom0() + { + actionBarBottom0.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarBottom0.CoolDown(30f); + }); + actionBarBottom0.GetKeyListener().ListenToKey(KeyCode.Alpha0); + } + + private void ObserveActionBarTop1() + { + actionBarTop1.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarTop1.CoolDown(25f); + }); + actionBarTop1.GetKeyListener().ListenToKey(KeyCode.Q); + } + + private void ObserveActionBarTop2() + { + actionBarTop2.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarTop2.CoolDown(125f); + }); + actionBarTop2.GetKeyListener().ListenToKey(KeyCode.E); + } + + private void ObserveActionBarTop3() + { + actionBarTop3.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarTop3.CoolDown(15f); + }); + actionBarTop3.GetKeyListener().ListenToKey(KeyCode.R); + } + + private void ObserveActionBarTop4() + { + actionBarTop4.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarTop4.CoolDown(5f); + }); + actionBarTop4.GetKeyListener().ListenToKey(KeyCode.T); + } + + private void ObserveActionBarTop5() + { + actionBarTop5.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarTop5.CoolDown(2f); + }); + actionBarTop5.GetKeyListener().ListenToKey(KeyCode.F); + } + + private void ObserveActionBarTop6() + { + actionBarTop6.GetKeyListener().ListenToKey(KeyCode.G); + } + + private void ObserveActionBarTop7() + { + actionBarTop7.GetKeyListener().ListenToKey(KeyCode.C); + } + + private void ObserveActionBarTop8() + { + actionBarTop8.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarTop8.CoolDown(120f); + }); + actionBarTop8.GetKeyListener().ListenToKey(KeyCode.Q); + actionBarTop8.GetKeyListener().RequireAnyShift(); + actionBarTop8.GetKeyListener().RequireAnyControl(); + } + + private void ObserveActionBarTop9() + { + actionBarTop9.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarTop9.CoolDown(60f); + }); + actionBarTop9.GetKeyListener().ListenToKey(KeyCode.E); + actionBarTop9.GetKeyListener().RequireAnyShift(); + } + + private void ObserveActionBarTop0() + { + actionBarTop0.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => + { + CancelActiveSkillBarCast(); + actionBarTop0.CoolDown(30f); + }); + actionBarTop0.GetKeyListener().ListenToKey(KeyCode.R); + actionBarTop0.GetKeyListener().RequireAnyControl(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneComponent.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneComponent.cs.meta new file mode 100644 index 00000000..1f3f4a85 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 97f38aff25264c5ca4645e1a23c0e762 +timeCreated: 1598817260 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneContract.cs b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneContract.cs new file mode 100644 index 00000000..95a69a32 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneContract.cs @@ -0,0 +1,24 @@ +using System; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Base.Model; + +namespace SharpUI.Source.Client.UI.Game.GameScreen +{ + public interface IGameSceneComponent : IBaseComponent + { + } + + public interface IGameScenePresenter + { + void OnSettingsClicked(); + void OnVendorClicked(); + void OnSkillsClicked(); + } + + public interface IGameSceneModel : IBaseModel + { + IObservable GetSkillTreeScene(); + IObservable GetSettingsScene(); + IObservable GetVendorsScene(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneContract.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneContract.cs.meta new file mode 100644 index 00000000..727bce44 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneContract.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bbcab1e9bd8942ecb261a89407288c9d +timeCreated: 1598817268 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneModel.cs b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneModel.cs new file mode 100644 index 00000000..ae653eb5 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneModel.cs @@ -0,0 +1,18 @@ +using System; +using UniRx; + +namespace SharpUI.Source.Client.UI.Game.GameScreen +{ + public class GameSceneModel : IGameSceneModel + { + private const string SettingsSceneName = "Settings"; + private const string SkillTreeSceneName = "SkillTree"; + private const string VendorSceneName = "Vendor"; + + public IObservable GetSettingsScene() => Observable.Return(SettingsSceneName); + + public IObservable GetSkillTreeScene() => Observable.Return(SkillTreeSceneName); + + public IObservable GetVendorsScene() => Observable.Return(VendorSceneName); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneModel.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneModel.cs.meta new file mode 100644 index 00000000..38184f12 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameSceneModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ecb72dc9b2bf458bad7bc67b34555cb9 +timeCreated: 1598817238 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameScenePresenter.cs b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameScenePresenter.cs new file mode 100644 index 00000000..408d1fbd --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameScenePresenter.cs @@ -0,0 +1,35 @@ +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.Util.Extensions; + +namespace SharpUI.Source.Client.UI.Game.GameScreen +{ + public class GameScenePresenter : BasePresenter, IGameScenePresenter + { + private readonly IGameSceneModel _model; + + public GameScenePresenter() + { + _model = new GameSceneModel(); + } + + public GameScenePresenter(IGameSceneModel model) + { + _model = model; + } + + public void OnSettingsClicked() + { + _model.GetSettingsScene().SubscribeWith(disposables, sceneName => ShowSceneAdditive(sceneName)); + } + + public void OnVendorClicked() + { + _model.GetVendorsScene().SubscribeWith(disposables, sceneName => ShowSceneAdditive(sceneName)); + } + + public void OnSkillsClicked() + { + _model.GetSkillTreeScene().SubscribeWith(disposables, sceneName => ShowSceneAdditive(sceneName)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameScenePresenter.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameScenePresenter.cs.meta new file mode 100644 index 00000000..c5c0e947 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/GameScreen/GameScenePresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1be49766535e4de4ab65c680cc2e9588 +timeCreated: 1598817252 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen.meta b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen.meta new file mode 100644 index 00000000..95467d3a --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 76285f0b5f064ac38342fde4247a6b36 +timeCreated: 1585226090 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenComponent.cs b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenComponent.cs new file mode 100644 index 00000000..dcc4e856 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenComponent.cs @@ -0,0 +1,36 @@ +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.Loading; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Client.UI.Game.LoadingScreen +{ + public class LoadingScreenComponent : MonoBehaviourComponent, + ILoadingScreenComponent + { + [SerializeField] public RectButton buttonBack; + [SerializeField] public LoadingBar loadingBar; + + protected override LoadingScreenComponent GetComponent() => this; + + private ILoadingScreenPresenter _presenter; + + public void SetupComponent() + { + _presenter = GetPresenter(); + + buttonBack.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => _presenter.OnBack()); + + loadingBar.UpdatePercentage(0f); + + _presenter.SimulateLoadingBar(); + } + + public void UpdateLoadingPercentage(float percentage) + { + loadingBar.UpdatePercentage(percentage); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenComponent.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenComponent.cs.meta new file mode 100644 index 00000000..edc2eb1c --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f1fbcae15b3440e2b28ec36ec89a1362 +timeCreated: 1585226425 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenContract.cs b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenContract.cs new file mode 100644 index 00000000..6c13786d --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenContract.cs @@ -0,0 +1,23 @@ +using System; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Base.Model; + +namespace SharpUI.Source.Client.UI.Game.LoadingScreen +{ + public interface ILoadingScreenComponent : IBaseComponent + { + void UpdateLoadingPercentage(float percentage); + } + + public interface ILoadingScreenPresenter + { + void OnBack(); + void SimulateLoadingBar(); + } + + public interface ILoadingScreenModel : IBaseModel + { + IObservable GetCharacterSelectScene(); + IObservable GetGamePlaygroundScene(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenContract.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenContract.cs.meta new file mode 100644 index 00000000..8ffbc01b --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenContract.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e204d3f6018c4f809e55958e9292728c +timeCreated: 1585226109 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenModel.cs b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenModel.cs new file mode 100644 index 00000000..3fc8dc8e --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenModel.cs @@ -0,0 +1,15 @@ +using System; +using UniRx; + +namespace SharpUI.Source.Client.UI.Game.LoadingScreen +{ + public class LoadingScreenModel : ILoadingScreenModel + { + private const string CharacterSelectScene = "CharacterSelection"; + private const string GamePlaygroundScene = "GamePlayground"; + + public IObservable GetCharacterSelectScene() => Observable.Return(CharacterSelectScene); + + public IObservable GetGamePlaygroundScene() => Observable.Return(GamePlaygroundScene); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenModel.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenModel.cs.meta new file mode 100644 index 00000000..e9690703 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 481378adb4994694a24cad8acd6057e0 +timeCreated: 1585226239 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenPresenter.cs b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenPresenter.cs new file mode 100644 index 00000000..caa20eb0 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenPresenter.cs @@ -0,0 +1,45 @@ +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.Util.Extensions; +using SharpUI.Source.Common.Util.Reactive; +using UniRx; + +namespace SharpUI.Source.Client.UI.Game.LoadingScreen +{ + public class LoadingScreenPresenter : BasePresenter, ILoadingScreenPresenter + { + private const long BarSimulationDelay = 6; + private const int BarSimulationSteps = 500; + private readonly ILoadingScreenModel _model; + private readonly IDelayObserver _delayObserver; + + public LoadingScreenPresenter() + { + _model = new LoadingScreenModel(); + _delayObserver = new DelayObserver(); + } + + public LoadingScreenPresenter(ILoadingScreenModel model, IDelayObserver delayObserver) + { + _model = model; + _delayObserver = delayObserver; + } + + public void SimulateLoadingBar() + { + _delayObserver.DelayMilliseconds(BarSimulationDelay, Scheduler.MainThread, BarSimulationSteps) + .Finally(OnProgressCompleted) + .SubscribeWith(disposables, value => UpdatePercentage(value/5f)); + } + + private void UpdatePercentage(float percentage) + => OnComponent(component => component.UpdateLoadingPercentage(percentage+1)); + + private void OnProgressCompleted() + => _model.GetGamePlaygroundScene().SubscribeWith(disposables, + sceneName => ShowScene(sceneName)); + + public void OnBack() + => _model.GetCharacterSelectScene().SubscribeWith(disposables, + sceneName => ShowScene(sceneName)); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenPresenter.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenPresenter.cs.meta new file mode 100644 index 00000000..098c1c41 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/LoadingScreen/LoadingScreenPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 71dba9651ca048a792987d264a85a96d +timeCreated: 1585226297 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen.meta b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen.meta new file mode 100644 index 00000000..1a771ac6 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 74e3a4f022f24b7e9d3921c82ea3c865 +timeCreated: 1600175024 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenComponent.cs b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenComponent.cs new file mode 100644 index 00000000..9478387b --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenComponent.cs @@ -0,0 +1,26 @@ +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Elements.ModalViews; +using SharpUI.Source.Common.Util.Extensions; +using UniRx.Triggers; +using UnityEngine; + +namespace SharpUI.Source.Client.UI.Game.VendorScreen +{ + public class VendorScreenComponent : MonoBehaviourComponent, + IVendorScreenComponent + { + [SerializeField] public ModalView vendorModalView; + + private IVendorScreenPresenter _presenter; + + protected override VendorScreenComponent GetComponent() => this; + + public void SetupComponent() + { + _presenter = GetPresenter(); + + vendorModalView.OnDestroyAsObservable().SubscribeWith(this, + _ => _presenter.OnVendorWindowDestroyed()); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenComponent.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenComponent.cs.meta new file mode 100644 index 00000000..f53f5aed --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e2409a9945034e0b86f990cb74e23de0 +timeCreated: 1600175109 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenContract.cs b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenContract.cs new file mode 100644 index 00000000..b110f5bf --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenContract.cs @@ -0,0 +1,20 @@ +using System; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Base.Model; + +namespace SharpUI.Source.Client.UI.Game.VendorScreen +{ + public interface IVendorScreenComponent : IBaseComponent + { + } + + public interface IVendorScreenPresenter + { + void OnVendorWindowDestroyed(); + } + + public interface IVendorScreenModel : IBaseModel + { + IObservable GetMySceneName(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenContract.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenContract.cs.meta new file mode 100644 index 00000000..92d04021 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenContract.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1273d5a116d14637bc06190bf1c5aaef +timeCreated: 1600175076 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenModel.cs b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenModel.cs new file mode 100644 index 00000000..2dfd3b10 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenModel.cs @@ -0,0 +1,12 @@ +using System; +using UniRx; + +namespace SharpUI.Source.Client.UI.Game.VendorScreen +{ + public class VendorScreenModel : IVendorScreenModel + { + private const string MyScene = "Vendor"; + + public IObservable GetMySceneName() => Observable.Return(MyScene); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenModel.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenModel.cs.meta new file mode 100644 index 00000000..c3cb377e --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6d40ff73d14148e5b8c4f8ccd811adc7 +timeCreated: 1600175091 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenPresenter.cs b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenPresenter.cs new file mode 100644 index 00000000..44524602 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenPresenter.cs @@ -0,0 +1,25 @@ +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.Util.Extensions; + +namespace SharpUI.Source.Client.UI.Game.VendorScreen +{ + public class VendorScreenPresenter : BasePresenter, IVendorScreenPresenter + { + private readonly IVendorScreenModel _model; + + public VendorScreenPresenter() + { + _model = new VendorScreenModel(); + } + + public VendorScreenPresenter(IVendorScreenModel model) + { + _model = model; + } + + public void OnVendorWindowDestroyed() + { + _model.GetMySceneName().SubscribeWith(disposables, sceneName => HideScene(sceneName)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenPresenter.cs.meta b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenPresenter.cs.meta new file mode 100644 index 00000000..c8e26bf5 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/Game/VendorScreen/VendorScreenPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8a96bdcb3a6846219c1838ada4a1064b +timeCreated: 1600175099 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User.meta b/Assets/SharpUI/Source/Client/UI/User.meta new file mode 100644 index 00000000..3a6a1172 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1a19b4bb530d40dbaca54afca0da14fa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate.meta new file mode 100644 index 00000000..825cb558 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b312c4077d7743fbb8e97e375545967e +timeCreated: 1585223358 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters.meta new file mode 100644 index 00000000..2f50cda6 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7879a32e55c149718e930e0f09112537 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColor.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColor.cs new file mode 100644 index 00000000..1fe8c1f1 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColor.cs @@ -0,0 +1,32 @@ +using System; + +namespace SharpUI.Source.Client.UI.User.CharacterCreate.ArrowListAdapters +{ + public class BioColor + { + public enum BioColorType { Red, Green, Blue, Yellow, Black, White, Orange, Purple } + + private readonly BioColorType _type; + + public BioColor(BioColorType type) + { + _type = type; + } + + public override string ToString() + { + switch (_type) + { + case BioColorType.Red: return "Red"; + case BioColorType.Green: return "Green"; + case BioColorType.Blue: return "Blue"; + case BioColorType.Yellow: return "Yellow"; + case BioColorType.Black: return "Black"; + case BioColorType.White: return "White"; + case BioColorType.Orange: return "Orange"; + case BioColorType.Purple: return "Purple"; + default: throw new ArgumentOutOfRangeException(); + } + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColor.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColor.cs.meta new file mode 100644 index 00000000..aafe4a6c --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f11eca09d7e94c8cacae6254c36611fc +timeCreated: 1597608646 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColorListAdapter.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColorListAdapter.cs new file mode 100644 index 00000000..c8aeeffa --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColorListAdapter.cs @@ -0,0 +1,13 @@ +using SharpUI.Source.Common.UI.Elements.ArrowLists.Adapter; + +namespace SharpUI.Source.Client.UI.User.CharacterCreate.ArrowListAdapters +{ + public class BioColorListAdapter : ArrowListAdapter + { + public override string CurrentItem() => HasCurrentData() ? data[currentIndex].ToString() : null; + + public override string PreviousItem() => HasPreviousData() ? data[currentIndex - 1].ToString() : null; + + public override string NextItem() => HasNextData() ? data[currentIndex + 1].ToString() : null; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColorListAdapter.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColorListAdapter.cs.meta new file mode 100644 index 00000000..6600ae1e --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/BioColorListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bbdcfc4bab5b4ab7b9fa7e662aa6ed4c +timeCreated: 1597608481 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyle.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyle.cs new file mode 100644 index 00000000..daa0adc5 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyle.cs @@ -0,0 +1,33 @@ +using System; + +namespace SharpUI.Source.Client.UI.User.CharacterCreate.ArrowListAdapters +{ + public class DefaultStyle + { + public enum DefaultStyleType { Style1, Style2, Style3, Style4, Style5, Style6, Style7, Style8, Style9 } + + private readonly DefaultStyleType _type; + + public DefaultStyle(DefaultStyleType type) + { + _type = type; + } + + public override string ToString() + { + switch (_type) + { + case DefaultStyleType.Style1: return "Style 1"; + case DefaultStyleType.Style2: return "Style 2"; + case DefaultStyleType.Style3: return "Style 3"; + case DefaultStyleType.Style4: return "Style 4"; + case DefaultStyleType.Style5: return "Style 5"; + case DefaultStyleType.Style6: return "Style 6"; + case DefaultStyleType.Style7: return "Style 7"; + case DefaultStyleType.Style8: return "Style 8"; + case DefaultStyleType.Style9: return "Style 9"; + default: throw new ArgumentOutOfRangeException(); + } + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyle.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyle.cs.meta new file mode 100644 index 00000000..f1b67988 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyle.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f98828a2eb7e45cf8d3a013f847b03db +timeCreated: 1598300290 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyleAdapter.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyleAdapter.cs new file mode 100644 index 00000000..aae6372b --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyleAdapter.cs @@ -0,0 +1,13 @@ +using SharpUI.Source.Common.UI.Elements.ArrowLists.Adapter; + +namespace SharpUI.Source.Client.UI.User.CharacterCreate.ArrowListAdapters +{ + public class DefaultStyleAdapter : ArrowListAdapter + { + public override string CurrentItem() => HasCurrentData() ? data[currentIndex].ToString() : null; + + public override string PreviousItem() => HasPreviousData() ? data[currentIndex - 1].ToString() : null; + + public override string NextItem() => HasNextData() ? data[currentIndex + 1].ToString() : null; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyleAdapter.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyleAdapter.cs.meta new file mode 100644 index 00000000..f9bf1167 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/ArrowListAdapters/DefaultStyleAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 039fb2d1e9ba4361a43626b74f435d95 +timeCreated: 1598300551 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateComponent.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateComponent.cs new file mode 100644 index 00000000..c266dddf --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateComponent.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using SharpUI.Source.Client.UI.User.CharacterCreate.ArrowListAdapters; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Elements.ArrowLists; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Client.UI.User.CharacterCreate +{ + public class CharacterCreateComponent + : MonoBehaviourComponent, ICharacterCreateComponent + { + [SerializeField] public GameObject tooltipPrefab; + + [SerializeField] public RectButton buttonBack; + [SerializeField] public RectButton buttonCreate; + [SerializeField] public ArrowList arrowListSkinColor; + [SerializeField] public ArrowList arrowListHairStyle; + [SerializeField] public ArrowList arrowListHairColor; + [SerializeField] public ArrowList arrowListEyeStyle; + + private BioColorListAdapter _skinColorListAdapter; + private BioColorListAdapter _hairColorListAdapter; + private DefaultStyleAdapter _hairStyleAdapter; + private DefaultStyleAdapter _eyeStyleAdapter; + + private ICharacterCreatePresenter _presenter; + + protected override CharacterCreateComponent GetComponent() => this; + + public void SetupComponent() + { + _presenter = GetPresenter(); + + _skinColorListAdapter = new BioColorListAdapter(); + _hairStyleAdapter = new DefaultStyleAdapter(); + _hairColorListAdapter = new BioColorListAdapter(); + _eyeStyleAdapter = new DefaultStyleAdapter(); + + arrowListSkinColor.SetAdapter(_skinColorListAdapter); + arrowListHairStyle.SetAdapter(_hairStyleAdapter); + arrowListHairColor.SetAdapter(_hairColorListAdapter); + arrowListEyeStyle.SetAdapter(_eyeStyleAdapter); + + buttonBack.GetEventListener() + .ObserveOnClicked() + .SubscribeWith(this, _ => _presenter.OnBackClicked()); + + buttonCreate.GetEventListener() + .ObserveOnClicked() + .SubscribeWith(this, _ => _presenter.OnCreateClicked()); + + _presenter.LoadData(); + } + + public void RenderBioColors(List colors) + { + _skinColorListAdapter.SetData(colors); + _hairColorListAdapter.SetData(colors); + } + + public void RenderDefaultStyles(List styles) + { + _hairStyleAdapter.SetData(styles); + _eyeStyleAdapter.SetData(styles); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateComponent.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateComponent.cs.meta new file mode 100644 index 00000000..064106a1 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 21567ee7163a47d091beffcaa3104843 +timeCreated: 1585223957 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateContract.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateContract.cs new file mode 100644 index 00000000..70757d7d --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateContract.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Client.UI.User.CharacterCreate.ArrowListAdapters; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Base.Model; + +namespace SharpUI.Source.Client.UI.User.CharacterCreate +{ + public interface ICharacterCreateComponent : IBaseComponent + { + void RenderBioColors(List colors); + void RenderDefaultStyles(List styles); + } + + public interface ICharacterCreatePresenter + { + void OnBackClicked(); + void OnCreateClicked(); + void LoadData(); + } + + public interface ICharacterCreateModel : IBaseModel + { + IObservable GetCharacterSelectScene(); + IObservable> GetBioColors(); + IObservable> GetDefaultStyles(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateContract.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateContract.cs.meta new file mode 100644 index 00000000..e6564c50 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateContract.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 22e6b661c1fc423a86a2a96b6e1a34b9 +timeCreated: 1585223377 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateModel.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateModel.cs new file mode 100644 index 00000000..fa60e430 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateModel.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Client.UI.User.CharacterCreate.ArrowListAdapters; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.CharacterCreate +{ + public class CharacterCreateModel : ICharacterCreateModel + { + private const string CharacterSelectScene = "CharacterSelection"; + private static List BioColors => new List + { + new BioColor(BioColor.BioColorType.Red), + new BioColor(BioColor.BioColorType.White), + new BioColor(BioColor.BioColorType.Yellow), + new BioColor(BioColor.BioColorType.Purple), + new BioColor(BioColor.BioColorType.Orange), + new BioColor(BioColor.BioColorType.Green), + new BioColor(BioColor.BioColorType.Black), + new BioColor(BioColor.BioColorType.Blue) + }; + private static List DefaultStyles => new List + { + new DefaultStyle(DefaultStyle.DefaultStyleType.Style1), + new DefaultStyle(DefaultStyle.DefaultStyleType.Style2), + new DefaultStyle(DefaultStyle.DefaultStyleType.Style3), + new DefaultStyle(DefaultStyle.DefaultStyleType.Style4), + new DefaultStyle(DefaultStyle.DefaultStyleType.Style5), + new DefaultStyle(DefaultStyle.DefaultStyleType.Style6), + new DefaultStyle(DefaultStyle.DefaultStyleType.Style7), + new DefaultStyle(DefaultStyle.DefaultStyleType.Style8), + new DefaultStyle(DefaultStyle.DefaultStyleType.Style9) + }; + + public IObservable GetCharacterSelectScene() => Observable.Return(CharacterSelectScene); + + public IObservable> GetBioColors() => Observable.Return(BioColors); + + public IObservable> GetDefaultStyles() => Observable.Return(DefaultStyles); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateModel.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateModel.cs.meta new file mode 100644 index 00000000..38b7d90d --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreateModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1fa1b236b4934e79b050fee25e57ce17 +timeCreated: 1585223569 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreatePresenter.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreatePresenter.cs new file mode 100644 index 00000000..7a4dc535 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreatePresenter.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using SharpUI.Source.Client.UI.User.CharacterCreate.ArrowListAdapters; +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.Util.Extensions; + +namespace SharpUI.Source.Client.UI.User.CharacterCreate +{ + public class CharacterCreatePresenter : BasePresenter, ICharacterCreatePresenter + { + private readonly ICharacterCreateModel _model; + + public CharacterCreatePresenter() + { + _model = new CharacterCreateModel(); + } + + public CharacterCreatePresenter(ICharacterCreateModel model) + { + _model = model; + } + + public void LoadData() + { + _model.GetBioColors().SubscribeWith(disposables, ShowBioColors); + _model.GetDefaultStyles().SubscribeWith(disposables, ShowDefaultStyles); + } + + private void ShowBioColors(List bioColors) + => OnComponent(component => component.RenderBioColors(bioColors)); + + private void ShowDefaultStyles(List defaultStyles) => + OnComponent(component => component.RenderDefaultStyles(defaultStyles)); + + public void OnBackClicked() + { + _model.GetCharacterSelectScene() + .SubscribeWith(disposables, sceneName => ShowScene(sceneName)); + } + + public void OnCreateClicked() + { + _model.GetCharacterSelectScene() + .SubscribeWith(disposables, sceneName => ShowScene(sceneName)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreatePresenter.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreatePresenter.cs.meta new file mode 100644 index 00000000..2fd8a2ef --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterCreate/CharacterCreatePresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6ef3e57eff9d4b79982c406fd1748038 +timeCreated: 1585223680 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect.meta new file mode 100644 index 00000000..bd6d6e84 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: eca9228363614122a13cd573daaa616f +timeCreated: 1584090058 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList.meta new file mode 100644 index 00000000..0fa3456f --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fffbea925ec64a02894c737b3e8a579b +timeCreated: 1585223034 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterItemHolder.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterItemHolder.cs new file mode 100644 index 00000000..fe015589 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterItemHolder.cs @@ -0,0 +1,32 @@ +using SharpUI.Source.Common.UI.Elements.List.Holder; +using SharpUI.Source.Common.UI.Elements.List.ListItem; +using SharpUI.Source.Common.UI.Factory; +using SharpUI.Source.Data.Model.Character; + +namespace SharpUI.Source.Client.UI.User.CharacterSelect.CharacterList +{ + public class CharacterItemHolder : ItemHolder + { + private readonly ItemImage _itemImage; + private readonly CharacterIconFactory _characterIconFactory; + + public CharacterItemHolder(ItemImage item, CharacterIconFactory characterIconFactory) : base(item) + { + _itemImage = item; + _characterIconFactory = characterIconFactory; + } + + public override void BindData(Character itemData) + { + base.BindData(itemData); + RenderItem(); + } + + private void RenderItem() + { + _itemImage.textTitle.text = data.Name; + _itemImage.textDescription.text = $"Level {data.Level}"; + _itemImage.imageIcon.sprite = _characterIconFactory.CreateSpriteFor(data.ClassType); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterItemHolder.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterItemHolder.cs.meta new file mode 100644 index 00000000..f9885ebc --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterItemHolder.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8d9d49ad043f4a9e87b2ae998a4e7499 +timeCreated: 1585078797 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterListAdapter.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterListAdapter.cs new file mode 100644 index 00000000..72f4c31b --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterListAdapter.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Elements.List.Adapter; +using SharpUI.Source.Common.UI.Elements.List.Holder; +using SharpUI.Source.Common.UI.Factory; +using SharpUI.Source.Data.Model.Character; +using UnityEngine; + +namespace SharpUI.Source.Client.UI.User.CharacterSelect.CharacterList +{ + public class CharacterListAdapter : ListAdapter + { + [SerializeField] public ListItemFactory itemFactory; + [SerializeField] public CharacterIconFactory characterIconFactory; + + public void SetCharactersAndNotify(List characters) + { + SetData(characters); + NotifyDataSetChanged(); + } + + protected override ItemHolder CreateListItemHolder() + { + var item = itemFactory.CreateListItemImage(); + var holder = new CharacterItemHolder(item, characterIconFactory); + return holder; + } + + protected override void BindListItemHolder(ItemHolder holder, int position) + { + (holder as CharacterItemHolder)?.BindData(GetData(position)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterListAdapter.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterListAdapter.cs.meta new file mode 100644 index 00000000..38c5596e --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterList/CharacterListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5effb0abde104836a15f69e52f039b0d +timeCreated: 1585060439 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectComponent.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectComponent.cs new file mode 100644 index 00000000..5a6326da --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectComponent.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic; +using System.Linq; +using SharpUI.Source.Client.UI.User.CharacterSelect.CharacterList; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Elements.List; +using SharpUI.Source.Common.UI.Elements.List.Selection; +using SharpUI.Source.Common.UI.Elements.TooltipInfo; +using SharpUI.Source.Common.Util.Extensions; +using SharpUI.Source.Data.Model.Character; +using TMPro; +using UniRx; +using UniRx.Triggers; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Client.UI.User.CharacterSelect +{ + public class CharacterSelectComponent : MonoBehaviourComponent, + ICharacterSelectComponent + { + [SerializeField] public GameObject tooltipPrefab; + [SerializeField] public Button buttonBack; + [SerializeField] public Button buttonEnterWorld; + [SerializeField] public Button buttonCreateNewCharacter; + [SerializeField] public Button buttonDeleteCharacter; + [SerializeField] public ListView characterListView; + [SerializeField] public TMP_Text deleteCharacterInfoText; + + private CharacterListAdapter _adapter; + private ISelectionChangeListener _selectionChangeListener; + private ITooltip _tooltipDeleteCharacter; + + protected override CharacterSelectComponent GetComponent() => this; + + private ICharacterSelectPresenter _presenter; + + public void SetupComponent() + { + _presenter = GetPresenter(); + + _tooltipDeleteCharacter = Instantiate(tooltipPrefab).GetComponent(); + _tooltipDeleteCharacter.SetShowDelayTimeMillis(450); + _tooltipDeleteCharacter.OffsetPointerByPercentage(80f); + _tooltipDeleteCharacter.BindContent(deleteCharacterInfoText.GetComponent()); + + _adapter = characterListView.GetComponent(); + _selectionChangeListener = _adapter.GetSelectionChangeListener(); + + _selectionChangeListener.ObserveItemSelected() + .SubscribeWith(this, _presenter.OnCharacterSelected); + + _selectionChangeListener.ObserveSelectionChange() + .SubscribeWith(this, _ => + _presenter.OnCharacterSelectionChanged(_adapter.HasSelectedItems())); + + buttonBack.OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnBack()); + + buttonEnterWorld.OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnEnterWorld()); + + buttonCreateNewCharacter.OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnCreateNewCharacter()); + + buttonDeleteCharacter.OnClickAsObservable() + .SubscribeWith(this, _ => + { + var character = _adapter.GetSelectedData().First(); + _presenter.OnDeleteCharacter(character); + }); + + buttonDeleteCharacter.OnPointerEnterAsObservable().SubscribeWith(this, + _ => _presenter.OnPointerEnteredDeleteCharacterButton()); + buttonDeleteCharacter.OnPointerExitAsObservable().SubscribeWith(this, + _ => _presenter.OnPointerExitedDeleteCharacterButton()); + } + + public void DeleteSelected() + { + _adapter.RemoveSelected(); + } + + public void SetDeleteButtonEnabled(bool deleteEnabled) + { + buttonDeleteCharacter.interactable = deleteEnabled; + } + + public void SetEnterWorldEnabled(bool enterEnabled) + { + buttonEnterWorld.interactable = enterEnabled; + } + + public void ShowCharacterDetails(Character character) + { + // Show character details + } + + public void ListCharacters(List characters) + { + _adapter.SetCharactersAndNotify(characters); + } + + public void ShowDeleteCharacterTooltip() + { + _tooltipDeleteCharacter.ShowBelow(buttonDeleteCharacter.GetComponent()); + } + + public void HideDeleteCharacterTooltip() + { + _tooltipDeleteCharacter.Hide(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectComponent.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectComponent.cs.meta new file mode 100644 index 00000000..f8923cf5 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 211eae0cfed94798aa583f786d8c2553 +timeCreated: 1584090118 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectContract.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectContract.cs new file mode 100644 index 00000000..7d3404f7 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectContract.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Base.Model; +using SharpUI.Source.Data.Model.Character; + +namespace SharpUI.Source.Client.UI.User.CharacterSelect +{ + public interface ICharacterSelectComponent : IBaseComponent + { + void ListCharacters(List characters); + void ShowCharacterDetails(Character character); + void DeleteSelected(); + void SetDeleteButtonEnabled(bool deleteEnabled); + void SetEnterWorldEnabled(bool enterEnabled); + void ShowDeleteCharacterTooltip(); + void HideDeleteCharacterTooltip(); + } + + public interface ICharacterSelectPresenter + { + void OnBack(); + void OnEnterWorld(); + void OnCreateNewCharacter(); + void OnDeleteCharacter(Character character); + void OnCharacterSelected(Character character); + void OnCharacterSelectionChanged(bool characterSelected); + void OnPointerEnteredDeleteCharacterButton(); + void OnPointerExitedDeleteCharacterButton(); + } + + public interface ICharacterSelectModel : IBaseModel + { + IObservable GetLoginScene(); + IObservable GetCharacterCreateScene(); + IObservable GetGameLoadingScene(); + IObservable> GetCharacters(); + void DeleteCharacter(Character character); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectContract.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectContract.cs.meta new file mode 100644 index 00000000..6935fc28 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectContract.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8239e990daf8446d8d1601e66d8c21c8 +timeCreated: 1584090092 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectModel.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectModel.cs new file mode 100644 index 00000000..778a262b --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectModel.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Data.Model.Character; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.CharacterSelect +{ + public class CharacterSelectModel : ICharacterSelectModel + { + private const string LoginSceneName = "Login"; + private const string CharacterCreateScene = "CharacterCreate"; + private const string GameLoadingScene = "LoadingScene"; + + private readonly List _characters = new List + { // Mocked characters + CharacterFactory.CreateWarriorCharacter("BoneCrusher", 10), + CharacterFactory.CreateHunterCharacter("SlayerX", 47), + CharacterFactory.CreateWarriorCharacter("Boki", 16), + CharacterFactory.CreateCasterCharacter("MageCaster", 17), + CharacterFactory.CreateWarriorCharacter("Simple", 80), + CharacterFactory.CreateHunterCharacter("Terminator", 34), + CharacterFactory.CreateWarriorCharacter("Ruller", 61), + CharacterFactory.CreateCasterCharacter("Hack", 27), + CharacterFactory.CreateWarriorCharacter("Tim", 100), + CharacterFactory.CreateHunterCharacter("Diablo", 57), + CharacterFactory.CreateWarriorCharacter("Lakii", 96), + CharacterFactory.CreateCasterCharacter("Little", 39) + }; + + public CharacterSelectModel() { } + + public CharacterSelectModel(List characters) => _characters = characters; + + public IObservable GetLoginScene() => Observable.Return(LoginSceneName); + + public IObservable GetCharacterCreateScene() => Observable.Return(CharacterCreateScene); + + public IObservable GetGameLoadingScene() => Observable.Return(GameLoadingScene); + + public IObservable> GetCharacters() => Observable.Return(_characters); + + public void DeleteCharacter(Character character) + { + _characters.Remove(character); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectModel.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectModel.cs.meta new file mode 100644 index 00000000..98076326 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 64638c0c1e2247e19b2eefbdc731d0b6 +timeCreated: 1584090102 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectPresenter.cs b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectPresenter.cs new file mode 100644 index 00000000..76e8f983 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectPresenter.cs @@ -0,0 +1,96 @@ +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.Util.Extensions; +using SharpUI.Source.Data.Model.Character; + +namespace SharpUI.Source.Client.UI.User.CharacterSelect +{ + public class CharacterSelectPresenter : BasePresenter, ICharacterSelectPresenter + { + private readonly ICharacterSelectModel _model; + private bool _isCharacterSelected; + + public CharacterSelectPresenter() + { + _model = new CharacterSelectModel(); + } + + public CharacterSelectPresenter(ICharacterSelectModel model) + { + _model = model; + } + + public override void OnComponentStarted() + { + base.OnComponentStarted(); + LoadData(); + } + + private void LoadData() + { + LoadCharacters(); + } + + private void LoadCharacters() + { + _model.GetCharacters() + .SubscribeWith(disposables, characters => + OnComponent(component => component.ListCharacters(characters))); + } + + public void OnBack() + { + _model.GetLoginScene().SubscribeWith(disposables, sceneName => ShowScene(sceneName)); + } + + public void OnEnterWorld() + { + _model.GetGameLoadingScene().SubscribeWith(disposables, sceneName => ShowScene(sceneName)); + } + + public void OnCreateNewCharacter() + { + _model.GetCharacterCreateScene().SubscribeWith(disposables, sceneName => ShowScene(sceneName)); + } + + public void OnDeleteCharacter(Character character) + { + _model.DeleteCharacter(character); + OnComponent(component => + { + component.DeleteSelected(); + component.SetDeleteButtonEnabled(false); + component.HideDeleteCharacterTooltip(); + }); + } + + public void OnCharacterSelected(Character character) + { + OnComponent(component => component.ShowCharacterDetails(character)); + } + + public void OnCharacterSelectionChanged(bool characterSelected) + { + _isCharacterSelected = characterSelected; + OnComponent(component => + { + component.SetDeleteButtonEnabled(characterSelected); + component.SetEnterWorldEnabled(characterSelected); + }); + } + + public void OnPointerEnteredDeleteCharacterButton() + { + OnComponent(component => + { + if (_isCharacterSelected) + component.ShowDeleteCharacterTooltip(); + } + ); + } + + public void OnPointerExitedDeleteCharacterButton() + { + OnComponent(component => component.HideDeleteCharacterTooltip()); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectPresenter.cs.meta b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectPresenter.cs.meta new file mode 100644 index 00000000..4dcc8c5d --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/CharacterSelect/CharacterSelectPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 45cc24c4b2aa4e1b86fe68e5c3ad65e7 +timeCreated: 1584090110 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Login.meta b/Assets/SharpUI/Source/Client/UI/User/Login.meta new file mode 100644 index 00000000..78f91b0e --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 937a9d4ba4e1477190436bddaab6b8fd +timeCreated: 1582489197 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Login/LoginComponent.cs b/Assets/SharpUI/Source/Client/UI/User/Login/LoginComponent.cs new file mode 100644 index 00000000..8b673581 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login/LoginComponent.cs @@ -0,0 +1,139 @@ +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.Dialogs; +using SharpUI.Source.Common.UI.Elements.DropDowns; +using SharpUI.Source.Common.UI.Elements.DropDowns.Adapters; +using SharpUI.Source.Common.UI.Elements.Toggle; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEditor; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Client.UI.User.Login +{ + public class LoginComponent : MonoBehaviourComponent, ILoginComponent + { + [SerializeField] public GameObject dialogPrefab; + + [SerializeField] public TMP_InputField inputEmail; + [SerializeField] public TMP_InputField inputPassword; + [SerializeField] public ToggleButton toggleRememberLogin; + [SerializeField] public ToggleButton toggleRememberEmail; + [SerializeField] public RectButton buttonLogin; + [SerializeField] public Button buttonCreateAccount; + [SerializeField] public Button buttonLoginHelp; + [SerializeField] public Button buttonSupport; + [SerializeField] public Button buttonReadMore; + [SerializeField] public Button buttonShop; + [SerializeField] public RectButton buttonOptions; + [SerializeField] public RectButton buttonExit; + [SerializeField] public DropDown regionDropdown; + + protected override LoginComponent GetComponent() => this; + private ILoginPresenter _presenter; + + public void SetupComponent() + { + _presenter = GetPresenter(); + + inputEmail.onValueChanged.AsObservable() + .SubscribeWith(this, email => _presenter.OnEmailChanged(email)); + + inputPassword.onValueChanged.AsObservable() + .SubscribeWith(this, password => _presenter.OnPasswordChanged(password)); + + toggleRememberLogin.ObserveToggleStateChange() + .SubscribeWith(this, rememberLogin => _presenter.OnRememberLoginChanged(rememberLogin)); + + toggleRememberEmail.ObserveToggleStateChange() + .SubscribeWith(this, rememberEmail => _presenter.OnRememberEmailChanged(rememberEmail)); + + buttonLogin.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => _presenter.OnLoginClicked(inputEmail.text, inputPassword.text)); + + buttonCreateAccount.OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnRegisterClicked()); + + buttonLoginHelp.OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnCantLoginClicked()); + + buttonSupport.OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnSupportClicked()); + + buttonReadMore.OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnReadMoreClicked()); + + buttonShop.OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnShopClicked()); + + buttonOptions.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => _presenter.OnOptionsClicked()); + + buttonExit.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => _presenter.OnExitClicked()); + + _presenter.OnRegionsRequested(); + } + + public void ShowReadMoreDialog(string title, string description) + { + var dialogInstance = Instantiate(dialogPrefab, GetComponent()); + var dialog = dialogInstance.GetComponent(); + dialog.SetIconType(DialogIconType.Info); + dialog.SetNeutralButtonVisible(false); + dialog.SetPositiveButtonText("OK"); + dialog.SetNegativeButtonText("Cancel"); + dialog.SetTitle(title); + dialog.SetDescription(description); + dialog.buttonPositive.GetComponent() + .GetEventListener() + .ObserveOnClicked() + .SubscribeWith(this, _ => dialog.Close()); + dialog.buttonNegative.GetComponent() + .GetEventListener() + .ObserveOnClicked() + .SubscribeWith(this, _ => dialog.Close()); + } + + public void ShowShopDialog(string title, string description) + { + var dialogInstance = Instantiate(dialogPrefab, GetComponent()); + var dialog = dialogInstance.GetComponent(); + dialog.SetIconType(DialogIconType.Info); + dialog.SetNeutralButtonVisible(false); + dialog.SetPositiveButtonText("OK"); + dialog.SetNegativeButtonText("Cancel"); + dialog.SetTitle(title); + dialog.SetDescription(description); + dialog.buttonPositive.GetComponent() + .GetEventListener() + .ObserveOnClicked() + .SubscribeWith(this, _ => dialog.Close()); + dialog.buttonNegative.GetComponent() + .GetEventListener() + .ObserveOnClicked() + .SubscribeWith(this, _ => dialog.Close()); + } + + public void ShowRegions(IEnumerable regions) + { + var adapter = new DefaultDropDownAdapter(); + regionDropdown.SetAdapter(adapter); + adapter.SetData(regions); + + regionDropdown.SelectAtIndex(1); + } + + public void ExitApplication() + { + #if UNITY_EDITOR + EditorApplication.isPlaying = false; + #else + Application.Quit(); + #endif + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Login/LoginComponent.cs.meta b/Assets/SharpUI/Source/Client/UI/User/Login/LoginComponent.cs.meta new file mode 100644 index 00000000..2d044fc7 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login/LoginComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 72f9052c15a93f541b9ff2e50140f963 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Client/UI/User/Login/LoginContract.cs b/Assets/SharpUI/Source/Client/UI/User/Login/LoginContract.cs new file mode 100644 index 00000000..04384b33 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login/LoginContract.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using Castle.Core; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Base.Model; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.Login +{ + public interface ILoginComponent : IBaseComponent + { + void ShowReadMoreDialog(string title, string description); + void ShowShopDialog(string title, string description); + void ShowRegions(IEnumerable regions); + void ExitApplication(); + } + + public interface ILoginPresenter + { + Subject ObserveEmailChange(); + Subject ObservePasswordChange(); + Subject ObserveRememberLoginChange(); + Subject ObserveRememberEmailChange(); + void OnEmailChanged(string email); + void OnPasswordChanged(string password); + void OnRememberLoginChanged(bool loginChanged); + void OnRememberEmailChanged(bool emailChanged); + void OnLoginClicked(string email, string password); + void OnRegisterClicked(); + void OnCantLoginClicked(); + void OnSupportClicked(); + void OnReadMoreClicked(); + void OnShopClicked(); + void OnOptionsClicked(); + void OnExitClicked(); + void OnRegionsRequested(); + } + + public interface ILoginModel : IBaseModel + { + void LogIn(string email, string password); + IObservable GetCharacterSelectionScene(); + IObservable> GetReadMoreDialogData(); + IObservable> GetShopDialogData(); + IObservable> GetRegionsData(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Login/LoginContract.cs.meta b/Assets/SharpUI/Source/Client/UI/User/Login/LoginContract.cs.meta new file mode 100644 index 00000000..069569e4 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login/LoginContract.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6838d68126a24b029f06b69dbdc65553 +timeCreated: 1582494176 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Login/LoginModel.cs b/Assets/SharpUI/Source/Client/UI/User/Login/LoginModel.cs new file mode 100644 index 00000000..65af8c97 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login/LoginModel.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using Castle.Core; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.Login +{ + public class LoginModel : ILoginModel + { + private const string CharacterSelectSceneName = "CharacterSelection"; + + private static Pair ReadMoreTitleDescription => + new Pair( + "Maintenance", + "This will take you to our web page. Click OK to go, or cancel to close this dialog."); + + private static Pair ShopTitleDescription => + new Pair( + "Shop", + "Go to our shop by clicking OK button or click cancel to dismiss this dialog."); + + private static List Regions => new List + { + "Americas", "Europe", "Asia", "Australia", "Africa" + }; + + public void LogIn(string email, string password) + { + // Implement login logic here. + } + + public IObservable GetCharacterSelectionScene() + => Observable.Return(CharacterSelectSceneName); + + public IObservable> GetReadMoreDialogData() + => Observable.Return(ReadMoreTitleDescription); + + public IObservable> GetShopDialogData() + => Observable.Return(ShopTitleDescription); + + public IObservable> GetRegionsData() + => Observable.Return(Regions); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Login/LoginModel.cs.meta b/Assets/SharpUI/Source/Client/UI/User/Login/LoginModel.cs.meta new file mode 100644 index 00000000..624a2da4 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login/LoginModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2163e7df7dd84303af216d7645afd0b9 +timeCreated: 1582536388 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Login/LoginPresenter.cs b/Assets/SharpUI/Source/Client/UI/User/Login/LoginPresenter.cs new file mode 100644 index 00000000..e6b1c9ee --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login/LoginPresenter.cs @@ -0,0 +1,110 @@ +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.Login +{ + public class LoginPresenter : BasePresenter, ILoginPresenter + { + [CanBeNull] private Subject _emailChangedObserver; + [CanBeNull] private Subject _passwordChangedObserver; + [CanBeNull] private Subject _rememberLoginChangedObserver; + [CanBeNull] private Subject _rememberEmailChangedObserver; + + private readonly ILoginModel _model; + + public LoginPresenter() + { + _model = new LoginModel(); + } + + public LoginPresenter(ILoginModel model) + { + _model = model; + } + + public Subject ObserveEmailChange() => + _emailChangedObserver ?? (_emailChangedObserver = new Subject()); + + public Subject ObservePasswordChange() => + _passwordChangedObserver ?? (_passwordChangedObserver = new Subject()); + + public Subject ObserveRememberLoginChange() => + _rememberLoginChangedObserver ?? (_rememberLoginChangedObserver = new Subject()); + + public Subject ObserveRememberEmailChange() => + _rememberEmailChangedObserver ?? (_rememberEmailChangedObserver = new Subject()); + + public void OnEmailChanged(string email) + { + _emailChangedObserver?.OnNext(email); + } + + public void OnPasswordChanged(string password) + { + _passwordChangedObserver?.OnNext(password); + } + + public void OnRememberLoginChanged(bool loginChanged) + { + _rememberLoginChangedObserver?.OnNext(loginChanged); + } + + public void OnRememberEmailChanged(bool emailChanged) + { + _rememberEmailChangedObserver?.OnNext(emailChanged); + } + + public void OnLoginClicked(string email, string password) + { + _model.LogIn(email, password); + + _model.GetCharacterSelectionScene().SubscribeWith(disposables, + sceneName => ShowScene(sceneName)); + } + + public void OnRegisterClicked() + { + // Do nothing + } + + public void OnCantLoginClicked() + { + // Do nothing + } + + public void OnSupportClicked() + { + // Do nothing + } + + public void OnReadMoreClicked() + { + _model.GetReadMoreDialogData() + .SubscribeWith(disposables, data => OnComponent( + component => component.ShowReadMoreDialog(data.First, data.Second))); + } + + public void OnShopClicked() + { + _model.GetShopDialogData() + .SubscribeWith(disposables, data => OnComponent( + component => component.ShowShopDialog(data.First, data.Second))); + } + + public void OnOptionsClicked() => ShowSceneAdditive("Settings"); + + public void OnExitClicked() + { + OnComponent(component => component.ExitApplication()); + } + + public void OnRegionsRequested() + { + _model.GetRegionsData() + .SubscribeWith(disposables, data => OnComponent( + component => component.ShowRegions(data))); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Login/LoginPresenter.cs.meta b/Assets/SharpUI/Source/Client/UI/User/Login/LoginPresenter.cs.meta new file mode 100644 index 00000000..04517460 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Login/LoginPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e9665269dc2742daa4cef15218c7e017 +timeCreated: 1582455675 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp.meta b/Assets/SharpUI/Source/Client/UI/User/LoginHelp.meta new file mode 100644 index 00000000..73ae64b1 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2b743b466d814e31a83e69c4838fa3c9 +timeCreated: 1582666784 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpComponent.cs b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpComponent.cs new file mode 100644 index 00000000..f4cac37c --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpComponent.cs @@ -0,0 +1,37 @@ +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Client.UI.User.LoginHelp +{ + public class LoginHelpComponent : MonoBehaviourComponent, ILoginHelpComponent + { + [SerializeField] public TMP_InputField textEmail; + [SerializeField] public Button buttonResetPassword; + [SerializeField] public Button buttonBack; + + protected override LoginHelpComponent GetComponent() => this; + + private ILoginHelpPresenter _presenter; + + public void SetupComponent() + { + _presenter = GetPresenter(); + + textEmail.onValueChanged + .AsObservable() + .SubscribeWith(this, email => _presenter.OnEmailChanged(email)); + + buttonResetPassword + .OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnResetPasswordClicked(textEmail.text)); + + buttonBack + .OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.GoBack()); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpComponent.cs.meta b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpComponent.cs.meta new file mode 100644 index 00000000..054fb0bf --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2526d586b9f64b80a28ea0901352ef03 +timeCreated: 1582667012 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpContract.cs b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpContract.cs new file mode 100644 index 00000000..e27c6718 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpContract.cs @@ -0,0 +1,23 @@ +using System; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Base.Model; + +namespace SharpUI.Source.Client.UI.User.LoginHelp +{ + public interface ILoginHelpComponent : IBaseComponent + { + } + + public interface ILoginHelpPresenter + { + void OnResetPasswordClicked(string email); + void OnEmailChanged(string email); + void GoBack(); + } + + public interface ILoginHelpModel : IBaseModel + { + void ResetPassword(string email); + IObservable GetLoginSceneName(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpContract.cs.meta b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpContract.cs.meta new file mode 100644 index 00000000..3461d138 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpContract.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1e23cd493a904266863d742cf02b5ed2 +timeCreated: 1582666801 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpModel.cs b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpModel.cs new file mode 100644 index 00000000..a4e50fd7 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpModel.cs @@ -0,0 +1,19 @@ +using System; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.LoginHelp +{ + public class LoginHelpModel : ILoginHelpModel + { + private const string LoginSceneName = "LoginScene"; + + public void ResetPassword(string email) + { + } + + public IObservable GetLoginSceneName() + { + return Observable.Return(LoginSceneName); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpModel.cs.meta b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpModel.cs.meta new file mode 100644 index 00000000..e81a7b85 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 20f0d6981a004d299070c812b7ed2bcf +timeCreated: 1582667175 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpPresenter.cs b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpPresenter.cs new file mode 100644 index 00000000..65034551 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpPresenter.cs @@ -0,0 +1,44 @@ +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.LoginHelp +{ + public class LoginHelpPresenter : BasePresenter, ILoginHelpPresenter + { + [CanBeNull] private Subject _emailChangedObserver; + + private readonly ILoginHelpModel _model; + + public LoginHelpPresenter() + { + _model = new LoginHelpModel(); + } + + public LoginHelpPresenter(ILoginHelpModel model) + { + _model = model; + } + + public Subject ObserveEmailChange() => + _emailChangedObserver ?? (_emailChangedObserver = new Subject()); + + public void OnResetPasswordClicked(string email) + { + _model.ResetPassword(email); + } + + public void OnEmailChanged(string email) + { + _emailChangedObserver?.OnNext(email); + } + + public void GoBack() + { + _model + .GetLoginSceneName() + .SubscribeWith(disposables, sceneName => ShowScene(sceneName)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpPresenter.cs.meta b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpPresenter.cs.meta new file mode 100644 index 00000000..2b3682ba --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/LoginHelp/LoginHelpPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3a132cbae95e40a7b55185114478db0b +timeCreated: 1582667131 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register.meta b/Assets/SharpUI/Source/Client/UI/User/Register.meta new file mode 100644 index 00000000..dd668b3f --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 551078fb09c74837b40bdd4b3ac2e1d1 +timeCreated: 1582489265 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register/RegisterComponent.cs b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterComponent.cs new file mode 100644 index 00000000..9136ac4a --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterComponent.cs @@ -0,0 +1,70 @@ +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Client.UI.User.Register +{ + public class RegisterComponent : MonoBehaviourComponent, IRegisterComponent + { + [SerializeField] public TMP_InputField textEmail; + [SerializeField] public TMP_InputField textName; + [SerializeField] public TMP_InputField textLastName; + [SerializeField] public TMP_InputField textPassword; + [SerializeField] public TMP_InputField textPasswordConfirm; + [SerializeField] public Button buttonLogin; + [SerializeField] public Button buttonBack; + + protected override RegisterComponent GetComponent() => this; + + private IRegisterPresenter _presenter; + + public void SetupComponent() + { + _presenter = GetPresenter(); + + buttonLogin + .OnClickAsObservable() + .SubscribeWith(this, _ => + _presenter.OnRegisterClicked( + textEmail.text, + textName.text, + textLastName.text, + textPassword.text, + textPasswordConfirm.text)); + + buttonBack + .OnClickAsObservable() + .SubscribeWith(this, _ => _presenter.OnGoBack()); + + textEmail.onValueChanged + .AsObservable() + .SubscribeWith( + this, + email => _presenter.OnEmailChanged(email)); + + textName.onValueChanged + .AsObservable() + .SubscribeWith( + this, + clientName => _presenter.OnNameChanged(clientName)); + + textLastName.onValueChanged + .AsObservable() + .SubscribeWith(this, + lastName => _presenter.OnLastNameChanged(lastName)); + + textPassword.onValueChanged.AsObservable() + .SubscribeWith( + this, + clientPassword => _presenter.OnPasswordChanged(clientPassword)); + + textPasswordConfirm.onValueChanged.AsObservable() + .SubscribeWith( + this, + clientPasswordConfirm => _presenter.OnPasswordConfirmChanged(clientPasswordConfirm)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register/RegisterComponent.cs.meta b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterComponent.cs.meta new file mode 100644 index 00000000..96601738 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d07dff32495d478ab4c83c00945b2e0b +timeCreated: 1582460669 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register/RegisterContract.cs b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterContract.cs new file mode 100644 index 00000000..99512210 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterContract.cs @@ -0,0 +1,27 @@ +using System; +using SharpUI.Source.Common.UI.Base.Component; +using SharpUI.Source.Common.UI.Base.Model; + +namespace SharpUI.Source.Client.UI.User.Register +{ + public interface IRegisterComponent : IBaseComponent + { + } + + public interface IRegisterPresenter + { + void OnEmailChanged(string email); + void OnPasswordChanged(string password); + void OnPasswordConfirmChanged(string passwordConfirm); + void OnRegisterClicked(string email, string name, string lastName, string password, string passwordConfirm); + void OnNameChanged(string name); + void OnGoBack(); + void OnLastNameChanged(string lastName); + } + + public interface IRegisterModel : IBaseModel + { + void RegisterClient(string email, string name, string lastName, string password, string passwordConfirm); + IObservable GetLoginSceneName(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register/RegisterContract.cs.meta b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterContract.cs.meta new file mode 100644 index 00000000..f7244043 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterContract.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b6d0e212c8db46d1a8fb29240c325589 +timeCreated: 1582494355 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register/RegisterModel.cs b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterModel.cs new file mode 100644 index 00000000..e39af6a1 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterModel.cs @@ -0,0 +1,19 @@ +using System; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.Register +{ + public class RegisterModel : IRegisterModel + { + private const string LoginSceneName = "LoginScene"; + + public void RegisterClient(string email, string name, string lastName, string password, string passwordConfirm) + { + } + + public IObservable GetLoginSceneName() + { + return Observable.Return(LoginSceneName); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register/RegisterModel.cs.meta b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterModel.cs.meta new file mode 100644 index 00000000..5024adca --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fb757dc656e74bf19e9c625f40e3b5aa +timeCreated: 1582542484 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register/RegisterPresenter.cs b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterPresenter.cs new file mode 100644 index 00000000..ce993b62 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterPresenter.cs @@ -0,0 +1,59 @@ +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; + +namespace SharpUI.Source.Client.UI.User.Register +{ + public class RegisterPresenter : BasePresenter, IRegisterPresenter + { + [CanBeNull] private Subject _emailChangedObserver; + [CanBeNull] private Subject _nameChangedObserver; + [CanBeNull] private Subject _lastNameChangedObserver; + [CanBeNull] private Subject _passwordChangedObserver; + [CanBeNull] private Subject _passwordConfirmChangedObserver; + + private readonly IRegisterModel _model; + + public RegisterPresenter() => _model = new RegisterModel(); + + public RegisterPresenter(IRegisterModel model) => _model = model; + + public Subject ObserveEmailChange() => + _emailChangedObserver ?? (_emailChangedObserver = new Subject()); + + public Subject ObserveNameChange() => + _nameChangedObserver ?? (_nameChangedObserver = new Subject()); + + public Subject ObserveLastNameChange() => + _lastNameChangedObserver ?? (_lastNameChangedObserver = new Subject()); + + public Subject ObservePasswordChange() => + _passwordChangedObserver ?? (_passwordChangedObserver = new Subject()); + + public Subject ObservePasswordConfirmChange() => + _passwordConfirmChangedObserver ?? (_passwordConfirmChangedObserver = new Subject()); + + public void OnEmailChanged(string email) => _emailChangedObserver?.OnNext(email); + + public void OnNameChanged(string name) => _nameChangedObserver?.OnNext(name); + + public void OnLastNameChanged(string lastName) => _lastNameChangedObserver?.OnNext(lastName); + + public void OnPasswordChanged(string password) => _passwordChangedObserver?.OnNext(password); + + public void OnPasswordConfirmChanged(string passwordConfirm) + => _passwordConfirmChangedObserver?.OnNext(passwordConfirm); + + public void OnRegisterClicked(string email, string name, string lastName, string pswd, string pswdConfirm) + => _model.RegisterClient(email, name, lastName, pswd, pswdConfirm); + + public void OnGoBack() + { + _model + .GetLoginSceneName() + .ObserveOnMainThread() + .SubscribeWith(disposables, sceneName => ShowScene(sceneName)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Client/UI/User/Register/RegisterPresenter.cs.meta b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterPresenter.cs.meta new file mode 100644 index 00000000..876861f1 --- /dev/null +++ b/Assets/SharpUI/Source/Client/UI/User/Register/RegisterPresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1795ecf1e0984178ac91b8c379f27f42 +timeCreated: 1582460681 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common.meta b/Assets/SharpUI/Source/Common.meta new file mode 100644 index 00000000..59aef260 --- /dev/null +++ b/Assets/SharpUI/Source/Common.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c4badd8e73bd8403ba262b5b94fa9b7a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI.meta b/Assets/SharpUI/Source/Common/UI.meta new file mode 100644 index 00000000..a6b37742 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f73986e36bfe45dcade11214735e2eb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Base.meta b/Assets/SharpUI/Source/Common/UI/Base.meta new file mode 100644 index 00000000..b60d7efd --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 63778364f54184bfa94ccd825a731d03 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Base/Component.meta b/Assets/SharpUI/Source/Common/UI/Base/Component.meta new file mode 100644 index 00000000..d90d8c08 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Component.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fabb91e10b815f44a9dffe72656192ee +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Base/Component/BaseComponent.cs b/Assets/SharpUI/Source/Common/UI/Base/Component/BaseComponent.cs new file mode 100644 index 00000000..ad06b2aa --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Component/BaseComponent.cs @@ -0,0 +1,34 @@ +using System.Globalization; +using System.Threading; +using SharpUI.Source.Common.UI.Base.Presenter; + +namespace SharpUI.Source.Common.UI.Base.Component +{ + public class BaseComponent + where TPresenter : class, IBasePresenter, new() + where TComponent : IBaseComponent + { + private readonly TPresenter _presenter; + + public BaseComponent() + { + Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us") + { + NumberFormat = { NumberDecimalSeparator = "." } + }; + _presenter = new TPresenter(); + } + + public BaseComponent(TPresenter presenter) => _presenter = presenter; + + public TPresenter GetPresenter() => _presenter; + + public void OnAwake(TComponent component) => _presenter.TakeComponent(component); + + public void OnStart() => _presenter.OnComponentStarted(); + + public void OnDisable() => _presenter.DropComponent(); + + public void OnDestroy() => _presenter.OnComponentDestroyed(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Component/BaseComponent.cs.meta b/Assets/SharpUI/Source/Common/UI/Base/Component/BaseComponent.cs.meta new file mode 100644 index 00000000..a3561c99 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Component/BaseComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ffb186d963524b748d23a7c8b79200c9 +timeCreated: 1582986071 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Component/IBaseComponent.cs b/Assets/SharpUI/Source/Common/UI/Base/Component/IBaseComponent.cs new file mode 100644 index 00000000..d7b86f3a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Component/IBaseComponent.cs @@ -0,0 +1,15 @@ +using System; + +namespace SharpUI.Source.Common.UI.Base.Component +{ + public interface IBaseComponent + { + void SetupComponent(); + + void ShowScene(string sceneName, Action onSceneLoadComplete); + + void ShowSceneAdditive(string sceneName, Action onSceneLoadComplete); + + void HideScene(string sceneName, Action onSceneUnloadComplete); + } +} diff --git a/Assets/SharpUI/Source/Common/UI/Base/Component/IBaseComponent.cs.meta b/Assets/SharpUI/Source/Common/UI/Base/Component/IBaseComponent.cs.meta new file mode 100644 index 00000000..d049c12a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Component/IBaseComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aa2f966033161ec4fb2d6f6bcc5daf84 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Base/Component/MonoBehaviourComponent.cs b/Assets/SharpUI/Source/Common/UI/Base/Component/MonoBehaviourComponent.cs new file mode 100644 index 00000000..94ef220d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Component/MonoBehaviourComponent.cs @@ -0,0 +1,51 @@ +using System; +using SharpUI.Source.Common.UI.Base.Presenter; +using SharpUI.Source.Common.UI.Util.Scenes; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Base.Component +{ + public abstract class MonoBehaviourComponent : MonoBehaviour + where TPresenter : class, IBasePresenter, new() + where TComponent : IBaseComponent + { + private ISceneUtils _sceneUtils = new SceneUtils(); + private BaseComponent _component; + + protected MonoBehaviourComponent() + { + _component = new BaseComponent(); + } + + protected TPresenter GetPresenter() => _component.GetPresenter(); + + protected abstract TComponent GetComponent(); + + public void SetComponent(BaseComponent component) => _component = component; + + public void SetSceneUtils(ISceneUtils sceneUtils) => _sceneUtils = sceneUtils; + + public virtual void Awake() => _component.OnAwake(GetComponent()); + + public virtual void Start() => _component.OnStart(); + + public virtual void OnDisable() => _component.OnDisable(); + + public virtual void OnDestroy() => _component.OnDestroy(); + + public void ShowScene(string sceneName, Action onCompleteAction = null) + { + StartCoroutine(_sceneUtils.LoadSceneAsync(sceneName, () => onCompleteAction?.Invoke())); + } + + public void ShowSceneAdditive(string sceneName, Action onCompleteAction) + { + StartCoroutine(_sceneUtils.LoadSceneAdditiveAsync(sceneName, () => onCompleteAction?.Invoke())); + } + + public void HideScene(string sceneName, Action onCompleteAction) + { + StartCoroutine(_sceneUtils.UnloadSceneAsync(sceneName, () => onCompleteAction?.Invoke())); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Component/MonoBehaviourComponent.cs.meta b/Assets/SharpUI/Source/Common/UI/Base/Component/MonoBehaviourComponent.cs.meta new file mode 100644 index 00000000..32f20330 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Component/MonoBehaviourComponent.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e5d704786bbf427bacbb3f6c98cce63e +timeCreated: 1585757970 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Model.meta b/Assets/SharpUI/Source/Common/UI/Base/Model.meta new file mode 100644 index 00000000..cd86722a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Model.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4b9b47238fa2428194b865eab7d8023d +timeCreated: 1582494599 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Model/IBaseModel.cs b/Assets/SharpUI/Source/Common/UI/Base/Model/IBaseModel.cs new file mode 100644 index 00000000..d9acb479 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Model/IBaseModel.cs @@ -0,0 +1,6 @@ +namespace SharpUI.Source.Common.UI.Base.Model +{ + public interface IBaseModel + { + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Model/IBaseModel.cs.meta b/Assets/SharpUI/Source/Common/UI/Base/Model/IBaseModel.cs.meta new file mode 100644 index 00000000..403a7059 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Model/IBaseModel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e415c4fccef3453fb3813578a7e64d35 +timeCreated: 1582494610 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Presenter.meta b/Assets/SharpUI/Source/Common/UI/Base/Presenter.meta new file mode 100644 index 00000000..fdaff8c7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Presenter.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a16bb6e41b01455ebce64183b9bd3159 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Base/Presenter/BasePresenter.cs b/Assets/SharpUI/Source/Common/UI/Base/Presenter/BasePresenter.cs new file mode 100644 index 00000000..eeeb7bd8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Presenter/BasePresenter.cs @@ -0,0 +1,37 @@ +using System; +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Base.Component; +using UniRx; + +namespace SharpUI.Source.Common.UI.Base.Presenter +{ + public class BasePresenter : IBasePresenter where TComponent : IBaseComponent + { + protected readonly CompositeDisposable disposables; + + [CanBeNull] private TComponent _component; + + protected BasePresenter() => disposables = new CompositeDisposable(); + + protected BasePresenter(CompositeDisposable disposable) => disposables = disposable; + + public virtual void TakeComponent(TComponent ownedComponent) => _component = ownedComponent; + + public virtual void DropComponent() => _component = default; + + public virtual void OnComponentStarted() => _component?.SetupComponent(); + + public virtual void OnComponentDestroyed() => disposables.Dispose(); + + protected void OnComponent(Action action) => action(_component); + + protected void HideScene(string sceneName, Action onSceneUnloadComplete = null) + => _component?.HideScene(sceneName, onSceneUnloadComplete); + + protected void ShowScene(string sceneName, Action onSceneLoadComplete = null) + => _component?.ShowScene(sceneName, onSceneLoadComplete); + + protected void ShowSceneAdditive(string sceneName, Action onSceneLoadComplete = null) + => _component?.ShowSceneAdditive(sceneName, onSceneLoadComplete); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Presenter/BasePresenter.cs.meta b/Assets/SharpUI/Source/Common/UI/Base/Presenter/BasePresenter.cs.meta new file mode 100644 index 00000000..2651601d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Presenter/BasePresenter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e27d15a2a6ec4c15b96c1792a0fe8437 +timeCreated: 1582485672 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Presenter/IBasePresenter.cs b/Assets/SharpUI/Source/Common/UI/Base/Presenter/IBasePresenter.cs new file mode 100644 index 00000000..0a7a2a4b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Presenter/IBasePresenter.cs @@ -0,0 +1,15 @@ +using SharpUI.Source.Common.UI.Base.Component; + +namespace SharpUI.Source.Common.UI.Base.Presenter +{ + public interface IBasePresenter where TComponent: IBaseComponent + { + void TakeComponent(TComponent component); + + void DropComponent(); + + void OnComponentStarted(); + + void OnComponentDestroyed(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Base/Presenter/IBasePresenter.cs.meta b/Assets/SharpUI/Source/Common/UI/Base/Presenter/IBasePresenter.cs.meta new file mode 100644 index 00000000..a63f6cad --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Base/Presenter/IBasePresenter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3e0740fd66fa940a19855d93df443d4b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Elements.meta b/Assets/SharpUI/Source/Common/UI/Elements.meta new file mode 100644 index 00000000..f787de6b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a77eee8e075b4dc459c2adf0f1d45a8c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ActionBars.meta b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars.meta new file mode 100644 index 00000000..dabf020f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 738fe6b720fc4d569e662a958bd0e431 +timeCreated: 1599853470 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarButton.cs b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarButton.cs new file mode 100644 index 00000000..ab1efeca --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarButton.cs @@ -0,0 +1,90 @@ +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Util.TimeUtils; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.ActionBars +{ + public class ActionBarButton : RectButton + { + [SerializeField] public Image iconImage; + [SerializeField] public Image cooldownFillImage; + [SerializeField] public TMP_Text cooldownText; + [SerializeField] public TMP_Text topText; + [SerializeField] public TMP_Text bottomText; + [SerializeField] public Image.FillMethod fillMethod = Image.FillMethod.Radial360; + [SerializeField] public bool canOverrideCooldown; + + [CanBeNull] private IActionBarCooldown _cooldown; + [CanBeNull] private ManagedUiUpdate _managedUiUpdate; + private ITimeProvider _timeProvider = new TimeProvider(); + private bool _isCoolingDown; + + protected override void SetupUI() + { + base.SetupUI(); + InitCooldown(); + InitUiUpdater(); + } + + public void SetTimeProvider(ITimeProvider timeProvider) => _timeProvider = timeProvider; + + private void InitCooldown() + { + _cooldown = new ActionBarCooldown(); + _cooldown.TakeCooldownImage(cooldownFillImage); + _cooldown.TakeCooldownText(cooldownText); + _cooldown.SetFillMethod(fillMethod); + _cooldown.ObserveCooldownFinished().SubscribeWith(this, _ => CoolDownFinished()); + _cooldown?.Expire(); + } + + private void InitUiUpdater() + { + _managedUiUpdate = new ManagedUiUpdate(); + _managedUiUpdate.SetUiUpdateTimeout(0.02f); + _managedUiUpdate.ObserveUiUpdate().SubscribeWith(this, elapsedTime => _cooldown.Update()); + } + + public void SetActionBarCooldown(IActionBarCooldown cooldown) => _cooldown = cooldown; + + public void Update() + { + if (!_isCoolingDown) return; + + var deltaTime = _timeProvider.GetDeltaTime(); + _cooldown?.ConsumeSeconds(deltaTime); + _managedUiUpdate?.ConsumeDeltaTime(deltaTime); + } + + public void CoolDown(float seconds) + { + if (!CanCoolDown()) return; + + _isCoolingDown = true; + _cooldown?.CoolDown(seconds); + } + + public bool IsCoolingDown() => _isCoolingDown; + + private bool CanCoolDown() + { + if (!IsAbilityBound()) + return false; + + return canOverrideCooldown || !_isCoolingDown; + } + + private bool IsAbilityBound() => iconImage.gameObject.activeSelf; + + private void CoolDownFinished() + { + _isCoolingDown = false; + } + + public void SetFillMethod(Image.FillMethod method) => _cooldown?.SetFillMethod(method); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarButton.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarButton.cs.meta new file mode 100644 index 00000000..dfe4e28b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarButton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 004184e198fa473489a2376582ec2309 +timeCreated: 1599852515 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarCooldown.cs b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarCooldown.cs new file mode 100644 index 00000000..4e8d395d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarCooldown.cs @@ -0,0 +1,81 @@ +using System; +using SharpUI.Source.Common.UI.Util.TimeUtils; +using TMPro; +using UniRx; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.ActionBars +{ + public class ActionBarCooldown : TimeConsumer, IActionBarCooldown + { + private readonly Subject _observeCooldownFinished = new Subject(); + private readonly ITimeFormatter _timeFormatter = new CooldownTimeFormatter(); + private Image _slicedCooldownImage; + private TMP_Text _cooldownText; + private float _cooldownTime; + private float _remainingTime; + private bool _isConsumingTime; + + public void TakeCooldownText(TMP_Text text) => _cooldownText = text; + + public void TakeCooldownImage(Image image) + { + _slicedCooldownImage = image; + _slicedCooldownImage.fillClockwise = false; + _slicedCooldownImage.fillMethod = Image.FillMethod.Radial360; + } + + public IObservable ObserveCooldownFinished() => _observeCooldownFinished; + + public void SetFillMethod(Image.FillMethod method) => _slicedCooldownImage.fillMethod = method; + + public bool IsConsumingTime() => _isConsumingTime; + + public void CoolDown(float seconds) + { + _isConsumingTime = true; + _cooldownTime = seconds; + _remainingTime = seconds; + _slicedCooldownImage.fillAmount = 1; + _slicedCooldownImage.gameObject.SetActive(true); + _cooldownText.gameObject.SetActive(true); + } + + public void Expire() + { + CooldownFinished(); + } + + public override void ConsumeSeconds(float seconds) + { + if (!_isConsumingTime) return; + + _remainingTime -= seconds; + } + + public void Update() + { + if (_remainingTime < 0) + { + CooldownFinished(); + return; + } + + SetCooldownText(); + SetImageFill(); + } + + private void SetCooldownText() => _cooldownText.text = _timeFormatter.FormatSeconds(_remainingTime); + + private void SetImageFill() => _slicedCooldownImage.fillAmount = _remainingTime / _cooldownTime; + + private void CooldownFinished() + { + _isConsumingTime = false; + _slicedCooldownImage.fillAmount = 0; + _slicedCooldownImage.gameObject.SetActive(false); + _cooldownText.gameObject.SetActive(false); + _observeCooldownFinished.OnNext(Unit.Default); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarCooldown.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarCooldown.cs.meta new file mode 100644 index 00000000..a0db5fb1 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/ActionBarCooldown.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9ebfda74baa648f595acfc00f75c4824 +timeCreated: 1599853511 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/IActionBarCooldown.cs b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/IActionBarCooldown.cs new file mode 100644 index 00000000..ac14803f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/IActionBarCooldown.cs @@ -0,0 +1,20 @@ +using System; +using TMPro; +using UniRx; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.ActionBars +{ + public interface IActionBarCooldown + { + bool IsConsumingTime(); + void CoolDown(float seconds); + void ConsumeSeconds(float seconds); + void TakeCooldownImage(Image image); + IObservable ObserveCooldownFinished(); + void TakeCooldownText(TMP_Text text); + void SetFillMethod(Image.FillMethod method); + void Expire(); + void Update(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/IActionBarCooldown.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/IActionBarCooldown.cs.meta new file mode 100644 index 00000000..9e70cc03 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ActionBars/IActionBarCooldown.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f08243b5ab084009a2f98728f1c4d7e2 +timeCreated: 1600290158 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists.meta new file mode 100644 index 00000000..320142f8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bb5cb484b1a64ccfa0556fb83ce74738 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter.meta new file mode 100644 index 00000000..853dd3cf --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5b502986af144d96bf506b4e6dc6754f +timeCreated: 1597606378 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/ArrowListAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/ArrowListAdapter.cs new file mode 100644 index 00000000..216af694 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/ArrowListAdapter.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.ArrowLists.Adapter +{ + public abstract class ArrowListAdapter : IArrowListAdapter where TData : class + { + private readonly Subject _dataChangeObserver; + private readonly Subject _selectionChangeObserver; + protected List data = new List(); + protected int currentIndex; + + protected ArrowListAdapter() + { + currentIndex = -1; + _dataChangeObserver = new Subject(); + _selectionChangeObserver = new Subject(); + } + + public void SetData(IEnumerable newData) + { + data = new List(newData); + TrySelectFirst(); + NotifyDataSetChanged(); + } + + private void TrySelectFirst() + { + if (data.Count > 0) + currentIndex = 0; + } + + public int DataCount() => data.Count; + + private void NotifyDataSetChanged() => _dataChangeObserver.OnNext(Unit.Default); + + public IObservable ObserveDataChange() => _dataChangeObserver; + + public IObservable ObserveSelectionChange() => _selectionChangeObserver; + + public bool HasCurrentData() => currentIndex != -1; + + public bool HasPreviousData() => currentIndex > 0; + + public bool HasNextData() => data.Count > 2 && currentIndex < data.Count - 1; + + public bool HasDataAtIndex(int index) => index < data.Count; + + public void SelectAt(int index) + { + if (!HasDataAtIndex(index)) return; + + currentIndex = index; + _selectionChangeObserver.OnNext(Unit.Default); + } + + public void SelectPrevious() + { + if (!HasPreviousData()) return; + + currentIndex--; + _selectionChangeObserver.OnNext(Unit.Default); + } + + public void SelectNext() + { + if (!HasNextData()) return; + + currentIndex++; + _selectionChangeObserver.OnNext(Unit.Default); + } + + public void ClearAllAndNotify() + { + data.Clear(); + currentIndex = -1; + NotifyDataSetChanged(); + } + + public abstract string CurrentItem(); + + public abstract string PreviousItem(); + + public abstract string NextItem(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/ArrowListAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/ArrowListAdapter.cs.meta new file mode 100644 index 00000000..a73a4c53 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/ArrowListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 490dc55320604ca897dcf894984a238c +timeCreated: 1597606388 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/EmptyArrowListAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/EmptyArrowListAdapter.cs new file mode 100644 index 00000000..c4baabc5 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/EmptyArrowListAdapter.cs @@ -0,0 +1,9 @@ +namespace SharpUI.Source.Common.UI.Elements.ArrowLists.Adapter +{ + public class EmptyArrowListAdapter : ArrowListAdapter + { + public override string CurrentItem() => ""; + public override string PreviousItem() => ""; + public override string NextItem() => ""; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/EmptyArrowListAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/EmptyArrowListAdapter.cs.meta new file mode 100644 index 00000000..0a8490a0 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/EmptyArrowListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b2fbfe9338b94e519d62a6ce3c318d80 +timeCreated: 1597607369 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/IArrowListAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/IArrowListAdapter.cs new file mode 100644 index 00000000..6d3ab04b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/IArrowListAdapter.cs @@ -0,0 +1,25 @@ +using System; +using JetBrains.Annotations; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.ArrowLists.Adapter +{ + public interface IArrowListAdapter + { + [CanBeNull] string CurrentItem(); + [CanBeNull] string PreviousItem(); + [CanBeNull] string NextItem(); + + int DataCount(); + void ClearAllAndNotify(); + IObservable ObserveDataChange(); + IObservable ObserveSelectionChange(); + bool HasCurrentData(); + bool HasPreviousData(); + bool HasNextData(); + bool HasDataAtIndex(int index); + void SelectAt(int index); + void SelectPrevious(); + void SelectNext(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/IArrowListAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/IArrowListAdapter.cs.meta new file mode 100644 index 00000000..da7614fe --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Adapter/IArrowListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bd6f2f3a59654eee95428a97ce199fd5 +timeCreated: 1597607341 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation.meta new file mode 100644 index 00000000..30faf111 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 00f51fd82b9644f4bb3a0cfe123dc3b3 +timeCreated: 1597744183 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/AnimateDirection.cs b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/AnimateDirection.cs new file mode 100644 index 00000000..b377cfe3 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/AnimateDirection.cs @@ -0,0 +1,7 @@ +namespace SharpUI.Source.Common.UI.Elements.ArrowLists.Animation +{ + public enum AnimateDirection + { + Left, Right + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/AnimateDirection.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/AnimateDirection.cs.meta new file mode 100644 index 00000000..5e0cab34 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/AnimateDirection.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2c5a528f932f49b98b7c9bef0930232e +timeCreated: 1597745224 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/ArrowListAnimator.cs b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/ArrowListAnimator.cs new file mode 100644 index 00000000..0a6da93d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/ArrowListAnimator.cs @@ -0,0 +1,154 @@ +using SharpUI.Source.Common.UI.Elements.ArrowLists.Extensions; +using SharpUI.Source.Common.Util.Extensions; +using SharpUI.Source.Common.Util.Reactive; +using TMPro; +using UniRx; +using UnityEngine; +using Object = UnityEngine.Object; + +namespace SharpUI.Source.Common.UI.Elements.ArrowLists.Animation +{ + public class ArrowListAnimator : IArrowListAnimator + { + private const int SlideAnimationSteps = 20; + private const int SlideAnimationIntervalMillis = 4; + private const float DefaultTextAlpha = 1.0f; + private const float InvisibleTextAlpha = 0.0f; + + private readonly IDelayObserver _delayObserver = new DelayObserver(); + private readonly CompositeDisposable _disposable = new CompositeDisposable(); + private RectTransform _textTransform; + private RectTransform _cloneTransform; + private TMP_Text _text; + private TMP_Text _cloneText; + private Vector2 _textSize; + private Vector3 _originalPosition; + private Vector3 _clonePosition; + private bool _isAnimating; + private AnimateDirection _direction; + + public ArrowListAnimator() { } + + public ArrowListAnimator(CompositeDisposable disposable, IDelayObserver delayObserver) + { + _disposable = disposable; + _delayObserver = delayObserver; + } + + public AnimateDirection GetDirection() => _direction; + + public void BindTextComponent(TMP_Text text) + { + _text = text; + _textTransform = text.GetComponent(); + _textSize = _textTransform.sizeDelta; + } + + public void SlideLeft() + { + _direction = AnimateDirection.Left; + InitTextState(); + Animate(); + } + + public void SlideRight() + { + _direction = AnimateDirection.Right; + InitTextState(); + Animate(); + } + + public void CloneText() + { + _cloneText = Object.Instantiate(_text, _text.transform.parent); + _cloneText.text = _text.text; + _cloneTransform = _cloneText.GetComponent(); + _clonePosition = _cloneTransform.localPosition; + } + + private void InitTextState() + { + _text.alpha = InvisibleTextAlpha; + var localPosition = _textTransform.localPosition; + localPosition.x -= _textSize.x*_direction.DirectionMultiplier(); + _textTransform.localPosition = localPosition; + _originalPosition = localPosition; + } + + public void Unbind() + { + _disposable.Dispose(); + } + + public bool IsAnimating() => _isAnimating; + + private void Animate() + { + _delayObserver + .DelayMilliseconds(SlideAnimationIntervalMillis, Scheduler.MainThread, SlideAnimationSteps) + .DoOnError(_ => OnAnimationFinished()) + .DoOnSubscribe(OnAnimationStarted) + .Finally(OnAnimationFinished) + .SubscribeWith(_disposable, AnimateStep); + } + + private void OnAnimationStarted() + { + _isAnimating = true; + } + + private void OnAnimationFinished() + { + if (!_isAnimating) return; + + _isAnimating = false; + Object.DestroyImmediate(_cloneText.gameObject); + _text.alpha = DefaultTextAlpha; + } + + private void AnimateStep(long value) + { + OffsetPosition(value); + ApplyAlpha(value); + ApplyScale(value); + } + + private void OffsetPosition(long value) + { + var offset = GetOffset(value) * _direction.DirectionMultiplier(); + SetLocalPositions(offset); + } + + private void ApplyAlpha(long value) + { + var percentage = GetPercentage(value); + _text.alpha = percentage; + _cloneText.alpha = 1.0f - percentage; + } + + private void ApplyScale(long value) + { + var scale = 1.0f - GetPercentage(value)*0.5f; + _cloneText.transform.localScale = new Vector3(scale, scale, scale); + } + + private float GetOffset(long value) + { + return GetPercentage(value) * _textSize.x; + } + + private float GetPercentage(long value) + { + return (value + 1f) / SlideAnimationSteps; + } + + private void SetLocalPositions(float offset) + { + _textTransform.localPosition = + new Vector3(_originalPosition.x + offset, _originalPosition.y, _originalPosition.z); + + _cloneTransform.localPosition = + new Vector3(_clonePosition.x + offset, _clonePosition.y, _clonePosition.z); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/ArrowListAnimator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/ArrowListAnimator.cs.meta new file mode 100644 index 00000000..742cb3ff --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/ArrowListAnimator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6eb5d625989d4c8fb3ab270163bae2ee +timeCreated: 1597744208 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/IArrowListAnimator.cs b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/IArrowListAnimator.cs new file mode 100644 index 00000000..c803ba7b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/IArrowListAnimator.cs @@ -0,0 +1,15 @@ +using TMPro; + +namespace SharpUI.Source.Common.UI.Elements.ArrowLists.Animation +{ + public interface IArrowListAnimator + { + void BindTextComponent(TMP_Text text); + void CloneText(); + void SlideLeft(); + void SlideRight(); + void Unbind(); + bool IsAnimating(); + AnimateDirection GetDirection(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/IArrowListAnimator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/IArrowListAnimator.cs.meta new file mode 100644 index 00000000..55c90b53 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Animation/IArrowListAnimator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 792a7f24f37d40aa98aed001bccf8933 +timeCreated: 1597745240 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/ArrowList.cs b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/ArrowList.cs new file mode 100644 index 00000000..a8819eee --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/ArrowList.cs @@ -0,0 +1,110 @@ +using SharpUI.Source.Common.UI.Elements.ArrowLists.Adapter; +using SharpUI.Source.Common.UI.Elements.ArrowLists.Animation; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.ArrowLists +{ + public class ArrowList : MonoBehaviour + { + [SerializeField] public RectButton leftButton; + [SerializeField] public RectButton rightButton; + [SerializeField] public TMP_Text itemText; + + private CompositeDisposable _disposable = new CompositeDisposable(); + private IArrowListAnimator _textAnimator = new ArrowListAnimator(); + private IArrowListAdapter _adapter; + + public void Start() + { + ObserveButtonClicks(); + _textAnimator.BindTextComponent(itemText); + } + + public void SetDisposable(CompositeDisposable disposable) + => _disposable = disposable; + + public void SetArrowListAnimator(IArrowListAnimator textAnimator) + => _textAnimator = textAnimator; + + private void ObserveButtonClicks() + { + leftButton.GetEventListener() + .ObserveOnClicked() + .SubscribeWith(this, _ => LeftClicked()); + + rightButton.GetEventListener() + .ObserveOnClicked() + .SubscribeWith(this, _ => RightClicked()); + } + + private void LeftClicked() + { + if (_textAnimator.IsAnimating()) + return; + + _textAnimator.CloneText(); + _adapter.SelectPrevious(); + _textAnimator.SlideRight(); + } + + private void RightClicked() + { + if (_textAnimator.IsAnimating()) + return; + + _textAnimator.CloneText(); + _adapter.SelectNext(); + _textAnimator.SlideLeft(); + } + + public void SetAdapter(IArrowListAdapter adapter) + { + _adapter = adapter; + ObserveAdapterChanges(); + } + + private void ObserveAdapterChanges() + { + _disposable.Clear(); + _adapter.ObserveDataChange().SubscribeWith(_disposable, _ => Render()); + _adapter.ObserveSelectionChange().SubscribeWith(_disposable, _ => Render()); + } + + private void SetButtonInteractableStates() + { + SetLeftButtonInteractable(); + SetRightButtonInteractable(); + } + + private void SetLeftButtonInteractable() + { + if (_adapter.HasPreviousData()) + leftButton.EnableButton(); + else + leftButton.DisableButton(); + } + + private void SetRightButtonInteractable() + { + if (_adapter.HasNextData()) + rightButton.EnableButton(); + else + rightButton.DisableButton(); + } + + private void Render() + { + SetButtonInteractableStates(); + itemText.SetText(_adapter.CurrentItem() ?? ""); + } + + public void OnDestroy() + { + _textAnimator.Unbind(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/ArrowList.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/ArrowList.cs.meta new file mode 100644 index 00000000..30aefe9f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/ArrowList.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ac0d31b723c8450fa3b5003c4a6bebc1 +timeCreated: 1597606192 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions.meta new file mode 100644 index 00000000..843b97ee --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7e3806d0af9b43e1a51106b6767856e2 +timeCreated: 1597745086 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions/ArrowListExtensions.cs b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions/ArrowListExtensions.cs new file mode 100644 index 00000000..7b6bf26a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions/ArrowListExtensions.cs @@ -0,0 +1,10 @@ +using SharpUI.Source.Common.UI.Elements.ArrowLists.Animation; + +namespace SharpUI.Source.Common.UI.Elements.ArrowLists.Extensions +{ + public static class ArrowListExtensions + { + public static float DirectionMultiplier(this AnimateDirection direction) + => direction == AnimateDirection.Left ? -1 : 1; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions/ArrowListExtensions.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions/ArrowListExtensions.cs.meta new file mode 100644 index 00000000..42758a22 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ArrowLists/Extensions/ArrowListExtensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 724e34e10e4c40129d54bb9c76c4fcbf +timeCreated: 1597745098 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/BaseElement.cs b/Assets/SharpUI/Source/Common/UI/Elements/BaseElement.cs new file mode 100644 index 00000000..32ccb3e0 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/BaseElement.cs @@ -0,0 +1,99 @@ +using System.Collections.Generic; +using System.Linq; +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Elements.Decorators; +using SharpUI.Source.Common.UI.Elements.Events; +using SharpUI.Source.Common.UI.Elements.State; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements +{ + public abstract class BaseElement : MonoBehaviour + { + [SerializeField] public bool isEnabled = true; + [SerializeField] public bool isClickable; + [SerializeField] public bool isSelectable; + [SerializeField] public bool isSelected; + + [CanBeNull] protected Selectable selectableElement; + protected ElementEventPromoter eventPromoter; + protected ElementEventDispatcher dispatcher; + protected ElementState state; + protected List decorators; + + public virtual void Awake() + { + SetupElement(); + SetupSelectable(); + } + + public virtual void Start() + { + SetupUI(); + ObserveEvents(); + } + + protected virtual void SetupUI() + { + SetClickable(isClickable); + SetSelectable(isSelectable); + SetSelected(isSelected); + } + + public void SetClickable(bool clickable) + { + isClickable = clickable; + if (clickable) + state.MakeClickable(); + else + state.MakeNonClickable(); + } + + public void SetSelectable(bool selectable) + { + isSelectable = selectable; + if (selectable) + state.MakeSelectable(); + else + state.MakeNonSelectable(); + } + + public void SetSelected(bool selected) + { + isSelected = selected; + if (selected) + { + eventPromoter.ObservedSelected(); + + if (!state.IsSelected()) return; + if (selectableElement != null) + selectableElement.Select(); + } + else + { + eventPromoter.ObservedDeselect(); + } + } + + public IElementEventListener GetEventListener() => dispatcher; + + public IElementState GetState() => state; + + public List GetDecorators() => decorators; + + public IElementEventDispatcher GetEventDispatcher() => dispatcher; + + protected virtual void SetupElement() + { + decorators = gameObject.GetComponentsInChildren().ToList(); + dispatcher = new ElementEventDispatcher(); + state = new ElementState(); + eventPromoter = new ElementEventPromoter(dispatcher, state, decorators); + } + + protected abstract void SetupSelectable(); + + protected abstract void ObserveEvents(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/BaseElement.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/BaseElement.cs.meta new file mode 100644 index 00000000..d4f5b560 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/BaseElement.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f266a11ddd1b483e8434e3e5ede0ce08 +timeCreated: 1594378446 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button.meta b/Assets/SharpUI/Source/Common/UI/Elements/Button.meta new file mode 100644 index 00000000..5fe17a83 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b65896f20bbf435b882081adfc7b8d75 +timeCreated: 1585250905 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/BaseButton.cs b/Assets/SharpUI/Source/Common/UI/Elements/Button/BaseButton.cs new file mode 100644 index 00000000..bec72bff --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/BaseButton.cs @@ -0,0 +1,66 @@ +using SharpUI.Source.Common.UI.Util.Keyboard; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; +using UniRx.Triggers; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Button +{ + [RequireComponent(typeof(UnityEngine.UI.Button))] + public class BaseButton : BaseElement + { + protected UnityEngine.UI.Button button; + + private CompositeDisposable _deselectionObservable = new CompositeDisposable(); + private IKeyListener _keyListener; + + protected override void SetupElement() + { + base.SetupElement(); + button = GetComponent(); + } + + public void EnablePermanentSelection() + { + if (!_deselectionObservable.IsDisposed) + _deselectionObservable.Dispose(); + } + + public void DisablePermanentSelection() + { + if (!_deselectionObservable.IsDisposed) return; + + _deselectionObservable = new CompositeDisposable(); + button.OnDeselectAsObservable().SubscribeWith(_deselectionObservable, + _ => eventPromoter.ObservedDeselect()); + } + + public void SetKeyListener(IKeyListener keyListener) => _keyListener = keyListener; + + public IKeyListener GetKeyListener() => _keyListener ?? (_keyListener = CreateKeyListener()); + + private IKeyListener CreateKeyListener() + { + _keyListener = gameObject.AddComponent(); + _keyListener.TakeButton(this); + return _keyListener; + } + + protected override void SetupSelectable() => selectableElement = button; + + protected override void ObserveEvents() + { + button.OnPointerDownAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerDown()); + button.OnPointerUpAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerUp()); + button.OnClickAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedClick()); + button.OnPointerEnterAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerEnter()); + button.OnPointerExitAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerExit()); + button.OnSelectAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedSelected()); + button.OnDeselectAsObservable().SubscribeWith(_deselectionObservable, _ => eventPromoter.ObservedDeselect()); + button.OnPointerClickAsObservable().SubscribeWith(this, data => eventPromoter.ObservePointerClick(data.button)); + + if (isSelected) + eventPromoter.ObservedSelected(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/BaseButton.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Button/BaseButton.cs.meta new file mode 100644 index 00000000..c4ddc0a9 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/BaseButton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 386f54b5b4674334b3ad00d34927ee07 +timeCreated: 1585514993 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/ButtonSelectionGroup.cs b/Assets/SharpUI/Source/Common/UI/Elements/Button/ButtonSelectionGroup.cs new file mode 100644 index 00000000..019e55b5 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/ButtonSelectionGroup.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using System.Linq; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Button +{ + public class ButtonSelectionGroup : MonoBehaviour + { + [SerializeField] public bool selectButtonByIndex; + [SerializeField] public int selectAtIndex; + + private List _selectableButtons = new List(); + + public void Awake() + { + LoadButtons(); + } + + public void Start() + { + InitSelection(); + InitSelectionButtons(); + SelectIfRequested(); + } + + private void LoadButtons() + { + _selectableButtons = GetComponentsInChildren().ToList(); + } + + private void InitSelection() + { + foreach (var button in _selectableButtons) + { + button.SetSelected(false); + button.EnablePermanentSelection(); + } + } + + private void InitSelectionButtons() + { + for (var i = 0; i < _selectableButtons.Count; i++) + { + var index = (ushort) i; + var button = _selectableButtons[index]; + button.GetEventListener().ObserveOnSelected().SubscribeWith(this, + _ => OnButtonSelected(index)); + } + } + + private void SelectIfRequested() + { + if (!selectButtonByIndex || _selectableButtons.ElementAt(selectAtIndex) == null) + return; + + SelectAtIndex(selectAtIndex); + } + + public void SelectAtIndex(int index) + { + if (_selectableButtons.ElementAtOrDefault(index) == null) + return; + + _selectableButtons[index].SetSelected(true); + } + + private void OnButtonSelected(ushort buttonIndex) + { + DeselectOthers(buttonIndex); + } + + private void DeselectOthers(ushort selectedIndex) + { + for (var index = 0; index < _selectableButtons.Count; index++) + { + var button = _selectableButtons[index]; + if (button.GetState().IsSelected() && selectedIndex != index) + button.SetSelected(false); + } + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/ButtonSelectionGroup.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Button/ButtonSelectionGroup.cs.meta new file mode 100644 index 00000000..f38fafcc --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/ButtonSelectionGroup.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 590fd020d9284c589cda9e75585cccbf +timeCreated: 1587122014 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/CircleButton.cs b/Assets/SharpUI/Source/Common/UI/Elements/Button/CircleButton.cs new file mode 100644 index 00000000..65641f06 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/CircleButton.cs @@ -0,0 +1,48 @@ +using System; +using SharpUI.Source.Common.Util.Collision; +using SharpUI.Source.Common.Util.Collision.Data; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Button +{ + public class CircleButton : IconButton, ICanvasRaycastFilter + { + private CircleCollider2D _collider; + private RectTransform _rectTransform; + + protected override void SetupElement() + { + base.SetupElement(); + _rectTransform = GetComponent(); + _collider = gameObject.AddComponent(); + } + + protected override void SetupUI() + { + base.SetupUI(); + _collider.radius = ComputeRadius(); + } + + private float ComputeRadius() + { + var rect = _rectTransform.rect; + return Math.Max(rect.width, rect.height) / 2.0f; + } + + private ColliderData GetColliderData(Vector2 position, Camera eventCamera) + { + return new ColliderData + { + Point = position, + Transform = _rectTransform, + Camera = eventCamera, + Collider = _collider + }; + } + + public bool IsRaycastLocationValid(Vector2 position, Camera eventCamera) + { + return ColliderUtils.IsPointInsideCollider(GetColliderData(position, eventCamera)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/CircleButton.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Button/CircleButton.cs.meta new file mode 100644 index 00000000..3d2f62c7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/CircleButton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f86ee4e5715346038fbd413997a9cbb0 +timeCreated: 1585508855 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/IconButton.cs b/Assets/SharpUI/Source/Common/UI/Elements/Button/IconButton.cs new file mode 100644 index 00000000..f2c4330d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/IconButton.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Button +{ + public class IconButton : RectButton + { + [SerializeField] public Image iconImage; + + public void SetIcon(Sprite sprite) + { + iconImage.sprite = sprite; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/IconButton.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Button/IconButton.cs.meta new file mode 100644 index 00000000..c345b035 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/IconButton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8ee3b09d769841f6823e1585a54e4337 +timeCreated: 1585351391 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/RectButton.cs b/Assets/SharpUI/Source/Common/UI/Elements/Button/RectButton.cs new file mode 100644 index 00000000..1d44985f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/RectButton.cs @@ -0,0 +1,43 @@ +using SharpUI.Source.Common.UI.Elements.Decorators; + +namespace SharpUI.Source.Common.UI.Elements.Button +{ + public class RectButton : BaseButton + { + protected override void SetupUI() + { + base.SetupUI(); + SetEnabled(isEnabled); + } + + private void SetEnabled(bool stateEnabled) + { + isEnabled = stateEnabled; + + if (stateEnabled) + EnableButton(); + else + DisableButton(); + } + + public void EnableButton() + { + if (button.interactable) return; + + button.interactable = true; + state.Enable(); + dispatcher.OnEnabled(); + decorators.OnEnabled(); + } + + public void DisableButton() + { + if (button.interactable == false) return; + + button.interactable = false; + state.Disable(); + dispatcher.OnDisabled(); + decorators.OnDisabled(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/RectButton.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Button/RectButton.cs.meta new file mode 100644 index 00000000..7c8c1700 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/RectButton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bb98c87ed3f24487ab7f939a7bee4b43 +timeCreated: 1585250913 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/SkillTreeButton.cs b/Assets/SharpUI/Source/Common/UI/Elements/Button/SkillTreeButton.cs new file mode 100644 index 00000000..a44c94dd --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/SkillTreeButton.cs @@ -0,0 +1,77 @@ +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Elements.SkillTrees; +using SharpUI.Source.Common.UI.Elements.Toggle; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Button +{ + public class SkillTreeButton : IconButton + { + [SerializeField] public Image frameImage; + [SerializeField] public SkillLevel skillLevel; + [SerializeField] public SkillAmountLimit skillLimit; + [SerializeField,CanBeNull] public ToggleButton nodeOwner; + [SerializeField] public Color activeFrameColor; + [SerializeField] public Color disabledFrameColor; + [SerializeField] public Color activeIconColor; + [SerializeField] public Color disabledIconColor; + + private ISkillAmountLimit _skillAmountLimit; + private ISkillLevel _skillLevel; + + protected override void SetupUI() + { + base.SetupUI(); + SetSkillAmountLimit(skillLimit); + SetSkillLevel(skillLevel); + ObserveClicks(); + SetColors(); + } + + public void SetSkillAmountLimit(ISkillAmountLimit skillAmountLimit) => _skillAmountLimit = skillAmountLimit; + + public void SetSkillLevel(ISkillLevel newSkillLevel) => _skillLevel = newSkillLevel; + + private void ObserveClicks() + { + dispatcher.ObserveOnLeftClicked().SubscribeWith(this, _ => Increment()); + dispatcher.ObserveOnRightClicked().SubscribeWith(this, _ => Decrement()); + } + + private void Increment() + { + if (!CanIncrement()) return; + + _skillLevel.IncrementLevel(); + SetColors(); + } + + private void Decrement() + { + if (!CanDecrement()) return; + + _skillLevel.DecrementLevel(); + SetColors(); + } + + private bool CanIncrement() => _skillAmountLimit.CanSpend() && (nodeOwner == null || nodeOwner.isOn); + + private bool CanDecrement() => _skillAmountLimit.CanTakeBack(); + + private void SetColors() + { + if (_skillLevel.HaveLevels()) + { + frameImage.color = activeFrameColor; + iconImage.color = activeIconColor; + } + else + { + frameImage.color = disabledFrameColor; + iconImage.color = disabledIconColor; + } + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/SkillTreeButton.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Button/SkillTreeButton.cs.meta new file mode 100644 index 00000000..dc8cc26f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/SkillTreeButton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9072bfb5cca24f01a4acdc2ebc1db8a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/TabButton.cs b/Assets/SharpUI/Source/Common/UI/Elements/Button/TabButton.cs new file mode 100644 index 00000000..4434ba29 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/TabButton.cs @@ -0,0 +1,26 @@ +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Button +{ + public class TabButton : RectButton + { + [SerializeField] public GameObject content; + + public override void Awake() + { + base.Awake(); + + GetEventListener().ObserveOnSelected().SubscribeWith(this, + _ => SetContentVisibility(true)); + GetEventListener().ObserveOnDeselected().SubscribeWith(this, + _ => SetContentVisibility(false)); + } + + private void SetContentVisibility(bool visible) + { + if (content != null) + content.SetActive(visible); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Button/TabButton.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Button/TabButton.cs.meta new file mode 100644 index 00000000..cdb09220 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Button/TabButton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a9938e31ceb440d2ae34ff2a178baa61 +timeCreated: 1598046708 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators.meta new file mode 100644 index 00000000..0cc57478 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9280d52ad4164dfb86722d9a7f3d3939 +timeCreated: 1585294057 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/BaseDecorator.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/BaseDecorator.cs new file mode 100644 index 00000000..dd8f8312 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/BaseDecorator.cs @@ -0,0 +1,123 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public enum StateActive { Enabled, Disabled } + public enum StateSelected { Selected, Deselected } + public enum StateHover { Inside, Outside } + public enum StatePressed { Pressed, Released } + + public abstract class BaseDecorator : MonoBehaviour, IDecorator + { + private StateActive _stateActive = StateActive.Enabled; + private StateSelected _stateSelected = StateSelected.Deselected; + private StateHover _stateHover = StateHover.Outside; + private StatePressed _statePressed = StatePressed.Released; + + protected BaseDecorator() => SetDefaults(); + + public void SetStates(StateActive active, StateSelected selected, StateHover hover, StatePressed pressed) + { + _stateActive = active; + _stateSelected = selected; + _stateHover = hover; + _statePressed = pressed; + } + + private void SetDefaults() + { + _stateActive = StateActive.Enabled; + _stateSelected = StateSelected.Deselected; + _stateHover = StateHover.Outside; + _statePressed = StatePressed.Released; + } + + public virtual void OnPressed() + { + if (IsDisabled()) return; + + _statePressed = StatePressed.Pressed; + DecoratePressed(); + } + + public virtual void OnReleased() + { + if (IsDisabled()) return; + + _statePressed = StatePressed.Released; + DecorateReleased(); + } + + public virtual void OnSelected() + { + if (IsDisabled()) return; + + _stateSelected = StateSelected.Selected; + DecorateSelected(); + } + + public virtual void OnDeselected() + { + if (IsDisabled()) return; + + _stateSelected = StateSelected.Deselected; + DecorateDeselected(); + } + + public virtual void OnEnter() + { + if (IsDisabled() || IsSelected()) return; + + _stateHover = StateHover.Inside; + DecorateEnter(); + } + + public virtual void OnExit() + { + if (IsDisabled()) return; + + _stateHover = StateHover.Outside; + DecorateExit(); + } + + public virtual void OnEnabled() + { + SetDefaults(); + DecorateEnabled(); + } + + public virtual void OnDisabled() + { + SetDefaults(); + _stateActive = StateActive.Disabled; + DecorateDisabled(); + } + + public bool IsPressed() => _statePressed == StatePressed.Pressed; + + public bool IsReleased() => _statePressed == StatePressed.Released; + + public bool IsSelected() => _stateSelected == StateSelected.Selected; + + public bool IsDeselected() => _stateSelected == StateSelected.Deselected; + + public bool IsInside() => _stateHover == StateHover.Inside; + + public bool IsOutside() => _stateHover == StateHover.Outside; + + public bool IsEnabled() => _stateActive == StateActive.Enabled; + + public bool IsDisabled() => _stateActive == StateActive.Disabled; + + protected abstract void Decorate(TComponent component); + + protected abstract void DecoratePressed(); + protected abstract void DecorateReleased(); + protected abstract void DecorateSelected(); + protected abstract void DecorateDeselected(); + protected abstract void DecorateEnter(); + protected abstract void DecorateExit(); + protected abstract void DecorateEnabled(); + protected abstract void DecorateDisabled(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/BaseDecorator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/BaseDecorator.cs.meta new file mode 100644 index 00000000..e4ed0cf9 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/BaseDecorator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5fab3594810c413e9f2c276fde5b4fe7 +timeCreated: 1585311282 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecorator.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecorator.cs new file mode 100644 index 00000000..4b1420f6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecorator.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public abstract class ColorDecorator : BaseDecorator + { + [SerializeField] public Color normalColor = Color.white; + [SerializeField] public Color disabledColor = Color.white; + [SerializeField] public Color pressedColor = Color.white; + [SerializeField] public Color selectedColor = Color.white; + [SerializeField] public Color hoverColor = Color.white; + + protected override void DecoratePressed() => Decorate(pressedColor); + + protected override void DecorateReleased() + { + if (IsSelected()) Decorate(selectedColor); + else if (IsInside()) Decorate(hoverColor); + else Decorate(normalColor); + } + + protected override void DecorateSelected() => Decorate(selectedColor); + + protected override void DecorateDeselected() + { + if (IsInside()) Decorate(hoverColor); + else if (IsPressed()) Decorate(pressedColor); + else Decorate(normalColor); + } + + protected override void DecorateEnter() => Decorate(hoverColor); + + protected override void DecorateExit() + { + if (IsSelected()) Decorate(selectedColor); + else Decorate(normalColor); + } + + protected override void DecorateEnabled() => Decorate(normalColor); + + protected override void DecorateDisabled() => Decorate(disabledColor); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecorator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecorator.cs.meta new file mode 100644 index 00000000..7f053691 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecorator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: feb15f7a14dc4eab9ab00eb3e9118219 +timeCreated: 1585306499 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForImage.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForImage.cs new file mode 100644 index 00000000..558544a7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForImage.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + [RequireComponent(typeof(Image))] + public class ColorDecoratorForImage : ColorDecorator + { + private Image _image; + + public void Awake() + { + _image = GetComponent(); + Decorate(normalColor); + } + + protected override void Decorate(Color color) + { + _image.color = color; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForImage.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForImage.cs.meta new file mode 100644 index 00000000..1e743ef4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForImage.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5a03f8144ee14deb94df842abd5aabdc +timeCreated: 1585252654 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForText.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForText.cs new file mode 100644 index 00000000..3eda999d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForText.cs @@ -0,0 +1,22 @@ +using TMPro; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + [RequireComponent(typeof(TMP_Text))] + public class ColorDecoratorForText : ColorDecorator + { + private TMP_Text _text; + + public void Awake() + { + _text = GetComponent(); + Decorate(normalColor); + } + + protected override void Decorate(Color color) + { + _text.color = color; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForText.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForText.cs.meta new file mode 100644 index 00000000..29d128f8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ColorDecoratorForText.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a771616732fd4f90adc670eb508f6907 +timeCreated: 1585306412 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/DecoratorMode.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/DecoratorMode.cs new file mode 100644 index 00000000..519399b2 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/DecoratorMode.cs @@ -0,0 +1,10 @@ +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public enum DecoratorMode + { + OnPressRelease, + OnEnterExit, + OnSelectDeselect, + OnEnableDisable + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/DecoratorMode.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/DecoratorMode.cs.meta new file mode 100644 index 00000000..b633b4fd --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/DecoratorMode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: adccce14651d44ba9b17aaade6edfbfa +timeCreated: 1600023366 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ElementVisibility.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ElementVisibility.cs new file mode 100644 index 00000000..52f119e1 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ElementVisibility.cs @@ -0,0 +1,8 @@ +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public enum ElementVisibility + { + Visible, + Invisible + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ElementVisibility.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ElementVisibility.cs.meta new file mode 100644 index 00000000..9a564365 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ElementVisibility.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f0d24e3766204ed7a35bd4b808afd49f +timeCreated: 1598035092 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/IDecorator.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/IDecorator.cs new file mode 100644 index 00000000..66b2a679 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/IDecorator.cs @@ -0,0 +1,23 @@ +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public interface IDecorator + { + void OnPressed(); + void OnReleased(); + void OnSelected(); + void OnDeselected(); + void OnEnter(); + void OnExit(); + void OnEnabled(); + void OnDisabled(); + + bool IsPressed(); + bool IsReleased(); + bool IsSelected(); + bool IsDeselected(); + bool IsInside(); + bool IsOutside(); + bool IsEnabled(); + bool IsDisabled(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/IDecorator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/IDecorator.cs.meta new file mode 100644 index 00000000..f49ac234 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/IDecorator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 37cd4a39967b48c49cfe15ad8b0649cc +timeCreated: 1585294106 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/OffsetDecorator.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/OffsetDecorator.cs new file mode 100644 index 00000000..21b5e1e3 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/OffsetDecorator.cs @@ -0,0 +1,84 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public class OffsetDecorator : BaseDecorator + { + [SerializeField] public bool isEnabled = true; + [SerializeField] public DecoratorMode decoratorMode = DecoratorMode.OnPressRelease; + [SerializeField] public Vector3 offset; + + private RectTransform _rectTransform; + private Vector3 _originalPosition; + + public void Awake() + { + _rectTransform = gameObject.GetComponent(); + SaveState(); + } + + protected override void Decorate(Vector3 amount) + { + if (!isEnabled) return; + + _rectTransform.localPosition = _originalPosition + amount; + } + + protected override void DecoratePressed() + { + SaveState(); + if (decoratorMode == DecoratorMode.OnPressRelease) + Decorate(offset); + } + + protected override void DecorateReleased() + { + if (decoratorMode == DecoratorMode.OnPressRelease) + Decorate(Vector3.zero); + } + + protected override void DecorateSelected() + { + SaveState(); + if (decoratorMode == DecoratorMode.OnSelectDeselect) + Decorate(offset); + } + + protected override void DecorateDeselected() + { + if (decoratorMode == DecoratorMode.OnSelectDeselect) + Decorate(Vector3.zero); + } + + protected override void DecorateEnter() + { + SaveState(); + if (decoratorMode == DecoratorMode.OnEnterExit) + Decorate(offset); + } + + protected override void DecorateExit() + { + if (decoratorMode == DecoratorMode.OnEnterExit) + Decorate(Vector3.zero); + } + + protected override void DecorateEnabled() + { + SaveState(); + if (decoratorMode == DecoratorMode.OnEnableDisable) + Decorate(offset); + } + + protected override void DecorateDisabled() + { + if (decoratorMode == DecoratorMode.OnEnableDisable) + Decorate(Vector3.zero); + } + + private void SaveState() + { + _originalPosition = _rectTransform.localPosition; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/OffsetDecorator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/OffsetDecorator.cs.meta new file mode 100644 index 00000000..c54e76e1 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/OffsetDecorator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e0148c97f5dd46228c9dfb9bcfcbee85 +timeCreated: 1600023210 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ScaleDecorator.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ScaleDecorator.cs new file mode 100644 index 00000000..c76e48e5 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ScaleDecorator.cs @@ -0,0 +1,84 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public class ScaleDecorator : BaseDecorator + { + public enum ScaleType { ScaleXY, ScaleXYZ } + + [SerializeField] public bool isEnabled = true; + [SerializeField] public ScaleType scaleType = ScaleType.ScaleXY; + [SerializeField] public DecoratorMode decoratorMode = DecoratorMode.OnPressRelease; + [SerializeField][Range(0.0f, 1.0f)] public float defaultScale; + [SerializeField][Range(0.0f, 1.0f)] public float activeScale; + + private RectTransform _rectTransform; + + public void Awake() + { + _rectTransform = gameObject.GetComponent(); + } + + protected override void Decorate(float scale) + { + if (!isEnabled) return; + + _rectTransform.localScale = GetScaleVector(scale); + } + + private Vector3 GetScaleVector(float scale) + { + return scaleType == ScaleType.ScaleXYZ + ? new Vector3(scale, scale, scale) + : new Vector3(scale, scale, _rectTransform.localScale.z); + } + + protected override void DecoratePressed() + { + if (decoratorMode == DecoratorMode.OnPressRelease) + Decorate(activeScale); + } + + protected override void DecorateReleased() + { + if (decoratorMode == DecoratorMode.OnPressRelease) + Decorate(defaultScale); + } + + protected override void DecorateSelected() + { + if (decoratorMode == DecoratorMode.OnSelectDeselect) + Decorate(activeScale); + } + + protected override void DecorateDeselected() + { + if (decoratorMode == DecoratorMode.OnSelectDeselect) + Decorate(defaultScale); + } + + protected override void DecorateEnter() + { + if (decoratorMode == DecoratorMode.OnEnterExit) + Decorate(activeScale); + } + + protected override void DecorateExit() + { + if (decoratorMode == DecoratorMode.OnEnterExit) + Decorate(defaultScale); + } + + protected override void DecorateEnabled() + { + if (decoratorMode == DecoratorMode.OnEnableDisable) + Decorate(activeScale); + } + + protected override void DecorateDisabled() + { + if (decoratorMode == DecoratorMode.OnEnableDisable) + Decorate(defaultScale); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ScaleDecorator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ScaleDecorator.cs.meta new file mode 100644 index 00000000..81b3cf7f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/ScaleDecorator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c9a508816d3b43409c607a07028be87f +timeCreated: 1600021167 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SharpDecoratorExtensions.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SharpDecoratorExtensions.cs new file mode 100644 index 00000000..b39c3ebd --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SharpDecoratorExtensions.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public static class SharpDecoratorExtensions + { + public static void OnSelected(this IEnumerable decorators) + { + foreach (var decorator in decorators) + decorator.OnSelected(); + } + + public static void OnDeselected(this IEnumerable decorators) + { + foreach (var decorator in decorators) + decorator.OnDeselected(); + } + + public static void OnEnter(this IEnumerable decorators) + { + foreach (var decorator in decorators) + decorator.OnEnter(); + } + + public static void OnExit(this IEnumerable decorators) + { + foreach (var decorator in decorators) + decorator.OnExit(); + } + + public static void OnEnabled(this IEnumerable decorators) + { + foreach (var decorator in decorators) + decorator.OnEnabled(); + } + + public static void OnDisabled(this IEnumerable decorators) + { + foreach (var decorator in decorators) + decorator.OnDisabled(); + } + + public static void OnPressed(this IEnumerable decorators) + { + foreach (var decorator in decorators) + decorator.OnPressed(); + } + + public static void OnReleased(this IEnumerable decorators) + { + foreach (var decorator in decorators) + decorator.OnReleased(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SharpDecoratorExtensions.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SharpDecoratorExtensions.cs.meta new file mode 100644 index 00000000..9bda09c4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SharpDecoratorExtensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c1bbd94fdebf405b983828a2663ef91b +timeCreated: 1585311872 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SpriteDecorator.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SpriteDecorator.cs new file mode 100644 index 00000000..5ee22f04 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SpriteDecorator.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + [RequireComponent(typeof(Image))] + public sealed class SpriteDecorator : BaseDecorator + { + [SerializeField] public Sprite normalSprite; + [SerializeField] public Sprite disabledSprite; + [SerializeField] public Sprite pressedSprite; + [SerializeField] public Sprite selectedSprite; + [SerializeField] public Sprite hoverSprite; + + private Image _image; + + public void Awake() + { + _image = GetComponent(); + Decorate(normalSprite); + } + + protected override void Decorate(Sprite sprite) + { + if (!Equals(_image.sprite, sprite)) + _image.sprite = sprite; + } + + protected override void DecoratePressed() => Decorate(pressedSprite); + + protected override void DecorateReleased() + { + if (IsSelected()) Decorate(selectedSprite); + else if (IsInside()) Decorate(hoverSprite); + else Decorate(normalSprite); + } + + protected override void DecorateSelected() => Decorate(selectedSprite); + + protected override void DecorateDeselected() + { + if (IsInside()) Decorate(hoverSprite); + else if (IsPressed()) Decorate(pressedSprite); + else Decorate(normalSprite); + } + + protected override void DecorateEnter() => Decorate(hoverSprite); + + protected override void DecorateExit() + { + if (IsSelected()) Decorate(selectedSprite); + else Decorate(normalSprite); + } + + protected override void DecorateEnabled() => Decorate(normalSprite); + + protected override void DecorateDisabled() => Decorate(disabledSprite); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SpriteDecorator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SpriteDecorator.cs.meta new file mode 100644 index 00000000..3ffd944c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/SpriteDecorator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fffcae0ee53a4c80b40b7ca2a902c0fc +timeCreated: 1585351575 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/VisibilityDecorator.cs b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/VisibilityDecorator.cs new file mode 100644 index 00000000..5f527684 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/VisibilityDecorator.cs @@ -0,0 +1,38 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Decorators +{ + public class VisibilityDecorator : BaseDecorator + { + [SerializeField] public bool visibleWhenSelected = true; + + protected override void Decorate(ElementVisibility visibility) + { + gameObject.SetActive(visibility == ElementVisibility.Visible); + } + + protected override void DecoratePressed() { /* Do nothing */ } + + protected override void DecorateReleased() { /* Do nothing */ } + + protected override void DecorateSelected() => DefaultDecoration(); + + protected override void DecorateDeselected() => DefaultDecoration(); + + protected override void DecorateEnter() { /* Do nothing */ } + + protected override void DecorateExit() { /* Do nothing */ } + + protected override void DecorateEnabled() { /* Do nothing */ } + + protected override void DecorateDisabled() { /* Do nothing */ } + + private void DefaultDecoration() + { + if (visibleWhenSelected && IsSelected()) + Decorate(ElementVisibility.Visible); + else + Decorate(ElementVisibility.Invisible); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Decorators/VisibilityDecorator.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/VisibilityDecorator.cs.meta new file mode 100644 index 00000000..c3798a07 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Decorators/VisibilityDecorator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ccecbd869d224e15b8c0dda2e2bd269a +timeCreated: 1598034832 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Dialogs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs.meta new file mode 100644 index 00000000..e41968c9 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d9d000ac9a2d48b38f7ef50b76154dd4 +timeCreated: 1597911517 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/Dialog.cs b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/Dialog.cs new file mode 100644 index 00000000..2dd76bc3 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/Dialog.cs @@ -0,0 +1,161 @@ +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Util.Layout; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Dialogs +{ + public class Dialog : MonoBehaviour, IDialog + { + [SerializeField] public Sprite spriteInfo; + [SerializeField] public Sprite spriteQuestion; + [SerializeField] public Sprite spriteWarning; + [SerializeField] public Sprite spriteCustom; + [SerializeField] public TMP_Text titleText; + [SerializeField] public TMP_Text descriptionText; + [SerializeField] public Image iconImage; + [SerializeField] public UnityEngine.UI.Button closeIconButton; + [SerializeField] public RectTransform contentTransform; + [SerializeField] public GameObject defaultButtonsContainer; + [SerializeField] public RectButton buttonPositive; + [SerializeField] public RectButton buttonNegative; + [SerializeField] public RectButton buttonNeutral; + + private DialogIconType _iconType; + private ILayoutHelper _layoutHelper = new LayoutHelper(); + + public void Start() + { + closeIconButton.OnClickAsObservable().SubscribeWith(this, _ => DestroyDialog()); + } + + private void DestroyDialog() + { + DestroyImmediate(gameObject); + } + + public void SetLayoutHelper(ILayoutHelper layoutHelper) => _layoutHelper = layoutHelper; + + public void Show() + { + gameObject.SetActive(true); + } + + public void Hide() + { + gameObject.SetActive(false); + } + + public void Close() + { + DestroyDialog(); + } + + public void SetTitle(string title) + { + titleText.text = title; + } + + public void SetDescription(string description) + { + descriptionText.text = description; + _layoutHelper.ForceRebuildLayoutImmediate(contentTransform); + } + + public void SetDescriptionVisibility(bool visible) + { + descriptionText.gameObject.SetActive(visible); + } + + public void HideDefaultButtons() => defaultButtonsContainer.SetActive(false); + + public void ShowDefaultButtons() => defaultButtonsContainer.SetActive(true); + + public void SetPositiveButtonText(string text) + { + buttonPositive.GetComponentInChildren().text = text; + } + + public void SetNegativeButtonText(string text) + { + buttonNegative.GetComponentInChildren().text = text; + } + + public void SetNeutralButtonText(string text) + { + buttonNeutral.GetComponentInChildren().text = text; + } + + public void SetPositiveButtonVisible(bool visible) + { + buttonPositive.gameObject.SetActive(visible); + } + + public void SetNegativeButtonVisible(bool visible) + { + buttonNegative.gameObject.SetActive(visible); + } + + public void SetNeutralButtonVisible(bool visible) + { + buttonNeutral.gameObject.SetActive(visible); + } + + public void SetCustomContent(RectTransform customContentTransform) + { + ClearContent(); + customContentTransform.SetParent(contentTransform); + } + + public void ClearContent() + { + foreach (Transform child in contentTransform) + { + child.gameObject.SetActive(false); + } + } + + public void SetCustomSprite(Sprite sprite) + { + spriteCustom = sprite; + } + + public void SetCloseButtonVisible(bool visible) + { + closeIconButton.gameObject.SetActive(visible); + } + + public void SetIconType(DialogIconType type) + { + _iconType = type; + var sprite = GetIconSprite(); + if (sprite == null) + { + iconImage.gameObject.SetActive(false); + } + else + { + iconImage.gameObject.SetActive(true); + iconImage.sprite = GetIconSprite(); + } + } + + private Sprite GetIconSprite() + { + switch (_iconType) + { + case DialogIconType.Info: return spriteInfo; + case DialogIconType.Question: return spriteQuestion; + case DialogIconType.Warning: return spriteWarning; + case DialogIconType.Custom: return spriteCustom; + case DialogIconType.None: return null; + default: return null; + } + } + + public DialogIconType GetIconType() => _iconType; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/Dialog.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/Dialog.cs.meta new file mode 100644 index 00000000..0819e6f6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/Dialog.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e19c1788aa2b42daa0990f6c8197156c +timeCreated: 1597911523 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/DialogIconType.cs b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/DialogIconType.cs new file mode 100644 index 00000000..adffb0c6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/DialogIconType.cs @@ -0,0 +1,11 @@ +namespace SharpUI.Source.Common.UI.Elements.Dialogs +{ + public enum DialogIconType + { + None, + Custom, + Info, + Question, + Warning + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/DialogIconType.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/DialogIconType.cs.meta new file mode 100644 index 00000000..1a70ad54 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/DialogIconType.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 98cf908e968a424ebb71c7b91d99a680 +timeCreated: 1597914030 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/IDialog.cs b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/IDialog.cs new file mode 100644 index 00000000..855e8286 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/IDialog.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Dialogs +{ + public interface IDialog + { + void Show(); + void Hide(); + void Close(); + void SetCloseButtonVisible(bool visible); + void SetCustomSprite(Sprite sprite); + void SetIconType(DialogIconType type); + DialogIconType GetIconType(); + void SetCustomContent(RectTransform customContentTransform); + void ClearContent(); + void SetPositiveButtonText(string text); + void SetNegativeButtonText(string text); + void SetNeutralButtonText(string text); + void SetPositiveButtonVisible(bool visible); + void SetNegativeButtonVisible(bool visible); + void SetNeutralButtonVisible(bool visible); + void HideDefaultButtons(); + void ShowDefaultButtons(); + void SetTitle(string title); + void SetDescription(string description); + void SetDescriptionVisibility(bool visible); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/IDialog.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/IDialog.cs.meta new file mode 100644 index 00000000..bce070da --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Dialogs/IDialog.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 550343431fb1481fa26cc46bab338d8c +timeCreated: 1597912006 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Drag.meta b/Assets/SharpUI/Source/Common/UI/Elements/Drag.meta new file mode 100644 index 00000000..834ef9f4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Drag.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: aefdaa9c795f4d159589f4c29562daa6 +timeCreated: 1599772955 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Drag/Draggable.cs b/Assets/SharpUI/Source/Common/UI/Elements/Drag/Draggable.cs new file mode 100644 index 00000000..452571f7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Drag/Draggable.cs @@ -0,0 +1,44 @@ +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; +using UnityEngine.EventSystems; + +namespace SharpUI.Source.Common.UI.Elements.Drag +{ + public class Draggable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler + { + private GameObject _dragTrigger; + private GameObject _dragElement; + private bool _isDraggable; + + protected void SetDragGameObjects(GameObject dragTrigger, GameObject dragElement) + { + _dragTrigger = dragTrigger; + _dragElement = dragElement; + } + + public bool IsDraggable() => _isDraggable; + + public void OnBeginDrag(PointerEventData eventData) + { + _isDraggable = eventData.hovered.Contains(_dragTrigger); + } + + public void OnDrag(PointerEventData eventData) + { + if (!_isDraggable || !eventData.CanDrag()) return; + + OnDragged(eventData.delta); + } + + public void OnEndDrag(PointerEventData eventData) + { + _isDraggable = false; + } + + private void OnDragged(Vector2 size) + { + var pos = _dragElement.GetComponent().localPosition + new Vector3(size.x, size.y, 0); + _dragElement.GetComponent().localPosition = pos; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Drag/Draggable.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Drag/Draggable.cs.meta new file mode 100644 index 00000000..b35ce423 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Drag/Draggable.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 78d58b61e8cf4b3492b6af1b51f5e6d2 +timeCreated: 1599772968 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns.meta b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns.meta new file mode 100644 index 00000000..6f567258 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e95b35e9d6d04a3894083e371f0850a5 +timeCreated: 1598650826 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters.meta b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters.meta new file mode 100644 index 00000000..c71b1aba --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fe10629120784cd78724eca0202ec2c3 +timeCreated: 1598650922 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DefaultDropDownAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DefaultDropDownAdapter.cs new file mode 100644 index 00000000..65ded65a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DefaultDropDownAdapter.cs @@ -0,0 +1,10 @@ +namespace SharpUI.Source.Common.UI.Elements.DropDowns.Adapters +{ + public class DefaultDropDownAdapter : DropDownAdapter + { + public override string GetItemTextAt(int index) + { + return data[index]; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DefaultDropDownAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DefaultDropDownAdapter.cs.meta new file mode 100644 index 00000000..239b0f0b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DefaultDropDownAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 85e31383ae9b47d08c289fbd9c834406 +timeCreated: 1598652857 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DropDownAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DropDownAdapter.cs new file mode 100644 index 00000000..53a41bec --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DropDownAdapter.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UniRx; +using static TMPro.TMP_Dropdown; + +namespace SharpUI.Source.Common.UI.Elements.DropDowns.Adapters +{ + public abstract class DropDownAdapter : IDropDownAdapter where TData : class + { + private readonly Subject _dataChangeObserver = new Subject(); + protected List data = new List(); + + public void SetData(IEnumerable newData) + { + data = new List(newData); + NotifyDataSetChanged(); + } + + public int DataCount() => data.Count; + + private void NotifyDataSetChanged() => _dataChangeObserver.OnNext(Unit.Default); + + public IObservable ObserveDataChange() => _dataChangeObserver; + + public List GetOptionsData() + => data + .Select((item, index) => new OptionData(GetItemTextAt(index))) + .ToList(); + + public abstract string GetItemTextAt(int index); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DropDownAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DropDownAdapter.cs.meta new file mode 100644 index 00000000..8e386d83 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/DropDownAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d3a267115f8644168b31332f818d38db +timeCreated: 1598651135 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/IDropDownAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/IDropDownAdapter.cs new file mode 100644 index 00000000..d49ba7e7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/IDropDownAdapter.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using UniRx; +using static TMPro.TMP_Dropdown; + +namespace SharpUI.Source.Common.UI.Elements.DropDowns.Adapters +{ + public interface IDropDownAdapter + { + string GetItemTextAt(int index); + int DataCount(); + IObservable ObserveDataChange(); + List GetOptionsData(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/IDropDownAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/IDropDownAdapter.cs.meta new file mode 100644 index 00000000..cdde9d8c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/Adapters/IDropDownAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a4d766ab028b4c3993126c871b5c3276 +timeCreated: 1598650931 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/DropDown.cs b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/DropDown.cs new file mode 100644 index 00000000..c9c050b4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/DropDown.cs @@ -0,0 +1,49 @@ +using SharpUI.Source.Common.UI.Elements.DropDowns.Adapters; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.DropDowns +{ + public class DropDown : MonoBehaviour + { + private CompositeDisposable _disposable = new CompositeDisposable(); + private IDropDownAdapter _adapter; + private TMP_Dropdown _dropdown; + + public void Awake() + { + _dropdown = GetComponent(); + } + + public void SelectAtIndex(int index) + { + _dropdown.value = index; + } + + public void SetDisposable(CompositeDisposable disposable) + => _disposable = disposable; + + public void SetAdapter(IDropDownAdapter adapter) + { + _adapter = adapter; + ObserveChanges(); + } + + private void ObserveChanges() + { + _adapter.ObserveDataChange().SubscribeWith(_disposable, _ => Render()); + } + + private void Render() + { + _dropdown.options = _adapter.GetOptionsData(); + } + + public void OnDestroy() + { + _disposable.Dispose(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/DropDown.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/DropDown.cs.meta new file mode 100644 index 00000000..a96b2fbd --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/DropDowns/DropDown.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5b428c36e6014cde8f2a3f90ebc1085b +timeCreated: 1598650833 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events.meta b/Assets/SharpUI/Source/Common/UI/Elements/Events.meta new file mode 100644 index 00000000..796fdfa2 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ae6f3313495c448e8e7a8abfb4f74c49 +timeCreated: 1585342587 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventDispatcher.cs b/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventDispatcher.cs new file mode 100644 index 00000000..4fbaf731 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventDispatcher.cs @@ -0,0 +1,82 @@ +using System; +using JetBrains.Annotations; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.Events +{ + public class ElementEventDispatcher : IElementEventDispatcher, IElementEventListener + { + [CanBeNull] private Subject _onPressedObserver; + [CanBeNull] private Subject _onReleasedObserver; + [CanBeNull] private Subject _onClickedObserver; + [CanBeNull] private Subject _onLeftClickedObserver; + [CanBeNull] private Subject _onRightClickedObserver; + [CanBeNull] private Subject _onMiddleClickedObserver; + [CanBeNull] private Subject _onEnabledObserver; + [CanBeNull] private Subject _onDisabledObserver; + [CanBeNull] private Subject _onEnteredObserver; + [CanBeNull] private Subject _onExitedObserver; + [CanBeNull] private Subject _onSelectedObserver; + [CanBeNull] private Subject _onDeselectedObserver; + + public void OnPressed() => _onPressedObserver?.OnNext(Unit.Default); + + public void OnReleased() => _onReleasedObserver?.OnNext(Unit.Default); + + public void OnClicked() => _onClickedObserver?.OnNext(Unit.Default); + + public void OnLeftClicked() => _onLeftClickedObserver?.OnNext(Unit.Default); + + public void OnRightClicked() => _onRightClickedObserver?.OnNext(Unit.Default); + + public void OnMiddleClicked() => _onMiddleClickedObserver?.OnNext(Unit.Default); + + public void OnEnabled() => _onEnabledObserver?.OnNext(Unit.Default); + + public void OnDisabled() => _onDisabledObserver?.OnNext(Unit.Default); + + public void OnEnter() => _onEnteredObserver?.OnNext(Unit.Default); + + public void OnExit() => _onExitedObserver?.OnNext(Unit.Default); + + public void OnSelect() => _onSelectedObserver?.OnNext(Unit.Default); + + public void OnDeselect() => _onDeselectedObserver?.OnNext(Unit.Default); + + public IObservable ObserveOnPressed() + => _onPressedObserver ?? (_onPressedObserver = new Subject()); + + public IObservable ObserveOnReleased() + => _onReleasedObserver ?? (_onReleasedObserver = new Subject()); + + public IObservable ObserveOnClicked() + => _onClickedObserver ?? (_onClickedObserver = new Subject()); + + public IObservable ObserveOnLeftClicked() + => _onLeftClickedObserver ?? (_onLeftClickedObserver = new Subject()); + + public IObservable ObserveOnRightClicked() + => _onRightClickedObserver ?? (_onRightClickedObserver = new Subject()); + + public IObservable ObserveOnMiddleClicked() + => _onMiddleClickedObserver ?? (_onMiddleClickedObserver = new Subject()); + + public IObservable ObserveOnEnabled() + => _onEnabledObserver ?? (_onEnabledObserver = new Subject()); + + public IObservable ObserveOnDisabled() + => _onDisabledObserver ?? (_onDisabledObserver = new Subject()); + + public IObservable ObserveOnEntered() + => _onEnteredObserver ?? (_onEnteredObserver = new Subject()); + + public IObservable ObserveOnExited() + => _onExitedObserver ?? (_onExitedObserver = new Subject()); + + public IObservable ObserveOnSelected() + => _onSelectedObserver ?? (_onSelectedObserver = new Subject()); + + public IObservable ObserveOnDeselected() + => _onDeselectedObserver ?? (_onDeselectedObserver = new Subject()); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventDispatcher.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventDispatcher.cs.meta new file mode 100644 index 00000000..f93a4704 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventDispatcher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0131b7ec5ef2454ab04391910ba26a46 +timeCreated: 1585252753 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventPromoter.cs b/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventPromoter.cs new file mode 100644 index 00000000..95914f7b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventPromoter.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Elements.Decorators; +using SharpUI.Source.Common.UI.Elements.State; +using UnityEngine.EventSystems; + +namespace SharpUI.Source.Common.UI.Elements.Events +{ + public class ElementEventPromoter : IElementEventPromoter + { + private readonly IElementEventDispatcher _eventDispatcher; + private readonly IElementState _state; + private readonly List _decorators; + + public ElementEventPromoter( + IElementEventDispatcher eventDispatcher, + IElementState state, + List decorators) + { + _eventDispatcher = eventDispatcher; + _state = state; + _decorators = decorators; + } + + public void ObservedPointerDown() + { + if (_state.IsClickable()) + PromotePointerDown(); + } + + public void ObservedPointerUp() + { + if (_state.IsClickable()) + PromotePointerUp(); + } + + public void ObservedClick() + { + if (_state.IsClickable()) + PromoteClick(); + } + + public void ObservePointerClick(PointerEventData.InputButton inputButton) + { + if (!_state.IsClickable()) return; + + switch (inputButton) + { + case PointerEventData.InputButton.Left: + PromoteLeftClick(); + break; + case PointerEventData.InputButton.Right: + PromoteRightClick(); + break; + case PointerEventData.InputButton.Middle: + PromoteMiddleClick(); + break; + default: + throw new ArgumentOutOfRangeException(nameof(inputButton), inputButton, null); + } + } + + public void ObservedPointerEnter() => PromoteEnter(); + + public void ObservedPointerExit() => PromoteExit(); + + public void ObservedSelected() + { + if (_state.IsClickable()) + PromoteSelect(); + } + + public void ObservedDeselect() + { + if (_state.IsClickable()) + PromoteDeselect(); + } + + private void PromotePointerDown() + { + _state.Press(); + _eventDispatcher.OnPressed(); + _decorators.OnPressed(); + } + + private void PromotePointerUp() + { + _state.Release(); + _eventDispatcher.OnReleased(); + _decorators.OnReleased(); + } + + private void PromoteClick() => _eventDispatcher.OnClicked(); + + private void PromoteLeftClick() => _eventDispatcher.OnLeftClicked(); + + private void PromoteRightClick() => _eventDispatcher.OnRightClicked(); + + private void PromoteMiddleClick() => _eventDispatcher.OnMiddleClicked(); + + private void PromoteEnter() + { + _state.Focus(); + _eventDispatcher.OnEnter(); + _decorators.OnEnter(); + } + + private void PromoteExit() + { + _state.UnFocus(); + _eventDispatcher.OnExit(); + _decorators.OnExit(); + } + + protected void PromoteSelect() + { + _state.SelectIfSelectable(); + if (_state.IsDeselected()) return; + + _eventDispatcher.OnSelect(); + _decorators.OnSelected(); + } + + protected void PromoteDeselect() + { + _state.DeselectIfSelectable(); + if (_state.IsSelected()) return; + + _eventDispatcher.OnDeselect(); + _decorators.OnDeselected(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventPromoter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventPromoter.cs.meta new file mode 100644 index 00000000..37823f72 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/ElementEventPromoter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d6eb04d5f0d1474cb9be1693ba93ea04 +timeCreated: 1585339589 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventDispatcher.cs b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventDispatcher.cs new file mode 100644 index 00000000..d556dc12 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventDispatcher.cs @@ -0,0 +1,18 @@ +namespace SharpUI.Source.Common.UI.Elements.Events +{ + public interface IElementEventDispatcher + { + void OnPressed(); + void OnReleased(); + void OnClicked(); + void OnLeftClicked(); + void OnRightClicked(); + void OnMiddleClicked(); + void OnEnabled(); + void OnDisabled(); + void OnEnter(); + void OnExit(); + void OnSelect(); + void OnDeselect(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventDispatcher.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventDispatcher.cs.meta new file mode 100644 index 00000000..4e96034f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventDispatcher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d9d3d7c5d06f470a9fb6dfadda1d4242 +timeCreated: 1585252769 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventListener.cs b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventListener.cs new file mode 100644 index 00000000..59dfdb4c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventListener.cs @@ -0,0 +1,21 @@ +using System; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.Events +{ + public interface IElementEventListener + { + IObservable ObserveOnPressed(); + IObservable ObserveOnReleased(); + IObservable ObserveOnClicked(); + IObservable ObserveOnLeftClicked(); + IObservable ObserveOnRightClicked(); + IObservable ObserveOnMiddleClicked(); + IObservable ObserveOnEnabled(); + IObservable ObserveOnDisabled(); + IObservable ObserveOnEntered(); + IObservable ObserveOnExited(); + IObservable ObserveOnSelected(); + IObservable ObserveOnDeselected(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventListener.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventListener.cs.meta new file mode 100644 index 00000000..e7a8e10a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventListener.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e212af21753044d7a9872aeea4e0b2ee +timeCreated: 1585549219 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventPromoter.cs b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventPromoter.cs new file mode 100644 index 00000000..2ef72592 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventPromoter.cs @@ -0,0 +1,22 @@ +using UnityEngine.EventSystems; + +namespace SharpUI.Source.Common.UI.Elements.Events +{ + public interface IElementEventPromoter + { + void ObservedPointerDown(); + + void ObservedPointerUp(); + + void ObservedClick(); + void ObservePointerClick(PointerEventData.InputButton inputButton); + + void ObservedPointerEnter(); + + void ObservedPointerExit(); + + void ObservedSelected(); + + void ObservedDeselect(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventPromoter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventPromoter.cs.meta new file mode 100644 index 00000000..c5592985 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/IElementEventPromoter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 13d4071a0d7745eeac53ac16218f89fc +timeCreated: 1585342614 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/ItemEventPromoter.cs b/Assets/SharpUI/Source/Common/UI/Elements/Events/ItemEventPromoter.cs new file mode 100644 index 00000000..a447c9b9 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/ItemEventPromoter.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Elements.Decorators; +using SharpUI.Source.Common.UI.Elements.State; + +namespace SharpUI.Source.Common.UI.Elements.Events +{ + public class ItemEventPromoter : ElementEventPromoter + { + public ItemEventPromoter( + IElementEventDispatcher eventDispatcher, + IElementState state, + List decorators + ) : base(eventDispatcher, state, decorators) + { + } + + public void SelectItem() => PromoteSelect(); + + public void DeselectItem() => PromoteDeselect(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Events/ItemEventPromoter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Events/ItemEventPromoter.cs.meta new file mode 100644 index 00000000..e2d83dfc --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Events/ItemEventPromoter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6695046626f74991b16fbf90d81d92bd +timeCreated: 1585564035 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Input.meta b/Assets/SharpUI/Source/Common/UI/Elements/Input.meta new file mode 100644 index 00000000..2e75ff84 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Input.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7229b9b808994c4bbc8c9dcfa633c3d3 +timeCreated: 1594367176 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Input/InputField.cs b/Assets/SharpUI/Source/Common/UI/Elements/Input/InputField.cs new file mode 100644 index 00000000..6a1f56bc --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Input/InputField.cs @@ -0,0 +1,34 @@ +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx.Triggers; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Input +{ + [RequireComponent(typeof(TMP_InputField))] + public class InputField : BaseElement + { + private TMP_InputField _inputField; + + protected override void SetupElement() + { + base.SetupElement(); + _inputField = GetComponent(); + } + + protected override void SetupSelectable() => selectableElement = _inputField; + + protected override void ObserveEvents() + { + _inputField.OnPointerDownAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerDown()); + _inputField.OnPointerUpAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerUp()); + _inputField.OnPointerEnterAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerEnter()); + _inputField.OnPointerExitAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerExit()); + _inputField.OnSelectAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedSelected()); + _inputField.OnDeselectAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedDeselect()); + + if (isSelected) + eventPromoter.ObservedSelected(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Input/InputField.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Input/InputField.cs.meta new file mode 100644 index 00000000..3d48df1e --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Input/InputField.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 72f411f547944b5785ac4a5a56b712ca +timeCreated: 1594367195 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List.meta b/Assets/SharpUI/Source/Common/UI/Elements/List.meta new file mode 100644 index 00000000..105ae4f0 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e95bcc8ffd320fa48944183ab6fc76a4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter.meta new file mode 100644 index 00000000..6fa29aae --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a8f0312e4012422f99875f60ed8398ab +timeCreated: 1585076914 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/DefaultListAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/DefaultListAdapter.cs new file mode 100644 index 00000000..e7d66498 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/DefaultListAdapter.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Elements.List.Holder; +using SharpUI.Source.Common.UI.Factory; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.List.Adapter +{ + public class DefaultListAdapter : ListAdapter + { + [SerializeField] public ListItemFactory itemFactory; + + public void SetItemsAndNotify(List items) + { + SetData(items); + NotifyDataSetChanged(); + } + + protected override ItemHolder CreateListItemHolder() + { + var item = itemFactory.CreateListItemText(); + var holder = new DefaultItemHolder(item); + return holder; + } + + protected override void BindListItemHolder(ItemHolder holder, int position) + { + (holder as DefaultItemHolder)?.BindData(GetData(position)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/DefaultListAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/DefaultListAdapter.cs.meta new file mode 100644 index 00000000..5a4e1630 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/DefaultListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cf6e83a143e345fea1cf1cc05f609e81 +timeCreated: 1585517791 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/IListAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/IListAdapter.cs new file mode 100644 index 00000000..cd5b8e1f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/IListAdapter.cs @@ -0,0 +1,20 @@ +using System; +using SharpUI.Source.Common.UI.Elements.List.Selection; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.List.Adapter +{ + public interface IListAdapter + { + void SetCanClickItems(bool canClick); + void SetCanSelectItems(bool canSelect); + void SetItemsEnabled(bool itemsEnabled); + void ClearAll(); + int DataCount(); + int HoldersCount(); + void RenderTo(int position, Transform containerTransform); + IObservable ObserveDataChange(); + void SetSelectionStrategy(ItemSelectionType type, int amount = 0); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/IListAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/IListAdapter.cs.meta new file mode 100644 index 00000000..5b2ea292 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/IListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 04704270617c424eb20537bbd5e89e39 +timeCreated: 1585140092 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/ListAdapter.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/ListAdapter.cs new file mode 100644 index 00000000..a1d6a4f9 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/ListAdapter.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SharpUI.Source.Common.UI.Elements.List.Holder; +using SharpUI.Source.Common.UI.Elements.List.Selection; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.List.Adapter +{ + public abstract class ListAdapter : MonoBehaviour, IListAdapter where TData : class + { + private readonly Subject _dataSetChangedObserver; + private readonly IItemHolderStateManager _itemHolderStateManager; + private ISelectionStrategy> _selectionStrategy; + private readonly HashSet> _holders = new HashSet>(); + private List _data = new List(); + + protected ListAdapter() + { + _dataSetChangedObserver = new Subject(); + _selectionStrategy = SelectionStrategyFactory + .CreateSelectionStrategy, TData>(ItemSelectionType.None); + _itemHolderStateManager = new ItemHolderStateManager(_holders, _selectionStrategy); + } + + public int DataCount() => _data.Count; + + public int HoldersCount() => _holders.Count; + + protected void SetData(List newData) + { + ClearAll(); + _data = new List(newData); + } + + protected TData GetData(int index) => _data[index]; + + public bool HasSelectedItems() => _selectionStrategy.HasSelections(); + + public void SetCanClickItems(bool canClick) => _itemHolderStateManager.SetCanClickItems(canClick); + + public void SetCanSelectItems(bool canSelect) => _itemHolderStateManager.SetCanSelectItems(canSelect); + + public void SetItemsEnabled(bool itemsEnabled) => _itemHolderStateManager.SetItemsEnabled(itemsEnabled); + + protected void NotifyDataSetChanged() => _dataSetChangedObserver.OnNext(Unit.Default); + + public IObservable ObserveDataChange() => _dataSetChangedObserver; + + private void OnItemClicked(ItemHolder holder) => _selectionStrategy.ItemClicked(holder); + + public ISelectionChangeListener GetSelectionChangeListener() + => _selectionStrategy.GetSelectionChangeListener(); + + public IObservable GetItemHolderStateObserver() => _itemHolderStateManager.GetStateChangeObserver(); + + public List GetSelectedData() + => (from holder in _selectionStrategy.GetSelectedHolders() + select holder.GetData()).ToList(); + + public void RemoveSelected() + { + foreach (var holder in _selectionStrategy.GetSelectedHolders()) + { + DeselectAndDestroy(holder); + DeleteItem(holder); + } + } + + private void DeselectAndDestroy(ItemHolder itemHolder) + { + _selectionStrategy.DeselectItem(itemHolder); + DestroyImmediate(itemHolder.item.gameObject); + } + + private void DeleteItem(ItemHolder itemHolder) + { + _data.Remove(itemHolder.GetData()); + _holders.Remove(itemHolder); + } + + public void ClearAll() + { + foreach (var holder in _holders) + DeselectAndDestroy(holder); + + _selectionStrategy.DeselectAll(); + _data.Clear(); + _holders.Clear(); + } + + public void RenderTo(int position, Transform containerTransform) + { + var holder = CreateListItemHolder(); + holder.item.transform.SetParent(containerTransform); + _itemHolderStateManager.InitItemState(holder.item); + holder.item.GetEventListener().ObserveOnClicked() + .SubscribeWith(this, _ => OnItemClicked(holder)); + BindListItemHolder(holder, position); + _holders.Add(holder); + } + + public void SetSelectionStrategy(ItemSelectionType type, int amount = 0) + { + _selectionStrategy = SelectionStrategyFactory + .CreateSelectionStrategy, TData>(type, amount); + _itemHolderStateManager.OnNewSelectionStrategy(_selectionStrategy); + } + + protected abstract ItemHolder CreateListItemHolder(); + + protected abstract void BindListItemHolder(ItemHolder holder, int position); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/ListAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/ListAdapter.cs.meta new file mode 100644 index 00000000..5664ceee --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Adapter/ListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 38e3f3cfeb72468488ecf674d1d81aa6 +timeCreated: 1585058520 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder.meta new file mode 100644 index 00000000..fdef5fdc --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 77021f2e7e3a436b80aa981223e70409 +timeCreated: 1585077279 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/DefaultItemHolder.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/DefaultItemHolder.cs new file mode 100644 index 00000000..c3211b8a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/DefaultItemHolder.cs @@ -0,0 +1,20 @@ +using SharpUI.Source.Common.UI.Elements.List.ListItem; + +namespace SharpUI.Source.Common.UI.Elements.List.Holder +{ + public class DefaultItemHolder : ItemHolder + { + private readonly ItemText _itemText; + + public DefaultItemHolder(ItemText itemText) : base(itemText) + { + _itemText = itemText; + } + + public override void BindData(string text) + { + base.BindData(text); + _itemText.textTitle.text = text; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/DefaultItemHolder.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/DefaultItemHolder.cs.meta new file mode 100644 index 00000000..57d3f1be --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/DefaultItemHolder.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d78d7e9f132f4afda2c63b31e21ea4c7 +timeCreated: 1585518059 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/IItemHolderStateManager.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/IItemHolderStateManager.cs new file mode 100644 index 00000000..eff1ffb6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/IItemHolderStateManager.cs @@ -0,0 +1,16 @@ +using System; +using SharpUI.Source.Common.UI.Elements.List.Selection; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.List.Holder +{ + public interface IItemHolderStateManager where TData : class + { + void OnNewSelectionStrategy(ISelectionStrategy> selectionStrategy); + void SetCanClickItems(bool canClick); + void SetCanSelectItems(bool canSelect); + void SetItemsEnabled(bool itemsEnabled); + void InitItemState(ListItem.Item item); + IObservable GetStateChangeObserver(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/IItemHolderStateManager.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/IItemHolderStateManager.cs.meta new file mode 100644 index 00000000..bea32a9c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/IItemHolderStateManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1cd164cc111a45c88c94cdda06e6edf9 +timeCreated: 1585651606 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolder.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolder.cs new file mode 100644 index 00000000..f05930bf --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolder.cs @@ -0,0 +1,20 @@ +using SharpUI.Source.Common.UI.Elements.List.ListItem; + +namespace SharpUI.Source.Common.UI.Elements.List.Holder +{ + public class ItemHolder where TData : class + { + public readonly Item item; + + protected TData data; + + public ItemHolder(Item item) + { + this.item = item; + } + + public virtual void BindData(TData itemData) => data = itemData; + + public TData GetData() => data; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolder.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolder.cs.meta new file mode 100644 index 00000000..5a0939e8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolder.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c164ad84c3b5446ea184a0eed6670de7 +timeCreated: 1585077308 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolderStateManager.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolderStateManager.cs new file mode 100644 index 00000000..10a94703 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolderStateManager.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Elements.List.Selection; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.List.Holder +{ + public class ItemHolderStateManager : IItemHolderStateManager where TData : class + { + private readonly Subject _stateChangeObserver = new Subject(); + private readonly IEnumerable> _holders; + private ISelectionStrategy> _selectionStrategy; + private bool _itemsEnabled; + private bool _canClickItems; + private bool _canSelectItems; + + public ItemHolderStateManager(IEnumerable> holders, + ISelectionStrategy> selectionStrategy) + { + _holders = holders; + _selectionStrategy = selectionStrategy; + } + + public void OnNewSelectionStrategy(ISelectionStrategy> selectionStrategy) + => _selectionStrategy = selectionStrategy; + + public IObservable GetStateChangeObserver() => _stateChangeObserver; + + public void SetCanClickItems(bool canClick) + { + _canClickItems = canClick; + foreach (var holder in _holders) + holder.item.SetClickable(_canClickItems); + _stateChangeObserver.OnNext(Unit.Default); + } + + public void SetCanSelectItems(bool canSelect) + { + _canSelectItems = canSelect; + _selectionStrategy.DeselectAll(); + foreach (var holder in _holders) + holder.item.SetSelectable(_canSelectItems); + _stateChangeObserver.OnNext(Unit.Default); + } + + public void SetItemsEnabled(bool itemsEnabled) + { + _itemsEnabled = itemsEnabled; + + if (_itemsEnabled) + EnableItems(); + else + DisableItems(); + _stateChangeObserver.OnNext(Unit.Default); + } + + private void EnableItems() + { + foreach (var holder in _holders) + holder.item.EnableButton(); + _stateChangeObserver.OnNext(Unit.Default); + } + + private void DisableItems() + { + _selectionStrategy.DeselectAll(); + foreach (var holder in _holders) + holder.item.DisableButton(); + _stateChangeObserver.OnNext(Unit.Default); + } + + public void InitItemState(ListItem.Item item) + { + if (_itemsEnabled) + item.EnableButton(); + else + item.DisableButton(); + item.SetClickable(_canClickItems); + item.SetSelectable(_canClickItems && _canSelectItems); + _stateChangeObserver.OnNext(Unit.Default); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolderStateManager.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolderStateManager.cs.meta new file mode 100644 index 00000000..2e24f5cb --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Holder/ItemHolderStateManager.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 525e909cbcea46239a183a9ab23c9ded +timeCreated: 1585650407 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem.meta new file mode 100644 index 00000000..af86ead7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e187c1b9bd5741728b37cffe9b859d2e +timeCreated: 1585034787 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/Item.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/Item.cs new file mode 100644 index 00000000..5c43e1a1 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/Item.cs @@ -0,0 +1,36 @@ +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.Events; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; +using UniRx.Triggers; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.List.ListItem +{ + [RequireComponent(typeof(UnityEngine.UI.Button), typeof(Image))] + public class Item : RectButton + { + protected override void SetupUI() + { + base.SetupUI(); + eventPromoter = new ItemEventPromoter(dispatcher, state, decorators); + } + + protected override void ObserveEvents() + { + button.OnPointerDownAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerDown()); + button.OnPointerUpAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerUp()); + button.OnClickAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedClick()); + button.OnPointerEnterAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerEnter()); + button.OnPointerExitAsObservable().SubscribeWith(this, _ => eventPromoter.ObservedPointerExit()); + + if (isSelected) + eventPromoter.ObservedSelected(); + } + + public void SelectItem() => (eventPromoter as ItemEventPromoter)?.SelectItem(); + + public void DeselectItem() => (eventPromoter as ItemEventPromoter)?.DeselectItem(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/Item.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/Item.cs.meta new file mode 100644 index 00000000..463c2552 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/Item.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b919a28ae56e4e1c8918bca2b0aaf74c +timeCreated: 1585052717 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemDescription.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemDescription.cs new file mode 100644 index 00000000..142b925c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemDescription.cs @@ -0,0 +1,12 @@ +using TMPro; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.List.ListItem +{ + [RequireComponent(typeof(Item))] + public class ItemDescription : Item + { + [SerializeField] public TMP_Text textTitle; + [SerializeField] public TMP_Text textDescription; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemDescription.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemDescription.cs.meta new file mode 100644 index 00000000..5cbdfd38 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemDescription.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9d6f2ad1c64045579f3090671a12287c +timeCreated: 1585034851 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemImage.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemImage.cs new file mode 100644 index 00000000..bc550635 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemImage.cs @@ -0,0 +1,15 @@ +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.List.ListItem +{ + [RequireComponent(typeof(Item))] + public class ItemImage : Item + { + [SerializeField] public TMP_Text textTitle; + [SerializeField] public TMP_Text textDescription; + [SerializeField] public Image iconBackground; + [SerializeField] public Image imageIcon; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemImage.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemImage.cs.meta new file mode 100644 index 00000000..660e93cd --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemImage.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 437c55041a984d6da166ebc4dea55efa +timeCreated: 1585034842 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemText.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemText.cs new file mode 100644 index 00000000..4dd9d59f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemText.cs @@ -0,0 +1,11 @@ +using TMPro; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.List.ListItem +{ + [RequireComponent(typeof(Item))] + public class ItemText : Item + { + [SerializeField] public TMP_Text textTitle; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemText.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemText.cs.meta new file mode 100644 index 00000000..7be53662 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListItem/ItemText.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1e84099ddb2c40658de7254f8d1a6d2f +timeCreated: 1585034826 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListView.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/ListView.cs new file mode 100644 index 00000000..359c3041 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListView.cs @@ -0,0 +1,76 @@ +using SharpUI.Source.Common.UI.Elements.List.Adapter; +using SharpUI.Source.Common.UI.Elements.List.Selection; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.List +{ + [RequireComponent(typeof(IListAdapter))] + public class ListView : MonoBehaviour + { + [SerializeField] public GameObject container; + [SerializeField] public bool enableItems; + [SerializeField] public bool canClickItems; + [SerializeField] public bool canSelectItems; + [SerializeField] public ItemSelectionType selectionType; + [SerializeField] public int selectionAmount; + + private IListAdapter _adapter; + + public void Awake() + { + if (GetComponent() != null) + _adapter = GetComponent(); + + SetInteraction(); + SetSelectionStrategy(); + ObserveDataChange(); + } + + public void SetAdapter(IListAdapter adapter) + { + _adapter = adapter; + } + + public void SetItemsEnabled(bool itemsEnabled) + { + enableItems = itemsEnabled; + _adapter.SetItemsEnabled(itemsEnabled); + } + + public void SetItemsClickable(bool clickable) + { + canClickItems = clickable; + _adapter.SetCanClickItems(clickable); + } + + public void SetItemsSelectable(bool selectable) + { + canSelectItems = selectable; + _adapter.SetCanSelectItems(selectable); + } + + private void SetInteraction() + { + _adapter.SetCanClickItems(canClickItems); + _adapter.SetCanSelectItems(canSelectItems); + _adapter.SetItemsEnabled(enableItems); + } + + private void SetSelectionStrategy() + { + _adapter.SetSelectionStrategy(selectionType, selectionAmount); + } + + private void ObserveDataChange() + { + _adapter.ObserveDataChange().SubscribeWith(this, _ => RenderItems()); + } + + private void RenderItems() + { + for (var i = 0; i < _adapter.DataCount(); i++) + _adapter.RenderTo(i, container.transform); + } + } +} diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/ListView.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/ListView.cs.meta new file mode 100644 index 00000000..afc87d2a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/ListView.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c8a3437e8aaf7b44bc0d1e62b7de955 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection.meta new file mode 100644 index 00000000..057a24b8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 02c3d44cc68f4b26ba37bb0457b22f68 +timeCreated: 1585146403 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionChangeListener.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionChangeListener.cs new file mode 100644 index 00000000..79a0917a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionChangeListener.cs @@ -0,0 +1,12 @@ +using System; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public interface ISelectionChangeListener where TData: class + { + IObservable ObserveItemSelected(); + IObservable ObserveItemDeselected(); + IObservable ObserveSelectionChange(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionChangeListener.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionChangeListener.cs.meta new file mode 100644 index 00000000..2cb4b7ab --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionChangeListener.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 043d9fe3d18244a38cf17f2ccf118e96 +timeCreated: 1585554710 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionStrategy.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionStrategy.cs new file mode 100644 index 00000000..5805cac6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionStrategy.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public interface ISelectionStrategy + { + ItemSelectionType GetSelectionType(); + int GetMaxAmount(); + void DeselectAll(); + void DeselectItem(THolder holder); + void ItemClicked(THolder holder); + bool HasSelections(); + ISelectionChangeListener GetSelectionChangeListener() where TData : class; + IReadOnlyCollection GetSelectedHolders(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionStrategy.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionStrategy.cs.meta new file mode 100644 index 00000000..007d0381 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ISelectionStrategy.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c0ccff3708aa4574b30137dd4bf30d1f +timeCreated: 1585146417 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ItemSelectionType.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ItemSelectionType.cs new file mode 100644 index 00000000..54b89ab8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ItemSelectionType.cs @@ -0,0 +1,10 @@ +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public enum ItemSelectionType : ushort + { + None = 1, + Single = 2, + Limited = 3, + All = 4 + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ItemSelectionType.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ItemSelectionType.cs.meta new file mode 100644 index 00000000..129730cb --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/ItemSelectionType.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 54ebe45b7ce244d0806856b9bc077029 +timeCreated: 1585146453 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionChangeListener.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionChangeListener.cs new file mode 100644 index 00000000..69254f39 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionChangeListener.cs @@ -0,0 +1,29 @@ +using System; +using JetBrains.Annotations; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public class SelectionChangeListener : ISelectionChangeListener + where TData : class + { + [CanBeNull] private Subject _itemSelectedObserver; + [CanBeNull] private Subject _itemDeselectedObserver; + [CanBeNull] private Subject _selectionChangeObserver; + + public void OnItemSelected(TData item) => _itemSelectedObserver?.OnNext(item); + + public void OnItemDeselected(TData item) => _itemDeselectedObserver?.OnNext(item); + + public void OnSelectionChanged() => _selectionChangeObserver?.OnNext(Unit.Default); + + public IObservable ObserveItemSelected() + => _itemSelectedObserver ?? (_itemSelectedObserver = new Subject()); + + public IObservable ObserveItemDeselected() + => _itemDeselectedObserver ?? (_itemDeselectedObserver = new Subject()); + + public IObservable ObserveSelectionChange() + => _selectionChangeObserver ?? (_selectionChangeObserver = new Subject()); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionChangeListener.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionChangeListener.cs.meta new file mode 100644 index 00000000..c04d2080 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionChangeListener.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 75a55fe5693343d3b3b52aaed5aac980 +timeCreated: 1585551404 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategy.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategy.cs new file mode 100644 index 00000000..dc0bffdf --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategy.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using SharpUI.Source.Common.UI.Elements.List.Holder; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public abstract class SelectionStrategy : ISelectionStrategy + where THolder : ItemHolder + where TData : class + { + private readonly ItemSelectionType _type; + private readonly int _maxAmount; + private readonly HashSet _selectedHolders = new HashSet(); + private readonly SelectionChangeListener _selectionChangeListener; + + protected SelectionStrategy(ItemSelectionType type = ItemSelectionType.None, int amount = 0) + { + _type = type; + _maxAmount = amount; + _selectionChangeListener = new SelectionChangeListener(); + } + + protected bool CanSelect() => _selectedHolders.Count < _maxAmount; + + public ItemSelectionType GetSelectionType() => _type; + + public int GetMaxAmount() => _maxAmount; + + public abstract void ItemClicked(THolder holder); + public bool HasSelections() => _selectedHolders.Count > 0; + + public ISelectionChangeListener GetSelectionChangeListener() where T : class + => (ISelectionChangeListener) _selectionChangeListener; + + protected void SelectItem(THolder holder) + { + _selectedHolders.Add(holder); + holder.item.SelectItem(); + _selectionChangeListener.OnItemSelected(holder.GetData()); + _selectionChangeListener.OnSelectionChanged(); + } + + public void DeselectItem(THolder holder) + { + _selectedHolders.Remove(holder); + holder.item.DeselectItem(); + _selectionChangeListener.OnItemDeselected(holder.GetData()); + _selectionChangeListener.OnSelectionChanged(); + } + + public void DeselectAll() + { + foreach (var holder in _selectedHolders) + { + holder.item.DeselectItem(); + _selectionChangeListener.OnItemDeselected(holder.GetData()); + } + + _selectedHolders.Clear(); + _selectionChangeListener.OnSelectionChanged(); + } + + protected bool IsSelected(THolder holder) => _selectedHolders.Contains(holder); + + public IReadOnlyCollection GetSelectedHolders() + { + return new ReadOnlyCollection(_selectedHolders.ToArray()); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategy.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategy.cs.meta new file mode 100644 index 00000000..9fe2dab8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategy.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 74df89f7a41b4c59b9d19f4bf5909337 +timeCreated: 1585146491 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyAll.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyAll.cs new file mode 100644 index 00000000..999f5c7a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyAll.cs @@ -0,0 +1,25 @@ +using SharpUI.Source.Common.UI.Elements.List.Holder; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public class SelectionStrategyAll : SelectionStrategy + where THolder : ItemHolder + where TData : class + { + public SelectionStrategyAll() : base(ItemSelectionType.All, int.MaxValue) + { + } + + public override void ItemClicked(THolder item) + { + if (IsSelected(item)) + { + DeselectItem(item); + } + else + { + SelectItem(item); + } + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyAll.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyAll.cs.meta new file mode 100644 index 00000000..f6b3b53a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyAll.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6deec80fc1c54435a8e4ddb1f8a1ed85 +timeCreated: 1585159630 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyFactory.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyFactory.cs new file mode 100644 index 00000000..1ec2b7a3 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyFactory.cs @@ -0,0 +1,43 @@ +using SharpUI.Source.Common.UI.Elements.List.Holder; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public static class SelectionStrategyFactory + { + public static ISelectionStrategy CreateSelectionStrategy( + ItemSelectionType type, int amount = 0) + where THolder : ItemHolder + where TData : class + { + switch (type) + { + case ItemSelectionType.None: return CreateNoSelectionStrategy(); + case ItemSelectionType.Single: return CreateSingleSelectionStrategy(); + case ItemSelectionType.Limited: return CreateLimitedSelectionStrategy(amount); + case ItemSelectionType.All: return CreateAllSelectionStrategy(); + default: + throw new UnknownSelectionStrategyException($"Unknown selection strategy with type {type}!"); + } + } + + private static SelectionStrategyNone CreateNoSelectionStrategy() + where THolder : ItemHolder + where TData : class + => new SelectionStrategyNone(); + + private static SelectionStrategySingle CreateSingleSelectionStrategy() + where THolder : ItemHolder + where TData : class + => new SelectionStrategySingle(); + + private static SelectionStrategyLimited CreateLimitedSelectionStrategy(int amount) + where THolder : ItemHolder + where TData : class + => new SelectionStrategyLimited(amount); + + private static SelectionStrategyAll CreateAllSelectionStrategy() + where THolder : ItemHolder + where TData : class + => new SelectionStrategyAll(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyFactory.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyFactory.cs.meta new file mode 100644 index 00000000..faaf43ce --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyFactory.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 026a3a8763e742468d9df82b567d0b5a +timeCreated: 1585162509 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyLimited.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyLimited.cs new file mode 100644 index 00000000..79b51ed2 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyLimited.cs @@ -0,0 +1,26 @@ +using SharpUI.Source.Common.UI.Elements.List.Holder; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public class SelectionStrategyLimited : SelectionStrategy + where THolder : ItemHolder + where TData : class + { + public SelectionStrategyLimited(int amount) : base(ItemSelectionType.Limited, amount) + { + } + + public override void ItemClicked(THolder item) + { + if (IsSelected(item)) + { + DeselectItem(item); + } + else + { + if (CanSelect()) + SelectItem(item); + } + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyLimited.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyLimited.cs.meta new file mode 100644 index 00000000..1b8f507e --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyLimited.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1387dbf1b9904c5ab5c5fa97edc5d1b7 +timeCreated: 1585159620 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyNone.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyNone.cs new file mode 100644 index 00000000..1cb74bd0 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyNone.cs @@ -0,0 +1,14 @@ +using SharpUI.Source.Common.UI.Elements.List.Holder; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public class SelectionStrategyNone : SelectionStrategy + where THolder : ItemHolder + where TData : class + { + public override void ItemClicked(THolder item) + { + // Don't select any items! + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyNone.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyNone.cs.meta new file mode 100644 index 00000000..133c944d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategyNone.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1e8f8592b9b44e71bcee19ec423afaa8 +timeCreated: 1585159593 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategySingle.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategySingle.cs new file mode 100644 index 00000000..635c665e --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategySingle.cs @@ -0,0 +1,19 @@ +using SharpUI.Source.Common.UI.Elements.List.Holder; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public class SelectionStrategySingle : SelectionStrategy + where THolder : ItemHolder + where TData : class + { + public SelectionStrategySingle() : base(ItemSelectionType.Single, 1) + { + } + + public override void ItemClicked(THolder item) + { + DeselectAll(); + SelectItem(item); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategySingle.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategySingle.cs.meta new file mode 100644 index 00000000..c011c552 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/SelectionStrategySingle.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 09a421431a2e431ab6bf3c16ca319488 +timeCreated: 1585159603 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/UnknownSelectionStrategyException.cs b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/UnknownSelectionStrategyException.cs new file mode 100644 index 00000000..0545449a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/UnknownSelectionStrategyException.cs @@ -0,0 +1,9 @@ +using System; + +namespace SharpUI.Source.Common.UI.Elements.List.Selection +{ + public class UnknownSelectionStrategyException : Exception + { + public UnknownSelectionStrategyException(string message = "") : base(message) { } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/UnknownSelectionStrategyException.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/UnknownSelectionStrategyException.cs.meta new file mode 100644 index 00000000..b64ba148 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/List/Selection/UnknownSelectionStrategyException.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8e2fc36727d54a639b2a80456221aaa9 +timeCreated: 1585810161 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Loading.meta b/Assets/SharpUI/Source/Common/UI/Elements/Loading.meta new file mode 100644 index 00000000..9a029056 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Loading.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 43ba0e82419c473081905602d32f1e88 +timeCreated: 1597836247 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Loading/LoadingBar.cs b/Assets/SharpUI/Source/Common/UI/Elements/Loading/LoadingBar.cs new file mode 100644 index 00000000..5508bbbe --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Loading/LoadingBar.cs @@ -0,0 +1,29 @@ +using System; +using SharpUI.Source.Common.UI.Elements.Progress; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Loading +{ + public class LoadingBar : ProgressBar + { + private const float PivotOffset = 8.0f; + [SerializeField] public Image pivotImage; + + public override void UpdatePercentage(float percentAmount) + { + base.UpdatePercentage(percentAmount); + SetPivotPosition(); + } + + private void SetPivotPosition() + { + var position = pivotImage.GetComponent().anchoredPosition; + var barWidth = barImage.GetComponent().rect.width; + var newWidth = util.ToDecimalPercentage(percentage) * barWidth; + position.x = Math.Min(newWidth, barWidth - PivotOffset); + position.x = Math.Max(PivotOffset, position.x); + pivotImage.GetComponent().anchoredPosition = position; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Loading/LoadingBar.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Loading/LoadingBar.cs.meta new file mode 100644 index 00000000..cff61baa --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Loading/LoadingBar.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 401a1256649342f8aca499223167a07f +timeCreated: 1597836261 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ModalViews.meta b/Assets/SharpUI/Source/Common/UI/Elements/ModalViews.meta new file mode 100644 index 00000000..2253224b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ModalViews.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0ca4e95b73374fae99783a490ebafe74 +timeCreated: 1599768512 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ModalViews/ModalView.cs b/Assets/SharpUI/Source/Common/UI/Elements/ModalViews/ModalView.cs new file mode 100644 index 00000000..8e09d4f6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ModalViews/ModalView.cs @@ -0,0 +1,92 @@ +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.Drag; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.ModalViews +{ + public class ModalView : Draggable + { + [SerializeField] public IconButton closeButton; + [SerializeField] public IconButton collapseButton; + [SerializeField] public RectTransform headerRectTransform; + [SerializeField] public RectTransform contentRectTransform; + [SerializeField] public RectTransform backgroundRectTransform; + [SerializeField] public bool isCollapsed; + [SerializeField] public bool isDraggable; + [SerializeField] public bool showBackground; + + private bool _isCollapsed; + + public void Start() + { + SetUp(); + InitCollapse(); + InitDrag(); + } + + private void InitCollapse() + { + _isCollapsed = isCollapsed; + SetCollapse(); + } + + private void SetUp() + { + if (closeButton.gameObject.activeSelf) + closeButton.GetEventListener().ObserveOnClicked().SubscribeWith(this, + _ => CloseModalView()); + + if (collapseButton.gameObject.activeSelf) + collapseButton.GetEventListener().ObserveOnClicked().SubscribeWith(this, + _ => ToggleCollapse()); + + backgroundRectTransform.gameObject.SetActive(showBackground); + } + + private void InitDrag() + { + if (!isDraggable) return; + + SetDragGameObjects(headerRectTransform.gameObject, gameObject); + } + + private void CloseModalView() + { + DestroyImmediate(gameObject); + } + + private void ToggleCollapse() + { + _isCollapsed = !_isCollapsed; + SetCollapse(); + } + + private void SetCollapse() + { + if (_isCollapsed) + Collapse(); + else + Expand(); + } + + private void Collapse() + { + contentRectTransform.gameObject.SetActive(false); + backgroundRectTransform.gameObject.SetActive(false); + var angles = collapseButton.iconImage.GetComponent().eulerAngles; + angles.z = 90; + collapseButton.iconImage.GetComponent().eulerAngles = angles; + + } + + private void Expand() + { + contentRectTransform.gameObject.SetActive(true); + backgroundRectTransform.gameObject.SetActive(showBackground); + var angles = collapseButton.iconImage.GetComponent().eulerAngles; + angles.z = -90; + collapseButton.iconImage.GetComponent().eulerAngles = angles; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/ModalViews/ModalView.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/ModalViews/ModalView.cs.meta new file mode 100644 index 00000000..3d8265eb --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/ModalViews/ModalView.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 99be0233461e4b8fb16ae5ccb8ef0bd4 +timeCreated: 1599768530 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Notifications.meta b/Assets/SharpUI/Source/Common/UI/Elements/Notifications.meta new file mode 100644 index 00000000..4849914c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Notifications.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cac214d4e89345e59a4d9dddfebfbfb9 +timeCreated: 1598814319 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Notifications/Notification.cs b/Assets/SharpUI/Source/Common/UI/Elements/Notifications/Notification.cs new file mode 100644 index 00000000..0f4da96c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Notifications/Notification.cs @@ -0,0 +1,86 @@ +using System; +using SharpUI.Source.Common.UI.Util.Animation; +using TMPro; +using UniRx; +using UnityEngine; +using UnityEngine.EventSystems; + +namespace SharpUI.Source.Common.UI.Elements.Notifications +{ + public class Notification : MonoBehaviour, IPointerClickHandler + { + [SerializeField] public TMP_Text textTitle; + [SerializeField] public TMP_Text textSubtitle; + [SerializeField] public bool autoFadeout; + [SerializeField] public bool hideOnStart; + [SerializeField] public bool closeWhenClicked; + [SerializeField] public long hideDelayMillis; + + private Subject _onPointerClickObserver; + private ICanvasGroupAnimator _animator = new CanvasGroupAnimator(); + + public void Awake() + { + InitAnimator(); + InitFadeOut(); + InitVisibility(); + } + + public void OnDestroy() + { + _animator.DropCanvasGroup(); + } + + public IObservable ObserveOnClick() + => _onPointerClickObserver ?? (_onPointerClickObserver = new Subject()); + + public void SetCanvasGroupAnimator(ICanvasGroupAnimator animator) => _animator = animator; + + private void InitAnimator() + { + var canvasGroup = GetComponent(); + _animator.TakeCanvasGroup(canvasGroup); + _animator.SetHideDelayMillis(hideDelayMillis); + } + + private void InitFadeOut() + { + if (autoFadeout && !hideOnStart && _animator.IsCanvasGroupVisible()) + _animator.FadeOut(); + } + + private void InitVisibility() + { + if (hideOnStart) + Hide(); + else + Show(); + } + + public void SetTitle(string title) => textTitle.text = title; + + public void SetSubtitle(string subtitle) => textSubtitle.text = subtitle; + + public void Show() => _animator.ShowCanvasGroup(); + + public void Hide() => _animator.HideCanvasGroup(); + + public void ShowAnimated() => _animator.FadeIn(); + + public void HideAnimated() => _animator.FadeOut(); + + private void Close() + { + _animator.DropCanvasGroup(); + DestroyImmediate(gameObject); + } + + public void OnPointerClick(PointerEventData eventData) + { + _onPointerClickObserver?.OnNext(Unit.Default); + + if (closeWhenClicked) + Close(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Notifications/Notification.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Notifications/Notification.cs.meta new file mode 100644 index 00000000..42503d7f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Notifications/Notification.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 91c3699c12184711937c7f16c88334f0 +timeCreated: 1598814345 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Progress.meta b/Assets/SharpUI/Source/Common/UI/Elements/Progress.meta new file mode 100644 index 00000000..9c07d099 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Progress.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a98088911a15463782bd87e1ef6f8175 +timeCreated: 1599484187 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Progress/ProgressBar.cs b/Assets/SharpUI/Source/Common/UI/Elements/Progress/ProgressBar.cs new file mode 100644 index 00000000..3cb9591b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Progress/ProgressBar.cs @@ -0,0 +1,56 @@ +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Util; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Progress +{ + public class ProgressBar : MonoBehaviour + { + public const string DefaultBarTextFormat = "{0:0.00} %"; + public const float DefaultPercentage = 0.0f; + + [SerializeField] public Image backgroundImage; + [SerializeField] public Image barImage; + [SerializeField,CanBeNull] public TMP_Text barText; + + protected readonly IUiUtil util = new UiUtil(); + protected float percentage; + + public virtual void Start() + { + percentage = DefaultPercentage; + UpdatePercentage(percentage); + } + + public virtual void UpdatePercentage(float percentAmount) + { + if (!util.PercentInRange(percentAmount)) + return; + + percentage = percentAmount; + SetBarFill(); + SetTextPercentage(); + } + + public float GetPercentage() => percentage; + + public void SetBarText(string text) + { + if (!(barText is null)) + barText.text = text; + } + + private void SetBarFill() + { + barImage.fillAmount = util.ToDecimalPercentage(percentage); + } + + private void SetTextPercentage() + { + if (!(barText is null)) + barText.text = string.Format(DefaultBarTextFormat, percentage); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Progress/ProgressBar.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Progress/ProgressBar.cs.meta new file mode 100644 index 00000000..a42dbff7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Progress/ProgressBar.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e2329df688044318967a969c0d05b772 +timeCreated: 1599484198 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillBars.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillBars.meta new file mode 100644 index 00000000..38e3de37 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillBars.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fa301ed5f23f4ec4a9d790faa4d2df30 +timeCreated: 1599818767 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillBars/SkillBar.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillBars/SkillBar.cs new file mode 100644 index 00000000..5c4474a1 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillBars/SkillBar.cs @@ -0,0 +1,182 @@ +using System; +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Util.TimeUtils; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.SkillBars +{ + public class SkillBar : MonoBehaviour + { + public enum CooldownConsumeType { Fill, Drain } + + private const float SkillBarMargin = 2f; + private const string DefaultBarTextFormat = "{0:0.0} sec"; + + [SerializeField] public Image skillBarImage; + [SerializeField] public Image skillIconImage; + [SerializeField] public TMP_Text skillNameText; + [SerializeField] public TMP_Text skillRemainingCooldownText; + [SerializeField] public float skillCooldown; + [SerializeField] public float skillCooldownRemaining; + [SerializeField] public string skillName; + [SerializeField] public CooldownConsumeType consumeType = CooldownConsumeType.Fill; + [SerializeField] public bool depleteWhenCompleted; + + [CanBeNull] private Subject _castFinishedObserver = new Subject(); + private float _cooldownRemaining; + private float _cooldown; + private bool _isFinished; + private bool _isCoolingDown; + private RectTransform _rectTransform; + private RectTransform _skillBarImageTransform; + private ITimeProvider _timeProvider = new TimeProvider(); + [CanBeNull] private ManagedUiUpdate _managedUiUpdate; + + public void Start() + { + InitUiUpdater(); + InitDefaultValues(); + UpdateProgress(0); + } + + public void OnDestroy() + { + _managedUiUpdate?.StopUiUpdates(); + } + + public void Cancel() + { + Deplete(); + } + + public void SetTimeProvider(ITimeProvider timeProvider) => _timeProvider = timeProvider; + + public void StartCooldown() + { + _isCoolingDown = true; + } + + public void RestartCooldown() + { + InitDefaultValues(); + StartCooldown(); + } + + private void InitUiUpdater() + { + _managedUiUpdate = new ManagedUiUpdate(); + _managedUiUpdate.ObserveUiUpdate().SubscribeWith(this, UpdateProgress); + } + + private void InitDefaultValues() + { + if (!IsValidSetup()) return; + + _isFinished = false; + _cooldown = skillCooldown; + _cooldownRemaining = skillCooldownRemaining; + skillNameText.text = skillName; + _rectTransform = GetComponent(); + _skillBarImageTransform = skillBarImage.GetComponent(); + InitConsumeType(); + SetRemainingCooldownText(); + } + + public void Update() + { + if (!_isCoolingDown) return; + + var deltaTime = _timeProvider.GetDeltaTime(); + _cooldownRemaining = Math.Max(0, _cooldownRemaining - deltaTime); + _managedUiUpdate?.ConsumeDeltaTime(deltaTime); + } + + public IObservable ObserveCooldownFinished() => _castFinishedObserver; + + public bool IsFinished() => _isFinished; + + public bool IsUpdatingUi() => _managedUiUpdate != null && !_managedUiUpdate.IsDepleted(); + + private void InitConsumeType() + { + var scale = consumeType == CooldownConsumeType.Drain ? -1 : 1; + skillBarImage.GetComponent().localScale = new Vector3(scale, scale, 1); + } + + private bool IsValidSetup() + { + return skillCooldownRemaining > skillCooldown + ? throw new OverflowException("Remaining cooldown should not be larger than cooldown.") + : true; + } + + public void UpdateProgress(float elapsedTime) + { + CheckStatus(); + + if (_isFinished || !_isCoolingDown) return; + + SetRemainingCooldownText(); + SetBarLength(); + } + + private void CheckStatus() + { + if (_cooldownRemaining <= 0 && !_isFinished) + SkillFinished(); + } + + private void SkillFinished() + { + _isFinished = true; + _isCoolingDown = false; + _castFinishedObserver?.OnNext(Unit.Default); + + if (depleteWhenCompleted) + Deplete(); + } + + private void Deplete() + { + _castFinishedObserver = null; + DestroyImmediate(gameObject); + } + + private void SetRemainingCooldownText() + { + skillRemainingCooldownText.text = string.Format(DefaultBarTextFormat, _cooldownRemaining); + } + + private void SetBarLength() + { + if (consumeType == CooldownConsumeType.Fill) + FillBar(); + else + DrainBar(); + } + + private void FillBar() + { + var progressPercentage = CurrentPercentage(); + var barProgressWidth = GetBarWidth() * progressPercentage; + _skillBarImageTransform + .SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, SkillBarMargin, barProgressWidth); + } + + private void DrainBar() + { + var progressPercentage = 1f - CurrentPercentage(); + var barProgressWidth = GetBarWidth() * progressPercentage; + _skillBarImageTransform + .SetInsetAndSizeFromParentEdge(RectTransform.Edge.Right, SkillBarMargin, barProgressWidth); + } + + private float CurrentPercentage() => (_cooldown - _cooldownRemaining) / _cooldown; + + private float GetBarWidth() => _rectTransform.rect.size.x - SkillBarMargin * 2; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillBars/SkillBar.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillBars/SkillBar.cs.meta new file mode 100644 index 00000000..ca926be8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillBars/SkillBar.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7b66ed70cbe84f44803672cfad57e77c +timeCreated: 1599818788 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees.meta new file mode 100644 index 00000000..28c57b74 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 104db8cee6d54d54af6743e7ea6e89c3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillAmountLimit.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillAmountLimit.cs new file mode 100644 index 00000000..69f64b3b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillAmountLimit.cs @@ -0,0 +1,14 @@ +using System; +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.SkillTrees +{ + public interface ISkillAmountLimit + { + void UpdateSpent(int spent); + bool CanSpend(); + bool CanTakeBack(); + int GetAvailable(); + IObservable ObserveAmountChanged(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillAmountLimit.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillAmountLimit.cs.meta new file mode 100644 index 00000000..8a4a2dda --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillAmountLimit.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4466898abf73407b95211905d5b70ae0 +timeCreated: 1600333435 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillLevel.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillLevel.cs new file mode 100644 index 00000000..369bd0b7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillLevel.cs @@ -0,0 +1,19 @@ +using UniRx; + +namespace SharpUI.Source.Common.UI.Elements.SkillTrees +{ + public interface ISkillLevel + { + void SetMaxLevel(int value); + void SetCurrentLevel(int value); + void IncrementLevel(); + void DecrementLevel(); + int GetCurrentLevel(); + int GetMaxLevel(); + bool HaveLevels(); + bool IsFullLevels(); + bool IsEmptyLevels(); + Subject ObserveMaxLevelChanged(); + Subject ObserveCurrentLevelChanged(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillLevel.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillLevel.cs.meta new file mode 100644 index 00000000..559e0318 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillLevel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 76cb320548a94df78fe5cd19543f5f05 +timeCreated: 1599562554 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillProgressLine.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillProgressLine.cs new file mode 100644 index 00000000..0c0d4c95 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillProgressLine.cs @@ -0,0 +1,9 @@ +namespace SharpUI.Source.Common.UI.Elements.SkillTrees +{ + public interface ISkillProgressLine + { + void OnSkillAmountChanged(int amount); + int GetUnlockAtSkillAmount(); + int GetTotalAmount(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillProgressLine.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillProgressLine.cs.meta new file mode 100644 index 00000000..ca610900 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/ISkillProgressLine.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1a42e9b3c8c747fd97035936bd3ee7f6 +timeCreated: 1599565146 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillAmountLimit.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillAmountLimit.cs new file mode 100644 index 00000000..81930ffe --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillAmountLimit.cs @@ -0,0 +1,55 @@ +using System; +using TMPro; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.SkillTrees +{ + public class SkillAmountLimit : MonoBehaviour, ISkillAmountLimit + { + [SerializeField] public int totalAvailable; + [SerializeField] public int totalSpent; + [SerializeField] public TMP_Text availableText; + [SerializeField] public TMP_Text spentText; + + private readonly Subject _amountChangedObserver = new Subject(); + private int _totalAvailable; + private int _available; + private int _spent; + + public void Awake() + { + _totalAvailable = totalAvailable; + _spent = totalSpent; + _available = _totalAvailable - _spent; + Render(); + } + + public void UpdateSpent(int spent) + { + if (!AreValidAmounts()) + return; + + _spent = spent; + _available = _totalAvailable - _spent; + _amountChangedObserver.OnNext(Unit.Default); + Render(); + } + + private bool AreValidAmounts() => _spent <= _totalAvailable; + + public bool CanSpend() => _available > 0; + + public bool CanTakeBack() => _spent > 0; + + public int GetAvailable() => _available; + + public IObservable ObserveAmountChanged() => _amountChangedObserver; + + private void Render() + { + availableText.text = _available.ToString(); + spentText.text = _spent.ToString(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillAmountLimit.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillAmountLimit.cs.meta new file mode 100644 index 00000000..d0353494 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillAmountLimit.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1e826a7d6b0a416fbe96061f631e78d9 +timeCreated: 1599638949 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillArrowLine.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillArrowLine.cs new file mode 100644 index 00000000..461db537 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillArrowLine.cs @@ -0,0 +1,52 @@ +using SharpUI.Source.Common.UI.Elements.Progress; +using SharpUI.Source.Common.UI.Elements.Toggle; +using SharpUI.Source.Common.UI.Util; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.SkillTrees +{ + public class SkillArrowLine : MonoBehaviour + { + [SerializeField] public ProgressBar progressBar; + [SerializeField] public Image triangleImage; + [SerializeField] public ToggleButton nodeOwner; + [SerializeField] public Color activeColor; + [SerializeField] public Color disabledColor; + + public void Start() + { + InitDefaults(); + ObserveToggleNodeChanges(); + Deactivate(); + } + + private void ObserveToggleNodeChanges() + { + nodeOwner.ObserveToggleStateChange().SubscribeWith(this, active => + { + if (active) Activate(); + else Deactivate(); + }); + } + + private void InitDefaults() + { + progressBar.backgroundImage.color = disabledColor; + progressBar.barImage.color = activeColor; + } + + private void Activate() + { + progressBar.UpdatePercentage(UiUtil.Percent100); + triangleImage.color = activeColor; + } + + private void Deactivate() + { + progressBar.UpdatePercentage(UiUtil.Percent0); + triangleImage.color = disabledColor; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillArrowLine.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillArrowLine.cs.meta new file mode 100644 index 00000000..17bb0e44 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillArrowLine.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 84c90f93ab7043dfb1acd10ddcd077cb +timeCreated: 1599601175 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillLevel.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillLevel.cs new file mode 100644 index 00000000..e575545a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillLevel.cs @@ -0,0 +1,90 @@ +using TMPro; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.SkillTrees +{ + public class SkillLevel : MonoBehaviour, ISkillLevel + { + public const int DefaultMaxLevel = 1; + public const int DefaultCurrentLevel = 0; + + [SerializeField] public TMP_Text levelMaxText; + [SerializeField] public TMP_Text currentLevelText; + [SerializeField] public int initialMaxLevel = -1; + [SerializeField] public int initialCurrentLevel = -1; + [SerializeField] public Color activeTextColor; + [SerializeField] public Color disabledTextColor; + + private readonly Subject _currentLevelChangeObserver = new Subject(); + private readonly Subject _maxLevelChangeObserver = new Subject(); + private int _currentLevel; + private int _maxLevel; + + public void Awake() + { + InitValues(); + } + + private void InitValues() + { + var maxLevel = initialMaxLevel >= 0 ? initialMaxLevel : DefaultMaxLevel; + var currentLevel = initialCurrentLevel >= 0 ? initialCurrentLevel : DefaultCurrentLevel; + SetMaxLevel(maxLevel); + SetCurrentLevel(currentLevel); + } + + public void SetMaxLevel(int value) + { + _maxLevel = value; + + if (_maxLevel < _currentLevel) + SetCurrentLevel(_maxLevel); + + levelMaxText.text = _maxLevel.ToString(); + _maxLevelChangeObserver.OnNext(Unit.Default); + } + + public void SetCurrentLevel(int value) + { + if (value < 0 || value > _maxLevel) return; + + _currentLevel = value; + currentLevelText.text = _currentLevel.ToString(); + _currentLevelChangeObserver.OnNext(Unit.Default); + SetColors(); + } + + private void SetColors() + { + if (IsEmptyLevels()) + { + currentLevelText.color = disabledTextColor; + levelMaxText.color = disabledTextColor; + } + else + { + currentLevelText.color = activeTextColor; + levelMaxText.color = activeTextColor; + } + } + + public void IncrementLevel() => SetCurrentLevel(_currentLevel + 1); + + public void DecrementLevel() => SetCurrentLevel(_currentLevel - 1); + + public int GetCurrentLevel() => _currentLevel; + + public int GetMaxLevel() => _maxLevel; + + public bool HaveLevels() => _currentLevel > 0; + + public bool IsFullLevels() => _currentLevel == _maxLevel; + + public bool IsEmptyLevels() => _currentLevel == 0; + + public Subject ObserveMaxLevelChanged() => _maxLevelChangeObserver; + + public Subject ObserveCurrentLevelChanged() => _currentLevelChangeObserver; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillLevel.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillLevel.cs.meta new file mode 100644 index 00000000..d92b8cea --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillLevel.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3b479eb38991469eb4b1a1925045b6e5 +timeCreated: 1599560835 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillProgressLine.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillProgressLine.cs new file mode 100644 index 00000000..da4be819 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillProgressLine.cs @@ -0,0 +1,73 @@ +using System; +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Elements.Progress; +using SharpUI.Source.Common.UI.Elements.Toggle; +using SharpUI.Source.Common.UI.Util; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.SkillTrees +{ + public class SkillProgressLine : ProgressBar, ISkillProgressLine + { + [SerializeField,CanBeNull] public SkillProgressLine parent; + [SerializeField] public ToggleButton checkPointToggle; + [SerializeField] public int requiredLevelsAmount; + + private readonly IUiUtil _uiUtil = new UiUtil(); + private int _unlockAtSkillAmount; + private int _totalAmount; + + public override void Start() + { + base.Start(); + CalculateUnlockAmount(); + OnSkillAmountChanged(0); + } + + public int GetUnlockAtSkillAmount() => _unlockAtSkillAmount; + + public int GetTotalAmount() => _totalAmount; + + public void OnSkillAmountChanged(int totalAmount) + { + _totalAmount = totalAmount; + var percentageAmount = GetPercentageFromAmount(); + UpdatePercentage(percentageAmount); + UpdateCheckPoint(); + } + + private void CalculateUnlockAmount() + { + _unlockAtSkillAmount = 0; + var parentProgress = parent; + while (parentProgress != null) + { + _unlockAtSkillAmount += parentProgress.requiredLevelsAmount; + parentProgress = parentProgress.parent; + } + } + + private bool IsUnlocked() => _totalAmount >= _unlockAtSkillAmount; + + private bool IsFilled() => _totalAmount >= _unlockAtSkillAmount + requiredLevelsAmount; + + private float GetPercentageFromAmount() + { + if (!IsUnlocked()) return 0f; + + float amount = Math.Min(_totalAmount - _unlockAtSkillAmount, requiredLevelsAmount); + return _uiUtil.ToPercentage(amount / requiredLevelsAmount); + + } + + private void UpdateCheckPoint() + { + if (checkPointToggle == null) return; + + if (IsFilled()) + checkPointToggle.ToggleOn(); + else + checkPointToggle.ToggleOff(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillProgressLine.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillProgressLine.cs.meta new file mode 100644 index 00000000..48900ba4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillProgressLine.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4f55155a472947af87fe5984b5033990 +timeCreated: 1599564107 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillTree.cs b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillTree.cs new file mode 100644 index 00000000..535e4aae --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillTree.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using System.Linq; +using SharpUI.Source.Common.UI.Elements.Toggle; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.SkillTrees +{ + public class SkillTree : MonoBehaviour + { + [SerializeField] public ToggleButton rootNode; + [SerializeField] public SkillAmountLimit skillAmounts; + + private List _skillLevels; + private List _skillProgressLines; + private ISkillAmountLimit _skillAmountLimit; + private bool _initialized; + + public void Awake() + { + SetupSkillTree(); + } + + public void OnGUI() + { + if (_initialized) return; + _initialized = true; + + ObserveChanges(); + TriggerRootNodeChange(); + OnAnyLevelChanged(); + } + + public void SetSkillLevels(List skillLevels) + => _skillLevels = skillLevels; + + public void SetSkillProgressLines(List skillProgressLines) => + _skillProgressLines = skillProgressLines; + + public void SetSkillAmountLimit(ISkillAmountLimit skillAmountLimit) + => _skillAmountLimit = skillAmountLimit; + + private void TriggerRootNodeChange() + { + rootNode.ToggleOn(); + } + + private void SetupSkillTree() + { + _skillAmountLimit = skillAmounts; + _skillLevels = gameObject.GetComponentsInChildren().ToList(); + _skillProgressLines = gameObject.GetComponentsInChildren().ToList(); + } + + private void ObserveChanges() + { + _skillLevels.ForEach(skillLevel => + skillLevel.ObserveCurrentLevelChanged().SubscribeWith(this, _ => OnAnyLevelChanged())); + } + + private void OnAnyLevelChanged() + { + var amountSpent = _skillLevels.Sum(skillLevel => skillLevel.GetCurrentLevel()); + UpdateProgressLines(amountSpent); + UpdateSkillAmounts(amountSpent); + } + + private void UpdateProgressLines(int spent) + { + _skillProgressLines.ForEach(progressLine => progressLine.OnSkillAmountChanged(spent)); + } + + private void UpdateSkillAmounts(int spent) + { + _skillAmountLimit.UpdateSpent(spent); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillTree.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillTree.cs.meta new file mode 100644 index 00000000..1213bce6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/SkillTrees/SkillTree.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 77a3b77746e74885810ed1eab764aee4 +timeCreated: 1599562437 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Sliders.meta b/Assets/SharpUI/Source/Common/UI/Elements/Sliders.meta new file mode 100644 index 00000000..bc092b1b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Sliders.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9879df6a22ed4f58bd06ee27471179d1 +timeCreated: 1598740087 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Sliders/SimpleSlider.cs b/Assets/SharpUI/Source/Common/UI/Elements/Sliders/SimpleSlider.cs new file mode 100644 index 00000000..3d8f32bf --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Sliders/SimpleSlider.cs @@ -0,0 +1,75 @@ +using SharpUI.Source.Common.UI.Util; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Sliders +{ + public class SimpleSlider : MonoBehaviour + { + public enum SliderValueDisplayType + { + Percentage, RawIntValue,RawFloatValue, None + } + + public const string DefaultPercentageTextFormat = "{0:0.0} %"; + public const string RawValueIntTextFormat = "{0:0}"; + public const string RawValueFloatTextFormat = "{0:0.0}"; + + [SerializeField] public Slider slider; + [SerializeField] public GameObject handle; + [SerializeField] public TMP_Text percentageText; + [SerializeField] public SliderValueDisplayType textDisplayType = SliderValueDisplayType.Percentage; + + private readonly IUiUtil _uiUtil = new UiUtil(); + + public void Start() + { + ObserveValueChange(); + OnValueChanged(slider.value); + } + + private void ObserveValueChange() + { + slider.OnValueChangedAsObservable().SubscribeWith(this, OnValueChanged); + } + + private void OnValueChanged(float value) + { + SetFormattedText(value); + } + + private void SetFormattedText(float value) + { + percentageText.gameObject.SetActive(true); + switch (textDisplayType) + { + case SliderValueDisplayType.Percentage: + var percentage = _uiUtil.ToPercentage(value) / SliderRange(); + percentageText.text = string.Format(DefaultPercentageTextFormat, percentage); + break; + case SliderValueDisplayType.RawIntValue: + percentageText.text = string.Format(RawValueIntTextFormat, value); + break; + case SliderValueDisplayType.RawFloatValue: + percentageText.text = string.Format(RawValueFloatTextFormat, value); + break; + default: + percentageText.gameObject.SetActive(false); + break; + } + } + + private float SliderRange() => slider.maxValue - slider.minValue; + + public void ShowHandle() => handle.SetActive(true); + + public void HideHandle() => handle.SetActive(false); + + public void ShowPercentage() => percentageText.gameObject.SetActive(true); + + public void HidePercentage() => percentageText.gameObject.SetActive(false); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Sliders/SimpleSlider.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Sliders/SimpleSlider.cs.meta new file mode 100644 index 00000000..26cdee59 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Sliders/SimpleSlider.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 23e0793da1984c9493e03514824cb577 +timeCreated: 1598740088 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/State.meta b/Assets/SharpUI/Source/Common/UI/Elements/State.meta new file mode 100644 index 00000000..e556f330 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/State.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0785a184d3b54653b4148a8831c16782 +timeCreated: 1585350861 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/State/ElementState.cs b/Assets/SharpUI/Source/Common/UI/Elements/State/ElementState.cs new file mode 100644 index 00000000..17dca230 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/State/ElementState.cs @@ -0,0 +1,95 @@ +namespace SharpUI.Source.Common.UI.Elements.State +{ + public class ElementState : IElementState + { + private bool _isSelectable; + private bool _isClickable; + + private bool _isEnabled; + private bool _isSelected; + private bool _isFocused; + private bool _isPressed; + + public ElementState() + { + _isSelectable = true; + _isClickable = true; + SetDefaults(); + } + + public ElementState(bool selectable = true, bool clickable = true, bool enabled = true, bool selected = false, + bool focused = false, bool pressed = false) + { + _isSelectable = selectable; + _isClickable = clickable; + _isEnabled = enabled; + _isSelected = selected; + _isFocused = focused; + _isPressed = pressed; + } + + private void SetDefaults() + { + _isEnabled = true; + _isSelected = false; + _isPressed = false; + _isFocused = false; + } + + public void Enable() => SetDefaults(); + + public void Disable() => _isEnabled = false; + + public void Press() => _isPressed = true; + + public void Release() => _isPressed = false; + + public void Focus() => _isFocused = true; + + public void UnFocus() => _isFocused = false; + + public void SelectIfSelectable() + { + if (_isSelectable) + _isSelected = true; + } + + public void DeselectIfSelectable() + { + if (_isSelectable) + _isSelected = false; + } + + public void MakeSelectable() => _isSelectable = true; + + public void MakeNonSelectable() => _isSelectable = false; + + public void MakeClickable() => _isClickable = true; + + public void MakeNonClickable() => _isClickable = false; + + public bool IsSelectable() => _isSelectable; + + public bool IsNonSelectable() => !_isSelectable; + + public bool IsSelected() => _isSelected; + + public bool IsDeselected() => !_isSelected; + + public bool IsFocused() => _isFocused; + + public bool IsUnFocused() => !_isFocused; + + public bool IsPressed() => _isPressed; + + public bool IsReleased() => !_isPressed; + + public bool IsEnabled() => _isEnabled; + + public bool IsDisabled() => !_isEnabled; + + public bool IsClickable() => _isClickable; + + public bool IsNotClickable() => !_isClickable; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/State/ElementState.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/State/ElementState.cs.meta new file mode 100644 index 00000000..3121117d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/State/ElementState.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 844945a4a8ca45cb83c6b9184c16f772 +timeCreated: 1585303801 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/State/IElementState.cs b/Assets/SharpUI/Source/Common/UI/Elements/State/IElementState.cs new file mode 100644 index 00000000..79910ac8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/State/IElementState.cs @@ -0,0 +1,31 @@ +namespace SharpUI.Source.Common.UI.Elements.State +{ + public interface IElementState + { + void Enable(); + void Disable(); + void Press(); + void Release(); + void Focus(); + void UnFocus(); + void SelectIfSelectable(); + void DeselectIfSelectable(); + void MakeSelectable(); + void MakeNonSelectable(); + void MakeClickable(); + void MakeNonClickable(); + + bool IsSelectable(); + bool IsNonSelectable(); + bool IsSelected(); + bool IsDeselected(); + bool IsFocused(); + bool IsUnFocused(); + bool IsPressed(); + bool IsReleased(); + bool IsEnabled(); + bool IsDisabled(); + bool IsClickable(); + bool IsNotClickable(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/State/IElementState.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/State/IElementState.cs.meta new file mode 100644 index 00000000..86528a74 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/State/IElementState.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 17deae87fffe4ef58273cfaf1254e24c +timeCreated: 1585305582 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Toggle.meta b/Assets/SharpUI/Source/Common/UI/Elements/Toggle.meta new file mode 100644 index 00000000..7a3eb31b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Toggle.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 66ddfaf6d08d4056813d460de83e8384 +timeCreated: 1586953378 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleButton.cs b/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleButton.cs new file mode 100644 index 00000000..ba196850 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleButton.cs @@ -0,0 +1,84 @@ +using System; +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.Decorators; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.Toggle +{ + public class ToggleButton : BaseButton + { + [SerializeField] public Image checkedImage; + [SerializeField] public bool isOn; + + [CanBeNull] private Subject _toggleObserver; + + public override void Awake() + { + base.Awake(); + SetToggleState(); + ObserveToggle(); + } + + private void SetToggleState() + { + checkedImage.enabled = isOn; + } + + private void ObserveToggle() + { + dispatcher.ObserveOnClicked().SubscribeWith(this, _ => ToggleState()); + } + + public void SetIsOn(bool on) + { + isOn = on; + SetToggleState(); + } + + private void ToggleState() + { + isOn = !isOn; + _toggleObserver?.OnNext(isOn); + SetToggleState(); + } + + public void ToggleOn() + { + if (isOn) return; + ToggleState(); + } + + public void ToggleOff() + { + if (!isOn) return; + ToggleState(); + } + + public void EnableToggle() + { + if (button.interactable) return; + + button.interactable = true; + state.Enable(); + dispatcher.OnEnabled(); + decorators.OnEnabled(); + } + + public void DisableToggle() + { + if (button.interactable == false) return; + + button.interactable = false; + state.Disable(); + dispatcher.OnDisabled(); + decorators.OnDisabled(); + } + + public IObservable ObserveToggleStateChange() + => _toggleObserver ?? (_toggleObserver = new Subject()); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleButton.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleButton.cs.meta new file mode 100644 index 00000000..c70064ec --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleButton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 590ccb8f6fcc40c28435925102a6a9a1 +timeCreated: 1586953666 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleGroup.cs b/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleGroup.cs new file mode 100644 index 00000000..bf90e288 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleGroup.cs @@ -0,0 +1,71 @@ +using JetBrains.Annotations; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.Toggle +{ + public class ToggleGroup : MonoBehaviour + { + [SerializeField] public bool selectByIndex; + [SerializeField] public ushort selectedIndex; + + private ToggleButton[] _toggleButtons; + private ushort _selectedIndex = ushort.MaxValue; + + public void Awake() + { + LoadToggleButtons(); + InitToggleButtons(); + } + + public void Start() + { + SelectIfRequested(); + } + + private void SelectIfRequested() + { + if (selectByIndex && HasToggleAtIndex(selectedIndex)) + ToggleButtonSelected(selectedIndex); + } + + private void LoadToggleButtons() + { + _toggleButtons = GetComponentsInChildren(); + } + + private void InitToggleButtons() + { + for (var i = 0; i < _toggleButtons.Length; i++) + { + var index = (ushort) i; + var toggleButton = _toggleButtons[index]; + toggleButton.ToggleOff(); + toggleButton.ObserveToggleStateChange().SubscribeWith(this, + _ => ToggleButtonSelected(index)); + } + } + + private void ToggleButtonSelected(ushort buttonIndex) + { + ToggleCurrentOff(); + _selectedIndex = buttonIndex; + _toggleButtons[buttonIndex].SetIsOn(true); + } + + private void ToggleCurrentOff() + { + if (_selectedIndex != ushort.MaxValue) + _toggleButtons[_selectedIndex].SetIsOn(false); + } + + public ushort GetSelectedIndex() => _selectedIndex; + + private bool HasToggleAtIndex(ushort index) => index < _toggleButtons.Length; + + [CanBeNull] public ToggleButton GetSelectedButton() + => _selectedIndex != ushort.MaxValue ? _toggleButtons[_selectedIndex] : null; + + public int ButtonCount() => _toggleButtons.Length; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleGroup.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleGroup.cs.meta new file mode 100644 index 00000000..a98f8aef --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/Toggle/ToggleGroup.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7fbe33252f0341909ef233194c50be93 +timeCreated: 1587038966 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo.meta b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo.meta new file mode 100644 index 00000000..d65195ac --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7d0d2c8faa11436ebab860e31a78e121 +timeCreated: 1597061191 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltip.cs b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltip.cs new file mode 100644 index 00000000..bedec1bb --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltip.cs @@ -0,0 +1,21 @@ +using SharpUI.Source.Common.UI.Util.Layout; +using SharpUI.Source.Common.Util.Reactive; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.TooltipInfo +{ + public interface ITooltip + { + void SetDelayObserver(IDelayObserver observer); + void PositionPointerTo(PointerPosition pointerPosition); + void OffsetPointerByPercentage(float offset); + void Hide(); + void SetShowDelayTimeMillis(long millis); + void ShowToLeftOf(RectTransform transform); + void ShowToRightOf(RectTransform transform); + void ShowAbove(RectTransform transform); + void ShowBelow(RectTransform transform); + void BindContent(RectTransform contentTransform); + void SetMargins(Margin margin); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltip.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltip.cs.meta new file mode 100644 index 00000000..4ae4f2ab --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltip.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fe2c7887feff4eaa9613af8239149341 +timeCreated: 1597218488 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltipPointer.cs b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltipPointer.cs new file mode 100644 index 00000000..da2151bb --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltipPointer.cs @@ -0,0 +1,12 @@ +namespace SharpUI.Source.Common.UI.Elements.TooltipInfo +{ + public interface ITooltipPointer + { + float Width { get; } + float Height { get; } + + void SetPosition(PointerPosition pointerPosition); + void SetOffsetPercentage(float percentage); + float OffsetSize(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltipPointer.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltipPointer.cs.meta new file mode 100644 index 00000000..d9a01785 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/ITooltipPointer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1498c0887ffc43d4a42b7fd0d673a966 +timeCreated: 1597396789 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/PointerPosition.cs b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/PointerPosition.cs new file mode 100644 index 00000000..a9166d4a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/PointerPosition.cs @@ -0,0 +1,7 @@ +namespace SharpUI.Source.Common.UI.Elements.TooltipInfo +{ + public enum PointerPosition + { + Left, Right, Top, Bottom + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/PointerPosition.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/PointerPosition.cs.meta new file mode 100644 index 00000000..57bedad4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/PointerPosition.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b93370c09a2e40b4b971ef62619440e7 +timeCreated: 1597214223 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/Tooltip.cs b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/Tooltip.cs new file mode 100644 index 00000000..bb41466f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/Tooltip.cs @@ -0,0 +1,206 @@ +using System; +using SharpUI.Source.Common.UI.Util; +using SharpUI.Source.Common.UI.Util.Layout; +using SharpUI.Source.Common.Util.Extensions; +using SharpUI.Source.Common.Util.Reactive; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Elements.TooltipInfo +{ + public class Tooltip : MonoBehaviour, ITooltip + { + private CompositeDisposable _showDisposable = new CompositeDisposable(); + private Margin _margin = new Margin(10, 10, 10, 10); + private readonly IUiUtil _util = new UiUtil(); + private ITooltipPointer _tooltipPointer; + private RectTransform _rectTransform; + private RectTransform _sourceTransform; + private RectTransform _contentTransform; + private long _showDelayTimeMillis; + private IDelayObserver _delayObserver = new DelayObserver(); + + public void Awake() + { + _tooltipPointer = GetComponentInChildren(); + _rectTransform = GetComponent(); + } + + public void Start() + { + PositionPointerTo(PointerPosition.Right); + } + + public void OnDestroy() + { + _showDisposable.Dispose(); + } + + public void SetShowDisposable(CompositeDisposable disposable) => _showDisposable = disposable; + + public void SetDelayObserver(IDelayObserver observer) + { + _delayObserver = observer; + } + + public void SetTooltipPointer(ITooltipPointer pointer) + { + _tooltipPointer = pointer; + } + + public void PositionPointerTo(PointerPosition pointerPosition) + { + _tooltipPointer.SetPosition(pointerPosition); + } + + public void OffsetPointerByPercentage(float offset) + { + _tooltipPointer.SetOffsetPercentage(offset); + } + + public void Hide() + { + _showDisposable.Clear(); + _contentTransform.SetParent(null); + gameObject.SetActive(false); + } + + public long GetShowDelayTime() => _showDelayTimeMillis; + + public void SetShowDelayTimeMillis(long millis) => _showDelayTimeMillis = millis; + + private void ShowInside(RectTransform parentTransform) + { + _sourceTransform = parentTransform; + transform.SetParent(parentTransform.transform.parent); + _contentTransform.SetParent(_rectTransform); + gameObject.SetActive(true); + } + + private float CenterHorizontalOffset() + => _util.Half(_sourceTransform.sizeDelta.x) - _util.Half(_tooltipPointer.Height) - + _tooltipPointer.OffsetSize(); + + private float CenterVerticalOffset() + => _util.Half(_sourceTransform.sizeDelta.y) - _util.Half(_tooltipPointer.Height) - + _tooltipPointer.OffsetSize(); + + private float PivotHorizontalOffset() + => -_sourceTransform.pivot.x * _sourceTransform.sizeDelta.x + +_rectTransform.pivot.x * _rectTransform.sizeDelta.x; + + private float PivotVerticalOffset() + => -_sourceTransform.pivot.y * _sourceTransform.sizeDelta.y + +_rectTransform.pivot.y * _rectTransform.sizeDelta.y; + + private float TopVerticalOffset() + => _sourceTransform.sizeDelta.y + _tooltipPointer.Width; + + private float BottomVerticalOffset() + => -_rectTransform.sizeDelta.y - _tooltipPointer.Width; + + private float LeftHorizontalOffset() + => -_rectTransform.sizeDelta.x - _tooltipPointer.Width; + + private float RightHorizontalOffset() + => _sourceTransform.sizeDelta.x + _tooltipPointer.Width; + + private Vector2 TopOffset() + => new Vector2( + PivotHorizontalOffset() + CenterHorizontalOffset(), + PivotVerticalOffset() + TopVerticalOffset()); + + private Vector2 BottomOffset() + => new Vector2( + PivotHorizontalOffset() + CenterHorizontalOffset(), + PivotVerticalOffset() + BottomVerticalOffset()); + + private Vector2 LeftOffset() + => new Vector2( + PivotHorizontalOffset() + LeftHorizontalOffset(), + PivotVerticalOffset() + CenterVerticalOffset()); + + private Vector2 RightOffset() + => new Vector2( + PivotHorizontalOffset() + RightHorizontalOffset(), + PivotVerticalOffset() + CenterVerticalOffset()); + + private void SetLocalPositionWith(Vector2 offset) + { + var sourceLocalPosition = _sourceTransform.localPosition; + _rectTransform.localPosition = new Vector3( + sourceLocalPosition.x + offset.x, + sourceLocalPosition.y + offset.y); + _contentTransform.gameObject.SetActive(true); + } + + private IObservable ClearAndDelay() + { + _showDisposable.Clear(); + return _delayObserver.DelayMilliseconds(_showDelayTimeMillis, Scheduler.MainThread); + } + + public void ShowToLeftOf(RectTransform sourceTransform) + { + ClearAndDelay().SubscribeWith(_showDisposable, _ => + { + _tooltipPointer.SetPosition(PointerPosition.Right); + ShowInside(sourceTransform); + SetLocalPositionWith(LeftOffset()); + }); + } + + public void ShowToRightOf(RectTransform sourceTransform) + { + ClearAndDelay().SubscribeWith(_showDisposable, _ => + { + _tooltipPointer.SetPosition(PointerPosition.Left); + ShowInside(sourceTransform); + SetLocalPositionWith(RightOffset()); + }); + } + + public void ShowAbove(RectTransform sourceTransform) + { + ClearAndDelay().SubscribeWith(_showDisposable, _ => + { + _tooltipPointer.SetPosition(PointerPosition.Bottom); + ShowInside(sourceTransform); + SetLocalPositionWith(TopOffset()); + }); + } + + public void ShowBelow(RectTransform sourceTransform) + { + ClearAndDelay().SubscribeWith(_showDisposable, _ => + { + _tooltipPointer.SetPosition(PointerPosition.Top); + ShowInside(sourceTransform); + SetLocalPositionWith(BottomOffset()); + }); + } + + public void SetMargins(Margin margin) => _margin = margin; + + public void BindContent(RectTransform contentTransform) + { + _contentTransform = contentTransform; + LayoutRebuilder.ForceRebuildLayoutImmediate(_contentTransform); + SetContentSize(_contentTransform.rect); + _contentTransform.SetParent(_rectTransform); + _contentTransform.localPosition = new Vector3( + -(_rectTransform.pivot.x - 0.5f) * _rectTransform.sizeDelta.x, + -(_rectTransform.pivot.y - 0.5f) * _rectTransform.sizeDelta.y); + _contentTransform.gameObject.SetActive(false); + } + + private void SetContentSize(Rect rect) + { + var width = rect.width + _margin.Left + _margin.Right; + var height = rect.height + _margin.Top + _margin.Bottom; + _rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width); + _rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/Tooltip.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/Tooltip.cs.meta new file mode 100644 index 00000000..8c07d734 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/Tooltip.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f4a12eea389a468eb4eab8610e8ed94a +timeCreated: 1597061205 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/TooltipPointer.cs b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/TooltipPointer.cs new file mode 100644 index 00000000..eed74d87 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/TooltipPointer.cs @@ -0,0 +1,175 @@ +using SharpUI.Source.Common.UI.Util; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Elements.TooltipInfo +{ + public class TooltipPointer : MonoBehaviour, ITooltipPointer + { + public const float LeftAngleZ = 0f; + public const float RightAngleZ = 180f; + public const float TopAngleZ = 270f; + public const float BottomAngleZ = 90f; + + private static Vector2 LeftDelta => new Vector2(2.0f, 0.0f); + private static Vector2 RightDelta => new Vector2(-2.0f, 0.0f); + private static Vector2 TopDelta => new Vector2(2.0f, -2.0f); + private static Vector2 BottomDelta => new Vector2(2.0f, 2.0f); + + private float _offset; + private PointerPosition _pointerPosition; + private RectTransform _rectTransform; + private Vector3 _originalLocalPosition; + private Quaternion _originalRotation; + private readonly IUiUtil _util = new UiUtil(); + + public float Width => _rectTransform.sizeDelta.x; + + public float Height => _rectTransform.sizeDelta.y; + + private Vector2 PointerSize => _rectTransform.sizeDelta; + + private Vector2 GetParentRectSize => transform.parent.GetComponent().sizeDelta; + + private float LeftHorizontalOffset => -_util.Half(PointerSize.x); + + private float RightHorizontalOffset => GetParentRectSize.x + _util.Half(PointerSize.x); + + private float TopVerticalOffset => GetParentRectSize.y + _util.Half(PointerSize.x); + + private float BottomVerticalOffset => -_util.Half(PointerSize.x); + + private float PointerOffsetSize => OffsetSize() + _util.Half(PointerSize.y); + + public void Awake() + { + InitDefaults(); + } + + public void Start() + { + SetPosition(PointerPosition.Left); + } + + private void InitDefaults() + { + _rectTransform = GetComponent(); + _originalLocalPosition = _rectTransform.localPosition; + _originalRotation = _rectTransform.rotation; + _offset = 0; + } + + public void SetPosition(PointerPosition pointerPosition) + { + _pointerPosition = pointerPosition; + Position(); + } + + private void Position() + { + switch (_pointerPosition) + { + case PointerPosition.Left: PositionLeft(); + break; + case PointerPosition.Right: PositionRight(); + break; + case PointerPosition.Top: PositionTop(); + break; + case PointerPosition.Bottom: PositionBottom(); + break; + } + } + + public void SetOffsetPercentage(float percentage) + { + if (!_util.PercentInRange(percentage)) + return; + + _offset = _util.ToDecimalPercentage(percentage); + Position(); + } + + private void OffsetPositionWith(Vector2 offset) + { + _rectTransform.localPosition = new Vector3( + _originalLocalPosition.x + offset.x, + _originalLocalPosition.y + offset.y, + _originalLocalPosition.z); + } + + private void SetRotation(float angleZ) + { + _rectTransform.rotation = _originalRotation; + _rectTransform.Rotate(0, 0, angleZ); + } + + public float OffsetSize() + { + switch (_pointerPosition) + { + case PointerPosition.Left: + case PointerPosition.Right: + return _offset * (GetParentRectSize.y - PointerSize.y); + case PointerPosition.Bottom: + return _offset * (GetParentRectSize.x - PointerSize.y - 2 * BottomDelta.x); + case PointerPosition.Top: + return _offset * (GetParentRectSize.x - PointerSize.y - 2 * TopDelta.x); + default: + return 0; + } + } + + private Vector2 LeftOffset() + { + return new Vector2( + LeftHorizontalOffset + LeftDelta.x, + PointerOffsetSize + LeftDelta.y); + } + + private Vector2 RightOffset() + { + return new Vector2( + RightHorizontalOffset + RightDelta.x, + PointerOffsetSize + RightDelta.y); + + } + + private Vector2 TopOffset() + { + return new Vector2( + PointerOffsetSize + TopDelta.x, + TopVerticalOffset + TopDelta.y); + } + + private Vector2 BottomOffset() + { + return new Vector2( + PointerOffsetSize + BottomDelta.x, + BottomVerticalOffset + BottomDelta.y); + } + + private void PositionLeft() + { + var offset = LeftOffset(); + OffsetPositionWith(offset); + SetRotation(LeftAngleZ); + } + + private void PositionRight() + { + OffsetPositionWith(RightOffset()); + SetRotation(RightAngleZ); + } + + private void PositionTop() + { + OffsetPositionWith(TopOffset()); + SetRotation(TopAngleZ); + } + + private void PositionBottom() + { + OffsetPositionWith(BottomOffset()); + SetRotation(BottomAngleZ); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/TooltipPointer.cs.meta b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/TooltipPointer.cs.meta new file mode 100644 index 00000000..2e615f66 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Elements/TooltipInfo/TooltipPointer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0479d451c8ca4c3aa39dde86464e0afd +timeCreated: 1597062913 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Factory.meta b/Assets/SharpUI/Source/Common/UI/Factory.meta new file mode 100644 index 00000000..0bb6964b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Factory.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a8a32219df0e779438ac3b53a9a16bdc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Factory/CharacterIconFactory.cs b/Assets/SharpUI/Source/Common/UI/Factory/CharacterIconFactory.cs new file mode 100644 index 00000000..bfa55f21 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Factory/CharacterIconFactory.cs @@ -0,0 +1,31 @@ +using System; +using SharpUI.Source.Data.Model.Character; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Factory +{ + public class CharacterIconFactory : MonoBehaviour + { + [SerializeField] public Sprite iconWarriorPrefab; + [SerializeField] public Sprite iconHunterPrefab; + [SerializeField] public Sprite iconCasterPrefab; + + private Sprite CreateWarriorIcon() => Instantiate(iconWarriorPrefab); + + private Sprite CreateHunterIcon() => Instantiate(iconHunterPrefab); + + private Sprite CreateCasterIcon() => Instantiate(iconCasterPrefab); + + public Sprite CreateSpriteFor(ClassType classType) + { + switch (classType) + { + case ClassType.Warrior: return CreateWarriorIcon(); + case ClassType.Hunter: return CreateHunterIcon(); + case ClassType.Caster: return CreateCasterIcon(); + default: + throw new ArgumentOutOfRangeException(nameof(classType), classType, "Unhandled classType"); + } + } + } +} diff --git a/Assets/SharpUI/Source/Common/UI/Factory/CharacterIconFactory.cs.meta b/Assets/SharpUI/Source/Common/UI/Factory/CharacterIconFactory.cs.meta new file mode 100644 index 00000000..a3e6f66d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Factory/CharacterIconFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0adb6e426267a7a4daa63292d887b921 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Factory/ListItemFactory.cs b/Assets/SharpUI/Source/Common/UI/Factory/ListItemFactory.cs new file mode 100644 index 00000000..659d3cc6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Factory/ListItemFactory.cs @@ -0,0 +1,26 @@ +using SharpUI.Source.Common.UI.Elements.List.ListItem; +using SharpUI.Source.Common.UI.Prototype.SharpList; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Factory +{ + public class ListItemFactory : MonoBehaviour + { + [SerializeField] public GameObject listItemPrefab; + [SerializeField] public GameObject listItemDescriptionPrefab; + [SerializeField] public GameObject listItemImagePrefab; + [SerializeField] public GameObject listItemCustom; + + public ItemText CreateListItemText() + => Instantiate(listItemPrefab).GetComponent(); + + public ItemDescription CreateListItemDescription() + => Instantiate(listItemDescriptionPrefab).GetComponent(); + + public ItemImage CreateListItemImage() + => Instantiate(listItemImagePrefab).GetComponent(); + + public CustomItem CreateCustomListItem() + => Instantiate(listItemCustom).GetComponent(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Factory/ListItemFactory.cs.meta b/Assets/SharpUI/Source/Common/UI/Factory/ListItemFactory.cs.meta new file mode 100644 index 00000000..0bb1b6d7 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Factory/ListItemFactory.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 87afb496b407430483aced5aafbe0aec +timeCreated: 1585044456 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Factory/UISpriteFactory.cs b/Assets/SharpUI/Source/Common/UI/Factory/UISpriteFactory.cs new file mode 100644 index 00000000..98c6b0b3 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Factory/UISpriteFactory.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Factory +{ + public class UISpriteFactory : MonoBehaviour + { + [SerializeField] public Sprite listItemBackground; + [SerializeField] public Sprite listItemBackgroundSelected; + + [SerializeField] public Sprite squareButtonNeutral; + [SerializeField] public Sprite squareButtonSelected; + } +} diff --git a/Assets/SharpUI/Source/Common/UI/Factory/UISpriteFactory.cs.meta b/Assets/SharpUI/Source/Common/UI/Factory/UISpriteFactory.cs.meta new file mode 100644 index 00000000..a9f24200 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Factory/UISpriteFactory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 99fdbef2aaee00a4b95cda686128edc7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharpUI/Source/Common/UI/Prototype.meta b/Assets/SharpUI/Source/Common/UI/Prototype.meta new file mode 100644 index 00000000..d6662109 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 142c83141ae746c5aead11b03772a784 +timeCreated: 1585302761 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Dialog.meta b/Assets/SharpUI/Source/Common/UI/Prototype/Dialog.meta new file mode 100644 index 00000000..559fe697 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Dialog.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 557483951a114877a1e0e67872f40866 +timeCreated: 1597911469 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Dialog/DialogPrototype.cs b/Assets/SharpUI/Source/Common/UI/Prototype/Dialog/DialogPrototype.cs new file mode 100644 index 00000000..5ababd8c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Dialog/DialogPrototype.cs @@ -0,0 +1,163 @@ +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Elements.Dialogs; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Prototype.Dialog +{ + public class DialogPrototype : MonoBehaviour + { + private const string _description = + "Dialog description, Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus id posuere augue." + +" Pellentesque eget ex laoreet, tincidunt elit sit amet, varius lacus. Quisque faucibus feugiat felis eu" + +" porta. Praesent feugiat tincidunt magna."; + + [SerializeField] public GameObject dialogDefaultPrefab; + [SerializeField] public Sprite customDialogSprite; + [SerializeField] public RectTransform customDialogContentTransform; + [SerializeField] public Transform panelTransform; + [SerializeField] public Button buttonShow; + [SerializeField] public Button buttonHide; + [SerializeField] public Button buttonShowClose; + [SerializeField] public Button buttonHideClose; + [SerializeField] public Button buttonCreateDialog; + [SerializeField] public Button buttonDestroyDialog; + [SerializeField] public Button buttonAddContent; + [SerializeField] public Button buttonRemoveContent; + [SerializeField] public Button buttonSetButtonTexts; + [SerializeField] public Button buttonTogglePositiveVisible; + [SerializeField] public Button buttonToggleNegativeVisible; + [SerializeField] public Button buttonToggleNeutralVisible; + [SerializeField] public Button buttonToggleDefaultButtonsContainer; + [SerializeField] public Button buttonToggleDescriptionVisible; + [SerializeField] public Button buttonSetDescriptionText; + [SerializeField] public TMP_Dropdown dropdownIcon; + + [CanBeNull] private IDialog _dialog; + + private bool _positiveButtonVisible = true, _negativeButtonVisible = true, _neutralButtonVisible = true, + _defaultButtonsContainerVisible = true, _descriptionVisible = true, _descriptionToggle = true; + + public void Start() + { + buttonCreateDialog.OnClickAsObservable().SubscribeWith(this, _ => CreateDialog()); + buttonDestroyDialog.OnClickAsObservable().SubscribeWith(this, _ => DestroyDialog()); + + buttonShow.OnClickAsObservable().SubscribeWith(this, _ => _dialog?.Show()); + buttonHide.OnClickAsObservable().SubscribeWith(this, _ => _dialog?.Hide()); + buttonShowClose.OnClickAsObservable().SubscribeWith(this, + _ => _dialog?.SetCloseButtonVisible(true)); + buttonHideClose.OnClickAsObservable().SubscribeWith(this, + _ => _dialog?.SetCloseButtonVisible(false)); + + dropdownIcon.onValueChanged.AsObservable().SubscribeWith(this, SetIcon); + + buttonAddContent.OnClickAsObservable().SubscribeWith(this, + _ => _dialog?.SetCustomContent(customDialogContentTransform)); + buttonRemoveContent.OnClickAsObservable().SubscribeWith(this, + _ => + { + _dialog?.ClearContent(); + customDialogContentTransform.parent = buttonShow.transform.parent; + customDialogContentTransform.transform.localPosition = new Vector3(400, 400, 0); + }); + + buttonSetButtonTexts.OnClickAsObservable().SubscribeWith(this, + _ => SetButtonTexts()); + + buttonTogglePositiveVisible.OnClickAsObservable().SubscribeWith(this, + _ => + { + _positiveButtonVisible = !_positiveButtonVisible; + _dialog?.SetPositiveButtonVisible(_positiveButtonVisible); + }); + + buttonToggleNegativeVisible.OnClickAsObservable().SubscribeWith(this, + _ => + { + _negativeButtonVisible = !_negativeButtonVisible; + _dialog?.SetNegativeButtonVisible(_negativeButtonVisible); + }); + + buttonToggleNeutralVisible.OnClickAsObservable().SubscribeWith(this, + _ => + { + _neutralButtonVisible = !_neutralButtonVisible; + _dialog?.SetNeutralButtonVisible(_neutralButtonVisible); + }); + + buttonToggleDefaultButtonsContainer.OnClickAsObservable().SubscribeWith(this, + _ => + { + _defaultButtonsContainerVisible = !_defaultButtonsContainerVisible; + if (_defaultButtonsContainerVisible) + _dialog?.ShowDefaultButtons(); + else + _dialog?.HideDefaultButtons(); + }); + + buttonToggleDescriptionVisible.OnClickAsObservable().SubscribeWith(this, + _ => + { + _descriptionVisible = !_descriptionVisible; + _dialog?.SetDescriptionVisibility(_descriptionVisible); + }); + + buttonSetDescriptionText.OnClickAsObservable().SubscribeWith(this, + _ => + { + _descriptionToggle = !_descriptionToggle; + if (_descriptionToggle) + _dialog?.SetDescription(_description); + else + _dialog?.SetDescription("Description text..."); + }); + } + + private void SetButtonTexts() + { + _dialog?.SetPositiveButtonText("Yes"); + _dialog?.SetNegativeButtonText("No"); + _dialog?.SetNeutralButtonText("OK"); + } + + private void CreateDialog() + { + if (_dialog != null) return; + + var dialogInstance = Instantiate(dialogDefaultPrefab, panelTransform); + _dialog = dialogInstance.GetComponent(); + _dialog?.SetCustomSprite(customDialogSprite); + _dialog?.SetIconType(GetDialogIconType()); + } + + private void DestroyDialog() + { + if (_dialog == null) return; + + _dialog.Close(); + _dialog = null; + } + + private void SetIcon(int index) + { + _dialog?.SetIconType(GetDialogIconType()); + } + + private DialogIconType GetDialogIconType() + { + switch (dropdownIcon.value) + { + case 0: return DialogIconType.Info; + case 1: return DialogIconType.Question; + case 2: return DialogIconType.Warning; + case 3: return DialogIconType.Custom; + case 4: return DialogIconType.None; + default: return DialogIconType.None; + } + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Dialog/DialogPrototype.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/Dialog/DialogPrototype.cs.meta new file mode 100644 index 00000000..aea0e404 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Dialog/DialogPrototype.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e5d38f1159494168aa5f017b8a44ea66 +timeCreated: 1597911479 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Settings.meta b/Assets/SharpUI/Source/Common/UI/Prototype/Settings.meta new file mode 100644 index 00000000..c09974f6 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Settings.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7916f153905248aa8366d8c6859566af +timeCreated: 1600010398 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Settings/SettingsPrototype.cs b/Assets/SharpUI/Source/Common/UI/Prototype/Settings/SettingsPrototype.cs new file mode 100644 index 00000000..7c0f264e --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Settings/SettingsPrototype.cs @@ -0,0 +1,27 @@ +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Util.Scenes; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Prototype.Settings +{ + public class SettingsPrototype : MonoBehaviour + { + [SerializeField] public IconButton closeButton; + [SerializeField] public RectButton saveButton; + [SerializeField] public RectButton applyButton; + + private readonly ISceneUtils _sceneUtils = new SceneUtils(); + + public void Start() + { + saveButton.GetEventListener().ObserveOnClicked().SubscribeWith(this, _ => UnloadScene()); + closeButton.GetEventListener().ObserveOnClicked().SubscribeWith(this, _ => UnloadScene()); + } + + private void UnloadScene() + { + StartCoroutine(_sceneUtils.UnloadSceneAsync("Settings")); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Settings/SettingsPrototype.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/Settings/SettingsPrototype.cs.meta new file mode 100644 index 00000000..9d952ebf --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Settings/SettingsPrototype.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b4fa0eee91da4498a34453aefa9c7fc4 +timeCreated: 1600010429 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton.meta new file mode 100644 index 00000000..fedd45e3 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bb4720026fb848098654e86d0c90b20c +timeCreated: 1585517351 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionItemHolder.cs b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionItemHolder.cs new file mode 100644 index 00000000..39586ebc --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionItemHolder.cs @@ -0,0 +1,23 @@ +using System; +using SharpUI.Source.Common.UI.Elements.List.Holder; +using SharpUI.Source.Common.UI.Elements.List.ListItem; + +namespace SharpUI.Source.Common.UI.Prototype.SharpButton +{ + public class DescriptionItemHolder : ItemHolder> + { + private readonly ItemDescription _itemDescription; + + public DescriptionItemHolder(ItemDescription itemDescription) : base(itemDescription) + { + _itemDescription = itemDescription; + } + + public override void BindData(Tuple descriptionData) + { + base.BindData(descriptionData); + _itemDescription.textTitle.text = descriptionData.Item1; + _itemDescription.textDescription.text = descriptionData.Item2; + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionItemHolder.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionItemHolder.cs.meta new file mode 100644 index 00000000..b41805a2 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionItemHolder.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: adbf701268f9470a92808572a84b493a +timeCreated: 1585520936 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionListAdapter.cs b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionListAdapter.cs new file mode 100644 index 00000000..01d015bf --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionListAdapter.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Elements.List.Adapter; +using SharpUI.Source.Common.UI.Elements.List.Holder; +using SharpUI.Source.Common.UI.Factory; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Prototype.SharpButton +{ + public class DescriptionListAdapter : ListAdapter> + { + [SerializeField] public ListItemFactory itemFactory; + + public void SetItemsAndNotify(List> items) + { + SetData(items); + NotifyDataSetChanged(); + } + + protected override ItemHolder> CreateListItemHolder() + { + var item = itemFactory.CreateListItemDescription(); + var holder = new DescriptionItemHolder(item); + return holder; + } + + protected override void BindListItemHolder(ItemHolder> holder, int position) + { + (holder as DescriptionItemHolder)?.BindData(GetData(position)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionListAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionListAdapter.cs.meta new file mode 100644 index 00000000..adc28c66 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/DescriptionListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f59d23f936fc4565891d0bb69f11a52f +timeCreated: 1585520864 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/SharpButtonPrototype.cs b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/SharpButtonPrototype.cs new file mode 100644 index 00000000..4c5be5cb --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/SharpButtonPrototype.cs @@ -0,0 +1,183 @@ +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.DropDowns; +using SharpUI.Source.Common.UI.Elements.DropDowns.Adapters; +using SharpUI.Source.Common.UI.Elements.Sliders; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Prototype.SharpButton +{ + public class SharpButtonPrototype : MonoBehaviour + { + // Default rect buttons + [SerializeField] public Button enableDefaultButtons; + [SerializeField] public Button disableDefaultButtons; + [SerializeField] public Button toggleClickable; + [SerializeField] public Button toggleSelectable; + [SerializeField] public Button toggleSelected; + [SerializeField] public RectButton buttonDefault; + [SerializeField] public RectButton buttonGreen; + [SerializeField] public RectButton buttonRed; + + // Link buttons + [SerializeField] public Button enableLinkButtons; + [SerializeField] public Button disableLinkButtons; + [SerializeField] public RectButton buttonLinkDefault; + [SerializeField] public RectButton buttonLinkBlue; + + // Icon buttons + [SerializeField] public Button enableIconButtons; + [SerializeField] public Button disableIconButtons; + [SerializeField] public RectButton defaultIconButton; + [SerializeField] public RectButton largeIconButton; + + // Round buttons + [SerializeField] public Button enableRoundButtons; + [SerializeField] public Button disableRoundButtons; + [SerializeField] public IconButton roundButton; + [SerializeField] public IconButton roundButtonClose; + [SerializeField] public IconButton roundButtonHero; + + // Dropdowns + [SerializeField] public DropDown dropDown; + + // SimpleSlider + [SerializeField] public SimpleSlider _slider; + + public void Start() + { + enableDefaultButtons.OnClickAsObservable() + .SubscribeWith(this, _ => + { + buttonDefault.EnableButton(); + buttonGreen.EnableButton(); + buttonRed.EnableButton(); + }); + + disableDefaultButtons.OnClickAsObservable() + .SubscribeWith(this, _ => + { + buttonDefault.DisableButton(); + buttonGreen.DisableButton(); + buttonRed.DisableButton(); + }); + + toggleClickable.GetComponentInChildren().text = buttonDefault.isClickable ? "Disable clicks" : "Enable clicks"; + toggleSelectable.GetComponentInChildren().text = + buttonDefault.isSelectable ? "Disable selection" : "Enable selection"; + toggleSelected.GetComponentInChildren().text = buttonDefault.isSelected ? "Deselect" : "Select"; + + toggleClickable.OnClickAsObservable() + .SubscribeWith(this, _ => + { + if (buttonDefault.isClickable) + { + buttonDefault.SetClickable(false); + buttonGreen.SetClickable(false); + buttonRed.SetClickable(false); + } + else + { + buttonDefault.SetClickable(true); + buttonGreen.SetClickable(true); + buttonRed.SetClickable(true); + } + toggleClickable.GetComponentInChildren().text = buttonDefault.isClickable ? "Disable clicks" : "Enable clicks"; + }); + + toggleSelectable.OnClickAsObservable() + .SubscribeWith(this, _ => + { + if (buttonDefault.isSelectable) + { + buttonDefault.SetSelectable(false); + buttonGreen.SetSelectable(false); + buttonRed.SetSelectable(false); + } + else + { + buttonDefault.SetSelectable(true); + buttonGreen.SetSelectable(true); + buttonRed.SetSelectable(true); + } + toggleSelectable.GetComponentInChildren().text = + buttonDefault.isSelectable ? "Disable selection" : "Enable selection"; + }); + + toggleSelected.OnClickAsObservable() + .SubscribeWith(this, _ => + { + if (buttonDefault.isSelected) + { + buttonDefault.SetSelected(false); + buttonGreen.SetSelected(false); + buttonRed.SetSelected(false); + } + else + { + buttonDefault.SetSelected(true); + buttonGreen.SetSelected(true); + buttonRed.SetSelected(true); + } + toggleSelected.GetComponentInChildren().text = buttonDefault.isSelected ? "Deselect" : "Select"; + }); + + + enableLinkButtons.OnClickAsObservable() + .SubscribeWith(this, _ => + { + buttonLinkDefault.EnableButton(); + buttonLinkBlue.EnableButton(); + }); + + disableLinkButtons.OnClickAsObservable() + .SubscribeWith(this, _ => + { + buttonLinkDefault.DisableButton(); + buttonLinkBlue.DisableButton(); + }); + + enableIconButtons.OnClickAsObservable() + .SubscribeWith(this, _ => + { + defaultIconButton.EnableButton(); + largeIconButton.EnableButton(); + }); + + disableIconButtons.OnClickAsObservable() + .SubscribeWith(this, _ => + { + defaultIconButton.DisableButton(); + largeIconButton.DisableButton(); + }); + + enableRoundButtons.OnClickAsObservable() + .SubscribeWith(this, _ => + { + roundButton.EnableButton(); + roundButtonClose.EnableButton(); + roundButtonHero.EnableButton(); + }); + + disableRoundButtons.OnClickAsObservable() + .SubscribeWith(this, _ => + { + roundButton.DisableButton(); + roundButtonClose.DisableButton(); + roundButtonHero.DisableButton(); + }); + + var dropDownOptions = new List + { + "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", "Option 6", "Option 7", "Option 8", + "Option 9", "Option 10", "Option 11", "Option 12", "Option 13", "Option 14", "Option 15", "Option 16" + }; + var dropDownStringAdapter = new DefaultDropDownAdapter(); + dropDown.SetAdapter(dropDownStringAdapter); + dropDownStringAdapter.SetData(dropDownOptions); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/SharpButtonPrototype.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/SharpButtonPrototype.cs.meta new file mode 100644 index 00000000..bfdc78a4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpButton/SharpButtonPrototype.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dc1ab1d49f7049a8a029f51d960a320e +timeCreated: 1585302784 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList.meta new file mode 100644 index 00000000..53f220c3 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3571ad4881484f398d593a0c091f9503 +timeCreated: 1585517379 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItem.cs b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItem.cs new file mode 100644 index 00000000..76125c08 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItem.cs @@ -0,0 +1,13 @@ +using SharpUI.Source.Common.UI.Elements.List.ListItem; +using TMPro; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Prototype.SharpList +{ + [RequireComponent(typeof(Item))] + public class CustomItem : Item + { + [SerializeField] public TMP_Text leftText; + [SerializeField] public TMP_Text rightText; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItem.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItem.cs.meta new file mode 100644 index 00000000..e5f482be --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 66ea24f89fb64f3eab4534f15da62dfd +timeCreated: 1585571043 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItemHolder.cs b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItemHolder.cs new file mode 100644 index 00000000..bd98bb53 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItemHolder.cs @@ -0,0 +1,23 @@ +using System; +using System.Globalization; +using SharpUI.Source.Common.UI.Elements.List.Holder; + +namespace SharpUI.Source.Common.UI.Prototype.SharpList +{ + public class CustomItemHolder : ItemHolder> + { + private readonly CustomItem _customItem; + + public CustomItemHolder(CustomItem customItem) : base(customItem) + { + _customItem = customItem; + } + + public override void BindData(Tuple customData) + { + base.BindData(customData); + _customItem.leftText.text = customData.Item1; + _customItem.rightText.text = customData.Item2.ToString(CultureInfo.InvariantCulture); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItemHolder.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItemHolder.cs.meta new file mode 100644 index 00000000..deadbc36 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomItemHolder.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4aaed7f0fe0843bb96d5ccb3213fa476 +timeCreated: 1585570957 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomListAdapter.cs b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomListAdapter.cs new file mode 100644 index 00000000..4a7d205f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomListAdapter.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Common.UI.Elements.List.Adapter; +using SharpUI.Source.Common.UI.Elements.List.Holder; +using SharpUI.Source.Common.UI.Factory; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Prototype.SharpList +{ + public class CustomListAdapter : ListAdapter> + { + [SerializeField] public ListItemFactory itemFactory; + + public void SetItemsAndNotify(List> items) + { + SetData(items); + NotifyDataSetChanged(); + } + + protected override ItemHolder> CreateListItemHolder() + { + var item = itemFactory.CreateCustomListItem(); + var holder = new CustomItemHolder(item); + return holder; + } + + protected override void BindListItemHolder(ItemHolder> holder, int position) + { + (holder as CustomItemHolder)?.BindData(GetData(position)); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomListAdapter.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomListAdapter.cs.meta new file mode 100644 index 00000000..0c4a9c50 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/CustomListAdapter.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b8e9a5e4ac5b4de497e9ae85683c9cd7 +timeCreated: 1585570568 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/SharpListPrototype.cs b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/SharpListPrototype.cs new file mode 100644 index 00000000..b606fc06 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/SharpListPrototype.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using SharpUI.Source.Client.UI.User.CharacterSelect.CharacterList; +using SharpUI.Source.Common.UI.Elements.List.Adapter; +using SharpUI.Source.Common.UI.Prototype.SharpButton; +using SharpUI.Source.Common.Util.Extensions; +using SharpUI.Source.Data.Model.Character; +using UniRx; +using UnityEngine; +using UnityEngine.Serialization; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Prototype.SharpList +{ + public class SharpListPrototype : MonoBehaviour + { + [FormerlySerializedAs("defaultList")] [SerializeField] public Elements.List.ListView defaultListView; + [FormerlySerializedAs("iconList")] [SerializeField] public Elements.List.ListView iconListView; + [FormerlySerializedAs("descriptionList")] [SerializeField] public Elements.List.ListView descriptionListView; + [FormerlySerializedAs("textList")] [SerializeField] public Elements.List.ListView textListView; + [FormerlySerializedAs("customList")] [SerializeField] public Elements.List.ListView customListView; + [SerializeField] public Button enableToggle; + [SerializeField] public Button clickableToggle; + [SerializeField] public Button selectableToggle; + [SerializeField] public Button clearAll; + [SerializeField] public Button loadAll; + + private DefaultListAdapter _defaultAdapter; + private DefaultListAdapter _textAdapter; + private DescriptionListAdapter _descriptionAdapter; + private CharacterListAdapter _charactersAdapter; + private CustomListAdapter _customListAdapter; + + private readonly List _textStrings = new List + { + "First", + "Second", + "And last one as a really long text description!", + "Fourth", + "Fifth", + "And last one as a really long text description!" + }; + + private readonly List> _descriptionData = new List> + { + new Tuple("Title", "Description"), + new Tuple("Hello World", "The description of the world!"), + new Tuple("Info", "There is no place like home."), + new Tuple("Long description", "This text should represent a very long description that spans over two lines."), + new Tuple("Title", "Description"), + new Tuple("Hello World", "The description of the world!"), + new Tuple("Info", "There is no place like home."), + new Tuple("Long description", "This text should represent a very long description that spans over two lines."), + new Tuple("Title", "Description"), + new Tuple("Hello World", "The description of the world!"), + new Tuple("Info", "There is no place like home."), + new Tuple("Long description", "This text should represent a very long description that spans over two lines.") + }; + + private readonly List _characters = new List + { + CharacterFactory.CreateWarriorCharacter("BoneCrusher", 10), + CharacterFactory.CreateHunterCharacter("SlayerX", 47), + CharacterFactory.CreateWarriorCharacter("Boki", 16), + CharacterFactory.CreateCasterCharacter("MageCaster", 17), + CharacterFactory.CreateWarriorCharacter("Simple", 80), + CharacterFactory.CreateHunterCharacter("Terminator", 34), + CharacterFactory.CreateWarriorCharacter("Ruller", 61), + CharacterFactory.CreateCasterCharacter("Hack", 27), + CharacterFactory.CreateWarriorCharacter("Tim", 100), + CharacterFactory.CreateHunterCharacter("Diablo", 57), + CharacterFactory.CreateWarriorCharacter("Lakii", 96), + CharacterFactory.CreateCasterCharacter("Little", 39) + }; + + private readonly List> _customData = new List> + { + new Tuple("Strength", 240.3f), + new Tuple("Stamina", 182.6f), + new Tuple("Resistance", 34.9f) + }; + + public void Start() + { + _defaultAdapter = defaultListView.GetComponent(); + _textAdapter = textListView.GetComponent(); + _descriptionAdapter = descriptionListView.GetComponent(); + _charactersAdapter = iconListView.GetComponent(); + _customListAdapter = customListView.GetComponent(); + + _defaultAdapter.SetItemsAndNotify(_textStrings); + _textAdapter.SetItemsAndNotify(_textStrings); + _descriptionAdapter.SetItemsAndNotify(_descriptionData); + _charactersAdapter.SetCharactersAndNotify(_characters); + _customListAdapter.SetItemsAndNotify(_customData); + + enableToggle.OnClickAsObservable() + .SubscribeWith(this, _ => + { + iconListView.SetItemsEnabled(!iconListView.enableItems); + enableToggle.GetComponentInChildren().text = + iconListView.enableItems ? "Disable items" : "Enable items"; + }); + + clickableToggle.OnClickAsObservable() + .SubscribeWith(this, _ => + { + iconListView.SetItemsClickable(!iconListView.canClickItems); + clickableToggle.GetComponentInChildren().text = + iconListView.canClickItems ? "Disable clicks" : "Enable clicks"; + }); + + selectableToggle.OnClickAsObservable() + .SubscribeWith(this, _ => + { + iconListView.SetItemsSelectable(!iconListView.canSelectItems); + selectableToggle.GetComponentInChildren().text = + iconListView.canSelectItems ? "Disable selection" : "Enable selection"; + }); + + clearAll.OnClickAsObservable() + .SubscribeWith(this, _ => + { + _charactersAdapter.ClearAll(); + }); + + loadAll.OnClickAsObservable() + .SubscribeWith(this, _ => + { + _charactersAdapter.SetCharactersAndNotify(_characters); + }); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/SharpListPrototype.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/SharpListPrototype.cs.meta new file mode 100644 index 00000000..b30b4a23 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SharpList/SharpListPrototype.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e0996ebe3ac541aea2e92852c9cfa990 +timeCreated: 1585517394 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree.meta new file mode 100644 index 00000000..7bb0f560 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7bb92f5effeb4086889f115c87721c66 +timeCreated: 1599519186 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree/SkillTreePrototype.cs b/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree/SkillTreePrototype.cs new file mode 100644 index 00000000..6fec29dc --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree/SkillTreePrototype.cs @@ -0,0 +1,256 @@ +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.TooltipInfo; +using SharpUI.Source.Common.UI.Util; +using SharpUI.Source.Common.UI.Util.Layout; +using SharpUI.Source.Common.Util.Extensions; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Prototype.SkillTree +{ + public class SkillTreePrototype : MonoBehaviour + { + [SerializeField] public TabButton utilityTabButton; + [SerializeField] public GameObject utilityTooltipMessage; + + [SerializeField] public SkillTreeButton northWindSkillButton; + [SerializeField] public SkillTreeButton reckoningShieldSkillButton; + [SerializeField] public SkillTreeButton queensVenomSkillButton; + [SerializeField] public SkillTreeButton quickStabSkillButton; + [SerializeField] public SkillTreeButton dualWieldSkillButton; + [SerializeField] public SkillTreeButton lightningCoilSkillButton; + [SerializeField] public SkillTreeButton recklessSkiesSkillButton; + [SerializeField] public SkillTreeButton onGuardSkillButton; + [SerializeField] public SkillTreeButton focusedAttacksSkillButton; + [SerializeField] public SkillTreeButton thunderstruckSkillButton; + [SerializeField] public SkillTreeButton goWithTheWindSkillButton; + [SerializeField] public SkillTreeButton fireballSkillButton; + [SerializeField] public SkillTreeButton pierceThroughSkillButton; + [SerializeField] public SkillTreeButton backstabSkillButton; + [SerializeField] public GameObject northWindContentGameObject; + [SerializeField] public GameObject reckoningShieldGameObject; + [SerializeField] public GameObject queensVenomGameObject; + [SerializeField] public GameObject quickStabGameObject; + [SerializeField] public GameObject dualWieldGameObject; + [SerializeField] public GameObject lightningCoilGameObject; + [SerializeField] public GameObject recklessSkiesGameObject; + [SerializeField] public GameObject onGuardGameObject; + [SerializeField] public GameObject focusedAttacksGameObject; + [SerializeField] public GameObject thunderstruckGameObject; + [SerializeField] public GameObject goWithTheWindGameObject; + [SerializeField] public GameObject fireballGameObject; + [SerializeField] public GameObject pierceThroughGameObject; + [SerializeField] public GameObject backstabGameObject; + [SerializeField] public GameObject abilityTooltip; + + private ITooltip _abilityTooltip; + + public void Awake() + { + InitTooltips(); + } + + private void InitTooltips() + { + _abilityTooltip = abilityTooltip.GetComponent(); + _abilityTooltip.SetShowDelayTimeMillis(300); + } + + public void Start() + { + northWindSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnNorthWindEnter()); + northWindSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + reckoningShieldSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnReckoningShieldEnter()); + reckoningShieldSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + queensVenomSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnQueensVenomEnter()); + queensVenomSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + quickStabSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnQuickStabEnter()); + quickStabSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + dualWieldSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnDualWieldEnter()); + dualWieldSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + lightningCoilSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnLightningCoilEnter()); + lightningCoilSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + recklessSkiesSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnRecklessSkiesEnter()); + recklessSkiesSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + onGuardSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnOnGuardEnter()); + onGuardSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + focusedAttacksSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnFocusedAttacksEnter()); + focusedAttacksSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + thunderstruckSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnThunderstruckEnter()); + thunderstruckSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + goWithTheWindSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnGoWithTheWindEnter()); + goWithTheWindSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + fireballSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnFireballEnter()); + fireballSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + pierceThroughSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnPierceThroughEnter()); + pierceThroughSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + backstabSkillButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnBackstabEnter()); + backstabSkillButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + + utilityTabButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnUtilityTabEntered()); + utilityTabButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => _abilityTooltip.Hide()); + } + + private void OnUtilityTabEntered() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent100); + _abilityTooltip.SetMargins(new Margin(-76, 0, 0, 106)); + _abilityTooltip.BindContent(utilityTooltipMessage.GetComponent()); + _abilityTooltip.ShowToLeftOf(utilityTabButton.GetComponent()); + } + + private void OnNorthWindEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent0); + _abilityTooltip.SetMargins(new Margin(-64, 0, 0, 0)); + _abilityTooltip.BindContent(northWindContentGameObject.GetComponent()); + _abilityTooltip.ShowAbove(northWindSkillButton.GetComponent()); + } + + private void OnReckoningShieldEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent100); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(reckoningShieldGameObject.GetComponent()); + _abilityTooltip.ShowToRightOf(reckoningShieldSkillButton.GetComponent()); + } + + private void OnQueensVenomEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent100); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(queensVenomGameObject.GetComponent()); + _abilityTooltip.ShowToRightOf(queensVenomSkillButton.GetComponent()); + } + + private void OnQuickStabEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent100); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(quickStabGameObject.GetComponent()); + _abilityTooltip.ShowToLeftOf(quickStabSkillButton.GetComponent()); + } + + private void OnDualWieldEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent0); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(dualWieldGameObject.GetComponent()); + _abilityTooltip.ShowToLeftOf(dualWieldSkillButton.GetComponent()); + } + + private void OnLightningCoilEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent0); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(lightningCoilGameObject.GetComponent()); + _abilityTooltip.ShowToRightOf(lightningCoilSkillButton.GetComponent()); + } + + private void OnRecklessSkiesEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent0); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(recklessSkiesGameObject.GetComponent()); + _abilityTooltip.ShowToLeftOf(recklessSkiesSkillButton.GetComponent()); + } + + private void OnOnGuardEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent0); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(onGuardGameObject.GetComponent()); + _abilityTooltip.ShowToLeftOf(onGuardSkillButton.GetComponent()); + } + + private void OnFocusedAttacksEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent0); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(focusedAttacksGameObject.GetComponent()); + _abilityTooltip.ShowToLeftOf(focusedAttacksSkillButton.GetComponent()); + } + + private void OnThunderstruckEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent0); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(thunderstruckGameObject.GetComponent()); + _abilityTooltip.ShowToRightOf(thunderstruckSkillButton.GetComponent()); + } + + private void OnGoWithTheWindEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent100); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(goWithTheWindGameObject.GetComponent()); + _abilityTooltip.ShowToRightOf(goWithTheWindSkillButton.GetComponent()); + } + + private void OnFireballEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent100); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(fireballGameObject.GetComponent()); + _abilityTooltip.ShowToRightOf(fireballSkillButton.GetComponent()); + } + + private void OnPierceThroughEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent100); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(pierceThroughGameObject.GetComponent()); + _abilityTooltip.ShowToRightOf(pierceThroughSkillButton.GetComponent()); + } + + private void OnBackstabEnter() + { + _abilityTooltip.OffsetPointerByPercentage(UiUtil.Percent100); + _abilityTooltip.SetMargins(new Margin(0, 0, 0, -64)); + _abilityTooltip.BindContent(backstabGameObject.GetComponent()); + _abilityTooltip.ShowToRightOf(backstabSkillButton.GetComponent()); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree/SkillTreePrototype.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree/SkillTreePrototype.cs.meta new file mode 100644 index 00000000..d0b00c0d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/SkillTree/SkillTreePrototype.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: adaf278021474e0e92443b3579890f84 +timeCreated: 1599519203 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Tabs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/Tabs.meta new file mode 100644 index 00000000..b7284bef --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Tabs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: aefce2bcf6f24108aa8b745f67520ecb +timeCreated: 1598016316 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Tabs/TabsPrototype.cs b/Assets/SharpUI/Source/Common/UI/Prototype/Tabs/TabsPrototype.cs new file mode 100644 index 00000000..5f991dc8 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Tabs/TabsPrototype.cs @@ -0,0 +1,27 @@ +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.Util.Extensions; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Prototype.Tabs +{ + public class TabsPrototype : MonoBehaviour + { + [SerializeField] public ButtonSelectionGroup buttonGroup; + [SerializeField] public TabButton tab5Button; + [SerializeField] public Button toggleTab5Button; + + public void Start() + { + toggleTab5Button.OnClickAsObservable().SubscribeWith(this, + _ => + { + if (tab5Button.GetState().IsEnabled()) + tab5Button.DisableButton(); + else + tab5Button.EnableButton(); + }); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Tabs/TabsPrototype.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/Tabs/TabsPrototype.cs.meta new file mode 100644 index 00000000..e09f311e --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Tabs/TabsPrototype.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b2e3798b77164f9c868753e423bd5d93 +timeCreated: 1598016325 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip.meta b/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip.meta new file mode 100644 index 00000000..c0833f0b --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 893062fd66aa4989aaed4d7a2bd9ccf3 +timeCreated: 1597175225 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip/TooltipPrototype.cs b/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip/TooltipPrototype.cs new file mode 100644 index 00000000..2d6ae357 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip/TooltipPrototype.cs @@ -0,0 +1,133 @@ +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.Toggle; +using SharpUI.Source.Common.UI.Elements.TooltipInfo; +using SharpUI.Source.Common.Util.Extensions; +using TMPro; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Prototype.Tooltip +{ + public class TooltipPrototype : MonoBehaviour + { + [SerializeField] public GameObject defaultTooltipGameObject; + [SerializeField] public GameObject tooltipHoverGameObject; + [SerializeField] public GameObject advancedTooltipGameObject; + [SerializeField] public GameObject weaponTooltipGameObject; + [SerializeField] public Button pointerLeft; + [SerializeField] public Button pointerRight; + [SerializeField] public Button pointerTop; + [SerializeField] public Button pointerBottom; + [SerializeField] public Slider pointerOffset; + [SerializeField] public IconButton hoverButton; + [SerializeField] public ToggleButton showOnLeft; + [SerializeField] public ToggleButton showOnRight; + [SerializeField] public ToggleButton showAbove; + [SerializeField] public ToggleButton showBelow; + [SerializeField] public Slider hoverOffset; + [SerializeField] public TMP_Text textHoverTooltip; + [SerializeField] public IconButton advancedButton; + [SerializeField] public RectTransform advancedContent; + [SerializeField] public IconButton weaponButton; + [SerializeField] public RectTransform weaponContent; + + private ITooltip _defaultTooltip; + private ITooltip _hoverTooltip; + private ITooltip _advancedTooltip; + private ITooltip _weaponTooltip; + + public void Awake() + { + _defaultTooltip = defaultTooltipGameObject.GetComponent(); + _hoverTooltip = tooltipHoverGameObject.GetComponent(); + _advancedTooltip = advancedTooltipGameObject.GetComponent(); + _weaponTooltip = weaponTooltipGameObject.GetComponent(); + } + + public void Start() + { + _defaultTooltip.OffsetPointerByPercentage(pointerOffset.value); + _hoverTooltip.OffsetPointerByPercentage(hoverOffset.value); + _hoverTooltip.BindContent(textHoverTooltip.GetComponent()); + + _weaponTooltip.OffsetPointerByPercentage(85f); + _weaponTooltip.BindContent(weaponContent); + + _advancedTooltip.OffsetPointerByPercentage(25f); + _advancedTooltip.BindContent(advancedContent); + + pointerLeft.OnClickAsObservable().SubscribeWith(this, + _ => _defaultTooltip.PositionPointerTo(PointerPosition.Left)); + + pointerRight.OnClickAsObservable().SubscribeWith(this, + _ => _defaultTooltip.PositionPointerTo(PointerPosition.Right)); + + pointerTop.OnClickAsObservable().SubscribeWith(this, + _ => _defaultTooltip.PositionPointerTo(PointerPosition.Top)); + + pointerBottom.OnClickAsObservable().SubscribeWith(this, + _ => _defaultTooltip.PositionPointerTo(PointerPosition.Bottom)); + + pointerOffset.OnValueChangedAsObservable().SubscribeWith(this, + value => _defaultTooltip.OffsetPointerByPercentage(value)); + + hoverOffset.OnValueChangedAsObservable().SubscribeWith(this, + value => _hoverTooltip.OffsetPointerByPercentage(value)); + + hoverButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnHoverButtonEntered()); + + hoverButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => OnHoverButtonExited()); + + advancedButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnAdvancedHoverEntered()); + + advancedButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => OnAdvancedHoverExited()); + + weaponButton.GetEventListener().ObserveOnEntered().SubscribeWith(this, + _ => OnWeaponEntered()); + + weaponButton.GetEventListener().ObserveOnExited().SubscribeWith(this, + _ => OnWeaponExited()); + } + + private void OnWeaponEntered() + { + var rectTransform = weaponButton.GetComponent(); + _weaponTooltip.ShowAbove(rectTransform); + } + + private void OnWeaponExited() + { + _weaponTooltip.Hide(); + } + + private void OnAdvancedHoverEntered() + { + var rectTransform = advancedButton.GetComponent(); + _advancedTooltip.ShowAbove(rectTransform); + } + + private void OnAdvancedHoverExited() + { + _advancedTooltip.Hide(); + } + + private void OnHoverButtonEntered() + { + var rectTransform = hoverButton.GetComponent(); + if (showOnLeft.isOn) _hoverTooltip.ShowToLeftOf(rectTransform); + else if (showOnRight.isOn) _hoverTooltip.ShowToRightOf(rectTransform); + else if (showAbove.isOn) _hoverTooltip.ShowAbove(rectTransform); + else if (showBelow.isOn) _hoverTooltip.ShowBelow(rectTransform); + } + + private void OnHoverButtonExited() + { + _hoverTooltip.Hide(); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip/TooltipPrototype.cs.meta b/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip/TooltipPrototype.cs.meta new file mode 100644 index 00000000..fd6d9c78 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Prototype/Tooltip/TooltipPrototype.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 129f907c20da4c38ba959cb761ee87bf +timeCreated: 1597175243 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util.meta b/Assets/SharpUI/Source/Common/UI/Util.meta new file mode 100644 index 00000000..4e39405c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 57fe18351c7b48f98d0a54a64d43bc6e +timeCreated: 1597144125 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation.meta b/Assets/SharpUI/Source/Common/UI/Util/Animation.meta new file mode 100644 index 00000000..55a91c3d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7d95391e29294de99df29644ccb9310d +timeCreated: 1599214241 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation/AnimationState.cs b/Assets/SharpUI/Source/Common/UI/Util/Animation/AnimationState.cs new file mode 100644 index 00000000..875cde99 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation/AnimationState.cs @@ -0,0 +1,17 @@ +namespace SharpUI.Source.Common.UI.Util.Animation +{ + public class AnimationState : IAnimationState + { + private bool _isAnimating; + + public AnimationState() { } + + public AnimationState(bool isAnimating) => _isAnimating = isAnimating; + + public void OnAnimationBegin() => _isAnimating = true; + + public void OnAnimationEnd() => _isAnimating = false; + + public bool IsAnimating() => _isAnimating; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation/AnimationState.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Animation/AnimationState.cs.meta new file mode 100644 index 00000000..4e14b7ed --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation/AnimationState.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2d8b64ef847f4601845fe7f81e78c798 +timeCreated: 1599220853 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation/CanvasGroupAnimator.cs b/Assets/SharpUI/Source/Common/UI/Util/Animation/CanvasGroupAnimator.cs new file mode 100644 index 00000000..77f6219f --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation/CanvasGroupAnimator.cs @@ -0,0 +1,108 @@ +using SharpUI.Source.Common.Util.Extensions; +using SharpUI.Source.Common.Util.Reactive; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Util.Animation +{ + public class CanvasGroupAnimator : ICanvasGroupAnimator + { + private const long DefaultFadeDelayMillis = 8; + private const int DefaultFadeOutSteps = 200; + private const int DefaultFadeInSteps = 80; + + private CompositeDisposable _disposable = new CompositeDisposable(); + private CanvasGroup _canvasGroup; + private IDelayObserver _delayObserver = new DelayObserver(); + private IAnimationState _state = new AnimationState(); + private long _hideDelayMillis; + + public void SetAnimationState(IAnimationState state) => _state = state; + + public void SetDisposable(CompositeDisposable disposable) => _disposable = disposable; + + public void TakeCanvasGroup(CanvasGroup group) => _canvasGroup = group; + + public void SetHideDelayMillis(long delay) => _hideDelayMillis = delay; + + public void SetDelayObserver(IDelayObserver delayObserver) => _delayObserver = delayObserver; + + public void DropCanvasGroup() + { + _disposable.Dispose(); + _canvasGroup = null; + } + + public void FadeIn() + { + if (_state.IsAnimating()) return; + + ShowCanvasGroup(); + SetCanvasGroupAlpha(0); + _delayObserver + .DelayMilliseconds(DefaultFadeDelayMillis, Scheduler.MainThread, DefaultFadeInSteps) + .DoOnError(_ => FinishFadeout()) + .DoOnSubscribe(OnAnimationStarted) + .Finally(FinishFadein) + .SubscribeWith(_disposable, value => SetCanvasGroupAlpha((value + 1f) / DefaultFadeInSteps)); + } + + public void FadeOut() + { + if (_state.IsAnimating()) return; + + ShowCanvasGroup(); + SetCanvasGroupAlpha(1); + _delayObserver + .DelayMilliseconds(_hideDelayMillis, Scheduler.MainThread, 1) + .DoOnError(_ => FinishFadeout()) + .DoOnSubscribe(OnAnimationStarted) + .SubscribeWith(_disposable, _ => AnimateFadeOut()); + } + + private void AnimateFadeOut() + { + _delayObserver + .DelayMilliseconds(DefaultFadeDelayMillis, Scheduler.MainThread, DefaultFadeOutSteps) + .Finally(FinishFadeout) + .SubscribeWith(_disposable, + value => SetCanvasGroupAlpha((float)(DefaultFadeOutSteps - value) / DefaultFadeOutSteps)); + } + + private void FinishFadeout() + { + OnAnimationFinished(); + SetCanvasGroupAlpha(0); + } + + private void FinishFadein() + { + OnAnimationFinished(); + SetCanvasGroupAlpha(1); + } + + private void OnAnimationStarted() => _state.OnAnimationBegin(); + + private void OnAnimationFinished() => _state.OnAnimationEnd(); + + private void SetCanvasGroupAlpha(float alpha) => _canvasGroup.alpha = alpha; + + public bool IsCanvasGroupVisible() => _canvasGroup.alpha > 0.0f; + + public void ShowCanvasGroup() + { + if (_state.IsAnimating()) return; + + _canvasGroup.gameObject.SetActive(true); + SetCanvasGroupAlpha(1); + } + + public void HideCanvasGroup() + { + if (_state.IsAnimating()) return; + + SetCanvasGroupAlpha(0); + _canvasGroup.gameObject.SetActive(false); + } + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation/CanvasGroupAnimator.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Animation/CanvasGroupAnimator.cs.meta new file mode 100644 index 00000000..fb50f5e3 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation/CanvasGroupAnimator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b72ff1bad3f94b12a974fe06b518cd8a +timeCreated: 1599211573 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation/IAnimationState.cs b/Assets/SharpUI/Source/Common/UI/Util/Animation/IAnimationState.cs new file mode 100644 index 00000000..3e9a3c0a --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation/IAnimationState.cs @@ -0,0 +1,9 @@ +namespace SharpUI.Source.Common.UI.Util.Animation +{ + public interface IAnimationState + { + void OnAnimationBegin(); + void OnAnimationEnd(); + bool IsAnimating(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation/IAnimationState.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Animation/IAnimationState.cs.meta new file mode 100644 index 00000000..70eee785 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation/IAnimationState.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: db59901e509e4facb86ffb1de0c40f47 +timeCreated: 1599220954 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation/ICanvasGroupAnimator.cs b/Assets/SharpUI/Source/Common/UI/Util/Animation/ICanvasGroupAnimator.cs new file mode 100644 index 00000000..8d8d934e --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation/ICanvasGroupAnimator.cs @@ -0,0 +1,21 @@ +using SharpUI.Source.Common.Util.Reactive; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Util.Animation +{ + public interface ICanvasGroupAnimator + { + void SetDisposable(CompositeDisposable disposable); + void SetAnimationState(IAnimationState state); + void TakeCanvasGroup(CanvasGroup group); + void SetDelayObserver(IDelayObserver delayObserver); + void SetHideDelayMillis(long delay); + void DropCanvasGroup(); + bool IsCanvasGroupVisible(); + void FadeIn(); + void FadeOut(); + void ShowCanvasGroup(); + void HideCanvasGroup(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Animation/ICanvasGroupAnimator.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Animation/ICanvasGroupAnimator.cs.meta new file mode 100644 index 00000000..83a652e9 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Animation/ICanvasGroupAnimator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 03d3e40945014d06a57f7810832b4267 +timeCreated: 1599214252 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Event.meta b/Assets/SharpUI/Source/Common/UI/Util/Event.meta new file mode 100644 index 00000000..75d6bc83 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Event.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 48094dd8b0234068aed721b115121975 +timeCreated: 1600585374 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Event/CurrentGameObjectProvider.cs b/Assets/SharpUI/Source/Common/UI/Util/Event/CurrentGameObjectProvider.cs new file mode 100644 index 00000000..a9866976 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Event/CurrentGameObjectProvider.cs @@ -0,0 +1,10 @@ +using UnityEngine; +using UnityEngine.EventSystems; + +namespace SharpUI.Source.Common.UI.Util.Event +{ + public class CurrentGameObjectProvider : ICurrentGameObjectProvider + { + public GameObject GetCurrentSelectedGameObject() => EventSystem.current.currentSelectedGameObject; + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Event/CurrentGameObjectProvider.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Event/CurrentGameObjectProvider.cs.meta new file mode 100644 index 00000000..4b234cf1 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Event/CurrentGameObjectProvider.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8ebc742933614ff693529ddb2c3fb83c +timeCreated: 1600585389 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Event/ICurrentGameObjectProvider.cs b/Assets/SharpUI/Source/Common/UI/Util/Event/ICurrentGameObjectProvider.cs new file mode 100644 index 00000000..280ee137 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Event/ICurrentGameObjectProvider.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Util.Event +{ + public interface ICurrentGameObjectProvider + { + GameObject GetCurrentSelectedGameObject(); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Event/ICurrentGameObjectProvider.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Event/ICurrentGameObjectProvider.cs.meta new file mode 100644 index 00000000..65a89414 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Event/ICurrentGameObjectProvider.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: edaf1b7159f24352ade17c6ff13c068b +timeCreated: 1600585475 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/IUiUtil.cs b/Assets/SharpUI/Source/Common/UI/Util/IUiUtil.cs new file mode 100644 index 00000000..976a9fb4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/IUiUtil.cs @@ -0,0 +1,10 @@ +namespace SharpUI.Source.Common.UI.Util +{ + public interface IUiUtil + { + bool PercentInRange(float percent); + float ToDecimalPercentage(float percentage); + float ToPercentage(float decimalPercentage); + float Half(float value); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/IUiUtil.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/IUiUtil.cs.meta new file mode 100644 index 00000000..357f7b85 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/IUiUtil.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 394d0a72a85e48119a229f530e30701c +timeCreated: 1597389939 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Keyboard.meta b/Assets/SharpUI/Source/Common/UI/Util/Keyboard.meta new file mode 100644 index 00000000..7bff8651 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Keyboard.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: df35fa0691914639b905f9e9166d1d38 +timeCreated: 1600377952 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyInputState.cs b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyInputState.cs new file mode 100644 index 00000000..9a2cdbdd --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyInputState.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Util.Keyboard +{ + public interface IKeyInputState + { + bool IsKeyPressed(KeyCode code); + bool IsKeyReleased(KeyCode code); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyInputState.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyInputState.cs.meta new file mode 100644 index 00000000..9bdc3567 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyInputState.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8c398e5b0ed3422280ffdedadf5f55fa +timeCreated: 1600584510 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyListener.cs b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyListener.cs new file mode 100644 index 00000000..05cb4f10 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyListener.cs @@ -0,0 +1,19 @@ +using System; +using SharpUI.Source.Common.UI.Elements.Button; +using UniRx; +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Util.Keyboard +{ + public interface IKeyListener + { + void ListenToKey(KeyCode keyCode); + void AddFilterTag(string filterTag); + void RemoveFilterTag(string filterTag); + void TakeButton(BaseButton baseButton); + IObservable ObserveDown(); + IObservable ObserveUp(); + void RequireAnyShift(bool require = true); + void RequireAnyControl(bool require = true); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyListener.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyListener.cs.meta new file mode 100644 index 00000000..5ba24f6c --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/IKeyListener.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2a2e7d69072a423d97953a34f76ff0eb +timeCreated: 1600378491 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Keyboard/KeyInputState.cs b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/KeyInputState.cs new file mode 100644 index 00000000..5180eb98 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/KeyInputState.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace SharpUI.Source.Common.UI.Util.Keyboard +{ + public class KeyInputState : IKeyInputState + { + public bool IsKeyPressed(KeyCode code) => Input.GetKeyDown(code); + + public bool IsKeyReleased(KeyCode code) => Input.GetKeyUp(code); + } +} \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Keyboard/KeyInputState.cs.meta b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/KeyInputState.cs.meta new file mode 100644 index 00000000..5882ecd4 --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/KeyInputState.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 939031d155ee451caf11c550e9b8b07b +timeCreated: 1600584401 \ No newline at end of file diff --git a/Assets/SharpUI/Source/Common/UI/Util/Keyboard/SimpleKeyListener.cs b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/SimpleKeyListener.cs new file mode 100644 index 00000000..60686f4d --- /dev/null +++ b/Assets/SharpUI/Source/Common/UI/Util/Keyboard/SimpleKeyListener.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using JetBrains.Annotations; +using SharpUI.Source.Common.UI.Elements.Button; +using SharpUI.Source.Common.UI.Elements.Decorators; +using SharpUI.Source.Common.UI.Util.Event; +using UniRx; +using UnityEngine; +using UnityEngine.UI; + +namespace SharpUI.Source.Common.UI.Util.Keyboard +{ + public class SimpleKeyListener : MonoBehaviour, IKeyListener + { + public const string DefaultInputTextTag = "InputField"; + private static IEnumerable DefaultGameObjectFilterTags => new List { DefaultInputTextTag }; + private readonly List _gameObjectFilterTags = new List(DefaultGameObjectFilterTags); + private readonly Subject _allKeysDownObserver = new Subject(); + private readonly Subject _anyKeyUpObserver = new Subject(); + + [CanBeNull] private BaseButton _baseButton; + [CanBeNull] private Button _button; + private IKeyInputState _state = new KeyInputState(); + private ICurrentGameObjectProvider _currentGameObjectProvider = new CurrentGameObjectProvider(); + private KeyCode _keyCode; + private bool _requireShift; + private bool _shiftDown; + private bool _requireControl; + private bool _controlDown; + + public void Update() + { + if (!ShouldRecordKeyEvents()) + return; + + CheckDown(); + CheckUp(); + } + + public void SetKeyInputState(IKeyInputState state) => _state = state; + + public void SetCurrentGameObjectProvider(ICurrentGameObjectProvider provider) => + _currentGameObjectProvider = provider; + + public void TakeButton(BaseButton button) + { + if (button == null) return; + + _baseButton = button; + _button = _baseButton.GetComponent