private static void SetupRuleButton(RoR2.UI.RuleBookViewerStrip ruleBookViewerStrip, RoR2.UI.RuleChoiceController choiceController)
        {
            choiceController.hgButton.onClick.AddListener(OnClick);
            choiceController.hgButton.onSelect.AddListener(OnSelect);

            foreach (var refreshOrder in choiceController.GetComponentsInChildren <RefreshCanvasDrawOrder>(true))
            {
                refreshOrder.enabled = false;
                refreshOrder.canvas.overrideSorting = false;
            }

            void OnClick()
            {
                if (!choiceController.canVote)
                {
                    return;
                }
                choiceController.StartCoroutine(RuleScrollCoroutine(ruleBookViewerStrip, choiceController));
            }

            void OnSelect()
            {
                var eventSystemLocator = choiceController.hgButton.eventSystemLocator;

                if (!eventSystemLocator || !eventSystemLocator.eventSystem || eventSystemLocator.eventSystem.currentInputSource != RoR2.UI.MPEventSystem.InputSource.Gamepad)
                {
                    return;
                }

                choiceController.StartCoroutine(RuleScrollCoroutine(ruleBookViewerStrip, choiceController));
            }
        }
        private static IEnumerator RuleScrollCoroutine(RoR2.UI.RuleBookViewerStrip ruleBookViewerStrip, RoR2.UI.RuleChoiceController choiceController)
        {
            var localTime   = 0F;
            var velocity    = 0F;
            var endPosition = -choiceController.transform.localPosition.x;

            ruleBookViewerStrip.currentPosition = ruleBookViewerStrip.choiceContainer.transform.localPosition.x;

            while (localTime < ruleScrollDuration)
            {
                ruleBookViewerStrip.currentPosition = Mathf.SmoothDamp(ruleBookViewerStrip.currentPosition, endPosition, ref velocity, ruleScrollDuration);
                ruleBookViewerStrip.UpdatePosition();

                yield return(new WaitForEndOfFrame());

                localTime += Time.deltaTime;
            }

            ruleBookViewerStrip.currentPosition = endPosition;
            ruleBookViewerStrip.UpdatePosition();
        }
        private static IEnumerator RuleScrollStartDelayCoroutine(RoR2.UI.RuleBookViewerStrip ruleBookViewerStrip)
        {
            yield return(new WaitForSeconds(0.1F));

            if (ruleBookViewerStrip.choiceControllers.Count == 0)
            {
                yield break;
            }

            var currentController = ruleBookViewerStrip.choiceControllers[Math.Min(ruleBookViewerStrip.currentDisplayChoiceIndex, ruleBookViewerStrip.choiceControllers.Count - 1)];

            ruleBookViewerStrip.currentPosition = -currentController.transform.localPosition.x;
            ruleBookViewerStrip.UpdatePosition();

            var hgButtonHistory = GameObject.Find("RightHandPanel").GetComponentInChildren <RoR2.UI.HGButtonHistory>(true);

            if (hgButtonHistory.lastRememberedGameObject)
            {
                yield break;
            }

            hgButtonHistory.lastRememberedGameObject = currentController.hgButton.gameObject;
        }
        internal static void RuleBookViewerStripSetData(On.RoR2.UI.RuleBookViewerStrip.orig_SetData orig, RoR2.UI.RuleBookViewerStrip self, List <RuleChoiceDef> newChoices, int choiceIndex)
        {
            var oldDisplayChoiceIndex = self.currentDisplayChoiceIndex;

            orig(self, newChoices, choiceIndex);

            if (self.currentDisplayChoiceIndex == oldDisplayChoiceIndex)
            {
                return;
            }

            RuleSelectedHighlightUpdate(self.choiceControllers[oldDisplayChoiceIndex], false);
            RuleSelectedHighlightUpdate(self.choiceControllers[self.currentDisplayChoiceIndex], true);
        }
 internal static void RuleBookViewerStripUpdate(On.RoR2.UI.RuleBookViewerStrip.orig_Update orig, RoR2.UI.RuleBookViewerStrip self)
 {
 }