Ejemplo n.º 1
0
        public static void DrawBaseTextureOptions(Rect rect, string label, ApparelComposite composite, bool paintable = false)
        {
            float w     = rect.width / 5;
            float w2    = (rect.width - w) / 4;
            float y     = rect.y;
            float x     = rect.x;
            Rect  rect1 = new Rect(x, y, w, 30f);

            Widgets.Label(rect1, label);
            x += w;
            Rect rect2 = new Rect(x, y, w2, 30f);

            Widgets.Dropdown <ApparelComposite, AlternateApparelGraphic>
            (
                rect2,
                composite,
                (ApparelComposite p) => p.ActiveAltGraphic,
                new Func <ApparelComposite, IEnumerable <Widgets.DropdownMenuElement <AlternateApparelGraphic> > >(DrawMainTexVariantButton_GenerateMenu),
                composite.ActiveAltGraphic?.label.CapitalizeFirst() ?? composite.AltGraphicsExt.defaultLabel.CapitalizeFirst(),
                null,
                null,
                null,
                delegate()
            {
            },
                paintable
            );
            x += w;
        }
Ejemplo n.º 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;
 }