private void OnClick(ButtonComponent button) { var index = this.GetIndexOf(button); if (index < 0) return; var window = this.GetWindow() as UIWindowExampleTransitions; window.ShowWindow(index); }
public override void OnInit() { this.content = this.GetLayoutComponent<UIWindowExampleComponent>(); this.button = this.GetLayoutComponent<ButtonComponent>(); this.button.SetCallback(() => this.Hide()); this.content.SetText(this.text); }
public override void ValidateEditor() { base.ValidateEditor(); if (this.label == null) { this.label = this.GetComponentInChildren <ButtonComponent>(true); } if (this.list == null) { this.list = this.GetComponentInChildren <ListComponent>(true); } if (this.list != null) { this.scrollRect = this.list.GetComponent <ScrollRect>(); if (this.scrollRect == null) { return; } this.drivenRectTransformTracker = new DrivenRectTransformTracker(); this.drivenRectTransformTracker.Add(this, this.list.rectTransform, DrivenTransformProperties.Anchors | DrivenTransformProperties.Pivot | DrivenTransformProperties.AnchoredPosition); if (this.minMaxSizeX.x >= 0f || this.minMaxSizeX.y >= 0f) { this.drivenRectTransformTracker.Add(this, this.list.rectTransform, DrivenTransformProperties.SizeDeltaX); } if (this.minMaxSizeY.x >= 0f || this.minMaxSizeY.y >= 0f) { this.drivenRectTransformTracker.Add(this, this.list.rectTransform, DrivenTransformProperties.SizeDeltaY); } this.list.hiddenByDefault = true; this.list.AddEditorParametersRegistry(new EditorParametersRegistry() { holder = this, hiddenByDefault = true, hiddenByDefaultDescription = "Value is hold by DropdownComponent" }); this.CalculateAnchorsAndPivot(); this.ApplyMinMaxSize(); } }
public override void OnInit() { this.contentComponent = this.GetLayoutComponent<UIWindowExampleComponent>(); this.buttonAlert = this.GetLayoutComponent<ButtonComponent>(LayoutTag.Tag4); this.buttonAlert.SetCallback(this.OnAlert); this.button = this.GetLayoutComponent<ButtonWithTipComponent>(); this.button.SetCallback(this.OnClick); this.button.SetTextToTip("<b>Click here to open new instance.</b>\nYou can simply edit this text or pass it from the code. See UIWindowExampleTip and UIWindowExampleScreen."); if (this.closeOnButtonPress == true) { this.contentComponent.SetText("This is the second instance of UIWindowExampleScreen. Look for this behaviour in UIWindowExampleScreen->OnInit() method."); this.button.SetTextToTip("<b>Click here to close current instance.</b>\nYou can simply edit this text or pass it from the code. See UIWindowExampleTip and UIWindowExampleScreen."); } }