public void Update() { // This is an item, on the floor, that has a collider. Yep. if (MouseOver) { if (AllowPickup && !Item.IsEquipped()) { // Show the user that they can pick this item up. if (InputManager.Active) { string key = InputManager.GetInput("Pick up").ToString(); string itemName = RichText.InBold(RichText.InColour(Item.Name, ItemRarityUtils.GetColour(Item.Rarity))); ActionHUD.DisplayAction("PickupPrompt".Translate(key, itemName)); } if (InputManager.InputDown("Pick up")) { // Check client-server situation... if (isServer) { // Pick up manually. Item.RequestDataUpdate(); PickupAccepted(Item.Data); Destroy(this.gameObject); } else { // Pick up using the command. Player.Local.NetUtils.CmdRequestPickup(Player.Local.gameObject, this.gameObject); } } } } }
public void LateUpdate() { if (!Active) { return; } str = (RichText.InBold(RichText.InColour("FPS: " + FPS, FPS > 55 ? Color.green : FPS > 30 ? Color.yellow : Color.red)) + "\n") + str; Text.text = str; str = ""; }
public string GetHelp(bool forPrint = false) { str.Clear(); const string INDENT = " * "; const string SEP = ", "; const string TYPE_START = " ("; const string TYPE_END = ") - "; const string WHITESPACE = " "; str.Append(forPrint ? RichText.InBold(Name) : Name); str.Append(WHITESPACE); for (int i = 0; i < ParameterCount; i++) { var param = Parameters[i]; str.Append(param.Name.Trim().ToLower()); if (i != ParameterCount - 1) { str.Append(SEP); } } str.AppendLine(); str.Append(Method.DeclaringType.FullName); str.Append('.'); str.Append(Method.Name); str.AppendLine(); str.Append(forPrint ? RichText.InItalics(Description) : Description); str.AppendLine(); for (int i = 0; i < ParameterCount; i++) { str.Append(INDENT); var param = Parameters[i]; str.Append(param.Name.ToLower().Trim()); str.Append(TYPE_START); str.Append(param.Type.ToString().ToLower()); str.Append(TYPE_END); string desc = param.Description.Trim(); if (desc.EndsWith(".")) { desc = desc.Remove(desc.Length - 1, 1); } str.Append(desc); if (i != ParameterCount - 1) { str.Append(SEP); str.AppendLine(); } } return(str.ToString().TrimEnd()); }
public void Refresh() { if (Item == null) { Title.text = DefaultTitle; Description.text = DefaultDescription; Image.enabled = false; } else { Image.enabled = true; Sprite spr = Atlas.GetSprite(Item.ItemIcon.name); Image.sprite = spr == null ? Item.ItemIcon : spr; Title.text = Item.Name; Description.text = ""; Description.text += RichText.InBold(RichText.InItalics(Item.ShortDescription)) + "\n"; Description.text += Item.LongDescription; } }
public void UpdateDetailedView() { if (Ship == null) { return; } if (IsEnemy) { // Do not display any details if this is an enemy ship. DetailsText.text = "Cannot see stats or details on this enemy ship..."; return; } str.Clear(); const string BOLD_START = "<b>"; const string BOLD_END = "</b>"; const string COLON = " : "; const string HYPHEN = " - "; const string RED = "<b><color=#ff6666>"; const string ORANGE = "<b><color=#ffa500ff>"; const string GREEN = "<b><color=#70ff77>"; const string END_COLOUR = "</color></b>"; string DESTROYED = RichText.InBold(RichText.InItalics("<b><color=#ff6666> [DESTROYED]</color></b>")); string DESTROYED_ESS = RichText.InBold(RichText.InItalics("<b><color=#ff6666> [DESTROYED] [!]</color></b>")); if (Ship.Damage.WaterOntake > 0f) { str.Append(RED); string water = ((Ship.Damage.WaterOntake / Ship.Damage.MaxWater) * 100f).ToString("n1"); str.Append("--> Taking On Water! "); str.Append(water); str.Append("% /s"); str.Append(END_COLOUR); str.Append('\n'); } if (Ship.Locomotion.GetAgilityMultiplier() != 1f) { str.Append("Max throttle at "); if (Ship.Locomotion.GetAgilityMultiplier() > 1f) { str.Append("<b><color=#70ff77>"); } else { str.Append("<b><color=#ff6666>"); } str.Append((Ship.Locomotion.GetAgilityMultiplier() * 100f).ToString("n1")); str.Append('%'); str.Append("</color></b>"); str.Append('\n'); } str.Append('\n'); foreach (var part in Ship.DamageModel.Parts) { str.Append(BOLD_START); str.Append(part.Name.Trim()); str.Append(BOLD_END); str.Append(COLON); str.Append(Mathf.Ceil(part.CurrentHealth)); str.Append('/'); str.Append(Mathf.Ceil(part.MaxHealth)); str.Append(HYPHEN); float p = part.HealthPercentage; string c = null; if (p >= 0.7f) { c = GREEN; } else if (p >= 0.4f) { c = ORANGE; } else { c = RED; } str.Append(c); str.Append(Mathf.RoundToInt(p * 100f)); str.Append('%'); str.Append(END_COLOUR); if (part.IsDestroyed) { if (part.IsEssential) { str.Append(DESTROYED_ESS); } else { str.Append(DESTROYED); } } str.Append('\n'); } DetailsText.text = str.ToString().Trim(); }
public void RefreshAmount() { Text.text = RichText.InBold(RichText.InColour(Item == null ? "---" : Item.Name, Item == null ? Color.black : ItemRarityUtils.GetColour(Item.Rarity))) + " x" + Amount; }
public string GetText() { KeyCode c = InputManager.GetInput(InputName); return(RichText.InBold(GetDisplayName()) + " : " + c); }