Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angus/77 load new cubes #252

Merged
merged 19 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions Assets/Scenes/ui.unity
Original file line number Diff line number Diff line change
Expand Up @@ -5111,9 +5111,9 @@ RectTransform:
m_Father: {fileID: 696549065}
m_RootOrder: 7
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_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 470, y: -34.15}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &149100829
Expand Down Expand Up @@ -10980,9 +10980,9 @@ RectTransform:
m_Father: {fileID: 696549065}
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_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 410, y: -34.15}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &366508109
Expand Down Expand Up @@ -13785,10 +13785,10 @@ RectTransform:
m_Father: {fileID: 608142348}
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: 25}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 320, y: -12.5}
m_SizeDelta: {x: 640, y: 25}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &423108921
GameObject:
Expand Down Expand Up @@ -18905,9 +18905,9 @@ RectTransform:
m_Father: {fileID: 696549065}
m_RootOrder: 2
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_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 290, y: -34.15}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &558938655
Expand Down Expand Up @@ -23696,10 +23696,10 @@ RectTransform:
m_Father: {fileID: 608142348}
m_RootOrder: 4
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: 68.3}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 320, y: -552.3929}
m_SizeDelta: {x: 640, y: 68.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &696549066
MonoBehaviour:
Expand Down Expand Up @@ -28305,7 +28305,7 @@ PrefabInstance:
- target: {fileID: 224141822819573504, guid: 3c01abf790e1a42ca8d10525f571cab5,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224141822819573504, guid: 3c01abf790e1a42ca8d10525f571cab5,
type: 3}
Expand All @@ -28315,12 +28315,12 @@ PrefabInstance:
- target: {fileID: 224141822819573504, guid: 3c01abf790e1a42ca8d10525f571cab5,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 224141822819573504, guid: 3c01abf790e1a42ca8d10525f571cab5,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
value: 640
objectReference: {fileID: 0}
- target: {fileID: 224141822819573504, guid: 3c01abf790e1a42ca8d10525f571cab5,
type: 3}
Expand Down Expand Up @@ -28365,12 +28365,12 @@ PrefabInstance:
- target: {fileID: 224141822819573504, guid: 3c01abf790e1a42ca8d10525f571cab5,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 320
objectReference: {fileID: 0}
- target: {fileID: 224141822819573504, guid: 3c01abf790e1a42ca8d10525f571cab5,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -236.52142
objectReference: {fileID: 0}
- target: {fileID: 224141822819573504, guid: 3c01abf790e1a42ca8d10525f571cab5,
type: 3}
Expand Down Expand Up @@ -28613,9 +28613,9 @@ RectTransform:
m_Father: {fileID: 1483820374}
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_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 320, y: -17.55}
m_SizeDelta: {x: 625.7892, y: 34.03119}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &820360713
Expand Down Expand Up @@ -28847,7 +28847,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &822478520
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -46269,7 +46269,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1326015993}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -2}
m_LocalPosition: {x: 0, y: 0, z: -1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 260993856}
Expand Down Expand Up @@ -51016,10 +51016,10 @@ RectTransform:
m_Father: {fileID: 608142348}
m_RootOrder: 3
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: 35.1}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 320, y: -500.69284}
m_SizeDelta: {x: 640, y: 35.1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1483820375
MonoBehaviour:
Expand Down Expand Up @@ -55356,10 +55356,10 @@ RectTransform:
m_Father: {fileID: 608142348}
m_RootOrder: 2
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: 35.1}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 320, y: -465.59283}
m_SizeDelta: {x: 640, y: 35.1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1581051998
MonoBehaviour:
Expand Down Expand Up @@ -62791,9 +62791,9 @@ RectTransform:
m_Father: {fileID: 696549065}
m_RootOrder: 1
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_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 230, y: -34.15}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1781468239
Expand Down Expand Up @@ -66151,9 +66151,9 @@ RectTransform:
m_Father: {fileID: 1581051997}
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_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 320, y: -17.55}
m_SizeDelta: {x: 625.7892, y: 34.03119}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1844524415
Expand Down Expand Up @@ -74479,9 +74479,9 @@ RectTransform:
m_Father: {fileID: 696549065}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 170, y: -34.15}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2086196501
Expand Down Expand Up @@ -74759,9 +74759,9 @@ RectTransform:
m_Father: {fileID: 696549065}
m_RootOrder: 3
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_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 350, y: -34.15}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2091469022
Expand Down
34 changes: 21 additions & 13 deletions Assets/Scripts/FeatureData/FeatureMenuController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class FeatureMenuController : MonoBehaviour
[SerializeField]
private RectTransform content = null;

