Exemplo n.º 1
0
        private void AllyCardController_Awake(On.RoR2.UI.AllyCardController.orig_Awake orig, AllyCardController self)
        {
            orig(self);
            if ((AllyCard_ShowEquipment.Value == NameEquipmentMode.EquipmentDrones && self.sourceMaster && self.sourceMaster.masterIndex == EquipmentDroneMasterIndex) ||
                (AllyCard_ShowEquipment.Value == NameEquipmentMode.Any))
            {
                var portrait = self.portraitIconImage.gameObject;
                var display  = Instantiate(portrait.transform.Find("CriticallyHurt"), portrait.transform);
                display.name = "EquipmentDisplay";
                display.transform.localPosition = new Vector3(-25, 0, 0);
                var component = display.gameObject.AddComponent <AllyCardEquipment>();
                component.image = display.GetComponent <Image>();
                component.allyCardController = self;

                /*
                 * component.tooltipProvider = display.gameObject.AddComponent<TooltipProvider>();
                 * component.tooltipProvider.titleColor = new Color32(255, 128, 0, 255);
                 * component.tooltipProvider.bodyColor = new Color32(127, 127, 127, 255);*/
            }
        }
Exemplo n.º 2
0
        private void AllyCardController_UpdateInfo(On.RoR2.UI.AllyCardController.orig_UpdateInfo orig, AllyCardController self)
        {
            orig(self);
            CharacterMaster master = self.sourceMaster;

            if (master &&
                ((master.masterIndex == EquipmentDroneMasterIndex && cfgNameEquipmentMode.Value == NameEquipmentMode.EquipmentDrones) || cfgNameEquipmentMode.Value == NameEquipmentMode.Any) &&
                master.inventory && master.inventory.currentEquipmentIndex != EquipmentIndex.None)
            {
                var firstLocalUser = LocalUserManager.GetFirstLocalUser();
                if (firstLocalUser != null && firstLocalUser.cachedMaster && master.teamIndex == firstLocalUser.cachedMaster.teamIndex)
                {
                    self.nameLabel.text += $" ({Language.GetString(EquipmentCatalog.GetEquipmentDef(master.inventory.currentEquipmentIndex).nameToken)})";
                }
            }
        }