public WorldStateUtilityItem(UtilityDescription _worldStateUtilityDescription, Action _anyValueChangedCallback, Action <WorldStateUtilityItem> _mouseDownCallback, Action <WorldStateUtilityItem> _deleteCallback, Action <WorldStateUtilityItem> _duplicateCallback) { m_UtilityDescription = _worldStateUtilityDescription; OnAnyValueChanged = _anyValueChangedCallback; OnMouseDown = _mouseDownCallback; OnDelete = _deleteCallback; OnDuplicate = _duplicateCallback; Init(); }
private void AddNewUtilityItem(UtilityDescription _utilityDescription) { if (m_SelectedListItem is GoalListItem selectedGoalListItem) { GoalDescription selectedDescription = selectedGoalListItem.GetDescription(); int newIndex = PuppeteerEditorHelper.Append(ref selectedDescription.UtilityParts, _utilityDescription); WorkingMemoryUtilityItem utilityItem = CreateUtilityItem(selectedDescription.UtilityParts[newIndex]); m_SelectedListItem.MarkUnsavedChanges(true); AddUnsavedMarker(); UpdateSelectedUtilityItem(utilityItem); } }
private WorkingMemoryUtilityItem CreateUtilityItem(UtilityDescription _utilityDescription) { WorkingMemoryUtilityItem utilityItem = new WorkingMemoryUtilityItem( _utilityDescription, AnyUtilityItemValueChanged, _item => { if (m_SelectedGoalPartItem != null) { PuppeteerEditorHelper.UpdateSelectedWorldStateItem(ref m_SelectedGoalPartItem, null); } UpdateSelectedUtilityItem(_item); }, DeleteUtilityItem, DuplicateUtilityItem ); m_GoalConfigurator.UtilityContainer.Add(utilityItem); return(utilityItem); }