Exemplo n.º 1
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo g = enumerator.Current;
                    yield return(g);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>() != null)
            {
                yield return((Gizmo) new Command_Action
                {
                    action = MakeMatchingStockpile,
                    hotKey = KeyBindingDefOf.Misc1,
                    defaultDesc = "CommandMakeBeaconStockpileDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Stockpile"),
                    defaultLabel = "CommandMakeBeaconStockpileLabel".Translate()
                });

                /*Error: Unable to find new state assignment for yield return*/;
            }
            yield break;
IL_015e:
            /*Error near IL_015f: Unexpected return in MoveNext()*/;
        }
Exemplo n.º 2
0
 private void MakeMatchingGrowZone()
 {
     Designator designator = DesignatorUtility.FindAllowedDesignator<Designator_ZoneAdd_Growing>();
     designator.DesignateMultiCell(from tempCell in GrowableCells
                                   where designator.CanDesignateCell(tempCell).Accepted
                                   select tempCell);
 }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo baseGizmo = enumerator.Current;
                    yield return(baseGizmo);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAdd_Growing>() == null)
            {
                yield break;
            }
            yield return((Gizmo) new Command_Action
            {
                action = this.MakeMatchingGrowZone,
                hotKey = KeyBindingDefOf.Misc2,
                defaultDesc = "CommandSunLampMakeGrowingZoneDesc".Translate(),
                icon = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Growing", true),
                defaultLabel = "CommandSunLampMakeGrowingZoneLabel".Translate()
            });

            /*Error: Unable to find new state assignment for yield return*/;
IL_015e:
            /*Error near IL_015f: Unexpected return in MoveNext()*/;
        }
Exemplo n.º 4
0
        public static IEnumerable <Gizmo> GetZoneAddGizmos()
        {
            yield return(DesignatorUtility.FindAllowedDesignator <Designator_GrowZoneSelect>());

            yield return(DesignatorUtility.FindAllowedDesignator <Designator_ZoneAdd_Growing_Expand>());

            yield return(DesignatorUtility.FindAllowedDesignator <Designator_ShrinkZoneSelect>());
        }
Exemplo n.º 5
0
        //public override IEnumerable<Gizmo> GetZoneAddGizmos()
        public static void Postfix(ref IEnumerable <Gizmo> __result)
        {
            List <Gizmo> result = new List <Gizmo> ();

            result.Add(DesignatorUtility.FindAllowedDesignator <Designator_AddMatch_Growing>());
            result.AddRange(__result);
            __result = result;
        }
Exemplo n.º 6
0
        private void MakeMatchingStockpile()
        {
            Designator des = DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>();

            des.DesignateMultiCell(from c in this.PortableCells
                                   where des.CanDesignateCell(c).Accepted
                                   select c);
        }
        public static IEnumerable <Gizmo> GetZoneAddGizmos()
        {
            yield return(DesignatorUtility.FindAllowedDesignator <Designator_TerrainStockpileZoneSelect>());

            yield return(DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Expand>());

            yield return(DesignatorUtility.FindAllowedDesignator <Designator_ShrinkZoneSelect>());
        }
Exemplo n.º 8
0
 public static Rect FocusArea(Rect labelArea, Area area)
 {
     labelArea.width -= (labelArea.height + WidgetRow.DefaultGap) * 3;
     if (Widgets.ButtonInvisible(labelArea))
     {
         Find.WindowStack.TryRemove(typeof(Dialog_ManageAreas), false);
         SelectedAreaInfo.SetValue(null, area);
         Find.DesignatorManager.Select(DesignatorUtility.FindAllowedDesignator <Designator_AreaAllowedExpand>());
     }
     return(labelArea);
 }
Exemplo n.º 9
0
 public static void parrot_designate_thing(Thing t)
 {
     use_native = true;
     try
     {
         DesignatorUtility.FindAllowedDesignator <Designator_Hunt>().DesignateThing(t);
     }
     finally
     {
         use_native = false;
     }
 }
 public static void parrot_designate_single_cell(IntVec3 c)
 {
     use_native = true;
     try
     {
         DesignatorUtility.FindAllowedDesignator <Designator_AreaIgnoreRoof>().DesignateSingleCell(c);
     }
     finally
     {
         use_native = false;
     }
 }
