public override bool Populate(PlayerSeat Seat, int pos) { Outline outty = GetComponent <Outline>(); actionOutline = new UiActionActive(this, outty); seat = Seat; contPlayer = GameData.Instance.RuntimeGame.Players.Find(player => player.Seat == seat); IRoster pRoster = contPlayer.Roster; if (pRoster.MoheRoster.Count <= pos) { return(false); } moheData = pRoster.MoheRoster[pos]; headerTxt = transform.Find("HeaderTxt").GetComponent <TextMeshProUGUI>(); lvlTxt = transform.Find("LvlTxt").GetComponent <TextMeshProUGUI>(); transform.Find("HealthBarImg").GetComponent <UiHealthBarFiller>().Populate(moheData); transform.Find("ExpBarImg").GetComponent <UiExpBarFiller>().Populate(moheData); moheImage = transform.Find("MohePortrait").GetComponent <Image>(); headerTxt.text = moheData.BaseMohe.Data.Name; lvlTxt.text = moheData.BaseExpType.CalculateLevel(moheData.Exp).ToString(); moheImage.sprite = moheData.BaseMohe.Data.Artwork; OnToggle += OnSetSwap; return(true); }
public override bool Populate(PlayerSeat Seat, int pos) { Outline outty = GetComponent <Outline>(); actionOutline = new UiActionActive(this, outty); seat = Seat; CostPanels = new List <IUiAttackCost>(); headerTxt = transform.Find("HeaderTxt").GetComponent <TextMeshProUGUI>(); descTxt = transform.Find("DescTxt").GetComponent <TextMeshProUGUI>(); IRuntimeMoheData moheData = GameData.Instance.RuntimeGame.Players.Find(player => player.Seat == seat).Roster.CurrentMohe(); //check to make sure the player has enough mohe for pos if (moheData.Abilities.Count <= pos) { return(false); } //Populate headers and desc ability = moheData.Abilities[pos]; headerTxt.text = ability.Ability.AbilityName; descTxt.text = ability.Ability.Description; Transform costParent = transform.Find("Cost"); foreach (Transform t in costParent) { Destroy(t.gameObject); } for (int i = 0; i < ability.AbilityComponents.Count; i++) { IUiAttackCost cost = UiAtkActionCostPooler.Instance.Get(seat, ability, i); cost.MBehaviour.transform.SetParent(costParent); cost.MBehaviour.transform.localScale = Vector3.one; CostPanels.Add(cost); } return(true); }