protected override void HandleViewDataChanged(ViewData viewData) { base.HandleViewDataChanged(viewData); if (_rootFlexRectMono) { _rootFlexRectMono.SizeDelta = new Vector2( viewData.ContentWidth, viewData.ContentHeight ); _rootFlexRectMono.Refresh(); } }
public void Refresh( List <Action> selfAbilities = null, Dictionary <Action, Action <Vector3> > locationAbilities = null, Dictionary <Action, Action <GameObject[]> > objectAbilities = null ) { Clear(); _rootFlexRectMono = HorizontalFlexibleRect.GetRect(ViewData); _rootFlexRectMono.transform.SetParent(ContentRect.transform, false); _rootFlexRectMono.SizeDelta = new Vector2(ContentRect.SizeDelta.x, ContentRect.SizeDelta.y); if (selfAbilities != null && selfAbilities.Count > 0) { CreateSelfAbilityBar( selfAbilities, ViewData.SelfActionBGColor ).transform.SetParent(_rootFlexRectMono.transform, false); } if (locationAbilities != null && locationAbilities.Count > 0) { CreateLocationAbilityBar( locationAbilities, ViewData.LocationActionBGColor ).transform.SetParent(_rootFlexRectMono.transform, false); } if (objectAbilities != null && objectAbilities.Count > 0) { CreateObjectAbilityBar( objectAbilities, ViewData.ObjectActionBGColor ).transform.SetParent(_rootFlexRectMono.transform, false); } _rootFlexRectMono.Refresh(); }