Beispiel #1
0
        private void AddNewGoalListItem(GoalDescription _goalDescription)
        {
            GoalDescription newGoalDescription = new GoalDescription
            {
                GUID         = Guid.NewGuid(),
                DisplayName  = _goalDescription.DisplayName,
                GoalParts    = new WorldStateDescription[_goalDescription.GoalParts.Length],
                UtilityParts = new UtilityDescription[_goalDescription.UtilityParts.Length],
                BaseUtility  = _goalDescription.BaseUtility,
            };

            for (int i = 0; i < _goalDescription.GoalParts.Length; ++i)
            {
                newGoalDescription.GoalParts[i] = new WorldStateDescription(_goalDescription.GoalParts[i]);
            }

            for (int i = 0; i < _goalDescription.UtilityParts.Length; ++i)
            {
                newGoalDescription.UtilityParts[i] = new UtilityDescription(_goalDescription.UtilityParts[i]);
            }

            GoalListItem item = CreateGoalListItem(newGoalDescription);

            m_ListItemScrollView.Add(item);

            item.MarkUnsavedChanges(true);
            AddUnsavedMarker();

            UpdateSelectedListItem(item);
        }
Beispiel #2
0
        private GoalListItem CreateGoalListItem(GoalDescription _goalDescription)
        {
            GoalListItem item = new GoalListItem(_goalDescription);

            item.OnMouseDown += UpdateSelectedListItem;
            item.OnDelete    += DeleteListItem;
            item.OnDuplicate += _item => AddNewGoalListItem((_item as GoalListItem).GetDescription());
            m_ListItems.Add(item);

            return(item);
        }