private void OnPatchVisibilityChange(DataLayer dataLayer, Patch patch, bool visible) { if (visible && filterPanel != null) { bool categorizedPatch; if (patch.Data is GridData gridData) { categorizedPatch = gridData.IsCategorized; } else if (patch.Data is PointData pointData) { categorizedPatch = pointData.IsCategorized; } else { return; } if (categorizedPatch ^ categorizedPanel) { Destroy(filterPanel.gameObject); filterPanel = null; if (IsFilterToggleOn) { CreateFilterPanel(categorizedPatch); } } } }
// // Private Methods // private void CreateFilterPanel(bool categorized) { categorizedPanel = categorized; if (categorized) { filterPanel = Instantiate(categorizedPanelPrefab, transform, false); } else { filterPanel = Instantiate(continuousPanelPrefab, transform, false); } filterPanel.Init(dataLayer); }
private void OnPatchVisibilityChange(DataLayer dataLayer, Patch patch, bool visible) { if (visible && filterPanel != null) { if (patch.Data is GridData) { bool categorizedPatch = (patch.Data as GridData).IsCategorized; if (categorizedPatch ^ categorizedPanel) { Destroy(filterPanel.gameObject); filterPanel = null; if (IsFilterToggleOn) { CreateFilterPanel(categorizedPatch); } } } } }