private void InitList() { MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Length == 0) { this.m_noRecruitsYetMessage.gameObject.SetActive(true); } else { this.m_noRecruitsYetMessage.gameObject.SetActive(false); } TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); foreach (TroopsListItem troopsListItem in componentsInChildren) { bool flag = true; if (availableShipmentTypes != null) { foreach (MobileClientShipmentType mobileClientShipmentType in availableShipmentTypes) { if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID) { flag = false; break; } } } if (flag) { Object.DestroyImmediate(troopsListItem.gameObject); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int k = 0; k < availableShipmentTypes.Length; k++) { bool flag2 = false; foreach (TroopsListItem troopsListItem2 in componentsInChildren) { if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID) { flag2 = true; break; } } if (!flag2) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject.transform.SetParent(this.m_troopsListContents.transform, false); TroopsListItem component = gameObject.GetComponent <TroopsListItem>(); component.SetCharShipment(availableShipmentTypes[k], false, null); FancyEntrance component2 = component.GetComponent <FancyEntrance>(); component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k; component2.Activate(); } } IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)obj; if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(jamCharacterShipment.ShipmentRecID)) { bool flag3 = true; bool flag4 = false; if (jamCharacterShipment.ShipmentRecID < 372 || jamCharacterShipment.ShipmentRecID > 383) { flag3 = false; } if (jamCharacterShipment.ShipmentRecID == 178 || jamCharacterShipment.ShipmentRecID == 179 || jamCharacterShipment.ShipmentRecID == 180 || jamCharacterShipment.ShipmentRecID == 192 || jamCharacterShipment.ShipmentRecID == 194 || jamCharacterShipment.ShipmentRecID == 195) { flag4 = true; } if (flag3 || flag4) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID); if (record != null) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject2.transform.SetParent(this.m_troopsListContents.transform, false); TroopsListItem component3 = gameObject2.GetComponent <TroopsListItem>(); component3.SetCharShipment(null, true, record); } } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } }
private void InitList() { MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Length == 0) { this.m_noRecruitsYetMessage.get_gameObject().SetActive(true); } else { this.m_noRecruitsYetMessage.get_gameObject().SetActive(false); } TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(); TroopsListItem[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { TroopsListItem troopsListItem = array[i]; bool flag = true; if (availableShipmentTypes != null) { MobileClientShipmentType[] array2 = availableShipmentTypes; for (int j = 0; j < array2.Length; j++) { MobileClientShipmentType mobileClientShipmentType = array2[j]; if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID) { flag = false; break; } } } if (flag) { Object.DestroyImmediate(troopsListItem.get_gameObject()); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(); for (int k = 0; k < availableShipmentTypes.Length; k++) { bool flag2 = false; TroopsListItem[] array3 = componentsInChildren; for (int l = 0; l < array3.Length; l++) { TroopsListItem troopsListItem2 = array3[l]; if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID) { flag2 = true; break; } } if (!flag2) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject.get_transform().SetParent(this.m_troopsListContents.get_transform(), false); TroopsListItem component = gameObject.GetComponent <TroopsListItem>(); component.SetCharShipment(availableShipmentTypes[k]); FancyEntrance component2 = component.GetComponent <FancyEntrance>(); component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k; component2.Activate(); } } }
private void InitList() { MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Length == 0) { this.m_noRecruitsYetMessage.get_gameObject().SetActive(true); } else { this.m_noRecruitsYetMessage.get_gameObject().SetActive(false); } TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); TroopsListItem[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { TroopsListItem troopsListItem = array[i]; bool flag = true; if (availableShipmentTypes != null) { MobileClientShipmentType[] array2 = availableShipmentTypes; for (int j = 0; j < array2.Length; j++) { MobileClientShipmentType mobileClientShipmentType = array2[j]; if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID) { flag = false; break; } } } if (flag) { Object.DestroyImmediate(troopsListItem.get_gameObject()); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int k = 0; k < availableShipmentTypes.Length; k++) { bool flag2 = false; TroopsListItem[] array3 = componentsInChildren; for (int l = 0; l < array3.Length; l++) { TroopsListItem troopsListItem2 = array3[l]; if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID) { flag2 = true; break; } } if (!flag2) { GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject.get_transform().SetParent(this.m_troopsListContents.get_transform(), false); TroopsListItem component = gameObject.GetComponent <TroopsListItem>(); component.SetCharShipment(availableShipmentTypes[k], false, null); FancyEntrance component2 = component.GetComponent <FancyEntrance>(); component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k; component2.Activate(); } } IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.get_Values().GetEnumerator(); try { while (enumerator.MoveNext()) { JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)enumerator.get_Current(); if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(jamCharacterShipment.ShipmentRecID)) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID); if (record != null) { GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject2.get_transform().SetParent(this.m_troopsListContents.get_transform(), false); TroopsListItem component3 = gameObject2.GetComponent <TroopsListItem>(); component3.SetCharShipment(null, true, record); } } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }