public static Rect AddPortraitWidget(float left, float top, DresserDTO dresserDto)
        {
            // Portrait
            Rect rect = new Rect(left, top, PortraitSize.x, PortraitSize.y);

            // Draw the pawn's portrait
            GUI.BeginGroup(rect);
            Vector2       size     = new Vector2(128f, 180f);
            Rect          position = new Rect(rect.width * 0.5f - size.x * 0.5f, 10f + rect.height * 0.5f - size.y * 0.5f, size.x, size.y);
            RenderTexture image    = PortraitsCache.Get(dresserDto.Pawn, size, new Vector3(0f, 0f, 0f), 1f);

            GUI.DrawTexture(position, image);
            GUI.EndGroup();

            GUI.color = Color.white;
            Widgets.DrawBox(rect, 1);

            for (int x = 0; x < ColorPreset.width; ++x)
            {
                for (int y = 0; y < ColorPreset.height; ++y)
                {
                    ColorPreset.SetPixel(x, y, Color.white);
                }
            }

            return(rect);
        }
示例#2
0
 public DresserUI(DresserDTO dresserDto)
 {
     this.closeOnEscapeKey        = true;
     this.doCloseButton           = false;
     this.doCloseX                = true;
     this.absorbInputAroundWindow = true;
     this.forcePause              = true;
     this.dresserDto              = dresserDto;
     this.dresserDto.SetUpdatePawnListeners(this.UpdatePawn);
 }
 public DresserUI(DresserDTO dresserDto)
 {
     this.doCloseButton           = false;
     this.doCloseX                = true;
     this.absorbInputAroundWindow = true;
     this.forcePause              = true;
     this.dresserDto              = dresserDto;
     this.dresserDto.SetUpdatePawnListeners(this.UpdatePawn);
     this.dresserDto.EditorTypeSelectionDto.SelectionChangeListener += delegate(object sender)
     {
         this.rerenderPawn = true;
     };
 }