void XH() { UISprite xphud = NGUITools.Draw <UISprite>("xphud", delegate(UISprite xpa) { // sp.atlas = Resources.Load<UIAtlas>("UI/Atlas - Windward"); // sp.spriteName = "Flat"; // sp.type = UISprite.Type.Sliced; // sp.color = new Color(0.25f, 1f, 0f, 1f); // sp.alpha = 1f; xpa.pivot = UIWidget.Pivot.TopLeft; xpa.SetAnchor(0.05f, 0, 0.97f, -10, 0.05f, 300, 0.97f, 5); UILabel xplbl = xpa.gameObject.AddWidget <UILabel>(2); xplbl.name = "XP"; xplbl.pivot = UIWidget.Pivot.BottomLeft; xplbl.bitmapFont = Resources.Load <UIFont>("UI/Font - Qlassik22"); xplbl.fontSize = 14; xplbl.effectStyle = UILabel.Effect.Shadow; xplbl.gradientBottom = new Color(0.5f, 0.5f, 0.5f, 1f); xplbl.SetAnchor(0f, 5, 1f, 2, 0f, xpa.width - 10, 1f, 30); UILabel lblXP = xpa.gameObject.AddComponent <UILabel>(); }); GameShip ship = MyPlayer.ship; int xp = MyPlayer.xp; int num; int num2; int num3; GameConfig.GetPointsFromXP(xp, out num, out num2, out num3); if (ship != null && ship.isActive) { xphud.alpha = 1f; UILabel labelXP = xphud.GetComponent <UILabel>(); Transform childXP = labelXP.transform.FindChild("XP"); if (childXP != null) { UILabel lblXP = childXP.GetComponent <UILabel>(); if (lblXP != null) { lblXP.text = "(TP)" + MyPlayer.talentPoints.ToString() + " (XP) " + xp.ToString("N0") + " / " + num3.ToString("N0"); } if (GameWorld.region != null) { lblXP.text = lblXP.text + " | " + Localization.Get("Region") + " #" + GameWorld.region.id.ToString(); } } } else { xphud.alpha = 0f; } }
void SH() { UISprite fg = NGUITools.Draw <UISprite>("fg", delegate(UISprite sp) { sp.depth = -100000;; // sp.atlas = Resources.Load<UIAtlas>("UI/Atlas - Windward"); // sp.spriteName = "Flat"; // sp.type = UISprite.Type.Sliced; // sp.color = new Color(0.25f, 1f, 0f, 1f); // sp.alpha = 1f; sp.pivot = UIWidget.Pivot.TopLeft; sp.SetAnchor(0.52f, -100, 0.06f, 10, 0.52f, 100, 0.06f, 20); UISprite spa = sp.gameObject.AddWidget <UISprite>(0); spa.depth = -1; spa.atlas = Resources.Load <UIAtlas>("UI/Atlas - Windward"); spa.spriteName = "Flat"; spa.type = UISprite.Type.Sliced; spa.color = new Color(0.25f, 1f, 0f, 1f); spa.pivot = UIWidget.Pivot.TopLeft; spa.SetAnchor(0f, 0, 0f, 0, 0.65f, 0, 1f, 0); UISprite bg = sp.gameObject.AddWidget <UISprite>(0); bg.depth = -1; bg.atlas = spa.atlas; bg.spriteName = "Flat"; bg.type = UISprite.Type.Sliced; bg.color = new Color(0.2f, 0.2f, 0.2f, 1f); bg.pivot = UIWidget.Pivot.TopLeft; bg.SetAnchor(0f, 0, 0f, 0, 0.65f, 0, 1f, 0); UILabel lbl = sp.gameObject.AddWidget <UILabel>(2); lbl.name = "Speed"; lbl.pivot = UIWidget.Pivot.BottomLeft; lbl.bitmapFont = Resources.Load <UIFont>("UI/Font - Qlassik22"); lbl.fontSize = 14; lbl.effectStyle = UILabel.Effect.Shadow; lbl.gradientBottom = new Color(0.5f, 0.5f, 0.5f, 1f); lbl.SetAnchor(0f, 5, 1f, 2, 0f, sp.width - 10, 1f, 30); UILabel lbl2 = sp.gameObject.AddWidget <UILabel>(2); lbl2.name = "Hull"; lbl2.pivot = UIWidget.Pivot.BottomLeft; lbl2.bitmapFont = Resources.Load <UIFont>("UI/Font - Qlassik22"); lbl2.fontSize = 14; lbl2.effectStyle = UILabel.Effect.Shadow; lbl2.gradientBottom = new Color(0.5f, 0.5f, 0.5f, 1f); lbl2.SetAnchor(0f, -65, 0f, 3, 0f, sp.width - 10, 1f, 30); UILabel lbl3 = sp.gameObject.AddWidget <UILabel>(2); lbl3.name = "Sails"; lbl3.pivot = UIWidget.Pivot.BottomLeft; lbl3.bitmapFont = Resources.Load <UIFont>("UI/Font - Qlassik22"); lbl3.fontSize = 14; lbl3.effectStyle = UILabel.Effect.Shadow; lbl3.gradientBottom = new Color(0.5f, 0.5f, 0.5f, 1f); lbl3.SetAnchor(0f, 135, 0f, 3, 0f, sp.width - 10, 1f, 30); UISlider slider = sp.gameObject.AddComponent <UISlider>(); slider.backgroundWidget = bg; slider.foregroundWidget = spa; }); GameShip ship = MyPlayer.ship; if (ship != null && ship.isActive) { fg.alpha = 1f; UISlider slider = fg.GetComponent <UISlider>(); slider.value = Mathf.Abs(ship.relativeMovementSpeed); Transform child = slider.transform.FindChild("Speed"); if (child != null) { UILabel lbl = child.GetComponent <UILabel>(); if (lbl != null) { lbl.text = ship.movementVelocity.magnitude.ToString("F1"); } } Transform child2 = slider.transform.FindChild("Hull"); if (child != null) { UILabel lbl2 = child2.GetComponent <UILabel>(); if (lbl2 != null) { lbl2.text = (ship.health * ship.maxHealth).ToString("F0") + "/" + ship.maxHealth.ToString("F0"); } } Transform child3 = slider.transform.FindChild("Sails"); if (child != null) { UILabel lbl3 = child3.GetComponent <UILabel>(); if (lbl3 != null) { lbl3.text = (ship.secondaryHealth * ship.maxSailHealth).ToString("F0") + "/" + ship.maxSailHealth.ToString("F0"); } } } else { fg.alpha = 0f; } }