public List<GameObject> SofiaObjectsList {get; private set;}

public GameObject volumeDatasetRendererObj = null;
public RecyclableScrollRect RecyclableScrollView;
public GameObject InfoWindow = null;
Expand All @@ -34,8 +32,6 @@ public class FeatureMenuController : MonoBehaviour


void OnEnable() {
SofiaObjectsList = new List<GameObject>();

if (volumeDatasetRendererObj != null)
_dataSets = volumeDatasetRendererObj.GetComponentsInChildren<VolumeDataSetRenderer>(true);

Expand All @@ -48,19 +44,31 @@ void OnEnable() {
{
featureSetManager = _activeDataSet.GetComponentInChildren<FeatureSetManager>();
}
if (featureSetManager.ImportedFeatureSetList.Count > 0)

if (featureSetManager)
{
RecyclableScrollView.Initialize(featureSetManager.ImportedFeatureSetList[0].FeatureMenuScrollerDataSource);
ListTitle.text = featureSetManager.ImportedFeatureSetList[CurrentFeatureSetIndex].name;
featureSetManager.NeedToRespawnMenuList = true;
}
if (featureSetManager.ImportedFeatureSetList?.Count > 0)
{
RecyclableScrollView.Initialize(featureSetManager.ImportedFeatureSetList[0].FeatureMenuScrollerDataSource);
ListTitle.text = featureSetManager.ImportedFeatureSetList[CurrentFeatureSetIndex].name;
}
}
}

private void OnDisable()
{
_activeDataSet = null;
CurrentFeatureSetIndex = 0;
featureSetManager = null;
_dataSets = null;
}

void Update()
{
if (featureSetManager != null && featureSetManager.NeedToRespawnMenuList)
if (featureSetManager?.NeedToRespawnMenuList == true)
{
if (featureSetManager.SelectedFeature != null && featureSetManager.SelectedFeature.Index != -1)
if (featureSetManager.SelectedFeature?.Index != null && featureSetManager.SelectedFeature.Index != -1)
{
UpdateInfo();
DisplaySet(featureSetManager.SelectedFeature.FeatureSetParent.Index);
Expand All @@ -70,7 +78,7 @@ void Update()
RecyclableScrollView.ReloadData();
featureSetManager.NeedToRespawnMenuList = false;
}
if (featureSetManager.NeedToUpdateInfo)
if (featureSetManager?.NeedToUpdateInfo == true)
{
UpdateInfo();
featureSetManager.NeedToUpdateInfo = false;
Expand All @@ -91,7 +99,7 @@ private VolumeDataSetRenderer getFirstActiveDataSet()

public void DisplayNextSet()
{
if ( featureSetManager.ImportedFeatureSetList.Count > 1)
if (featureSetManager?.ImportedFeatureSetList?.Count > 1)
{
CurrentFeatureSetIndex++;
if (CurrentFeatureSetIndex >= featureSetManager.ImportedFeatureSetList.Count)
Expand All @@ -102,7 +110,7 @@ public void DisplayNextSet()

public void DisplayPreviousSet()
{
if (featureSetManager.ImportedFeatureSetList.Count > 1)
if (featureSetManager?.ImportedFeatureSetList?.Count > 1)
{
CurrentFeatureSetIndex--;
if (CurrentFeatureSetIndex < 0)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/FeatureData/FeatureMenuDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void InitData()
/// </summary>
public int GetItemCount()
{
return _sofiaList.Count;
return _sofiaList?.Count ?? 0;
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Menu/QuickMenuController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ public void ToggleFeatures()
case 0:
this.gameObject.transform.Find("Image_fet_on").gameObject.SetActive(true);
notificationText.GetComponent<Text>().text = "Features enabled";
_activeDataSet.GetComponentInChildren<FeatureSetManager>().GetComponentsInChildren<FeatureSetRenderer>()[1].ToggleVisibility();
_activeDataSet.GetComponentInChildren<FeatureSetManager>()?.GetComponentsInChildren<FeatureSetRenderer>()?[1]?.ToggleVisibility();
break;
case 1:
this.gameObject.transform.Find("Image_fet_off").gameObject.SetActive(true);
notificationText.GetComponent<Text>().text = "Features disabled";
_activeDataSet.GetComponentInChildren<FeatureSetManager>().GetComponentsInChildren<FeatureSetRenderer>()[1].ToggleVisibility();
_activeDataSet.GetComponentInChildren<FeatureSetManager>()?.GetComponentsInChildren<FeatureSetRenderer>()?[1]?.ToggleVisibility();
break;
}
}
Expand Down
Loading