Beispiel #1
0
        public void UpdateSelection(int sel)
        {
            InternalChange = true;
            SelectedIndex  = sel;
            bool enabled = true;

            try
            {
                Selected = ActiveTTAB.InteractionByIndex[(uint)sel];
            }
            catch (Exception) {
                Selected = new TTABInteraction()
                {
                    TTAIndex = 0, MotiveEntries = new TTABMotiveEntry[MotiveNames.Length]
                };
                enabled = false;
                //disable everything and set Selected to a dummy.
            }

            AllowBox.Enabled     = enabled;
            ActionButton.Enabled = enabled;
            CheckButton.Enabled  = enabled;
            FlagsBox.Enabled     = enabled;
            MetaBox.Enabled      = enabled;
            MotiveBox.Enabled    = enabled;

            InteractionPathName.Text = GetTTA(Selected.TTAIndex);
            AutonomyInput.Value      = Selected.AutonomyThreshold;
            AttenuationCombo.Text    = Selected.AttenuationValue.ToString();
            JoinInput.Value          = Math.Max(-1, Selected.JoiningIndex);

            UpdateMotiveList();

            foreach (var checkAtt in FlagNames)
            {
                var check    = checkAtt.Key;
                var att      = checkAtt.Value;
                var property = Selected.GetType().GetProperty(att);
                check.Checked = (bool)property.GetValue(Selected, new object[0]);
            }

            if (InteractionList.Items.Count > 0)
            {
                var int1 = PieToInteraction.FirstOrDefault(x => x.Value == sel);
                PieView.SelectedNode = int1.Key;
                var int2 = -1;
                TTAToListIndex.TryGetValue(sel, out int2);
                if (int2 != -1 && !InteractionList.SelectedIndices.Contains(int2))
                {
                    InteractionList.SelectedIndices.Clear();
                    InteractionList.SelectedIndices.Add(int2);
                }
            }
            InternalChange = false;
            var oldInd = MotiveList.SelectedIndex;

            MotiveList.SelectedIndex = -1;
            MotiveList.SelectedIndex = oldInd;
        }
Beispiel #2
0
        private void FlagCheckedChanged(object sender, EventArgs e)
        {
            if (InternalChange)
            {
                return;
            }
            var  me       = (CheckBox)sender;
            var  param    = FlagNames[me];
            var  property = Selected.GetType().GetProperty(param);
            var  sel      = Selected;
            bool value    = me.Checked;

            Content.Content.Get().Changes.QueueResMod(new ResAction(() =>
            {
                property.SetValue(sel, value, new object[0]);
            }, ActiveTTAB));
        }