Пример #1
0
        private void olvTTSettings_CellEditFinishing(object sender, BrightIdeasSoftware.CellEditEventArgs e)
        {
            int            idx    = olvTTSettings.SelectedIndex;
            TeamTypeOption option = (e.RowObject as TeamTypeEntry).Option; //teamTypeOptions[idx];

            if (option.List != null)                                       // ((option is TeamTypeOptionAIObject) || (option is TeamTypeOptionList))
            {
                e.NewValue = (e.Control as ComboBox).SelectedItem;
            }
        }
Пример #2
0
        private List <TeamTypeOption> LoadTeamTypeOptions(IniDictionary config)
        {
            List <TeamTypeOption> options = new List <TeamTypeOption>();
            OrderedDictionary     section = config["TeamTypeOptions"];

            foreach (DictionaryEntry entry in section)
            {
                string[]       split  = (entry.Value as string).Split(',');
                string         tag    = split[0];
                string         name   = split[1];
                string         type   = split[2];
                TeamTypeOption option = null;

                if (type.CompareTo("TASKFORCES") == 0)
                {
                    option = new TeamTypeOptionAIObject(tag, name, taskForces.Items);
                }
                else if (type.CompareTo("SCRIPTTYPES") == 0)
                {
                    option = new TeamTypeOptionAIObject(tag, name, scriptTypes.Items);
                }
                else if (type.CompareTo("VETERANCY") == 0)
                {
                    option = new TeamTypeOptionList(tag, name, veterancyTypes);
                }
                else if (type.CompareTo("GROUP") == 0)
                {
                    option = new TeamTypeOptionList(tag, name, groupTypes);
                }
                else if (type.CompareTo("MIND") == 0)
                {
                    option = new TeamTypeOptionList(tag, name, mindControlTypes);
                }
                else if (type.CompareTo("HOUSE") == 0)
                {
                    option = new TeamTypeOptionStringList(tag, name, teamHouseTypes);
                }
                else if (type.CompareTo("BOOL") == 0)
                {
                    option = new TeamTypeOptionBool(tag, name);
                }
                else
                {
                    option = new TeamTypeOptionNumber(tag, name);
                }

                options.Add(option);
            }

            return(options);
        }
Пример #3
0
        private void olvTTSettings_CellEditStarting(object sender, BrightIdeasSoftware.CellEditEventArgs e)
        {
            int            idx    = olvTTSettings.SelectedIndex;
            TeamTypeOption option = (e.RowObject as TeamTypeEntry).Option;

            if (option.List != null)           // (option is TeamTypeOptionAIObject) || (option is TeamTypeOptionList) )
            {
                ComboBox cmb = new ComboBox();
                cmb.FlatStyle     = FlatStyle.Flat;
                cmb.DropDownStyle = ComboBoxStyle.DropDownList;
                cmb.Sorted        = option is TeamTypeOptionAIObject;
                foreach (object item in option.List)
                {
                    cmb.Items.Add(item);
                }
                cmb.SelectedItem = e.Value;
                cmb.Bounds       = e.CellBounds;
                e.Control        = cmb;
            }
        }
Пример #4
0
 public TeamTypeEntry(TeamTypeEntry other)
 {
     this.option = other.option;
     this.Value  = other.Value;
 }
Пример #5
0
 public TeamTypeEntry(TeamTypeOption option, object value)
 {
     this.option = option;
     this.Value  = value;
 }