public void UpdateData(ICharacterData character) { this.character = character; string selectedBuffKey = CacheBuffSelectionManager.SelectedUI != null?CacheBuffSelectionManager.SelectedUI.CharacterBuff.GetKey() : string.Empty; CacheBuffSelectionManager.DeselectSelectedUI(); CacheBuffSelectionManager.Clear(); if (character == null) { CacheBuffList.HideAll(); return; } IList <CharacterBuff> buffs = character.Buffs; CacheBuffList.Generate(buffs, (index, characterBuff, ui) => { UICharacterBuff uiCharacterBuff = ui.GetComponent <UICharacterBuff>(); uiCharacterBuff.Setup(characterBuff, character, index); uiCharacterBuff.Show(); CacheBuffSelectionManager.Add(uiCharacterBuff); if (selectedBuffKey.Equals(characterBuff.GetKey())) { uiCharacterBuff.OnClickSelect(); } }); }
protected void OnSelectCharacterBuff(UICharacterBuff ui) { if (uiBuffDialog != null) { uiBuffDialog.selectionManager = CacheBuffSelectionManager; uiBuffDialog.Setup(ui.Data, character, ui.IndexOfData); uiBuffDialog.Show(); } }