private void HandleShipmentItemPushed(int charShipmentID, WrapperShipmentItem item) { TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int i = 0; i < (int)componentsInChildren.Length; i++) { TroopsListItem troopsListItem = componentsInChildren[i]; if (troopsListItem.GetCharShipmentTypeID() == charShipmentID) { troopsListItem.HandleShipmentItemPushed(item); } } }
private void InitList() { List <WrapperShipmentType> availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Count == 0) { this.m_noRecruitsYetMessage.gameObject.SetActive(true); } else { this.m_noRecruitsYetMessage.gameObject.SetActive(false); } TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); TroopsListItem[] troopsListItemArray = componentsInChildren; for (int i = 0; i < (int)troopsListItemArray.Length; i++) { TroopsListItem troopsListItem = troopsListItemArray[i]; bool flag = true; if (availableShipmentTypes != null) { foreach (WrapperShipmentType availableShipmentType in availableShipmentTypes) { if (troopsListItem.GetCharShipmentTypeID() != availableShipmentType.CharShipmentID) { continue; } flag = false; break; } } if (flag) { UnityEngine.Object.Destroy(troopsListItem.gameObject); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int j = 0; j < availableShipmentTypes.Count; j++) { bool flag1 = false; TroopsListItem[] troopsListItemArray1 = componentsInChildren; int num = 0; while (num < (int)troopsListItemArray1.Length) { if (troopsListItemArray1[num].GetCharShipmentTypeID() != availableShipmentTypes[j].CharShipmentID) { num++; } else { flag1 = true; break; } } if (!flag1) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject.transform.SetParent(this.m_troopsListContents.transform, false); TroopsListItem component = gameObject.GetComponent <TroopsListItem>(); component.SetCharShipment(new WrapperShipmentType?(availableShipmentTypes[j]), false, null); FancyEntrance mListItemInitialEntranceDelay = component.GetComponent <FancyEntrance>(); mListItemInitialEntranceDelay.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)j; mListItemInitialEntranceDelay.Activate(); } } foreach (WrapperCharacterShipment value in PersistentShipmentData.shipmentDictionary.Values) { if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(value.ShipmentRecID)) { bool flag2 = true; bool flag3 = false; if (value.ShipmentRecID < 372 || value.ShipmentRecID > 383) { flag2 = false; } if (value.ShipmentRecID == 178 || value.ShipmentRecID == 179 || value.ShipmentRecID == 180 || value.ShipmentRecID == 192 || value.ShipmentRecID == 194 || value.ShipmentRecID == 195) { flag3 = true; } if (flag2 || flag3) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(value.ShipmentRecID); if (record != null) { GameObject gameObject1 = UnityEngine.Object.Instantiate <GameObject>(this.m_troopsListItemPrefab); gameObject1.transform.SetParent(this.m_troopsListContents.transform, false); gameObject1.GetComponent <TroopsListItem>().SetCharShipment(null, true, record); } } } } }
private void InitList() { List <WrapperShipmentType> availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes(); if (availableShipmentTypes == null || availableShipmentTypes.Count == 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 (WrapperShipmentType wrapperShipmentType in availableShipmentTypes) { if (troopsListItem.GetCharShipmentTypeID() == wrapperShipmentType.CharShipmentID) { flag = false; break; } } } if (flag) { Object.Destroy(troopsListItem.gameObject); } } if (availableShipmentTypes == null) { return; } componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true); for (int j = 0; j < availableShipmentTypes.Count; j++) { bool flag2 = false; foreach (TroopsListItem troopsListItem2 in componentsInChildren) { if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[j].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(new WrapperShipmentType?(availableShipmentTypes[j]), false, null); FancyEntrance component2 = component.GetComponent <FancyEntrance>(); component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)j; component2.Activate(); } } foreach (WrapperCharacterShipment wrapperCharacterShipment in PersistentShipmentData.shipmentDictionary.Values) { if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(wrapperCharacterShipment.ShipmentRecID)) { bool flag3 = true; bool flag4 = false; if (wrapperCharacterShipment.ShipmentRecID < 372 || wrapperCharacterShipment.ShipmentRecID > 383) { flag3 = false; } if (wrapperCharacterShipment.ShipmentRecID == 178 || wrapperCharacterShipment.ShipmentRecID == 179 || wrapperCharacterShipment.ShipmentRecID == 180 || wrapperCharacterShipment.ShipmentRecID == 192 || wrapperCharacterShipment.ShipmentRecID == 194 || wrapperCharacterShipment.ShipmentRecID == 195) { flag4 = true; } if (flag3 || flag4) { CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(wrapperCharacterShipment.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); } } } } }