void _Input() { this.BeginOrtho(); this.DrawBG(); var rtHead = new Rect(headRT); var rtName = new Rect(nameRT); var rtProp = new Rect(propRT); GLUI.DrawTex(headTex, UITool.GetVS(rtHead.cornerLB, rtHead.size, Vector2.zero)); var P = CharCtrl.I.P; GLUI.DrawString(rtName.center, P.charName, Vectors.half2d); GLUI.DrawString(rtProp.cornerLB, "生命: " + P.hp + "/" + P.hpMax); GLUI.DrawString(rtProp.cornerLB + -28.Y(), "魔法: " + P.mp + "/" + P.mpMax); GLUI.DrawString(rtProp.cornerLB + -28 * 2.Y(), "经验值: " + P.exp + "/" + P.expMax); GLUI.DrawString(rtProp.cornerLB + -28 * 3.Y(), "等级: " + P.lvl); }
void Update() { if (!Application.isPlaying && !updateInEditor) { return; } if (draw) { this.BeginOrtho(); this.Draw(); } if (modify) { rt.anchorMin = anchorMin; rt.anchorMax = anchorMax; rt.pivot = pivot; } else { anchorMin = rt.anchorMin; anchorMax = rt.anchorMax; offsetMin = rt.offsetMin; offsetMax = rt.offsetMax; pivot = rt.pivot; anchoredPosition = rt.anchoredPosition; sizeDelta = rt.sizeDelta; rectSize = rt.rect.size; rectPos = rt.rect.position; rect = new Rect(rt); absPosition = rect.pos; absPositionParent = UI.AbsRefPos(rt.parent); if (draw) { UITool.DrawSquare(absPositionParent, rectSideLength, Color.blue); } mouseOver = rect.Contains(UI.mousePosRef); } }
public static bool Button(string name, Vector2 pos, Vector2 buttonSize) { var rt = new Rect(pos, buttonSize); var down = false; if (Events.MouseDown0) { UITool.DrawButton(rt, Color.white, 2); down = rt.Contains(UI.mousePosRef); // down } else { if (rt.Contains(UI.mousePosRef)) // hover { UITool.DrawButton(rt, Color.white, 1); } else { UITool.DrawButton(rt, Color.white, 0); // normal } } GLUI.DrawString(name, pos, Vectors.half2d); return(down); }