/// <inheritdoc /> public SelectionBox() { _handles = new SelectionLine[12]; _lineThickness = 0.05f; Colour = DefaultColour; Renderer.InvokeResourceDependent(OnRendererInitialized); Changed.Event += s => { switch (s) { case nameof(Transparency): _bufferDirty = true; break; case nameof(Visible): _bufferDirty = true; break; case nameof(Colour): _bufferDirty = true; break; } }; for (var i = 0; i < 12; i++) { _handles[i] = new SelectionLine(); } }
private void Awake() { if (Instance == null) { Instance = this; } if (Instance != this) { Destroy(gameObject); } }
private void OnEnable() { var RootElement = new VisualElement(); var SearchTextElement = new TextField(); SearchTextElement.RegisterCallback <ChangeEvent <string> >(this.OnSearchTextChanged); RootElement.Add(SearchTextElement); this.TypeSelectionLineParentElement = new VisualElement(); foreach (var availableType in AvailableTypes) { var element = new SelectionLine(this.TypeSelectionLineParentElement, availableType.Key, availableType.Value, this.OnTypeSelected); TypeSelectionLineVisualElements.Add(availableType.Key, element); } RootElement.Add(this.TypeSelectionLineParentElement); this.rootVisualElement.Add(RootElement); }