Exemplo n.º 11
0
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     base.CompGetGizmosExtra();
     if (DesignatorUtility.FindAllowedDesignator <Designator_AreaAllowedExpand>() != null)
     {
         yield return(new Command_Action
         {
             action = new Action(this.DesignateArea),
             hotKey = KeyBindingDefOf.Misc1,
             defaultDesc = "VFEF_CommandMakeCompAreaDesc".Translate(base.parent.Label),
             icon = ContentFinder <Texture2D> .Get(TexturePath, true),
             defaultLabel = "VFEF_CommandMakeCompAreaLabel".Translate(base.parent.Label)
         });
     } //end if
 }     //end CompGetGizmosExtra
Exemplo n.º 12
0
 public static void parrot_designate_thing(Thing t, System.Type iType)
 {
     use_native = true;
     try
     {
         MethodInfo mi  = ExpressionHelper.GetMethodInfo(() => DesignatorUtility.FindAllowedDesignator <Designator>());
         MethodInfo mii = mi.GetGenericMethodDefinition().MakeGenericMethod(iType);
         Designator d   = (Designator)mii.Invoke(null, new object[] { });
         d.DesignateThing(t);
     }
     finally
     {
         use_native = false;
     }
 }
Exemplo n.º 13
0
 public static void parrot_designate_single_cell(IntVec3 c, Area z)
 {
     use_native = true;
     try
     {
         Area prev = Designator_AreaAllowed.SelectedArea;
         typeof(Designator_AreaAllowed).GetField("selectedArea", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).SetValue(null, z);
         DesignatorUtility.FindAllowedDesignator <Designator_AreaAllowedExpand>().DesignateSingleCell(c);
         typeof(Designator_AreaAllowed).GetField("selectedArea", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).SetValue(null, prev);
     }
     finally
     {
         use_native = false;
     }
 }
Exemplo n.º 14
0
 public static void parrot_designate_multiple_cell(IEnumerable <IntVec3> cells, System.Type iType)
 {
     use_native = true;
     try
     {
         MethodInfo mi  = ExpressionHelper.GetMethodInfo(() => DesignatorUtility.FindAllowedDesignator <Designator>());
         MethodInfo mii = mi.GetGenericMethodDefinition().MakeGenericMethod(iType);
         Designator d   = (Designator)mii.Invoke(null, new object[] { });
         d.DesignateMultiCell(cells);
     }
     finally
     {
         use_native = false;
     }
 }
Exemplo n.º 15
0
        }     //end CompGetGizmosExtra

        private void DesignateArea()
        {
            List <FloatMenuOption>       dropdown = new List <FloatMenuOption>();
            Designator_AreaAllowedExpand des      = DesignatorUtility.FindAllowedDesignator <Designator_AreaAllowedExpand>() as Designator_AreaAllowedExpand;

            foreach (Area_Allowed a in base.parent.Map.areaManager.AllAreas.OfType <Area_Allowed>())
            {
                dropdown.Add(new FloatMenuOption(a.Label, delegate
                {
                    SetArea(des, a);
                    des.DesignateMultiCell(CellsInRectangularRadius());
                }));
            }
            Find.WindowStack.Add(new FloatMenu(dropdown));
        }//end MakeArea
Exemplo n.º 16
0
        public static Rect FocusArea(Rect labelArea, Area area)
        {
            int numSkip = 3;

            if (Mod.settings.areaForTypes)
            {
                numSkip += 2;
            }
            labelArea.width -= (labelArea.height + WidgetRow.DefaultGap) * numSkip;
            if (Widgets.ButtonInvisible(labelArea))
            {
                Find.WindowStack.TryRemove(typeof(Dialog_ManageAreas), false);
                SelectedArea() = area;
                Find.DesignatorManager.Select(DesignatorUtility.FindAllowedDesignator <Designator_AreaAllowedExpand>());
            }
            return(labelArea);
        }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>() != null)
            {
                Command_Action command_Action = new Command_Action();
                command_Action.action      = MakeMatchingStockpile;
                command_Action.hotKey      = KeyBindingDefOf.Misc1;
                command_Action.defaultDesc = "CommandMakeBeaconStockpileDesc".Translate();
                command_Action.icon        = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Stockpile");

                command_Action.defaultLabel = "CommandMakeBeaconStockpileLabel".Translate();
                yield return(command_Action);
            }
        }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAdd_Growing>() != null)
            {
                Command_Action command_Action = new Command_Action();
                command_Action.action      = MakeMatchingGrowZone;
                command_Action.hotKey      = KeyBindingDefOf.Misc2;
                command_Action.defaultDesc = "CommandSunLampMakeGrowingZoneDesc".Translate();
                command_Action.icon        = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Growing");

                command_Action.defaultLabel = "CommandSunLampMakeGrowingZoneLabel".Translate();
                yield return(command_Action);
            }
        }
