private static void ShowAvailablePilots(Faction faction, string shipName) { availablePilotsCounter = 0; ShipRecord shipRecord = AllShips.Find(n => n.ShipName == shipName); List <PilotRecord> AllPilotsFiltered = AllPilots .Where(n => n.PilotShip == shipRecord && n.PilotFaction == faction && n.Instance.GetType().ToString().Contains(Edition.Current.NameShort) ) .OrderByDescending(n => n.PilotSkill). OrderByDescending(n => n.Instance.PilotInfo.Cost). ToList(); int pilotsCount = AllPilotsFiltered.Count(); Transform contentTransform = GameObject.Find("UI/Panels/SelectPilotPanel/Panel/Scroll View/Viewport/Content").transform; DestroyChildren(contentTransform); contentTransform.localPosition = new Vector3(0, contentTransform.localPosition.y, contentTransform.localPosition.z); contentTransform.GetComponent <RectTransform>().sizeDelta = new Vector2(pilotsCount * (PILOT_CARD_WIDTH + DISTANCE_MEDIUM) + 2 * DISTANCE_MEDIUM, 0); foreach (PilotRecord pilot in AllPilotsFiltered) { ShowAvailablePilot(pilot); } }
private static string GetNameOfShip(SquadBuilderShip squadBuilderShip) { return(AllShips.Find(n => n.ShipName == squadBuilderShip.Panel.transform.Find("GroupShip/DropdownShip").GetComponent <Dropdown>().captionText.text).ShipNamespace); }