예제 #1
0
        /*
         * public override IEnumerable<Gizmo> GetGizmos()
         * {
         *  foreach (var item in base.GetGizmos())
         *  {
         *      yield return item;
         *  }
         *  int num = 700000101;
         *  if (AltGraphicsExt != null)
         *  {
         *      Command_Action command_Action = new Command_Action()
         *      {
         *          icon = this.def.uiIcon,
         *          defaultLabel = AltGraphicsExt.keyLabel + ": " + (ActiveAltGraphic?.label ?? AltGraphicsExt.defaultLabel),
         *          defaultDesc = "Switch." + (ActiveAltGraphic?.texPath ?? def.graphicData.texPath),
         *          hotKey = KeyBindingDefOf.Misc10,
         *          activateSound = SoundDefOf.Click,
         *          action = delegate ()
         *          {
         *              Find.WindowStack.Add(MakeAlternateGraphicMenu());
         *          },
         *          groupKey = num + 1
         *      };
         *      yield return command_Action;
         *  }
         *  yield break;
         * }
         */

        public FloatMenu MakeAlternateGraphicMenu()
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            if (this.AltGraphics.NullOrEmpty())
            {
                return(null);
            }
            if (this.ActiveAltGraphic != null)
            {
                list.Add(new FloatMenuOption(AltGraphicsExt.defaultLabel, delegate()
                {
                    ActiveAltGraphic = null;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));
            }
            using (List <AlternateApparelGraphic> .Enumerator enumerator = this.AltGraphics.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AlternateApparelGraphic item = enumerator.Current;
                    if (this.ActiveAltGraphic == null || this.ActiveAltGraphic != item)
                    {
                        list.Add(new FloatMenuOption(item.label, delegate()
                        {
                            ActiveAltGraphic = item;
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
            }
            return(new FloatMenu(list));
        }
예제 #2
0
 private static IEnumerable <Widgets.DropdownMenuElement <AlternateApparelGraphic> > DrawMainTexVariantButton_GenerateMenu(ApparelComposite composite)
 {
     if (composite.ActiveAltGraphic != null)
     {
         yield return(new Widgets.DropdownMenuElement <AlternateApparelGraphic>
         {
             option = new FloatMenuOption(composite.AltGraphicsExt.defaultLabel.CapitalizeFirst(), delegate()
             {
                 composite.ActiveAltGraphic = null;
                 if (composite.Wearer != null)
                 {
                     UpdateApparelGraphicsFor(composite.Wearer);
                 }
             }, composite.def, MenuOptionPriority.Default, null, null, 0f, null, null),
             payload = null
         });
     }
     using (List <AlternateApparelGraphic> .Enumerator enumerator = composite.AltGraphics.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             AlternateApparelGraphic variant = enumerator.Current;
             if (composite.ActiveAltGraphic != variant)
             {
                 yield return(new Widgets.DropdownMenuElement <AlternateApparelGraphic>
                 {
                     option = new FloatMenuOption(variant.label.CapitalizeFirst() ?? variant.texPath.CapitalizeFirst(), delegate()
                     {
                         composite.ActiveAltGraphic = variant;
                         if (composite.Wearer != null)
                         {
                             UpdateApparelGraphicsFor(composite.Wearer);
                         }
                     }, MenuOptionPriority.Default, null, null, 0f, null, null),
                     payload = variant
                 });
             }
         }
     }
     yield break;
 }