Пример #1
0
 public Dialog_CustomizeApparelComposite(Thing thing)
 {
     if (Things == null)
     {
         Things = new List <Thing>();
     }
     if (thing is Apparel apparel && apparel.Wearer is Pawn pawn)
     {
         foreach (Apparel item in pawn.apparel.WornApparel)
         {
             //	Log.Message(pawn + ": wearing " + item);
             if (!Things.Contains(item) && AdeptusApparelUtility.CanCustomizeApparel(item))
             {
                 //	Log.Message(item + ": Customizeable");
                 Things.Add(item);
             }
         }
     }
     this.thing                   = thing;
     this.thingInd                = Things.IndexOf(thing);
     this.forcePause              = true;
     this.doCloseButton           = true;
     this.absorbInputAroundWindow = true;
     this.soundAppear             = SoundDefOf.CommsWindow_Open;
     this.soundClose              = SoundDefOf.CommsWindow_Close;
 }
Пример #2
0
        public override void PostClose()
        {
            Apparel apparel = this.thing as Apparel;

            if (apparel?.Wearer != null)
            {
                AdeptusApparelUtility.UpdateApparelGraphicsFor(apparel.Wearer);

                apparel.Wearer.Drawer.renderer.graphics.SetAllGraphicsDirty();
                PortraitsCache.SetDirty(apparel.Wearer);
            }
            base.PostClose();
        }
Пример #3
0
        private void FillMainRect(Rect mainRect)
        {
            Apparel apparel = this.thing as Apparel;

            Text.Font = GameFont.Small;
            float height         = 6f + 1 * 30f;
            Rect  scrollRect     = mainRect.LeftHalf();
            Rect  previewRect    = mainRect.RightHalf().TopPart(0.75f);
            Rect  scrollViewRect = new Rect(0f, 0f, scrollRect.width - 16f, height);

            if (apparel?.Wearer is Pawn Wearer)
            {
                GUI.DrawTexture(new Rect(previewRect.center.x - PawnPortraitSize.x / 2f, previewRect.yMin - 24f, PawnPortraitSize.x, PawnPortraitSize.y), PortraitsCache.Get(Wearer, PawnPortraitSize, default(Vector3), 1f, true, true));
            }
            else
            {
                Widgets.ThingIcon(new Rect(previewRect.center.x - PawnPortraitSize.x / 2f, previewRect.yMin - 24f, PawnPortraitSize.x, PawnPortraitSize.y), this.thing, 1f);
            }
            Widgets.BeginScrollView(scrollRect, ref this.scrollPosition, scrollViewRect, true);
            float num  = 6f;
            float num2 = this.scrollPosition.y - 30f;
            float num3 = this.scrollPosition.y + scrollRect.height;
            int   num4 = 0;

            if (this.thing is ApparelComposite composite)
            {
                if (composite.ColorableTwo != null)
                {
                    if (composite.ColorableFaction != null)
                    {
                        if (num > num2 && num < num3)
                        {
                            Rect rect = new Rect(0f, num, scrollViewRect.width, 30f);
                            AdeptusApparelUtility.DrawFactionColorsButton(rect, composite.ColorableFaction, false);
                        }
                        num += 30f;
                        num4++;
                    }
                }
                if (!composite.AltGraphics.NullOrEmpty())
                {
                    if (num > num2 && num < num3)
                    {
                        Rect rect = new Rect(0f, num, scrollViewRect.width, 30f);
                        AdeptusApparelUtility.DrawBaseTextureOptions(rect, "Main Texture:", composite);
                    }
                    num += 30f;
                    num4++;
                }
                if (!composite.Pauldrons.NullOrEmpty())
                {
                    for (int i = 0; i < composite.Pauldrons.Count; i++)
                    {
                        CompPauldronDrawer Drawer = composite.Pauldrons[i];
                        if (!Drawer.activeEntries.EnumerableNullOrEmpty())
                        {
                            foreach (ShoulderPadEntry entry in Drawer.activeEntries)
                            {
                                if (entry.Options.NullOrEmpty() && (entry.UseVariableTextures || entry.UseFactionTextures))
                                {
                                    if (entry.Options.NullOrEmpty())
                                    {
                                        if (Prefs.DevMode)
                                        {
                                            Log.Message(entry.Label + " no options");
                                        }
                                        continue;
                                    }
                                }
                                if (entry.Drawer == null)
                                {
                                    //entry.drawer = Drawer;
                                }
                                if (entry.UseFactionTextures)
                                {
                                    Rect rect = new Rect(0f, num, scrollViewRect.width, 30f);
                                    AdeptusApparelUtility.DrawFactionButton(rect, Drawer, entry, false);
                                    num += 30f;
                                    num4++;
                                }
                                else
                                if (entry.UseVariableTextures)
                                {
                                    Rect rect = new Rect(0f, num, scrollViewRect.width, 30f);
                                    AdeptusApparelUtility.DrawVariantButton(rect, Drawer, entry, false);
                                    num += 30f;
                                    num4++;
                                }
                            }
                        }
                    }
                }

                /*
                 * if (!composite.Extras.NullOrEmpty())
                 * {
                 *      for (int i = 0; i < composite.Extras.Count; i++)
                 *      {
                 *              CompApparelExtraPartDrawer Drawer = composite.Extras[i];
                 *              ExtraApparelPartProps entry = Drawer.ExtraPartEntry;
                 *              if (entry.Options.NullOrEmpty() && (entry.UseVariableTextures || entry.UseFactionTextures))
                 *              {
                 *                      if (entry.Options.NullOrEmpty())
                 *                      {
                 *                              if (Prefs.DevMode) Log.Message(entry.Label + " no options");
                 *                              continue;
                 *                      }
                 *              }
                 *              if (entry.Drawer == null)
                 *              {
                 *                      //entry.drawer = Drawer;
                 *              }
                 *              if (entry.UseFactionTextures)
                 *              {
                 *                      Rect rect = new Rect(0f, num, scrollViewRect.width, 30f);
                 *                      ITab_ToggleLivelry.DrawFactionButton(rect, Drawer, entry, false);
                 *                      num += 30f;
                 *                      num4++;
                 *              }
                 *              if (entry.UseVariableTextures)
                 *              {
                 *                      Rect rect = new Rect(0f, num, scrollViewRect.width, 30f);
                 *                      ITab_ToggleLivelry.DrawVariantButton(rect, Drawer, entry, false);
                 *                      num += 30f;
                 *                      num4++;
                 *              }
                 *
                 *      }
                 * }
                 */
            }

            /*
             * for (int i = 0; i < 10; i++)
             * {
             *      if (num > num2 && num < num3)
             *      {
             *              Rect rect = new Rect(0f, num, scrollViewRect.width, 30f);
             *              DrawSettings(rect, "box");
             *      }
             *      num += 30f;
             *      num4++;
             * }
             */
            Widgets.EndScrollView();
        }