protected override void sortPlayers(List <DataEntityHandle> listToSort) { if (!allIgloodataLoaded) { return; } listToSort.Sort(delegate(DataEntityHandle a, DataEntityHandle b) { int num = dataEntityCollection.GetComponent <DisplayNameData>(a).DisplayName.CompareTo(dataEntityCollection.GetComponent <DisplayNameData>(b).DisplayName); bool hasPublicIgloo = dataEntityCollection.GetComponent <ProfileData>(a).HasPublicIgloo; bool hasPublicIgloo2 = dataEntityCollection.GetComponent <ProfileData>(b).HasPublicIgloo; if (hasPublicIgloo && hasPublicIgloo2) { IglooListingData component = dataEntityCollection.GetComponent <IglooListingData>(a); IglooListingData component2 = dataEntityCollection.GetComponent <IglooListingData>(b); int num2 = -1 * component.RoomPopulation.CompareTo(component2.RoomPopulation); if (num2 == 0) { return(num); } return(num2); } if (hasPublicIgloo && !hasPublicIgloo2) { return(-1); } if (!hasPublicIgloo && hasPublicIgloo2) { return(1); } return((!hasPublicIgloo && !hasPublicIgloo2) ? num : 0); }); }
private void onIglooListingDataUpdated(IglooListingData iglooListingData) { DataEntityHandle entityByComponent = dataEntityCollection.GetEntityByComponent(iglooListingData); if (!DataEntityHandle.IsNullValue(entityByComponent) && !allPlayersList.Contains(entityByComponent)) { allPlayersList.Add(entityByComponent); } }
protected override void awake() { if (PlatformUtils.GetAspectRatioType() == AspectRatioType.Landscape) { GetComponent <UIDisabler>().enabled = false; GetComponent <UIDisabler>().ResetOnDestroy = false; } Service.Get <EventDispatcher>().AddListener <IglooServiceEvents.PopularIgloosListLoaded>(OnPopularIgloosListLoaded); Service.Get <EventDispatcher>().AddListener <IglooServiceEvents.IgloosFromZoneIdsLoaded>(onIgloosFromZoneIdsLoaded); dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <IglooListingData> >(onIglooListingDataAdded); DataEntityHandle[] entitiesByType = dataEntityCollection.GetEntitiesByType <IglooListingData>(); foreach (DataEntityHandle handle in entitiesByType) { IglooListingData component = dataEntityCollection.GetComponent <IglooListingData>(handle); component.IglooListingDataUpdated += onIglooListingDataUpdated; } }
protected override void onDestroy() { Service.Get <EventDispatcher>().DispatchEvent(new UIDisablerEvents.EnableUIElement("MyIglooButton")); Service.Get <EventDispatcher>().RemoveListener <IglooServiceEvents.PopularIgloosListLoaded>(OnPopularIgloosListLoaded); Service.Get <EventDispatcher>().RemoveListener <IglooServiceEvents.IgloosFromZoneIdsLoaded>(onIgloosFromZoneIdsLoaded); if (dataEntityCollection != null) { dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.ComponentAddedEvent <IglooListingData> >(onIglooListingDataAdded); } DataEntityHandle[] entitiesByType = dataEntityCollection.GetEntitiesByType <IglooListingData>(); foreach (DataEntityHandle handle in entitiesByType) { IglooListingData component = dataEntityCollection.GetComponent <IglooListingData>(handle); component.IglooListingDataUpdated -= onIglooListingDataUpdated; } DisplayNamePlayerPrefs.SetInt("IglooListType", (int)iglooListingType); Object.Destroy(emptyPopularObject); Object.Destroy(emptyFriendsObject); }