Exemplo n.º 1
0
 public void SetSelection(BountyOption bountyOption)
 {
     if (HasBounty(bountyOption))
     {
         currentlySelected = bountyOption;
         ShowVehicle((int)bountyOption.bounty.carData.vehicleIndex, bountyOption.bounty.carData.vehicleColor);
     }
     else
     {
         Debug.LogError("BountyList: Cannot show bounty option when not on list");
     }
 }
Exemplo n.º 2
0
    public BountyOption GetBountyOption(BountyData bounty)
    {
        BountyOption optionInList = null;
        var          optionIndex  = GetBountyOptionIndex(bounty);

        if (optionIndex >= 0 && optionIndex < shownBounties.Count)
        {
            optionInList = shownBounties[optionIndex];
        }
        else
        {
            Debug.LogError("BountyList: Bounty data does not exist in list");
        }

        return(optionInList);
    }
Exemplo n.º 3
0
    public void RemoveShownBounty(int index)
    {
        if (index >= 0 && index < shownBounties.Count)
        {
            var removedShownBounty = shownBounties[index];
            removedShownBounty.viewButton.onClick.RemoveAllListeners();
            bountyOptionsPool.Return(removedShownBounty.transform);
            shownBounties.Remove(removedShownBounty);

            if (currentlySelected == removedShownBounty)
            {
                currentlySelected = null;
            }
        }
        else
        {
            Debug.LogError("BountyList: Could not remove bounty from list, given index was invalid " + index);
        }
    }
Exemplo n.º 4
0
 public bool HasBounty(BountyOption bountyOption)
 {
     return(shownBounties.IndexOf(bountyOption) >= 0);
 }
Exemplo n.º 5
0
 private void ViewBountyPressed(BountyOption sender)
 {
     SetSelection(sender);
 }
Exemplo n.º 6
0
 public void RemoveShownBounty(BountyOption shownBounty)
 {
     RemoveShownBounty(GetBountyOptionIndex(shownBounty));
 }
Exemplo n.º 7
0
 public int GetBountyOptionIndex(BountyOption shownBounty)
 {
     return(shownBounties.IndexOf(shownBounty));
 }