public virtual void ComposeStatsGui() { ElementBounds leftDlgBounds = Composers["playercharacter"].Bounds; ElementBounds botDlgBounds = Composers["environment"].Bounds; ElementBounds leftColumnBounds = ElementBounds.Fixed(0, 25, 90, 20); ElementBounds rightColumnBounds = ElementBounds.Fixed(120, 30, 120, 8); ElementBounds leftColumnBoundsW = ElementBounds.Fixed(0, 0, 140, 20); ElementBounds rightColumnBoundsW = ElementBounds.Fixed(165, 0, 120, 20); EntityPlayer entity = capi.World.Player.Entity; double b = botDlgBounds.InnerHeight / RuntimeEnv.GUIScale + 10; ElementBounds bgBounds = ElementBounds .Fixed(0, 0, 130 + 100 + 5, leftDlgBounds.InnerHeight / RuntimeEnv.GUIScale - GuiStyle.ElementToDialogPadding - 20 + b) .WithFixedPadding(GuiStyle.ElementToDialogPadding) ; ElementBounds dialogBounds = bgBounds.ForkBoundingParent() .WithAlignment(EnumDialogArea.LeftMiddle) .WithFixedAlignmentOffset((leftDlgBounds.renderX + leftDlgBounds.OuterWidth + 10) / RuntimeEnv.GUIScale, b / 2) ; float?health = null; float?maxhealth = null; float?saturation = null; float?maxsaturation = null; getHealthSat(out health, out maxhealth, out saturation, out maxsaturation); float walkspeed = entity.Stats.GetBlended("walkspeed"); float healingEffectivness = entity.Stats.GetBlended("healingeffectivness"); float hungerRate = entity.Stats.GetBlended("hungerrate"); float rangedWeaponAcc = entity.Stats.GetBlended("rangedWeaponsAcc"); float rangedWeaponSpeed = entity.Stats.GetBlended("rangedWeaponsSpeed"); ITreeAttribute tempTree = entity.WatchedAttributes.GetTreeAttribute("bodyTemp"); float wetness = entity.WatchedAttributes.GetFloat("wetness"); string wetnessString = ""; if (wetness > 0.7) { wetnessString = Lang.Get("wetness_soakingwet"); } else if (wetness > 0.4) { wetnessString = Lang.Get("wetness_wet"); } else if (wetness > 0.1) { wetnessString = Lang.Get("wetness_slightlywet"); } Composers["playerstats"] = capi.Gui .CreateCompo("playerstats", dialogBounds) .AddShadedDialogBG(bgBounds, true) .AddDialogTitleBar(Lang.Get("Stats"), () => dlg.OnTitleBarClose()) .BeginChildElements(bgBounds) ; if (saturation != null) { Composers["playerstats"] .AddStaticText(Lang.Get("playerinfo-nutrition"), CairoFont.WhiteSmallText().WithWeight(Cairo.FontWeight.Bold), leftColumnBounds.WithFixedWidth(200)) .AddStaticText(Lang.Get("playerinfo-nutrition-Freeza"), CairoFont.WhiteDetailText(), leftColumnBounds = leftColumnBounds.BelowCopy().WithFixedWidth(90)) .AddStaticText(Lang.Get("playerinfo-nutrition-Vegita"), CairoFont.WhiteDetailText(), leftColumnBounds = leftColumnBounds.BelowCopy()) .AddStaticText(Lang.Get("playerinfo-nutrition-Krillin"), CairoFont.WhiteDetailText(), leftColumnBounds = leftColumnBounds.BelowCopy()) .AddStaticText(Lang.Get("playerinfo-nutrition-Cell"), CairoFont.WhiteDetailText(), leftColumnBounds = leftColumnBounds.BelowCopy()) .AddStaticText(Lang.Get("playerinfo-nutrition-Dairy"), CairoFont.WhiteDetailText(), leftColumnBounds = leftColumnBounds.BelowCopy()) .AddStatbar(rightColumnBounds = rightColumnBounds.BelowCopy(0, 16), GuiStyle.FoodBarColor, "fruitBar") .AddStatbar(rightColumnBounds = rightColumnBounds.BelowCopy(0, 12), GuiStyle.FoodBarColor, "vegetableBar") .AddStatbar(rightColumnBounds = rightColumnBounds.BelowCopy(0, 12), GuiStyle.FoodBarColor, "grainBar") .AddStatbar(rightColumnBounds = rightColumnBounds.BelowCopy(0, 12), GuiStyle.FoodBarColor, "proteinBar") .AddStatbar(rightColumnBounds = rightColumnBounds.BelowCopy(0, 12), GuiStyle.FoodBarColor, "dairyBar") ; leftColumnBoundsW = leftColumnBoundsW.FixedUnder(leftColumnBounds, -5); } Composers["playerstats"] .AddStaticText(Lang.Get("Physical"), CairoFont.WhiteSmallText().WithWeight(Cairo.FontWeight.Bold), leftColumnBoundsW.WithFixedWidth(200).WithFixedOffset(0, 23)) .Execute(() => { leftColumnBoundsW = leftColumnBoundsW.FlatCopy(); leftColumnBoundsW.fixedY += 5; }) ; if (health != null) { Composers["playerstats"] .AddStaticText(Lang.Get("Health Points"), CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) .AddDynamicText(health + " / " + maxhealth, CairoFont.WhiteDetailText(), rightColumnBoundsW = rightColumnBoundsW.FlatCopy().WithFixedPosition(rightColumnBoundsW.fixedX, leftColumnBoundsW.fixedY).WithFixedHeight(30), "health") ; } if (saturation != null) { Composers["playerstats"] .AddStaticText(Lang.Get("Satiety"), CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) .AddDynamicText((int)saturation + " / " + (int)maxsaturation, CairoFont.WhiteDetailText(), rightColumnBoundsW = rightColumnBoundsW.FlatCopy().WithFixedPosition(rightColumnBoundsW.fixedX, leftColumnBoundsW.fixedY), "satiety") ; } if (tempTree != null) { Composers["playerstats"] .AddStaticText(Lang.Get("Body Temperature"), CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) .AddRichtext(tempTree == null ? "-" : getBodyTempText(tempTree), CairoFont.WhiteDetailText(), rightColumnBoundsW = rightColumnBoundsW.FlatCopy().WithFixedPosition(rightColumnBoundsW.fixedX, leftColumnBoundsW.fixedY), "bodytemp") ; } if (wetnessString.Length > 0) { Composers["playerstats"] .AddRichtext(wetnessString, CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) ; } Composers["playerstats"] .AddStaticText(Lang.Get("Walk speed"), CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) .AddDynamicText((int)Math.Round(100 * walkspeed) + "%", CairoFont.WhiteDetailText(), rightColumnBoundsW = rightColumnBoundsW.FlatCopy().WithFixedPosition(rightColumnBoundsW.fixedX, leftColumnBoundsW.fixedY), "walkspeed") .AddStaticText(Lang.Get("Healing effectivness"), CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) .AddDynamicText((int)Math.Round(100 * healingEffectivness) + "%", CairoFont.WhiteDetailText(), rightColumnBoundsW = rightColumnBoundsW.FlatCopy().WithFixedPosition(rightColumnBoundsW.fixedX, leftColumnBoundsW.fixedY), "healeffectiveness") ; if (saturation != null) { Composers["playerstats"] .AddStaticText(Lang.Get("Hunger rate"), CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) .AddDynamicText((int)Math.Round(100 * hungerRate) + "%", CairoFont.WhiteDetailText(), rightColumnBoundsW = rightColumnBoundsW.FlatCopy().WithFixedPosition(rightColumnBoundsW.fixedX, leftColumnBoundsW.fixedY), "hungerrate") ; } Composers["playerstats"] .AddStaticText(Lang.Get("Ranged Accuracy"), CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) .AddDynamicText((int)Math.Round(100 * rangedWeaponAcc) + "%", CairoFont.WhiteDetailText(), rightColumnBoundsW = rightColumnBoundsW.FlatCopy().WithFixedPosition(rightColumnBoundsW.fixedX, leftColumnBoundsW.fixedY), "rangedweaponacc") .AddStaticText(Lang.Get("Ranged Charge Speed"), CairoFont.WhiteDetailText(), leftColumnBoundsW = leftColumnBoundsW.BelowCopy()) .AddDynamicText((int)Math.Round(100 * rangedWeaponSpeed) + "%", CairoFont.WhiteDetailText(), rightColumnBoundsW = rightColumnBoundsW.FlatCopy().WithFixedPosition(rightColumnBoundsW.fixedX, leftColumnBoundsW.fixedY), "rangedweaponchargespeed") .EndChildElements() .Compose() ; UpdateStatBars(); }