Exemple #1
0
        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();
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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);
        }