Beispiel #1
0
        public void SpawnSetup()
        {
            uiOverlay = new DroidUIOverlay(parent);
            parent.drawer.renderer.graphics.ResolveGraphics();
            parent.story.hairDef = DefDatabase <HairDef> .GetNamed("Shaved", true);


            try
            {
                if (headGraphicDef != null && bodyGraphicDef.supportsHead)
                {
                    headGraphic = headGraphicDef.graphicData.Graphic;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
                return;
            }
            try
            {
                bodyGraphic = bodyGraphicDef.graphicData.Graphic;
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }

            if (headGraphic != null)
            {
                parent.drawer.renderer.graphics.headGraphic = this.headGraphic;
                parent.drawer.renderer.graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi>(parent.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, parent.story.hairColor);
            }
            parent.drawer.renderer.graphics.nakedGraphic = this.bodyGraphic;
        }
        public void SpawnSetup()
        {
            uiOverlay = new DroidUIOverlay(parent);
            parent.drawer.renderer.graphics.ResolveGraphics();
            parent.story.hairDef = DefDatabase<HairDef>.GetNamed("Shaved", true);

            try
            {
                if (headGraphicDef != null && bodyGraphicDef.supportsHead)
                {
                    headGraphic = headGraphicDef.graphicData.Graphic;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
                return;
            }
            try
            {
                bodyGraphic = bodyGraphicDef.graphicData.Graphic;
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }

            if (headGraphic != null)
            {
                parent.drawer.renderer.graphics.headGraphic = this.headGraphic;
                parent.drawer.renderer.graphics.hairGraphic = GraphicDatabase.Get<Graphic_Multi>(parent.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, parent.story.hairColor);
            }
            parent.drawer.renderer.graphics.nakedGraphic = this.bodyGraphic;
        }
Beispiel #3
0
        public void DrawGUIOverlay()
        {
            if (!this.droid.SpawnedInWorld || Find.FogGrid.IsFogged(this.droid.Position))
            {
                return;
            }

            Vector3 vector = GenWorldUI.LabelDrawPosFor(this.droid, -0.6f);
            float   num    = vector.y;

            if (DroidUIOverlay.ShouldDrawOverlayOnMap(this.droid))
            {
                Text.Font = GameFont.Tiny;
                float num2 = Text.CalcSize(this.droid.Nickname).x;
                if (num2 < 20f)
                {
                    num2 = 20f;
                }
                Rect rect = new Rect(vector.x - num2 / 2f - 4f, vector.y, num2 + 8f, 12f);
                GUI.DrawTexture(rect, TexUI.GrayTextBG);
                if (this.droid.health.summaryHealth.SummaryHealthPercent < 0.999f)
                {
                    Rect screenRect = rect.ContractedBy(1f);
                    Widgets.FillableBar(screenRect, this.droid.health.summaryHealth.SummaryHealthPercent, PawnUIOverlay.HealthTex, BaseContent.ClearTex, false);
                }
                GUI.color   = PawnNameColorUtility.PawnNameColorOf(this.droid);
                Text.Anchor = TextAnchor.UpperCenter;
                Widgets.Label(new Rect(vector.x - num2 / 2f, vector.y - 2f, num2, 999f), this.droid.Nickname);
                if (this.droid.playerController != null && this.droid.playerController.Drafted)
                {
                    Widgets.DrawLineHorizontal(vector.x - num2 / 2f, vector.y + 11f, num2);
                }
                GUI.color   = Color.white;
                Text.Anchor = TextAnchor.UpperLeft;
                num        += 12f;
            }
        }
Beispiel #4
0
 public virtual void DoGraphicChanges()
 {
     overlay = new DroidUIOverlay(this);
     this.drawer.renderer.graphics.ResolveGraphics();
     this.story.hairDef = DefDatabase<HairDef>.GetNamed("Shaved", true);
     if (headGraphic != null)
     {
         this.drawer.renderer.graphics.headGraphic = this.headGraphic;
         this.drawer.renderer.graphics.hairGraphic = GraphicDatabase.Get<Graphic_Multi>(this.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, this.story.hairColor);
     }
     this.drawer.renderer.graphics.nakedGraphic = this.bodyGraphic;
 }