private void RefreshSocialGroups() { if (this.xboxLiveUser != null) { XboxSocialUserGroup socialUserGroup; if (!this.socialUserGroups.TryGetValue(this.presenceFilterDropdown.value, out socialUserGroup) && XboxLiveServicesSettings.Instance.DebugLogsOn) { Debug.Log("An Exception Occured: Invalid Presence Filter selected"); return; } Debug.LogWarning("Content Panel = " + this.contentPanel); try { while (this.contentPanel.childCount > 0) { var entry = this.contentPanel.GetChild(0).gameObject; this.entryObjectPool.ReturnObject(entry); } foreach (XboxSocialUser user in socialUserGroup.Users) { GameObject entryObject = this.entryObjectPool.GetObject(); XboxSocialUserEntry entry = entryObject.GetComponent <XboxSocialUserEntry>(); entry.Data = user; entryObject.transform.SetParent(this.contentPanel); } } catch (Exception ex) { Debug.LogError("An exception occured: " + ex.ToString()); } } else { this.socialUserGroups = null; var children = new List <GameObject>(); for (int i = 0; i < this.contentPanel.childCount; i++) { GameObject child = this.contentPanel.transform.GetChild(i).gameObject; children.Add(child); } this.contentPanel.DetachChildren(); foreach (var child in children) { Destroy(child); } } // Reset the scroll view to the top. this.scrollRect.verticalNormalizedPosition = 1; }
private void RefreshSocialGroups() { if (this.xboxLiveUser != null) { XboxSocialUserGroup socialUserGroup; if (!this.socialUserGroups.TryGetValue(this.presenceFilterDropdown.value, out socialUserGroup)) { var errorMessage = "An Invalid Presence Filter selected"; ExceptionManager.Instance.ThrowException( ExceptionSource.Social, ExceptionType.UnexpectedException, new Exception(errorMessage)); return; } try { while (this.contentPanel.childCount > 0) { var entry = this.contentPanel.GetChild(0).gameObject; this.entryObjectPool.ReturnObject(entry); } foreach (XboxSocialUser user in socialUserGroup.Users) { GameObject entryObject = this.entryObjectPool.GetObject(); XboxSocialUserEntry entry = entryObject.GetComponent <XboxSocialUserEntry>(); entry.Data = user; entryObject.transform.SetParent(this.contentPanel); } } catch (Exception ex) { ExceptionManager.Instance.ThrowException( ExceptionSource.Social, ExceptionType.UnexpectedException, ex); } } else { this.socialUserGroups.Clear(); var children = new List <GameObject>(); for (int i = 0; i < this.contentPanel.childCount; i++) { GameObject child = this.contentPanel.transform.GetChild(i).gameObject; children.Add(child); } this.contentPanel.DetachChildren(); foreach (var child in children) { Destroy(child); } } // Reset the scroll view to the top. this.scrollRect.verticalNormalizedPosition = 1; }