Exemplo n.º 19
0
 public override IEnumerable <Gizmo> GetGizmos()
 {
     foreach (Gizmo g in base.GetGizmos())
     {
         yield return(g);
     }
     if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>() != null)
     {
         yield return(new Command_Action
         {
             action = new Action(this.MakeMatchingStockpile),
             hotKey = KeyBindingDefOf.Misc3,
             defaultDesc = "TM_CommandMakePortalStockpileDesc".Translate(),
             icon = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Stockpile", true),
             defaultLabel = "TM_CommandMakePortalStockpileLabel".Translate()
         });
     }
 }
Exemplo n.º 20
0
 public override IEnumerable <Gizmo> GetGizmos()
 {
     foreach (Gizmo baseGizmo in base.GetGizmos())
     {
         yield return(baseGizmo);
     }
     if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAdd_Growing>() != null)
     {
         yield return(new Command_Action
         {
             action = new Action(this.MakeMatchingGrowZone),
             hotKey = KeyBindingDefOf.Misc2,
             defaultDesc = "CommandSunLampMakeGrowingZoneDesc".Translate(),
             icon = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Growing", true),
             defaultLabel = "CommandSunLampMakeGrowingZoneLabel".Translate()
         });
     }
 }
Exemplo n.º 21
0
 public static void parrot_designate_cell(IntVec3 c, DesignateMode mode)
 {
     use_native = true;
     try
     {
         if (mode == DesignateMode.Remove)
         {
             DesignatorUtility.FindAllowedDesignator <Designator_PlanRemove>().DesignateSingleCell(c);
         }
         else
         {
             DesignatorUtility.FindAllowedDesignator <Designator_PlanAdd>().DesignateSingleCell(c);
         }
     }
     finally
     {
         use_native = false;
     }
 }
Exemplo n.º 22
0
 public static void parrot_designate_single_cell(IntVec3 c, Rot4 placingRot, Thing thingToInstall)
 {
     use_native = true;
     try
     {
         var sel = Find.Selector.SelectedObjects;
         Find.Selector.ClearSelection();
         Designator_Install ins = (Designator_Install)DesignatorUtility.FindAllowedDesignator <Designator_Install>();
         var field = ins.GetType().GetField("placingRot", BindingFlags.NonPublic | BindingFlags.Instance);
         RimLog.Message("thing : " + thingToInstall);
         RimLog.Message("field : " + field);
         field.SetValue(ins, placingRot);
         Rand.PushState(0);
         Find.Selector.Select(thingToInstall, false, false);
         ins.DesignateSingleCell(c);
         Find.Selector.ClearSelection();
         sel.ForEach(u => Find.Selector.Select(u, false, false));
     }
     finally
     {
         use_native = false;
     }
 }
Exemplo n.º 23
0
 public override IEnumerable <Gizmo> GetZoneAddGizmos()
 {
     yield return(DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Expand>());
 }
Exemplo n.º 24
0
        public override IEnumerable <Gizmo> GetZoneAddGizmos()
        {
            yield return((Gizmo)DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Expand>());

            /*Error: Unable to find new state assignment for yield return*/;
        }
        public override IEnumerable <Gizmo> GetZoneAddGizmos()
        {
            yield return(DesignatorUtility.FindAllowedDesignator <Designator_ZoneAdd_Growing_Expand>());

            yield break;
        }
        private void MakeMatchingGrowZone()
        {
            Designator designator = DesignatorUtility.FindAllowedDesignator <Designator_ZoneAdd_Growing>();

            designator.DesignateMultiCell(GrowableCells.Where((IntVec3 tempCell) => designator.CanDesignateCell(tempCell).Accepted));
        }
 public override void RenderHighlight(List <IntVec3> dragCells)
 {
     DesignatorUtility.RenderHighlightOverSelectableCells(this, dragCells);
 }
