예제 #1
0
        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);
            }
        }
예제 #2
0
    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);
    }
예제 #3
0
        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);
        }
예제 #4
0
    //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);
        }
    }
예제 #5
0
 private static string GetNameOfPilot(SquadBuilderShip squadBuilderShip)
 {
     return(AllPilots.Find(n => n.PilotNameWithCost == squadBuilderShip.Panel.transform.Find("GroupShip/DropdownPilot").GetComponent <Dropdown>().captionText.text).PilotTypeName);
 }