//will be called from the "TappedResponder" public void attachAppBar() { //gets the containerBar from the singelton //moves the containerBar to the tapped gameObject UIContainerBar containerBar = UIContainerBar.Instance; if (containerBar.Target != this.gameObject)//only if change { containerBar.Target = this.gameObject; containerBar.HoverOffsetZ = HoverOffsetZ; containerBar.onTargetChange += deattachedAppBar; generateUI(); } }
/// <summary> /// Also refreshes the current UI, so it is properly set up after a change /// </summary> public void generateUI() { //gets the containerBar from the singelton UIContainerBar containerBar = UIContainerBar.Instance; //DeviceManager devMan = GetComponentInParent<DeviceManager>(); containerBar.clearUIElements(); //do something for each Device element foreach (AppData.uniqueIDDevice.UIContainerData IUElem in deviceData.myUIContainerData) { //passes the UI informations to the UIContainerBar Debug.Log("add UIElement"); containerBar.addUiElement(IUElem); } }