|
@@ -45,6 +45,7 @@ public class EncyclopediaUi : MonoBehaviour
|
|
|
|
|
|
public void Populate()
|
|
|
{
|
|
|
+ if(showDebug) Debug.Log("Creating Encyclopedia UI Element");
|
|
|
menuIndex = controller.menuIndex;
|
|
|
subMenuIndex = controller.subMenuIndex;
|
|
|
currentMenuIndex = controller.menuIndex;
|
|
@@ -60,7 +61,7 @@ public class EncyclopediaUi : MonoBehaviour
|
|
|
menuButtonSelection = new List<SelectedButton>();
|
|
|
Button[] oldButtons = menuContainer.GetComponentsInChildren<Button>();
|
|
|
int counter = 0;
|
|
|
- if(showDebug) Debug.Log($"Destroying {oldButtons.Length} menu buttons");
|
|
|
+ //if(showDebug) Debug.Log($"Destroying {oldButtons.Length} menu buttons");
|
|
|
foreach (Button item in oldButtons) DestroyImmediate(item.gameObject);
|
|
|
foreach (EncyclopediaCategory category in controller.categories)
|
|
|
{
|
|
@@ -78,7 +79,7 @@ public class EncyclopediaUi : MonoBehaviour
|
|
|
//menuIndex = controller.menuIndex;
|
|
|
menuButtonSelection[menuIndex].Select();
|
|
|
}
|
|
|
- if(showDebug) Debug.Log($"Created {counter} menu buttons");
|
|
|
+ //if(showDebug) Debug.Log($"Created {counter} menu buttons");
|
|
|
}
|
|
|
|
|
|
public void CreateSubMenu()
|
|
@@ -89,7 +90,7 @@ public class EncyclopediaUi : MonoBehaviour
|
|
|
int counter = 0;
|
|
|
var category = controller.categories[controller.menuIndex];
|
|
|
category.UpdateArticles();
|
|
|
- if(showDebug) Debug.Log($"Destroying {oldButtons.Length} sub menu buttons");
|
|
|
+ //if(showDebug) Debug.Log($"Destroying {oldButtons.Length} sub menu buttons");
|
|
|
foreach (Button item in oldButtons) DestroyImmediate(item.gameObject);
|
|
|
foreach (EncyclopediaArticle article in category.GetArticles())
|
|
|
{
|
|
@@ -110,7 +111,7 @@ public class EncyclopediaUi : MonoBehaviour
|
|
|
//subMenuIndex = controller.subMenuIndex;
|
|
|
subMenuButtonSelection[subMenuIndex].Select();
|
|
|
}
|
|
|
- if(showDebug) Debug.Log($"Created {counter} sub menu buttons");
|
|
|
+ //if(showDebug) Debug.Log($"Created {counter} sub menu buttons");
|
|
|
}
|
|
|
|
|
|
public void ShowArticle()
|
|
@@ -123,7 +124,9 @@ public class EncyclopediaUi : MonoBehaviour
|
|
|
if(layout == null) return;
|
|
|
HideViews();
|
|
|
layout.view.SetActive(true);
|
|
|
- foreach (var item in layout.view.GetComponentsInChildren<EncyclopediaArticleUi>(true))
|
|
|
+ var contentDataViews = layout.view.GetComponentsInChildren<IEncyclopediaArticleDataView>(true);
|
|
|
+ if(showDebug) Debug.Log($"Showing article content in layout {category.layoutName} and found {contentDataViews.Length} dataViewComponents");
|
|
|
+ foreach (var item in contentDataViews)
|
|
|
{
|
|
|
item.Setup(article);
|
|
|
}
|