Ejemplo n.º 1
0
        private static bool StillValid(FloatMenuOption opt, List <FloatMenuOption> curOpts, Pawn forPawn)
        {
            List <FloatMenuOption> list = null;
            Vector3 vector = new Vector3(-9999f, -9999f, -9999f);

            return(FloatMenuMap.StillValid(opt, curOpts, forPawn, ref list, ref vector));
        }
Ejemplo n.º 2
0
        public override void DoWindowContents(Rect inRect)
        {
            Pawn pawn = Find.Selector.SingleSelectedThing as Pawn;

            if (pawn == null)
            {
                Find.WindowStack.TryRemove(this, true);
            }
            else
            {
                if (Time.frameCount % 3 == 0)
                {
                    Profiler.BeginSample("Float menu ChoicesAtFor()");
                    List <FloatMenuOption> list = FloatMenuMakerMap.ChoicesAtFor(this.clickPos, pawn);
                    Profiler.EndSample();
                    List <FloatMenuOption> list2 = list;
                    Vector3 vector = this.clickPos;
                    Profiler.BeginSample("StillValid()");
                    for (int i = 0; i < this.options.Count; i++)
                    {
                        if (!this.options[i].Disabled && !FloatMenuMap.StillValid(this.options[i], list, pawn, ref list2, ref vector))
                        {
                            this.options[i].Disabled = true;
                        }
                    }
                    Profiler.EndSample();
                }
                base.DoWindowContents(inRect);
            }
        }
Ejemplo n.º 3
0
 private static bool StillValid(FloatMenuOption opt, List <FloatMenuOption> curOpts)
 {
     if (opt.revalidateClickTarget == null)
     {
         for (int i = 0; i < curOpts.Count; i++)
         {
             if (FloatMenuMap.OptionsMatch(opt, curOpts[i]))
             {
                 return(true);
             }
         }
     }
     else
     {
         if (!opt.revalidateClickTarget.Spawned)
         {
             return(false);
         }
         List <FloatMenuOption> list = FloatMenuMakerMap.ChoicesAtFor(opt.revalidateClickTarget.Position.ToVector3Shifted(), Find.Selector.SingleSelectedThing as Pawn);
         for (int j = 0; j < list.Count; j++)
         {
             if (FloatMenuMap.OptionsMatch(opt, list[j]))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
        public override void PreOptionChosen(FloatMenuOption opt)
        {
            base.PreOptionChosen(opt);
            Pawn pawn = Find.Selector.SingleSelectedThing as Pawn;

            if (!opt.Disabled && (pawn == null || !FloatMenuMap.StillValid(opt, FloatMenuMakerMap.ChoicesAtFor(this.clickPos, pawn), pawn)))
            {
                opt.Disabled = true;
            }
        }
Ejemplo n.º 5
0
        public override void DoWindowContents(Rect inRect)
        {
            Pawn pawn = Find.Selector.SingleSelectedThing as Pawn;

            if (pawn == null)
            {
                Find.WindowStack.TryRemove(this, true);
                return;
            }
            List <FloatMenuOption> curOpts = FloatMenuMakerMap.ChoicesAtFor(this.clickPos, pawn);

            for (int i = 0; i < this.options.Count; i++)
            {
                if (!this.options[i].Disabled && !FloatMenuMap.StillValid(this.options[i], curOpts))
                {
                    this.options[i].Disabled = true;
                }
            }
            base.DoWindowContents(inRect);
        }
Ejemplo n.º 6
0
 private static bool StillValid(FloatMenuOption opt, List <FloatMenuOption> curOpts, Pawn forPawn, ref List <FloatMenuOption> cachedChoices, ref Vector3 cachedChoicesForPos)
 {
     if (opt.revalidateClickTarget == null)
     {
         for (int i = 0; i < curOpts.Count; i++)
         {
             if (FloatMenuMap.OptionsMatch(opt, curOpts[i]))
             {
                 return(true);
             }
         }
     }
     else
     {
         if (!opt.revalidateClickTarget.Spawned)
         {
             return(false);
         }
         Vector3 vector = opt.revalidateClickTarget.Position.ToVector3Shifted();
         List <FloatMenuOption> list;
         if (vector == cachedChoicesForPos)
         {
             list = cachedChoices;
         }
         else
         {
             cachedChoices       = FloatMenuMakerMap.ChoicesAtFor(vector, forPawn);
             cachedChoicesForPos = vector;
             list = cachedChoices;
         }
         for (int j = 0; j < list.Count; j++)
         {
             if (FloatMenuMap.OptionsMatch(opt, list[j]))
             {
                 return(!list[j].Disabled);
             }
         }
     }
     return(false);
 }