private void RefreshBarControl() { var isBarVisible = this.CheckIsBarShouldBeVisible(); if (!isBarVisible) { this.RemoveAttachedControl(); return; } if (this.componentAttachedUIElement != null) { return; } var protoStaticWorldObject = this.data.ProtoStaticWorldObject; this.structurePointsBarControl = ControlsCache <ConstructionSiteStructurePointsBarControl> .Instance.Pop(); this.structurePointsBarControl.StaticObjectStructurePointsData = this.data; var offset = protoStaticWorldObject.SharedGetObjectCenterWorldOffset( this.SceneObject.AttachedWorldObject); this.componentAttachedUIElement = Api.Client.UI.AttachControl( this.SceneObject, this.structurePointsBarControl, positionOffset: offset + (0, 0.55), isFocusable: false); }
private void RemoveAttachedControl() { if (this.componentAttachedUIElement == null) { return; } this.componentAttachedUIElement.Destroy(); this.componentAttachedUIElement = null; ControlsCache <ConstructionSiteStructurePointsBarControl> .Instance.Push(this.structurePointsBarControl); this.structurePointsBarControl = null; }