Esempio n. 1
0
    public void UpdateCardInventory(List <Ship> ship_list = null, SORTING_TYPE sorting_type = SORTING_TYPE.NONE) //This will sort the cards array on the Sorting Type
    {
        if (ship_list != null)
        {
            ships = ship_list;
        }
        //to reset the game objects for a showing a new bunch of cards
        for (int i = 0; i < ship_cards.Count; i++)
        {
            ship_cards[i].gameObject.SetActive(false);
        }

        //checks if it should sort a new set of cards or just the current ones

        if (sorting_type == SORTING_TYPE.NONE)
        {
            sorting_type = curr_sorting_type;
        }
        else
        {
            curr_sorting_type = sorting_type;
        }

        switch (sorting_type)
        {
        case SORTING_TYPE.FRIGATE_TO_SPECIAL:
            //sorts ships by Frigate to Special
            ships = ships.OrderBy(c => c.GetShipClass() - Enum.GetNames(typeof(SORTING_TYPE)).Length - 1).ToList();
            break;

        case SORTING_TYPE.SPECIAL_TO_FRIGATE:
            //sorts ships by Special to Frigate
            ships = ships.OrderByDescending(c => c.GetShipClass()).ToList();
            break;

        case SORTING_TYPE.POWER:
            //sorts ships by ship power
            ships = ships.OrderByDescending(c => c.GetShipPower()).ToList();
            break;

        case SORTING_TYPE.INFLUENCE:
            //sorts ships by ship influence
            ships = ships.OrderByDescending(c => c.GetShipInfluence()).ToList();
            break;
        }

        for (int i = 0; i < ships.Count; i++)
        {
            ship_cards[i].gameObject.SetActive(true);
            ship_cards[i].UpdateCardInfo(ships[i]);
        }
        SortCardHierarchy();
    }
Esempio n. 2
0
 private void Awake()
 {
     PullCards();
     curr_sorting_type = SORTING_TYPE.SPECIAL_TO_FRIGATE;
 }