From 0cea62327f389072034c26baa5532f9ab503f6dd Mon Sep 17 00:00:00 2001 From: LH Date: Mon, 9 Dec 2019 14:56:10 +0800 Subject: [PATCH] [03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC] Added Change init PortaitInitIndex feature. --- .../Assets/RoyalGalleryPortrait.unity | 61 ++++++++++++++++++- .../Script/PortraitManager.cs | 38 ++++++++---- .../Packages/manifest.json | 3 +- 3 files changed, 86 insertions(+), 16 deletions(-) diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait.unity b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait.unity index 498378b..735c4bd 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait.unity +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait.unity @@ -1168,6 +1168,63 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 680606863} m_CullTransparentMesh: 0 +--- !u!1001 &758593924 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1056807493977812, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_Name + value: ConfigurationServer + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_RootOrder + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6143453941a05b54582f835773a10d58, type: 3} --- !u!1 &779577949 GameObject: m_ObjectHideFlags: 0 @@ -2431,7 +2488,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d8813dde4fb2c304bbcde08119f57d54, type: 3} m_Name: m_EditorClassIdentifier: - show_cur: + PortaitInitIndex: 0 camera: {fileID: 961139954} server: {fileID: 977824800} mode: 0 @@ -5099,7 +5156,7 @@ Transform: - {fileID: 2135091040} - {fileID: 274290747} m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1953387457 GameObject: diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/PortraitManager.cs b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/PortraitManager.cs index e4a5dc7..1c93e7e 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/PortraitManager.cs +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/PortraitManager.cs @@ -9,11 +9,16 @@ namespace UltraCombos.Frozen public class PortraitManager : MonoBehaviour { Dictionary portraits; - public string show_cur; + + [Configuration.Config] + [Range(0, 15)] + public int PortaitInitIndex = 0; + + string PortraitKeyCur = ""; public Camera camera; public RoyalGallery.RorayGalleryGrpcServer server; - string show_nxt = null; + string portraitKeyNxt = null; [SerializeField, Header("Debug")] bool mode = false; @@ -27,6 +32,8 @@ namespace UltraCombos.Frozen private void Start() { portraits = new Dictionary(); + + int i = 0; foreach (var p in GetComponentsInChildren()) { if (!p.isActiveAndEnabled) @@ -35,7 +42,12 @@ namespace UltraCombos.Frozen } portraits.Add(p.id, p); - // p.isVisible = false; + if (i == PortaitInitIndex) + { + PortraitKeyCur = p.id; + } + + ++i; } if (portraits.Count == 0) @@ -43,14 +55,14 @@ namespace UltraCombos.Frozen return; } - if (!portraits.ContainsKey(show_cur)) + if (!portraits.ContainsKey(PortraitKeyCur)) { - show_cur = ""; - show_nxt = portraits.Keys.GetEnumerator().Current; + PortraitKeyCur = ""; + portraitKeyNxt = portraits.Keys.GetEnumerator().Current; } else { - show_nxt = show_cur; + portraitKeyNxt = PortraitKeyCur; } if (server) @@ -66,18 +78,18 @@ namespace UltraCombos.Frozen return; } - if (show_nxt != null) + if (portraitKeyNxt != null) { - if (portraits.ContainsKey(show_cur)) + if (portraits.ContainsKey(PortraitKeyCur)) { //portraits[show_cur].isVisible = false; } - show_cur = show_nxt; - show_nxt = null; + PortraitKeyCur = portraitKeyNxt; + portraitKeyNxt = null; Transform tf = camera.GetComponent(); - Vector2 tar = portraits[show_cur].Positon; + Vector2 tar = portraits[PortraitKeyCur].Positon; camera.GetComponent().localPosition = new Vector3(tar.x, tar.y, tf.localPosition.z); //portraits[show_cur].isVisible = true; @@ -107,7 +119,7 @@ namespace UltraCombos.Frozen painting.UpdateTexture(texture); onPaintingUpdated.Invoke(painting.transform.position); - show_nxt = id; + portraitKeyNxt = id; } } diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Packages/manifest.json b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Packages/manifest.json index d809dfc..200881e 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Packages/manifest.json +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Packages/manifest.json @@ -1,10 +1,11 @@ { "dependencies": { + "com.ultracombos.configuration": "file:/../../../../../_Package/com.ultracombos.configuration", "com.ultracombos.grpc": "file:/../../../../../_Package/com.ultracombos.grpc", "com.ultracombos.minions-girlsroom-asset": "file:/../../../../../_Package/com.ultracombos.minions-girlsroom-asset", "com.ultracombos.movie-player": "file:/../../../../../_Package/com.ultracombos.movie-player", "com.ultracombos.utility-native-plugin": "file:/../../../../../_Package/com.ultracombos.utility-native-plugin", - "com.ultracombos.frozen.royal-gallery-asset": "file:/../../../../../_Package/com.ultracombos.frozen.royal-gallery-asset", + "com.ultracombos.frozen.royal-gallery-asset": "file:/../../../../../_Package/com.ultracombos.frozen.royal-gallery-asset", "com.unity.2d.animation": "1.0.16-preview.1", "com.unity.collab-proxy": "1.2.15", "com.unity.package-manager-ui": "2.0.8",