public static void TriggerReloadHook(Action <GameUIReloadBarController, PlayerController, Vector3, float, float, int> orig, GameUIReloadBarController self, PlayerController attachParent, Vector3 offset, float duration, float activeReloadStartPercent, int pixelWidth) { if (tempraryActiveReloads.ContainsKey(self)) { foreach (MultiActiveReload multiactivereload in tempraryActiveReloads[self]) { if (multiactivereload.sprite != null && multiactivereload.sprite.gameObject != null) { UnityEngine.Object.Destroy(multiactivereload.sprite.gameObject); } if (multiactivereload.celebrationSprite != null && multiactivereload.celebrationSprite.gameObject != null) { UnityEngine.Object.Destroy(multiactivereload.celebrationSprite.gameObject); } } tempraryActiveReloads[self].Clear(); } orig(self, attachParent, offset, duration, activeReloadStartPercent, pixelWidth); if (attachParent != null && attachParent.CurrentGun != null && attachParent.CurrentGun.GetComponent <MultiActiveReloadController>() != null) { foreach (MultiActiveReloadData data in attachParent.CurrentGun.GetComponent <MultiActiveReloadController>().reloads) { dfSprite sprite = UnityEngine.Object.Instantiate(self.activeReloadSprite); self.activeReloadSprite.Parent.AddControl(sprite); sprite.enabled = true; float width = self.progressSlider.Width; float maxValue = self.progressSlider.MaxValue; float num = data.startValue / maxValue * width; float num2 = data.endValue / maxValue * width; float x = num + (num2 - num) * data.activeReloadStartPercentage; float width2 = (float)pixelWidth * Pixelator.Instance.CurrentTileScale; sprite.RelativePosition = self.activeReloadSprite.RelativePosition; sprite.RelativePosition = GameUIUtility.QuantizeUIPosition(sprite.RelativePosition.WithX(x)); sprite.Width = width2; sprite.IsVisible = true; dfSprite celebrationSprite = UnityEngine.Object.Instantiate(self.celebrationSprite); self.activeReloadSprite.Parent.AddControl(celebrationSprite); celebrationSprite.enabled = true; dfSpriteAnimation component = celebrationSprite.GetComponent <dfSpriteAnimation>(); component.Stop(); component.SetFrameExternal(0); celebrationSprite.enabled = false; celebrationSprite.RelativePosition = sprite.RelativePosition + new Vector3(Pixelator.Instance.CurrentTileScale * -1f, Pixelator.Instance.CurrentTileScale * -2f, 0f); int activeReloadStartValue = Mathf.RoundToInt((float)(data.endValue - data.startValue) * data.activeReloadStartPercentage) + data.startValue - data.activeReloadLastTime / 2; MultiActiveReload reload = new MultiActiveReload { sprite = sprite, celebrationSprite = celebrationSprite, startValue = activeReloadStartValue, endValue = activeReloadStartValue + data.activeReloadLastTime, stopsReload = data.stopsReload, canAttemptActiveReloadAfterwards = data.canAttemptActiveReloadAfterwards, reloadData = data.reloadData, usesActiveReloadData = data.usesActiveReloadData }; if (tempraryActiveReloads.ContainsKey(self)) { tempraryActiveReloads[self].Add(reload); } else { tempraryActiveReloads.Add(self, new List <MultiActiveReload> { reload }); } } } }
// Token: 0x060001DA RID: 474 RVA: 0x000110B4 File Offset: 0x0000F2B4 public static void TriggerReloadHook(MultiActiveReloadManager.Action <GameUIReloadBarController, PlayerController, Vector3, float, float, int> orig, GameUIReloadBarController self, PlayerController attachParent, Vector3 offset, float duration, float activeReloadStartPercent, int pixelWidth) { bool flag = MultiActiveReloadManager.tempraryActiveReloads.ContainsKey(self); if (flag) { foreach (MultiActiveReload multiActiveReload in MultiActiveReloadManager.tempraryActiveReloads[self]) { bool flag2 = multiActiveReload.sprite != null && multiActiveReload.sprite.gameObject != null; if (flag2) { UnityEngine.Object.Destroy(multiActiveReload.sprite.gameObject); } bool flag3 = multiActiveReload.celebrationSprite != null && multiActiveReload.celebrationSprite.gameObject != null; if (flag3) { UnityEngine.Object.Destroy(multiActiveReload.celebrationSprite.gameObject); } } MultiActiveReloadManager.tempraryActiveReloads[self].Clear(); } orig(self, attachParent, offset, duration, activeReloadStartPercent, pixelWidth); bool flag4 = attachParent != null && attachParent.CurrentGun != null && attachParent.CurrentGun.GetComponent <MultiActiveReloadController>() != null; if (flag4) { foreach (MultiActiveReloadData multiActiveReloadData in attachParent.CurrentGun.GetComponent <MultiActiveReloadController>().reloads) { dfSprite dfSprite = UnityEngine.Object.Instantiate <dfSprite>(self.activeReloadSprite); self.activeReloadSprite.Parent.AddControl(dfSprite); dfSprite.enabled = true; float width = self.progressSlider.Width; float maxValue = self.progressSlider.MaxValue; float num = (float)multiActiveReloadData.startValue / maxValue * width; float num2 = (float)multiActiveReloadData.endValue / maxValue * width; float x = num + (num2 - num) * multiActiveReloadData.activeReloadStartPercentage; float width2 = (float)pixelWidth * Pixelator.Instance.CurrentTileScale; dfSprite.RelativePosition = self.activeReloadSprite.RelativePosition; dfSprite.RelativePosition = GameUIUtility.QuantizeUIPosition(dfSprite.RelativePosition.WithX(x)); dfSprite.Width = width2; dfSprite.IsVisible = true; dfSprite dfSprite2 = UnityEngine.Object.Instantiate <dfSprite>(self.celebrationSprite); self.activeReloadSprite.Parent.AddControl(dfSprite2); dfSprite2.enabled = true; dfSpriteAnimation component = dfSprite2.GetComponent <dfSpriteAnimation>(); component.Stop(); component.SetFrameExternal(0); dfSprite2.enabled = false; dfSprite2.RelativePosition = dfSprite.RelativePosition + new Vector3(Pixelator.Instance.CurrentTileScale * -1f, Pixelator.Instance.CurrentTileScale * -2f, 0f); int num3 = Mathf.RoundToInt((float)(multiActiveReloadData.endValue - multiActiveReloadData.startValue) * multiActiveReloadData.activeReloadStartPercentage) + multiActiveReloadData.startValue - multiActiveReloadData.activeReloadLastTime / 2; MultiActiveReload item = new MultiActiveReload { sprite = dfSprite, celebrationSprite = dfSprite2, startValue = num3, endValue = num3 + multiActiveReloadData.activeReloadLastTime, stopsReload = multiActiveReloadData.stopsReload, canAttemptActiveReloadAfterwards = multiActiveReloadData.canAttemptActiveReloadAfterwards, reloadData = multiActiveReloadData.reloadData, usesActiveReloadData = multiActiveReloadData.usesActiveReloadData, Name = multiActiveReloadData.Name }; bool flag5 = MultiActiveReloadManager.tempraryActiveReloads.ContainsKey(self); if (flag5) { MultiActiveReloadManager.tempraryActiveReloads[self].Add(item); } else { MultiActiveReloadManager.tempraryActiveReloads.Add(self, new List <MultiActiveReload> { item }); } } } }