Browse Source

Performance: Planet Indicators auf einem Canvas

master
laurids 2 years ago
parent
commit
3e665b820e
5 changed files with 52 additions and 51 deletions
  1. +34
    -41
      Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab
  2. +2
    -4
      Assets/GWConquest/Scripts/Planet.cs
  3. +3
    -1
      Assets/GWConquest/Scripts/UI/PlanetIndicatorUI.cs
  4. +11
    -3
      Assets/GWConquest/Scripts/UI/UIZoomScaling.cs
  5. +2
    -2
      Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset

+ 34
- 41
Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab View File

@ -345,6 +345,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ZoomThreshold: 400 ZoomThreshold: 400
ConstantScale: 1 ConstantScale: 1
Inverted: 0
--- !u!1 &1573826406629317414 --- !u!1 &1573826406629317414
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1015,8 +1016,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 02e6f936b2dd0634b921848bc8ca4842, type: 3} m_Script: {fileID: 11500000, guid: 02e6f936b2dd0634b921848bc8ca4842, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ZoomThreshold: 550
ZoomThreshold: 800
ConstantScale: 1 ConstantScale: 1
Inverted: 0
--- !u!1 &4082808148708746503 --- !u!1 &4082808148708746503
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1466,10 +1468,11 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 7384831771431062766} - component: {fileID: 7384831771431062766}
- component: {fileID: 7384831771431062765}
- component: {fileID: 7384831771431062764} - component: {fileID: 7384831771431062764}
- component: {fileID: 7384831771431062767} - component: {fileID: 7384831771431062767}
- component: {fileID: 6701703001733289505} - component: {fileID: 6701703001733289505}
- component: {fileID: 1235410532173918665}
- component: {fileID: 995647594929474570}
m_Layer: 0 m_Layer: 0
m_Name: PlanetIndicator m_Name: PlanetIndicator
m_TagString: Untagged m_TagString: Untagged
@ -1499,27 +1502,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 200} m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 0.5, y: 0.5} 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 --- !u!114 &7384831771431062764
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1548,23 +1530,6 @@ MonoBehaviour:
DistrictSymbols: {fileID: 6852626612145593344} DistrictSymbols: {fileID: 6852626612145593344}
DistrictSymbolPrefab: {fileID: 7541130419680964748, guid: 8fca0dbef7b398042895a2af57b648ea, DistrictSymbolPrefab: {fileID: 7541130419680964748, guid: 8fca0dbef7b398042895a2af57b648ea,
type: 3} 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 --- !u!114 &7384831771431062767
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1572,7 +1537,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7384831771431062761} m_GameObject: {fileID: 7384831771431062761}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e11e604ed3fa06f4bb0769de129bd71d, type: 3} m_Script: {fileID: 11500000, guid: e11e604ed3fa06f4bb0769de129bd71d, type: 3}
m_Name: m_Name:
@ -1596,6 +1561,34 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 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 --- !u!1 &7992197144211585402
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0


+ 2
- 4
Assets/GWConquest/Scripts/Planet.cs View File

@ -264,10 +264,8 @@ namespace GWConquest
if (showPlanetName) if (showPlanetName)
{ {
GameObject text = Instantiate(textPrefab); 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<PlanetIndicatorUI>(); indicatorUI = text.GetComponent<PlanetIndicatorUI>();
indicatorUI.SetPlanet(this); indicatorUI.SetPlanet(this);
} }


+ 3
- 1
Assets/GWConquest/Scripts/UI/PlanetIndicatorUI.cs View File

@ -43,6 +43,8 @@ namespace GWConquest
PlanetNameText.text = planet.PlanetName.ToUpper(); PlanetNameText.text = planet.PlanetName.ToUpper();
PlanetNameText.gameObject.SetActive(planet.showPlanetName); PlanetNameText.gameObject.SetActive(planet.showPlanetName);
GetComponent<StickUIToPlanet>().target = planet.transform;
foreach(var d in planet.GetComponentsInChildren<District>()) foreach(var d in planet.GetComponentsInChildren<District>())
{ {
var type = d.DistrictType; var type = d.DistrictType;
@ -115,7 +117,7 @@ namespace GWConquest
} }
private void FixedUpdate() { private void FixedUpdate() {
if(GameManager.EntitiesLoaded && Planet != null && Util.IsPointOnScreen(transform.position))
if(GameManager.EntitiesLoaded && Planet != null && Util.IsPointOnScreen(Planet.transform.position))
{ {
//UpdateIndicator(); //UpdateIndicator();


+ 11
- 3
Assets/GWConquest/Scripts/UI/UIZoomScaling.cs View File

@ -6,6 +6,7 @@ namespace GWConquest {
{ {
public float ZoomThreshold; public float ZoomThreshold;
public float ConstantScale; public float ConstantScale;
public bool Inverted;
public void UpdateScaling() public void UpdateScaling()
{ {
@ -25,9 +26,16 @@ namespace GWConquest {
if (distance < ZoomThreshold) 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 else
{ {


+ 2
- 2
Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset View File

@ -50,10 +50,10 @@ MonoBehaviour:
debugStartPort: 54321 debugStartPort: 54321
debugBuildMode: 1 debugBuildMode: 1
debugStartMapName: GalaxyMap debugStartMapName: GalaxyMap
debugPlayAsServer: 0
debugPlayAsServer: 1
showDebugInfo: 0 showDebugInfo: 0
overrideTimeScale: 1 overrideTimeScale: 1
debugEditorMode: 2
debugEditorMode: 1
consoleToggleKey: 9 consoleToggleKey: 9
consoleVisibleByDefault: 0 consoleVisibleByDefault: 0
compilationWarnLevel: 4 compilationWarnLevel: 4


Loading…
Cancel
Save