private void RegisterCallbacks() { duplicateButton.onClick.AddListener(() => OnDuplicate?.Invoke()); addButton.onClick.AddListener(() => OnAdd?.Invoke()); removeButton.onClick.AddListener(() => OnRemove?.Invoke()); moveUpButton.onClick.AddListener(() => OnMoveUp?.Invoke()); moveDownButton.onClick.AddListener(() => OnMoveDown?.Invoke()); RegisterSegmentedControlCallbacks(eventTypeSelect); RegisterSegmentedControlCallbacks(qualRankSelect); RegisterSegmentedControlCallbacks(inLimitSelect); RegisterSegmentedControlCallbacks(preQualLimitSelect); RegisterSegmentedControlCallbacks(preQualRankSelect); RegisterSegmentedControlCallbacks(ordRankSelect); RegisterSegmentedControlCallbacks(hillSurfaceSelect); presetsDropdown.onValueChanged.AddListener(arg => OnCurrentEventChanged?.Invoke()); hillsDropdown.onValueChanged.AddListener(arg => OnCurrentEventChanged?.Invoke()); hillsDropdown.onValueChanged.AddListener(arg => ShowInfo()); inLimitInput.onEndEdit.AddListener(arg => OnCurrentEventChanged?.Invoke()); qualRankDropdown.onValueChanged.AddListener(arg => OnCurrentEventChanged?.Invoke()); preQualLimitInput.onEndEdit.AddListener(arg => OnCurrentEventChanged?.Invoke()); preQualRankDropdown.onValueChanged.AddListener(arg => OnCurrentEventChanged?.Invoke()); ordRankDropdown.onValueChanged.AddListener(arg => OnCurrentEventChanged?.Invoke()); hillsSearch.OnValueChanged += data => { OnCurrentEventChanged?.Invoke(); }; }
private async void Duplicate_Click(object sender, RoutedEventArgs e) { if (OnDuplicate != null) { var selectedItem = lvManagedCertificates.SelectedItem; if (selectedItem != null && selectedItem is Certify.Models.ManagedCertificate) { OnDuplicate.Invoke(selectedItem as Certify.Models.ManagedCertificate); } } }
public TopPalette(Camera camera, IScreenParentObject parent = null, MyTexture2D texture = null) : base(camera, PalettePosition, PaletteSize, parent, texture) { CreatePaletteButton("Save", t => OnSave?.Invoke()); CreatePaletteButton("Load", t => OnLoad?.Invoke()); CreatePaletteButton("Group", t => OnGroup?.Invoke()); CreatePaletteButton("Ungroup", t => OnUnGroup?.Invoke()); CreatePaletteButton("Remove", t => OnRemove?.Invoke()); CreatePaletteButton("Undo remove", t => OnUndoRemove?.Invoke()); CreatePaletteButton("Duplicate", t => OnDuplicate?.Invoke()); ColorChanger.ResetColor(Color.LightGray); }
private static void OnSelectionChanged() { if (_duplicateOrPasteExecuted) { for (int i = 0; i < Selection.gameObjects.Length; i++) { GameObject source = FindSourceFromDuplicate(Selection.gameObjects[i], _sources); OnDuplicate?.Invoke(Selection.gameObjects[i], source); } OnDuplicates?.Invoke(Selection.gameObjects, FindSourcesFromDuplicates(Selection.gameObjects, _sources)); _duplicateOrPasteExecuted = false; } }
protected void Init() { AddToClassList(USS_CLASS_NAME); AddToClassList("worldStateItem"); AddToClassList("rounded"); m_WorldStateField = new TextField("World State") { value = m_UtilityDescription.WorldStateName }; m_WorldStateField.tooltip = "The identifier of the world state. The corresponding world state value should be castable to float."; m_WorldStateField.maxLength = 30; hierarchy.Add(m_WorldStateField); m_OperatorSelectorField = new UtilityOperatorSelectorField("Operator") { value = m_UtilityDescription.UtilityOperator }; m_OperatorSelectorField.tooltip = "Defines how the resulting value will be applied to the base utility value. All curves will be applied in order of appearance."; hierarchy.Add(m_OperatorSelectorField); m_CurveField = new CurveField("Curve") { value = m_UtilityDescription.UtilityCurve }; m_CurveField.tooltip = "The curve that will be evaluated based on the world state. world state will be interpreted as a float."; hierarchy.Add(m_CurveField); m_CurveMultiplierField = new FloatField("Curve Multiplier") { value = m_UtilityDescription.CurveMultiplier }; m_CurveMultiplierField.tooltip = "The evaluated curve value will be multiplied with this number before it is applied to the base utility value."; hierarchy.Add(m_CurveMultiplierField); m_WorldStateField.RegisterValueChangedCallback(WorldStateNameChanged); m_OperatorSelectorField.RegisterValueChangedCallback(UtilityOperatorChanged); m_CurveField.RegisterValueChangedCallback(CurveChanged); m_CurveMultiplierField.RegisterValueChangedCallback(CurveMultiplierChanged); this.AddManipulator(new Clickable(() => OnMouseDown?.Invoke(this))); this.AddManipulator(new ContextualMenuManipulator(_menubuilder => { _menubuilder.menu.AppendAction("Delete", _dropDownMenuAction => OnDelete?.Invoke(this), DropdownMenuAction.Status.Normal); _menubuilder.menu.AppendAction("Duplicate", _dropDownMenuAction => OnDuplicate?.Invoke(this), DropdownMenuAction.Status.Normal); })); }
protected void Init() { AddToClassList(USS_CLASS_NAME); AddToClassList("worldStateItem"); AddToClassList("rounded"); m_WorldStateField = new TextField("World State") { value = m_UtilityDescription.WorldStateName }; m_WorldStateField.maxLength = 30; hierarchy.Add(m_WorldStateField); m_OperatorSelectorField = new UtilityOperatorSelectorField("Operator") { value = m_UtilityDescription.UtilityOperator }; hierarchy.Add(m_OperatorSelectorField); m_CurveField = new CurveField("Curve") { value = m_UtilityDescription.UtilityCurve }; hierarchy.Add(m_CurveField); m_CurveMultiplierField = new FloatField("Curve Multiplier") { value = m_UtilityDescription.CurveMultiplier }; hierarchy.Add(m_CurveMultiplierField); m_WorldStateField.RegisterValueChangedCallback(WorldStateNameChanged); m_OperatorSelectorField.RegisterValueChangedCallback(UtilityOperatorChanged); m_CurveField.RegisterValueChangedCallback(CurveChanged); m_CurveMultiplierField.RegisterValueChangedCallback(CurveMultiplierChanged); this.AddManipulator(new Clickable(() => OnMouseDown?.Invoke(this))); this.AddManipulator(new ContextualMenuManipulator(_menubuilder => { _menubuilder.menu.AppendAction("Delete", _dropDownMenuAction => OnDelete?.Invoke(this), DropdownMenuAction.Status.Normal); _menubuilder.menu.AppendAction("Duplicate", _dropDownMenuAction => OnDuplicate?.Invoke(this), DropdownMenuAction.Status.Normal); })); }
protected void Init() { AddToClassList(USS_CLASS_NAME); AddToClassList("rounded"); m_KeyField = new TextField("World State") { value = m_WorldStateDescription.Key }; m_KeyField.tooltip = "The identifier of the world state."; m_KeyField.maxLength = 30; hierarchy.Add(m_KeyField); m_KeyField.RegisterCallback <ChangeEvent <string> >(KeyFieldChanged); hierarchy.Add(new Label("Desired Value")); ConfiguratorValueType?enumType = ConfiguratorTypeConverter.GetTypeFromObject(m_WorldStateDescription.Value); m_EnumFieldValueType = new EnumField("Type", enumType != null ? enumType : ConfiguratorValueType.BOOL) { tooltip = "Data type of the world state." }; m_EnumFieldValueType.AddToClassList("desiredValue"); hierarchy.Add(m_EnumFieldValueType); m_EnumFieldValueType.RegisterCallback <ChangeEvent <Enum> >(EnumChanged); m_ValueField = ConfiguratorTypeConverter.CreateFieldBasedOnType(enumType.Value, m_WorldStateDescription.Value, "Value", ValueFieldChanged); m_ValueField.tooltip = "Value of the world state."; m_ValueField.AddToClassList("desiredValue"); hierarchy.Add(m_ValueField); this.AddManipulator(new Clickable(() => OnMouseDown?.Invoke(this))); this.AddManipulator(new ContextualMenuManipulator(_menubuilder => { _menubuilder.menu.AppendAction("Delete", _dropDownMenuAction => OnDelete?.Invoke(this), DropdownMenuAction.Status.Normal); _menubuilder.menu.AppendAction("Duplicate", _dropDownMenuAction => OnDuplicate?.Invoke(this), DropdownMenuAction.Status.Normal); })); }
private void DuplicateClick(UIComponent component, UIMouseEventParameter eventParam) => OnDuplicate?.Invoke();
public BasicListItem(TDesc _description, bool _useDeleteContextManipulator = true, bool _useDuplicateManipulator = true) { m_Description = _description; m_Text = _description.DisplayName; Init(); if (_useDeleteContextManipulator) { this.AddManipulator(new ContextualMenuManipulator(_menubuilder => { _menubuilder.menu.AppendAction("Delete", _dropDownMenuAction => OnDelete?.Invoke(this), DropdownMenuAction.Status.Normal); })); } if (_useDuplicateManipulator) { this.AddManipulator(new ContextualMenuManipulator(_menubuilder => { _menubuilder.menu.AppendAction("Duplicate", _dropDownMenuAction => OnDuplicate?.Invoke(this), DropdownMenuAction.Status.Normal); })); } }
/// <summary> /// Duplicates the selected items. /// </summary> public void DuplicateSelection() { OnDuplicate?.Invoke(_selection); }