コード例 #1
0
        private void InjectDesignators()
        {
            int num = 0;

            foreach (MinerDesignatorDef current in DefDatabase <MinerDesignatorDef> .AllDefs)
            {
                if (!current.Injected)
                {
                    List <Designator> allResolvedDesignators = current.Category.AllResolvedDesignators;
                    int num2 = -1;
                    for (int i = 0; i < allResolvedDesignators.Count; i++)
                    {
                        if (allResolvedDesignators[i].GetType() == current.insertAfter)
                        {
                            num2 = i;
                            break;
                        }
                    }
                    if (num2 >= 0)
                    {
                        Designator_MineTool designator_MineTool = this.InstantiateDesignator(current.designatorClass, current);
                        designator_MineTool.icon = current.IconTex;
                        allResolvedDesignators.Insert(num2 + 1, designator_MineTool);
                        num++;
                    }
                    else
                    {
                        Bootstrapper.Logger.Error(string.Format("Failed to inject {0} after {1}", current.defName, current.insertAfter.Name), new object[0]);
                    }
                    current.Injected = true;
                }
            }
            if (num > 0)
            {
                Bootstrapper.Logger.Trace(new object[]
                {
                    "Injected " + num + " designators"
                });
            }
        }
コード例 #2
0
 public DesignatorEntry(Designator_MineTool designator, KeyBindingDef key)
 {
     this.designator = designator;
     this.key        = key;
 }