Ejemplo n.º 1
0
        private void ShowAISetup()
        {
            if (aiAgent == null)
            {
                viewContainer.Add(new Label("No AI Agent found"));
                return;
            }

            var aiName = new Label(aiAgent.GetType().Name);

            viewContainer.Add(aiName);

            if (aiAgent.Actions == null || aiAgent.Goals == null)
            {
                viewContainer.Add(new Label("AI Agent actions/goals are empty."));
                return;
            }

            foreach (var goal in goals)
            {
                var goalLabel = new Button {
                    text = $"{goal} ({goal.Priority})"
                };
                viewContainer.Add(goalLabel);

                goalLabel.clicked += () => {
                    if (expandedGoals.Contains(goal))
                    {
                        expandedGoals.Remove(goal);
                    }
                    else
                    {
                        expandedGoals.Add(goal);
                    }
                    UpdateContents();
                };

                if (expandedGoals.Contains(goal))
                {
                    var goalDetails = GetGoalDetails(goal);
                    viewContainer.Add(goalDetails);
                }
            }

            foreach (var action in actions)
            {
                viewContainer.Add(GetActionDetails(action));
            }
        }