Exemplo n.º 28
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            map = this.Map;
            foreach (Gizmo g in base.GetGizmos())
            {
                yield return(g);
            }
            if (this.BeehouseIsExpectingBees)
            {
                Command_Action RB_Gizmo_Drones_Waiting = new Command_Action();
                RB_Gizmo_Drones_Waiting.action = delegate
                {
                };
                RB_Gizmo_Drones_Waiting.defaultLabel = "RB_InsertBees".Translate();
                RB_Gizmo_Drones_Waiting.defaultDesc  = "RB_InsertBeesDesc".Translate();
                RB_Gizmo_Drones_Waiting.icon         = ContentFinder <Texture2D> .Get("UI/RB_Drones_Waiting", true);

                yield return(RB_Gizmo_Drones_Waiting);
            }
            else if (innerContainerDrones.NullOrEmpty())
            {
                yield return(BeeListSetupUtility.SetBeeListCommand(this, map));
            }
            else
            {
                Command_Action RB_Gizmo_Empty_Drones = new Command_Action();
                RB_Gizmo_Empty_Drones.action = delegate
                {
                    this.EjectContents();
                };
                RB_Gizmo_Empty_Drones.defaultLabel = "RB_ExtractBees".Translate();
                RB_Gizmo_Empty_Drones.defaultDesc  = "RB_ExtractBeesDesc".Translate();
                RB_Gizmo_Empty_Drones.icon         = ContentFinder <Texture2D> .Get("UI/RB_ExtractDrones_FromBeehouse", true);

                yield return(RB_Gizmo_Empty_Drones);
            }

            if (this.BeehouseIsExpectingQueens)
            {
                Command_Action RB_Gizmo_Queens_Waiting = new Command_Action();
                RB_Gizmo_Queens_Waiting.action = delegate
                {
                };
                RB_Gizmo_Queens_Waiting.defaultLabel = "RB_InsertQueens".Translate();
                RB_Gizmo_Queens_Waiting.defaultDesc  = "RB_InsertQueensDesc".Translate();
                RB_Gizmo_Queens_Waiting.icon         = ContentFinder <Texture2D> .Get("UI/RB_Queens_Waiting", true);

                yield return(RB_Gizmo_Queens_Waiting);
            }
            else
            if (innerContainerQueens.NullOrEmpty())
            {
                yield return(BeeListSetupUtility.SetQueenListCommand(this, map));
            }
            else
            {
                Command_Action RB_Gizmo_Empty_Queens = new Command_Action();
                RB_Gizmo_Empty_Queens.action = delegate
                {
                    this.EjectContentsQueens();
                };
                RB_Gizmo_Empty_Queens.defaultLabel = "RB_ExtractQueens".Translate();
                RB_Gizmo_Empty_Queens.defaultDesc  = "RB_ExtractQueensDesc".Translate();
                RB_Gizmo_Empty_Queens.icon         = ContentFinder <Texture2D> .Get("UI/RB_ExtractQueens_FromBeehouse", true);

                yield return(RB_Gizmo_Empty_Queens);
            }
            if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAdd_Growing>() != null)
            {
                yield return(new Command_Action
                {
                    action = new Action(this.MakeMatchingGrowZone),
                    hotKey = KeyBindingDefOf.Misc2,
                    defaultDesc = "RB_CommandBeehouseMakeGrowingZoneDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Growing", true),
                    defaultLabel = "CommandSunLampMakeGrowingZoneLabel".Translate()
                });
            }
        }
        private void MakeMatchingStockpile()
        {
            Designator des = DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>();

            des.DesignateMultiCell(TradeableCells.Where((IntVec3 c) => des.CanDesignateCell(c).Accepted));
        }
Exemplo n.º 30
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    enumerator = base.< GetGizmos > __BaseCallProxy0().GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_155;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        g             = enumerator.Current;
                        this.$current = g;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>() == null)
                {
                    goto IL_155;
                }
                Command_Action mz = new Command_Action();

                mz.action      = new Action(base.MakeMatchingStockpile);
                mz.hotKey      = KeyBindingDefOf.Misc1;
                mz.defaultDesc = "CommandMakeBeaconStockpileDesc".Translate();
                mz.icon        = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Stockpile", true);

                mz.defaultLabel = "CommandMakeBeaconStockpileLabel".Translate();
                this.$current   = mz;
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);

IL_155:
                this.$PC = -1;
                return(false);
            }