Exemple #1
0
        public static SurvivorIndex GetCurrentCharacter()
        {
            var bodyIndex     = BodyCatalog.FindBodyIndex(Main.LocalPlayerBody);
            var survivorIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(bodyIndex);

            return(survivorIndex);
        }
 // Token: 0x06002217 RID: 8727 RVA: 0x0009363C File Offset: 0x0009183C
 private SurvivorIndex GetSelectedSurvivorIndexFromBodyPreference()
 {
     if (this.networkUser)
     {
         SurvivorIndex survivorIndexFromBodyIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(this.networkUser.bodyIndexPreference);
         Debug.Log(survivorIndexFromBodyIndex);
         if (survivorIndexFromBodyIndex != SurvivorIndex.None)
         {
             return(survivorIndexFromBodyIndex);
         }
     }
     return(SurvivorIndex.Commando);
 }
Exemple #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());
                }
            }
        }
        private static void ShowEndgameText(ConCommandArgs args)
        {
            if (args.GetArgString(0).ToLower() == "custom")
            {
                flavorText = args.GetArgString(1);
            }
            else
            {
                var bodyIndex = BodyCatalog.FindBodyIndexCaseInsensitive(args.GetArgString(0));
                if (bodyIndex < 0)
                {
                    Debug.Log("Couldn't find body index!");
                    return;
                }
                var survivorIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(bodyIndex);
                if (survivorIndex < 0)
                {
                    Debug.Log("Couldn't find survivor index!");
                    return;
                }
                SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(survivorIndex);
                if (!survivorDef)
                {
                    Debug.Log("SurvivorDef not found!");
                    return;
                }

                bool isWinQuote = true;
                if (args.Count == 2)
                {
                    if (args.GetArgString(1).ToLower() == "fail")
                    {
                        isWinQuote = false;
                    }
                }
                flavorText = GetOutroText(survivorDef, isWinQuote);
            }
            Debug.Log("Outro Text: " + flavorText);
            Debug.Log(Language.GetString(flavorText));
            RoR2.Console.instance.SubmitCmd(null, "set_scene outro", false);
        }
            public void Awake()
            {
                if (!characterBody)
                {
                    characterBody = gameObject.GetComponent <CharacterBody>();
                }
                isNetwork = NetworkServer.active;

                this.localUser = LocalUserManager.readOnlyLocalUsersList[0];

                foreach (var entityStateMachine in gameObject.GetComponents <EntityStateMachine>())
                {
                    if (entityStateMachine.customName == "Body")
                    {
                        outer = entityStateMachine;
                        break;
                    }
                }

                survivorDef = SurvivorCatalog.GetSurvivorDef(SurvivorCatalog.GetSurvivorIndexFromBodyIndex(characterBody.bodyIndex));
            }
 // Token: 0x06002560 RID: 9568 RVA: 0x000A2874 File Offset: 0x000A0A74
 private void Update()
 {
     if (this.targetSkill)
     {
         if (this.tooltipProvider)
         {
             Color         color = Color.gray;
             SurvivorIndex survivorIndexFromBodyIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(this.targetSkill.characterBody.bodyIndex);
             if (survivorIndexFromBodyIndex != SurvivorIndex.None)
             {
                 color = SurvivorCatalog.GetSurvivorDef(survivorIndexFromBodyIndex).primaryColor;
                 float h;
                 float s;
                 float num;
                 Color.RGBToHSV(color, out h, out s, out num);
                 num   = ((num > 0.7f) ? 0.7f : num);
                 color = Color.HSVToRGB(h, s, num);
             }
             this.tooltipProvider.titleColor = color;
             this.tooltipProvider.titleToken = this.targetSkill.skillNameToken;
             this.tooltipProvider.bodyToken  = this.targetSkill.skillDescriptionToken;
         }
         float cooldownRemaining = this.targetSkill.cooldownRemaining;
         float num2  = this.targetSkill.CalculateFinalRechargeInterval();
         int   stock = this.targetSkill.stock;
         bool  flag  = stock > 0 || cooldownRemaining == 0f;
         bool  flag2 = this.targetSkill.IsReady();
         if (this.previousStock < stock)
         {
             Util.PlaySound("Play_UI_cooldownRefresh", RoR2Application.instance.gameObject);
         }
         if (this.animator)
         {
             if (this.targetSkill.maxStock > 1)
             {
                 this.animator.SetBool(this.animatorStackString, true);
             }
             else
             {
                 this.animator.SetBool(this.animatorStackString, false);
             }
         }
         if (this.isReadyPanelObject)
         {
             this.isReadyPanelObject.SetActive(flag2);
         }
         if (!this.wasReady && flag && this.flashPanelObject)
         {
             this.flashPanelObject.SetActive(true);
         }
         if (this.cooldownText)
         {
             if (flag)
             {
                 this.cooldownText.gameObject.SetActive(false);
             }
             else
             {
                 SkillIcon.sharedStringBuilder.Clear();
                 SkillIcon.sharedStringBuilder.AppendInt(Mathf.CeilToInt(cooldownRemaining), 0U, uint.MaxValue);
                 this.cooldownText.SetText(SkillIcon.sharedStringBuilder);
                 this.cooldownText.gameObject.SetActive(true);
             }
         }
         if (this.iconImage)
         {
             this.iconImage.enabled = true;
             this.iconImage.color   = (flag2 ? Color.white : Color.gray);
             this.iconImage.sprite  = this.targetSkill.icon;
         }
         if (this.cooldownRemapPanel)
         {
             float num3 = 1f;
             if (num2 >= Mathf.Epsilon)
             {
                 num3 = 1f - cooldownRemaining / num2;
             }
             float num4 = num3;
             this.cooldownRemapPanel.enabled = (num4 < 1f);
             this.cooldownRemapPanel.color   = new Color(1f, 1f, 1f, num3);
         }
         if (this.stockText)
         {
             if (this.targetSkill.maxStock > 1)
             {
                 this.stockText.gameObject.SetActive(true);
                 SkillIcon.sharedStringBuilder.Clear();
                 SkillIcon.sharedStringBuilder.AppendInt(this.targetSkill.stock, 0U, uint.MaxValue);
                 this.stockText.SetText(SkillIcon.sharedStringBuilder);
             }
             else
             {
                 this.stockText.gameObject.SetActive(false);
             }
         }
         this.wasReady      = flag;
         this.previousStock = stock;
         return;
     }
     if (this.tooltipProvider)
     {
         this.tooltipProvider.bodyColor  = Color.gray;
         this.tooltipProvider.titleToken = "";
         this.tooltipProvider.bodyToken  = "";
     }
     if (this.cooldownText)
     {
         this.cooldownText.gameObject.SetActive(false);
     }
     if (this.stockText)
     {
         this.stockText.gameObject.SetActive(false);
     }
     if (this.iconImage)
     {
         this.iconImage.enabled = false;
         this.iconImage.sprite  = null;
     }
 }