Esempio n. 1
0
        public static IEnumerable <KeyBindingCategoryDef> ImpliedKeyBindingCategoryDefs()
        {
            List <KeyBindingCategoryDef> gameUniversalCats = (from d in DefDatabase <KeyBindingCategoryDef> .AllDefs
                                                              where d.isGameUniversal
                                                              select d).ToList();

            using (IEnumerator <DesignationCategoryDef> enumerator = DefDatabase <DesignationCategoryDef> .AllDefs.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    DesignationCategoryDef def    = enumerator.Current;
                    KeyBindingCategoryDef  catDef = new KeyBindingCategoryDef();
                    catDef.defName        = "Architect_" + def.defName;
                    catDef.label          = def.label + " tab";
                    catDef.description    = "Key bindings for the \"" + def.LabelCap + "\" section of the Architect menu";
                    catDef.modContentPack = def.modContentPack;
                    catDef.checkForConflicts.AddRange(gameUniversalCats);
                    for (int i = 0; i < gameUniversalCats.Count; i++)
                    {
                        gameUniversalCats[i].checkForConflicts.Add(catDef);
                    }
                    def.bindingCatDef = catDef;
                    yield return(catDef);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_01ca:
            /*Error near IL_01cb: Unexpected return in MoveNext()*/;
        }
        public static IEnumerable <KeyBindingCategoryDef> ImpliedKeyBindingCategoryDefs()
        {
            List <KeyBindingCategoryDef> gameUniversalCats = DefDatabase <KeyBindingCategoryDef> .AllDefs.Where((KeyBindingCategoryDef d) => d.isGameUniversal).ToList();

            foreach (DesignationCategoryDef allDef in DefDatabase <DesignationCategoryDef> .AllDefs)
            {
                KeyBindingCategoryDef keyBindingCategoryDef = new KeyBindingCategoryDef();
                keyBindingCategoryDef.defName        = "Architect_" + allDef.defName;
                keyBindingCategoryDef.label          = allDef.label + " tab";
                keyBindingCategoryDef.description    = "Key bindings for the \"" + allDef.LabelCap + "\" section of the Architect menu";
                keyBindingCategoryDef.modContentPack = allDef.modContentPack;
                keyBindingCategoryDef.checkForConflicts.AddRange(gameUniversalCats);
                for (int i = 0; i < gameUniversalCats.Count; i++)
                {
                    gameUniversalCats[i].checkForConflicts.Add(keyBindingCategoryDef);
                }
                allDef.bindingCatDef = keyBindingCategoryDef;
                yield return(keyBindingCategoryDef);
            }
        }
        public static IEnumerable <KeyBindingCategoryDef> ImpliedKeyBindingCategoryDefs()
        {
            List <KeyBindingCategoryDef> gameUniversalCats = (from d in DefDatabase <KeyBindingCategoryDef> .AllDefs
                                                              where d.isGameUniversal
                                                              select d).ToList <KeyBindingCategoryDef>();

            foreach (DesignationCategoryDef def in DefDatabase <DesignationCategoryDef> .AllDefs)
            {
                KeyBindingCategoryDef catDef = new KeyBindingCategoryDef();
                catDef.defName     = "Architect_" + def.defName;
                catDef.label       = def.label + " tab";
                catDef.description = "Key bindings for the \"" + def.LabelCap + "\" section of the Architect menu";
                catDef.checkForConflicts.AddRange(gameUniversalCats);
                for (int i = 0; i < gameUniversalCats.Count; i++)
                {
                    gameUniversalCats[i].checkForConflicts.Add(catDef);
                }
                def.bindingCatDef = catDef;
                yield return(catDef);
            }
        }