private TextPerkCustomization CreatePerk(ScrollViewManipulatorCustomization parent, Perk perk) { if (parent.isNoDuplicate) { if (scrollViewTo.IsContains(perk.varName)) { return(null); } } TextPerkCustomization newPerk = Help.HelpFunctions.TransformSeer.CreateObjectInParent(parent.content, textPerkPrefab.gameObject, perk.varName).GetComponent <TextPerkCustomization>(); newPerk.perk = perk; newPerk.scrollView = parent; newPerk.isClickObject = parent.isClickObjects; newPerk.isDestoyObject = parent.isDestoyObjects; if (parent.isClickObjects) { newPerk.onClickPerk = SetPerkParent; } else { newPerk.onClickPerk = null; } parent.AddObject(newPerk.gameObject); return(newPerk); }
public void Init(Dictionary <string, Perk> curperks) { textPerks = new List <TextPerkCustomization>(); textPerksBuf = new List <TextPerkBufCustomization>(); perks = curperks; foreach (KeyValuePair <string, Perk> perk in perks) { TextPerkCustomization newTextPerk = CreatePerk(scrollViewFrom, perk.Value); if (newTextPerk == null) { continue; } textPerks.Add(newTextPerk); } UpdateAllTXT(); }
public void SetPerkParent(TextPerkCustomization textPerk) { TextPerkCustomization newTextPerk = CreatePerk(scrollViewTo, textPerk.perk); if (newTextPerk == null) { return; } if (scrollViewFrom.isDestoyObjects) { textPerks.Remove(textPerk); textPerk.onDestroyPerk?.Invoke(); scrollViewFrom.RemoveObject(textPerk.gameObject); } textPerks.Add(newTextPerk); newTextPerk.buff = CreateBuf(scrollViewBufTo, newTextPerk.perk); UpdateAllTXT(); }