private void OnHover(Constructable constructable) { if (isActive) { HandReticle main = HandReticle.main; if (constructable.constructed) { main.SetText(HandReticle.TextType.Hand, this.deconstructText, false); } else { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(this.constructText); foreach (KeyValuePair <TechType, int> keyValuePair in constructable.GetRemainingResources()) { TechType key = keyValuePair.Key; string text = Language.main.Get(key); int value = keyValuePair.Value; if (value > 1) { stringBuilder.AppendLine(Language.main.GetFormat <string, int>("RequireMultipleFormat", text, value)); } else { stringBuilder.AppendLine(text); } } main.SetText(HandReticle.TextType.Hand, stringBuilder.ToString(), false); main.SetProgress(constructable.amount); main.SetIcon(HandReticle.IconType.Progress, 1.5f); } } }
private void Update() { if (isActive) { PDAScanner.Result result = Scan(); if (!isScanning) { if (result != PDAScanner.Result.Known) { main.SetInteractText("AutoScan", "Active", false, false, HandReticle.Hand.None); main.SetIcon(HandReticle.IconType.Scan, 1.5f); } } else { main.SetInteractText(PDAScanner.scanTarget.techType.AsString(false), true, HandReticle.Hand.None); main.SetIcon(HandReticle.IconType.Progress, 10f); main.progressText.text = Mathf.RoundToInt(PDAScanner.scanTarget.progress * 100f) + "%"; Modules.SetProgressColor(Modules.Colors.Orange); main.progressImage.fillAmount = Mathf.Clamp01(PDAScanner.scanTarget.progress); main.SetProgress(PDAScanner.scanTarget.progress); } if (idleTimer > 0f) { idleTimer = Mathf.Max(0f, idleTimer - Time.deltaTime); } } }
private void OnHover() { if (energyMixin.charge <= 0f) { return; } PDAScanner.ScanTarget scanTarget = PDAScanner.scanTarget; PDAScanner.UpdateTarget(scanDistance, false); if (!scanTarget.isValid) { return; } PDAScanner.Result result = PDAScanner.CanScan(); if (result == PDAScanner.Result.Scan) { HandReticle main = HandReticle.main; main.SetInteractText(scanTarget.techType.AsString(false), true, HandReticle.Hand.Left); main.SetIcon(HandReticle.IconType.Scan, 1.5f); if (stateCurrent == ScanState.Scan) { main.SetIcon(HandReticle.IconType.Progress, 4f); main.progressText.text = Mathf.RoundToInt(PDAScanner.scanTarget.progress * 100f) + "%"; SetProgressColor(Colors.Green); main.progressImage.fillAmount = Mathf.Clamp01(PDAScanner.scanTarget.progress); main.SetProgress(PDAScanner.scanTarget.progress); } } }
static bool Prefix(BuilderTool __instance, Constructable constructable) { if (!constructable.gameObject.GetComponent <DebrisDeconstructable>()) { return(true); } HandReticle hand = HandReticle.main; hand.SetInteractText(L10n.str("ids_salvageableDebris"), __instance.deconstructText, false, false, HandReticle.Hand.None); if (!constructable.constructed) { hand.SetProgress(constructable.amount); hand.SetIcon(HandReticle.IconType.Progress, 1.5f); } return(false); }
public virtual void Update() { bool inInteractionRange = InInteractionRange(); #if SUBNAUTICA if (this.IsHovered && inInteractionRange) { HandReticle main = HandReticle.main; if (ButtonMode == InterfaceButtonMode.None) { if (Container != null) { if (Container.IsContainerFull) { main.SetIcon(HandReticle.IconType.Hand, 1f); main.SetInteractTextRaw(this.TextLineOne, this.TextLineTwo); } else { main.SetProgress(Container.Progress); main.SetIcon(HandReticle.IconType.Progress, 1f); } } } else { main.SetInteractTextRaw(this.TextLineOne, this.TextLineTwo); } } #elif BELOWZERO if (this.IsHovered && inInteractionRange) { HandReticle main = HandReticle.main; if (ButtonMode == InterfaceButtonMode.None) { if (Container != null) { if (Container.IsContainerFull) { main.SetIcon(HandReticle.IconType.Hand, 1f); main.SetTextRaw(HandReticle.TextType.Hand, this.TextLineOne); main.SetTextRaw(HandReticle.TextType.Hand, this.TextLineTwo); } else { main.SetProgress(Container.Progress); main.SetIcon(HandReticle.IconType.Progress, 1f); } } } else { main.SetTextRaw(HandReticle.TextType.Hand, this.TextLineOne); main.SetTextRaw(HandReticle.TextType.Hand, this.TextLineTwo); } } #endif if (this.IsHovered && inInteractionRange == false) { this.IsHovered = false; } if (this.IsHovered == false && isHoveredOutOfRange && inInteractionRange) { this.IsHovered = true; } }
public void Update() { if (!isActive) { return; } else if (thisVehicle.liveMixin.health < thisVehicle.liveMixin.maxHealth && energyMixin.charge > energyMixin.capacity * 0.1f) { weldSound.Play(); energyMixin.ConsumeEnergy(powerConsumption * Time.deltaTime); main.SetIcon(HandReticle.IconType.Progress, 1.5f); thisVehicle.liveMixin.health += Time.deltaTime * repairPerSec; main.SetInteractText("Repairing...", false, HandReticle.Hand.None); if (thisVehicle.liveMixin.health < thisVehicle.liveMixin.maxHealth * 0.5f) { SetProgressColor(Color.red); SetInteractColor(Color.red); } else if (thisVehicle.liveMixin.health < thisVehicle.liveMixin.maxHealth * 0.75f && thisVehicle.liveMixin.health > thisVehicle.liveMixin.maxHealth * 0.5f) { SetProgressColor(Color.yellow); SetInteractColor(Color.yellow); } else if (thisVehicle.liveMixin.health > thisVehicle.liveMixin.maxHealth * 0.75f) { SetProgressColor(Color.green); SetInteractColor(Color.green); } main.SetProgress(thisVehicle.liveMixin.health / thisVehicle.liveMixin.maxHealth); if (thisVehicle.liveMixin.health >= thisVehicle.liveMixin.maxHealth) { thisVehicle.liveMixin.health = thisVehicle.liveMixin.maxHealth; thisVehicle.SlotKeyDown(moduleSlotID); return; } } else if (energyMixin.charge <= energyMixin.capacity * 0.1f) { if (idleTimer > 0f) { weldSound.Stop(); idleTimer = Mathf.Max(0f, idleTimer - Time.deltaTime); SetInteractColor(Color.red); main.SetInteractText("Warning!\nLow Power!", "Repair Module Disabled!", false, false, HandReticle.Hand.None); } else { idleTimer = 3f; thisVehicle.SlotKeyDown(moduleSlotID); return; } } else if (thisVehicle.liveMixin.health == thisVehicle.liveMixin.maxHealth) { thisVehicle.SlotKeyDown(moduleSlotID); return; } }