From 3e665b820e4c34eaeda6662c109e550c82b32385 Mon Sep 17 00:00:00 2001 From: laurids Date: Sun, 28 Nov 2021 14:53:47 +0100 Subject: [PATCH] Performance: Planet Indicators auf einem Canvas --- .../Prefabs/UI/PlanetIndicator.prefab | 75 +++++++++---------- Assets/GWConquest/Scripts/Planet.cs | 6 +- .../Scripts/UI/PlanetIndicatorUI.cs | 4 +- Assets/GWConquest/Scripts/UI/UIZoomScaling.cs | 14 +++- .../resources/BoltRuntimeSettings.asset | 4 +- 5 files changed, 52 insertions(+), 51 deletions(-) diff --git a/Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab b/Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab index 49a2aed..642f0f8 100644 --- a/Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab +++ b/Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab @@ -345,6 +345,7 @@ MonoBehaviour: m_EditorClassIdentifier: ZoomThreshold: 400 ConstantScale: 1 + Inverted: 0 --- !u!1 &1573826406629317414 GameObject: m_ObjectHideFlags: 0 @@ -1015,8 +1016,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 02e6f936b2dd0634b921848bc8ca4842, type: 3} m_Name: m_EditorClassIdentifier: - ZoomThreshold: 550 + ZoomThreshold: 800 ConstantScale: 1 + Inverted: 0 --- !u!1 &4082808148708746503 GameObject: m_ObjectHideFlags: 0 @@ -1466,10 +1468,11 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 7384831771431062766} - - component: {fileID: 7384831771431062765} - component: {fileID: 7384831771431062764} - component: {fileID: 7384831771431062767} - component: {fileID: 6701703001733289505} + - component: {fileID: 1235410532173918665} + - component: {fileID: 995647594929474570} m_Layer: 0 m_Name: PlanetIndicator m_TagString: Untagged @@ -1499,27 +1502,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 200} m_Pivot: {x: 0.5, y: 0.5} ---- !u!223 &7384831771431062765 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7384831771431062761} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 2 - 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 &7384831771431062764 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1548,23 +1530,6 @@ MonoBehaviour: DistrictSymbols: {fileID: 6852626612145593344} DistrictSymbolPrefab: {fileID: 7541130419680964748, guid: 8fca0dbef7b398042895a2af57b648ea, type: 3} - DistrictSymbolTypes: - - DistrictType: 0 - Icon: {fileID: 21300000, guid: e08b397bc0cb6f642bfe7743721d644f, type: 3} - - DistrictType: 1 - Icon: {fileID: 21300000, guid: d6a99e4127bc1b64d9063cd2d1555439, type: 3} - - DistrictType: 2 - Icon: {fileID: 21300000, guid: eb2e846cc08c4064d8c4955a8ea81cf5, type: 3} - - DistrictType: 3 - Icon: {fileID: 21300000, guid: b724aa86e8fd31f4f9258e385e3a6757, type: 3} - - DistrictType: 4 - Icon: {fileID: 21300000, guid: 4fb8dc43dcaf1a240b82465fc3e9ae63, type: 3} - - DistrictType: 5 - Icon: {fileID: 21300000, guid: db5bbf45ac428c240a974c5887ce8dce, type: 3} - - DistrictType: 7 - Icon: {fileID: 21300000, guid: 451f948452dceda4cac8ed980695cf82, type: 3} - - DistrictType: 6 - Icon: {fileID: 21300000, guid: a8b2bb0f05ad6834c934a24e73d0d532, type: 3} --- !u!114 &7384831771431062767 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1572,7 +1537,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7384831771431062761} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: e11e604ed3fa06f4bb0769de129bd71d, type: 3} m_Name: @@ -1596,6 +1561,34 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &1235410532173918665 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384831771431062761} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d18f53b7611f3644afea9c395a4812c, type: 3} + m_Name: + m_EditorClassIdentifier: + target: {fileID: 0} +--- !u!114 &995647594929474570 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7384831771431062761} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 02e6f936b2dd0634b921848bc8ca4842, type: 3} + m_Name: + m_EditorClassIdentifier: + ZoomThreshold: 800 + ConstantScale: 1 + Inverted: 1 --- !u!1 &7992197144211585402 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/GWConquest/Scripts/Planet.cs b/Assets/GWConquest/Scripts/Planet.cs index 604e399..b8b6d0d 100644 --- a/Assets/GWConquest/Scripts/Planet.cs +++ b/Assets/GWConquest/Scripts/Planet.cs @@ -264,10 +264,8 @@ namespace GWConquest if (showPlanetName) { GameObject text = Instantiate(textPrefab); - text.transform.SetParent(transform); - text.transform.localPosition = Vector3.zero; - text.transform.localRotation = Quaternion.identity; - text.transform.localScale = Vector3.one; + text.transform.SetParent(IngameUI.Instance.PlanetNames.transform); + indicatorUI = text.GetComponent(); indicatorUI.SetPlanet(this); } diff --git a/Assets/GWConquest/Scripts/UI/PlanetIndicatorUI.cs b/Assets/GWConquest/Scripts/UI/PlanetIndicatorUI.cs index 26aa01c..520f55a 100644 --- a/Assets/GWConquest/Scripts/UI/PlanetIndicatorUI.cs +++ b/Assets/GWConquest/Scripts/UI/PlanetIndicatorUI.cs @@ -43,6 +43,8 @@ namespace GWConquest PlanetNameText.text = planet.PlanetName.ToUpper(); PlanetNameText.gameObject.SetActive(planet.showPlanetName); + GetComponent().target = planet.transform; + foreach(var d in planet.GetComponentsInChildren()) { var type = d.DistrictType; @@ -115,7 +117,7 @@ namespace GWConquest } private void FixedUpdate() { - if(GameManager.EntitiesLoaded && Planet != null && Util.IsPointOnScreen(transform.position)) + if(GameManager.EntitiesLoaded && Planet != null && Util.IsPointOnScreen(Planet.transform.position)) { //UpdateIndicator(); diff --git a/Assets/GWConquest/Scripts/UI/UIZoomScaling.cs b/Assets/GWConquest/Scripts/UI/UIZoomScaling.cs index 56efc57..18d63ec 100644 --- a/Assets/GWConquest/Scripts/UI/UIZoomScaling.cs +++ b/Assets/GWConquest/Scripts/UI/UIZoomScaling.cs @@ -6,6 +6,7 @@ namespace GWConquest { { public float ZoomThreshold; public float ConstantScale; + public bool Inverted; public void UpdateScaling() { @@ -25,9 +26,16 @@ namespace GWConquest { if (distance < ZoomThreshold) { - // Linear slope through zero - float planetScaleNear = ConstantScale / ZoomThreshold; - scale = distance * planetScaleNear; + + if(Inverted) + { + scale = ConstantScale * ZoomThreshold / distance; + } + else { + // Linear slope through zero + scale = ConstantScale * distance / ZoomThreshold; + } + } else { diff --git a/Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset b/Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset index b08a1fa..1fbbca9 100644 --- a/Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset +++ b/Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset @@ -50,10 +50,10 @@ MonoBehaviour: debugStartPort: 54321 debugBuildMode: 1 debugStartMapName: GalaxyMap - debugPlayAsServer: 0 + debugPlayAsServer: 1 showDebugInfo: 0 overrideTimeScale: 1 - debugEditorMode: 2 + debugEditorMode: 1 consoleToggleKey: 9 consoleVisibleByDefault: 0 compilationWarnLevel: 4