Exemplo n.º 1
0
        public void UpdateHook(On.RoR2.UI.SkillIcon.orig_Update orig, SkillIcon self)
        {
            orig.Invoke(self);

            if (self.targetSkill && self.targetSkillSlot == SkillSlot.Primary)
            {
                if (self.targetSkill.characterBody.baseNameToken == "BANDIT2_BODY_NAME")
                {
                    if (!modeLabel)
                    {
                        var pos = self.stockText.transform.position;

                        modeLabel = CreateLabel(
                            self.stockText.transform.parent,
                            "ModeLabel",
                            fireMode.ToString(),
                            new Vector2(pos.x - 7.5f, pos.y + 20f)
                            );

                        modeLabel.transform.rotation = self.stockText.transform.rotation;
                        modeLabel.color     = self.stockText.color;
                        modeLabel.alignment = self.stockText.alignment;
                    }

                    modeLabel.SetText(fireMode.ToString());
                }
            }
        }
        public void UpdateHook(On.RoR2.UI.SkillIcon.orig_Update orig, SkillIcon self)
        {
            orig.Invoke(self);

            if (self.targetSkill && self.targetSkillSlot == SkillSlot.Primary)
            {
                if (self.targetSkill.characterBody.baseNameToken == "CAPTAIN_BODY_NAME")
                {
                    self.stockText.gameObject.SetActive(true);
                    self.stockText.fontSize = 12f;
                    self.stockText.SetText(fireMode.ToString());
                }
            }
        }
Exemplo n.º 3
0
        public void UpdateHook(On.RoR2.UI.SkillIcon.orig_Update orig, SkillIcon self)
        {
            orig.Invoke(self);

            if (self.targetSkill && self.targetSkillSlot == SkillSlot.Primary)
            {
                SurvivorIndex survivorIndex =
                    SurvivorCatalog.GetSurvivorIndexFromBodyIndex(self.targetSkill.characterBody.bodyIndex);

                if (survivorIndex == SurvivorIndex.Captain)
                {
                    self.stockText.gameObject.SetActive(true);
                    self.stockText.fontSize = 12f;
                    self.stockText.SetText(fireMode.ToString());
                }
            }
        }
Exemplo n.º 4
0
        ////// Hooks //////
        #region Hooks
        private void SkillIcon_Update(On.RoR2.UI.SkillIcon.orig_Update orig, RoR2.UI.SkillIcon self)
        {
            orig(self);
            if (self.targetSkillSlot == SkillSlot.Utility && self.playerCharacterMasterController)
            {
                var        overlayTsf = self.transform.Find("GoFasterStripesPanel");
                GameObject overlay;
                if (overlayTsf == null)
                {
                    overlay = new GameObject("GoFasterStripesPanel");
                    var rtsf = overlay.AddComponent <RectTransform>();
                    rtsf.SetParent(self.transform, false);
                    rtsf.SetSiblingIndex(2);
                    rtsf.anchorMin     = Vector2.zero;
                    rtsf.pivot         = Vector2.one / 2f;
                    rtsf.anchorMax     = Vector2.one;
                    rtsf.localPosition = new Vector3(-18f, 18f, 0f);
                    rtsf.localScale    = Vector3.one * 1.1f;
                    rtsf.offsetMin     = Vector2.zero;
                    rtsf.offsetMax     = Vector2.zero;
                    overlay.layer      = 5;

                    var canvas = overlay.AddComponent <Canvas>();
                    var spren  = overlay.AddComponent <UnityEngine.UI.Image>();
                    spren.sprite        = skillIconOverlay;
                    spren.maskable      = true;
                    spren.raycastTarget = false;
                    spren.color         = Color.white;
                }
                else
                {
                    overlay = overlayTsf.gameObject;
                }

                var hasItem = GetCount(self.playerCharacterMasterController.body) > 0;

                if (overlay.activeSelf != hasItem)
                {
                    overlay.SetActive(hasItem);
                }
            }
        }
