/// <summary> /// Fill the godfather panel with godfather. /// </summary> /// <param name="godfather">Godfather gamer info.</param> public void FillGodfatherPanel(GamerInfo godfather) { // Clear the godfather panel ClearGodfatherPanel(false); // If there is godfather to display, fill the godfather panel with gamer prefab if (!string.IsNullOrEmpty(godfather.GamerId)) { // Create a godfather gamer GameObject and hook it at the godfather items layout GameObject prefabInstance = Instantiate <GameObject>(godfatherGamerPrefab); prefabInstance.transform.SetParent(godfatherItemsLayout.transform, false); // Fill the newly created GameObject with gamer data GodfatherGamerHandler godfatherGamerHandler = prefabInstance.GetComponent <GodfatherGamerHandler>(); godfatherGamerHandler.FillData(godfather["profile"], godfather.GamerId); // Add the newly created GameObject to the list godfatherItems.Add(prefabInstance); } // Else, show the "no godfather" text else { noGodfatherText.gameObject.SetActive(true); } }
/// <summary> /// Fill the godfather panel with godchildren list. /// </summary> /// <param name="godchildrenList">Godchildren gamer info.</param> public void FillGodfatherPanel(NonpagedList <GamerInfo> godchildrenList) { // Clear the godfather panel ClearGodfatherPanel(false); // If there are godchildren to display, fill the godfather panel with gamer prefabs if ((godchildrenList != null) && (godchildrenList.Count > 0)) { foreach (GamerInfo godchild in godchildrenList) { // Create a godfather gamer GameObject and hook it at the godfather items layout GameObject prefabInstance = Instantiate <GameObject>(godfatherGamerPrefab); prefabInstance.transform.SetParent(godfatherItemsLayout.transform, false); // Fill the newly created GameObject with gamer data GodfatherGamerHandler godfatherGamerHandler = prefabInstance.GetComponent <GodfatherGamerHandler>(); godfatherGamerHandler.FillData(godchild["profile"], godchild.GamerId); // Add the newly created GameObject to the list godfatherItems.Add(prefabInstance); } } // Else, show the "no godchild" text else { noGodchildText.gameObject.SetActive(true); } }
/// <summary> /// Build a "new godchild" event type then add it to the pending list to display. (events are displayed one by one) /// </summary> /// <param name="eventMessage">Message of the event. (describes there is a new godchild)</param> /// <param name="godchildProfile">Profile of the new godchild under the Bundle format.</param> public void BuildAndAddEventItem_NewGodchild(string eventMessage, Bundle godchildProfile) { // Create a godfather gamer GameObject GameObject godfatherGamerPrefabInstance = Instantiate <GameObject>(godfatherGamerPrefab); // Fill the newly created GameObject with event gamer data GodfatherGamerHandler godfatherGamerHandler = godfatherGamerPrefabInstance.GetComponent <GodfatherGamerHandler>(); godfatherGamerHandler.FillData(godchildProfile); // Add an event item with the newly created GameObject linked to it AddEventItem(eventMessage, godfatherGamerPrefabInstance); }