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 GetPilotTooltipImage(GameObject panel) { string pilotKey = panel.GetComponent <Dropdown>().captionText.text; GenericShip ship = (GenericShip)Activator.CreateInstance(Type.GetType(AllPilots.Find(n => n.PilotNameWithCost == pilotKey).PilotTypeName)); return(ship.ImageUrl); }
private static string GetImageOfIconicPilot(ShipRecord ship) { string image = null; if (ship.Instance.IconicPilots != null) { image = AllPilots.Find(n => n.PilotTypeName == ship.Instance.IconicPilots[CurrentSquadList.SquadFaction].ToString()).Instance.ImageUrl; } return(image); }
//Faction change //TODO: Change private static void CheckPlayerFactonChange(PlayerNo playerNo) { Faction playerFaction = GetPlayerFaction(playerNo); List <Transform> playerShips = new List <Transform>(); foreach (Transform shipPanel in GetShipsPanel(playerNo)) { playerShips.Add(shipPanel); } bool isFactionChanged = false; foreach (Transform shipPanel in playerShips) { if (shipPanel.name == "AddShipPanel") { continue; } string pilotName = shipPanel.Find("GroupShip/DropdownPilot").GetComponent <Dropdown>().captionText.text; GenericShip newPilot = (GenericShip)Activator.CreateInstance(Type.GetType(AllPilots.Find(n => n.PilotNameWithCost == pilotName).PilotTypeName)); if (newPilot.faction != playerFaction) { isFactionChanged = true; RemoveShip(playerNo, shipPanel.gameObject); } } if (isFactionChanged) { AddInitialShip(playerNo); } }
private static string GetNameOfPilot(SquadBuilderShip squadBuilderShip) { return(AllPilots.Find(n => n.PilotNameWithCost == squadBuilderShip.Panel.transform.Find("GroupShip/DropdownPilot").GetComponent <Dropdown>().captionText.text).PilotTypeName); }