Ejemplo n.º 1
0
        private void RefreshInputControls()
        {
            foreach (Control ctl in InputFlowPanel.Controls)
            {
                ctl.Dispose();
            }

            InputFlowPanel.Controls.Clear();

            var inputs = new Dictionary <InputAxis, List <InputAxis> >();

            foreach (Behavior b in EnabledBehaviorsListBox.CheckedItems)
            {
                foreach (Consideration c in b.Considerations)
                {
                    if (c.Input == null || c.Input.KBRec == null)
                    {
                        continue;
                    }

                    if (!inputs.ContainsKey(c.Input))
                    {
                        inputs.Add(c.Input, new List <InputAxis>());
                    }

                    var clamped = c.Input.Clamp(c.ParameterValues);
                    inputs[c.Input].Add(clamped);
                }
            }

            foreach (var kvp in inputs)
            {
                InputAxis union = null;
                foreach (var input in kvp.Value)
                {
                    union = input.Union(union);
                }

                if (union == null)
                {
                    continue;
                }

                var widget = new EditWidgetConsiderationInput(union, this);
                widget.Tag = kvp.Key;
                InputFlowPanel.Controls.Add(widget);
            }

            RefreshInputs();
        }
Ejemplo n.º 2
0
        internal void Attach(Behavior behavior)
        {
            foreach (Control ctl in ScoreLayoutPanel.Controls)
            {
                ctl.Dispose();
            }

            ScoreLayoutPanel.Controls.Clear();


            foreach (Control ctl in InputFlowPanel.Controls)
            {
                ctl.Dispose();
            }

            InputFlowPanel.Controls.Clear();


            EditBehavior = behavior;
            NameEditWidget.Attach("Behavior", EditBehavior);
            if (!string.IsNullOrEmpty(EditBehavior.Payload))
            {
                CustomPayload.Text = EditBehavior.Payload;
            }
            else
            {
                CustomPayload.Text = "";
            }

            EditBehavior.DialogRebuildNeeded += Rebuild;

            BehaviorWeightEditBox.Value = (decimal)EditBehavior.Weight;

            ActionComboBox.SelectedIndex    = (int)EditBehavior.Action;
            CanTargetSelfCheckBox.Checked   = EditBehavior.CanTargetSelf;
            CanTargetOthersCheckBox.Checked = EditBehavior.CanTargetOthers;

            var inputs = new Dictionary <InputAxis, List <InputAxis> >();

            foreach (var consideration in EditBehavior.Considerations)
            {
                if (consideration.Input != null)
                {
                    if (!inputs.ContainsKey(consideration.Input))
                    {
                        inputs.Add(consideration.Input, new List <InputAxis>());
                    }

                    var clamped = consideration.Input.Clamp(consideration.ParameterValues);
                    inputs[consideration.Input].Add(clamped);

                    ScoreLayoutPanel.Controls.Add(new EditWidgetConsiderationScore(consideration, this));
                }
            }

            foreach (var kvp in inputs)
            {
                InputAxis union = null;
                foreach (var input in kvp.Value)
                {
                    union = input.Union(union);
                }

                if (union == null)
                {
                    continue;
                }

                var widget = new EditWidgetConsiderationInput(union, this);
                widget.Tag = kvp.Key;
                InputFlowPanel.Controls.Add(widget);
            }

            RefreshInputs();
        }