Exemplo n.º 5
0
        internal void SkillIcon_Update(On.RoR2.UI.SkillIcon.orig_Update orig, SkillIcon self)
        {
            orig(self);

            if (!SkillIconDirty.ContainsKey(self))
            {
                this.SkillIconDirty.Add(self, true);
                this.lastSkill.Add(self, null);
            }
            if (self.targetSkill && (self.targetSkill != this.lastSkill[self] || this.SkillIconDirty[self]))
            {
                this.lastSkill[self]      = self.targetSkill;
                this.SkillIconDirty[self] = false;
                BetterUI.sharedStringBuilder.Clear();
                BetterUI.sharedStringBuilder.Append(Language.GetString(self.targetSkill.skillDescriptionToken));
                if (mod.config.AdvancedIconsSkillShowBaseCooldown.Value || mod.config.AdvancedIconsSkillShowCalculatedCooldown.Value)
                {
                    BetterUI.sharedStringBuilder.Append("\n");
                }
                if (mod.config.AdvancedIconsSkillShowBaseCooldown.Value)
                {
                    BetterUI.sharedStringBuilder.Append("\nBase Cooldown: <style=cIsDamage>");
                    BetterUI.sharedStringBuilder.Append(self.targetSkill.baseRechargeInterval);
                    BetterUI.sharedStringBuilder.Append("</style> second");
                    if (self.targetSkill.baseRechargeInterval != 1)
                    {
                        BetterUI.sharedStringBuilder.Append("s");
                    }
                }
                if (mod.config.AdvancedIconsSkillShowCalculatedCooldown.Value && self.targetSkill.baseRechargeInterval > self.targetSkill.finalRechargeInterval)
                {
                    BetterUI.sharedStringBuilder.Append("\nEffective Cooldown: <style=cIsHealing>");
                    BetterUI.sharedStringBuilder.Append(self.targetSkill.finalRechargeInterval);
                    BetterUI.sharedStringBuilder.Append("</style> second");
                    if (self.targetSkill.baseRechargeInterval != 1)
                    {
                        BetterUI.sharedStringBuilder.Append("s");
                    }
                }

                if (mod.config.AdvancedIconsSkillShowProcCoefficient.Value || mod.config.AdvancedIconsSkillCalculateSkillProcEffects.Value)
                {
                    procCoefficientInfos = ProcCoefficientCatalog.GetProcCoefficientInfo(self.targetSkill.skillDef.skillNameToken);

                    if (procCoefficientInfos != null)
                    {
                        foreach (var info in procCoefficientInfos)
                        {
                            BetterUI.sharedStringBuilder.Append("\n\n<size=110%>");
                            BetterUI.sharedStringBuilder.Append(info.name);
                            BetterUI.sharedStringBuilder.Append("</size>");
                            if (mod.config.AdvancedIconsSkillShowProcCoefficient.Value)
                            {
                                BetterUI.sharedStringBuilder.Append("\n <style=cIsUtility>Proc Coefficient: ");
                                BetterUI.sharedStringBuilder.Append(info.procCoefficient);
                                BetterUI.sharedStringBuilder.Append("</style>");
                            }
                            if (info.procCoefficient > 0 && mod.config.AdvancedIconsSkillCalculateSkillProcEffects.Value)
                            {
                                foreach (var item in ProcItemsCatalog.GetAllItems())
                                {
                                    int stacks = self.targetSkill.characterBody.inventory.itemStacks[(int)item.Key];
                                    if (stacks > 0)
                                    {
                                        ItemDef itemDef = ItemCatalog.GetItemDef(item.Key);
                                        BetterUI.sharedStringBuilder.Append("\n  ");
                                        BetterUI.sharedStringBuilder.Append(Language.GetString(itemDef.nameToken));
                                        BetterUI.sharedStringBuilder.Append(": ");
                                        BetterUI.sharedStringBuilder.Append(item.Value.GetOutputString(stacks, self.targetSkill.characterBody.master.luck, info.procCoefficient));
                                    }
                                }
                            }
                        }
                    }
                }

                self.tooltipProvider.overrideBodyText = BetterUI.sharedStringBuilder.ToString();
            }

            if (mod.config.AdvancedIconsSkillShowCooldownStacks.Value && self.targetSkill && self.targetSkill.cooldownRemaining > 0)
            {
                BetterUI.sharedStringBuilder.Clear();
                BetterUI.sharedStringBuilder.AppendInt(Mathf.CeilToInt(self.targetSkill.cooldownRemaining), 0U, uint.MaxValue);
                self.cooldownText.SetText(BetterUI.sharedStringBuilder);
                self.cooldownText.gameObject.SetActive(true);
            }
        }