Example #1
0
        private void showFloatMapHackMenu(int hackType)
        {
            var opts = new List <FloatMenuOption>();

            foreach (var m in Find.Maps)
            {
                var lib = "";
                if (m == Find.CurrentMap)
                {
                    lib = "ATPP_ThisCurrentMap".Translate(m.Parent.Label);
                }
                else
                {
                    lib = m.Parent.Label;
                }

                opts.Add(new FloatMenuOption(lib, delegate
                {
                    Current.Game.CurrentMap = m;
                    var x = new Designator_SurrogateToHack(hackType);
                    Find.DesignatorManager.Select(x);
                }));
            }

            if (opts.Count == 0)
            {
                return;
            }
            {
                if (opts.Count == 1)
                {
                    var x = new Designator_SurrogateToHack(hackType);
                    Find.DesignatorManager.Select(x);
                }
                else
                {
                    var floatMenuMap = new FloatMenu(opts);
                    Find.WindowStack.Add(floatMenuMap);
                }
            }
        }
Example #2
0
        private void showFloatMapHackMenu(int hackType)
        {
            //Listing map de destination
            List <FloatMenuOption> opts = new List <FloatMenuOption>();
            string lib = "";

            for (int i = 0; i < Find.Maps.Count; i++)
            {
                Map m = Find.Maps[i];
                if (m == Find.CurrentMap)
                {
                    lib = "ATPP_ThisCurrentMap".Translate(m.Parent.Label);
                }
                else
                {
                    lib = m.Parent.Label;
                }

                opts.Add(new FloatMenuOption(lib, delegate
                {
                    Current.Game.CurrentMap      = m;
                    Designator_SurrogateToHack x = new Designator_SurrogateToHack(hackType);
                    Find.DesignatorManager.Select(x);
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
            }
            if (opts.Count != 0)
            {
                if (opts.Count == 1)
                {
                    Designator_SurrogateToHack x = new Designator_SurrogateToHack(hackType);
                    Find.DesignatorManager.Select(x);
                }
                else
                {
                    FloatMenu floatMenuMap = new FloatMenu(opts);
                    Find.WindowStack.Add(floatMenuMap);
                }
            }
        }