Example #1
0
 // Token: 0x060020CD RID: 8397 RVA: 0x0009A118 File Offset: 0x00098318
 public void SelectThisButton(MPButton selectedButton)
 {
     for (int i = 0; i < this.buttons.Length; i++)
     {
         this.buttons[i] == selectedButton;
     }
 }
Example #2
0
        // Token: 0x060021A8 RID: 8616 RVA: 0x0009E640 File Offset: 0x0009C840
        public void SetDisplayData(GameEndReportPanelController.DisplayData newDisplayData)
        {
            if (this.displayData.Equals(newDisplayData))
            {
                return;
            }
            this.displayData = newDisplayData;
            if (this.resultLabel)
            {
                GameResultType gameResultType = GameResultType.Unknown;
                if (this.displayData.runReport != null)
                {
                    gameResultType = this.displayData.runReport.gameResultType;
                }
                string token;
                if (gameResultType != GameResultType.Lost)
                {
                    if (gameResultType != GameResultType.Won)
                    {
                        token = "GAME_RESULT_UNKNOWN";
                    }
                    else
                    {
                        token = "GAME_RESULT_WON";
                    }
                }
                else
                {
                    token = "GAME_RESULT_LOST";
                }
                this.resultLabel.text = Language.GetString(token);
            }
            RunReport runReport = this.displayData.runReport;

            RunReport.PlayerInfo playerInfo = (runReport != null) ? runReport.GetPlayerInfoSafe(this.displayData.playerIndex) : null;
            this.SetPlayerInfo(playerInfo);
            RunReport runReport2 = this.displayData.runReport;
            int       num        = (runReport2 != null) ? runReport2.playerInfoCount : 0;

            this.playerNavigationController.gameObject.SetActive(num > 1);
            this.playerNavigationController.SetDisplayData(new CarouselNavigationController.DisplayData(num, this.displayData.playerIndex));
            ReadOnlyCollection <MPButton> elements = this.playerNavigationController.buttonAllocator.elements;

            for (int i = 0; i < elements.Count; i++)
            {
                MPButton             mpbutton                = elements[i];
                RunReport.PlayerInfo playerInfo2             = this.displayData.runReport.GetPlayerInfo(i);
                CharacterBody        bodyPrefabBodyComponent = BodyCatalog.GetBodyPrefabBodyComponent(playerInfo2.bodyIndex);
                Texture texture = bodyPrefabBodyComponent ? bodyPrefabBodyComponent.portraitIcon : null;
                mpbutton.GetComponentInChildren <RawImage>().texture = texture;
                mpbutton.GetComponent <TooltipProvider>().SetContent(TooltipProvider.GetPlayerNameTooltipContent(playerInfo2.name));
            }
            this.selectedPlayerEffectRoot.transform.SetParent(this.playerNavigationController.buttonAllocator.elements[this.displayData.playerIndex].transform);
            this.selectedPlayerEffectRoot.gameObject.SetActive(false);
            this.selectedPlayerEffectRoot.gameObject.SetActive(true);
            this.selectedPlayerEffectRoot.offsetMin  = Vector2.zero;
            this.selectedPlayerEffectRoot.offsetMax  = Vector2.zero;
            this.selectedPlayerEffectRoot.localScale = Vector3.one;
        }
 // Token: 0x060022E9 RID: 8937 RVA: 0x00098004 File Offset: 0x00096204
 public void ChooseHeaderByButton(MPButton mpButton)
 {
     for (int i = 0; i < this.headers.Length; i++)
     {
         if (this.headers[i].headerButton == mpButton)
         {
             this.currentHeaderIndex = i;
             this.RebuildHeaders();
             return;
         }
     }
 }
Example #4
0
        // Token: 0x060021FB RID: 8699 RVA: 0x00092BAC File Offset: 0x00090DAC
        private void Rebuild()
        {
            this.buttonAllocator.AllocateElements(this.displayData.pageCount);
            int i     = 0;
            int count = this.buttonAllocator.elements.Count;

            while (i < count)
            {
                MPButton   mpbutton = this.buttonAllocator.elements[i];
                ColorBlock colors   = mpbutton.colors;
                colors.colorMultiplier = 1f;
                mpbutton.colors        = colors;
                mpbutton.onClick.RemoveAllListeners();
                CarouselNavigationController.DisplayData buttonDisplayData = new CarouselNavigationController.DisplayData(this.displayData.pageCount, i);
                mpbutton.onClick.AddListener(delegate()
                {
                    this.SetDisplayData(buttonDisplayData);
                    Action <int> action = this.onPageChangeSubmitted;
                    if (action == null)
                    {
                        return;
                    }
                    action(this.displayData.pageIndex);
                });
                i++;
            }
            if (this.displayData.pageIndex >= 0 && this.displayData.pageIndex < this.displayData.pageCount)
            {
                MPButton   mpbutton2 = this.buttonAllocator.elements[this.displayData.pageIndex];
                ColorBlock colors2   = mpbutton2.colors;
                colors2.colorMultiplier = 2f;
                mpbutton2.colors        = colors2;
            }
            bool flag          = this.displayData.pageCount > 1;
            bool interactable  = flag && (this.allowLooping || this.displayData.pageIndex > 0);
            bool interactable2 = flag && (this.allowLooping || this.displayData.pageIndex < this.displayData.pageCount - 1);

            if (this.leftButton)
            {
                this.leftButton.gameObject.SetActive(flag);
                this.leftButton.interactable = interactable;
            }
            if (this.rightButton)
            {
                this.rightButton.gameObject.SetActive(flag);
                this.rightButton.interactable = interactable2;
            }
        }
Example #5
0
            // Token: 0x060023F2 RID: 9202 RVA: 0x000A8D30 File Offset: 0x000A6F30
            private void RefreshCrownAndPromoteButton()
            {
                if (Client.Instance == null)
                {
                    return;
                }
                bool flag = Client.Instance.Lobby.Owner == this.steamId && this.steamId > 0UL;

                if (this.lobbyLeaderCrown != flag)
                {
                    if (flag)
                    {
                        this.lobbyLeaderCrown = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/UI/LobbyLeaderCrown"), this.gameObject.transform);
                    }
                    else
                    {
                        UnityEngine.Object.Destroy(this.lobbyLeaderCrown);
                        this.lobbyLeaderCrown = null;
                    }
                }
                if (this.elementChildLocator)
                {
                    bool       flag2      = !flag && SteamworksLobbyManager.ownsLobby && this.steamId != 0UL && !SteamLobbyFinder.running && !NetworkSession.instance;
                    GameObject gameObject = this.elementChildLocator.FindChild("PromoteButton").gameObject;
                    if (gameObject)
                    {
                        gameObject.SetActive(flag2);
                        if (flag2)
                        {
                            MPButton component = gameObject.GetComponent <MPButton>();
                            if (component)
                            {
                                component.onClick.RemoveAllListeners();
                                component.onClick.AddListener(delegate()
                                {
                                    Console.instance.SubmitCmd(null, string.Format(CultureInfo.InvariantCulture, "steam_lobby_assign_owner {0}", TextSerialization.ToStringInvariant(this.steamId)), false);
                                });
                            }
                        }
                    }
                }
            }
        // Token: 0x06002551 RID: 9553 RVA: 0x000A264C File Offset: 0x000A084C
        private MPButton AddButton(UnityAction callback, string displayToken, params object[] formatParams)
        {
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.buttonPrefab, this.buttonContainer);
            string     text       = Language.GetString(displayToken);

            if (formatParams != null && formatParams.Length != 0)
            {
                text = string.Format(text, formatParams);
            }
            gameObject.GetComponentInChildren <TextMeshProUGUI>().text = text;
            MPButton component = gameObject.GetComponent <MPButton>();

            component.onClick.AddListener(callback);
            gameObject.SetActive(true);
            if (!this.defaultChoice)
            {
                this.defaultChoice = component;
            }
            return(component);
        }
        // Token: 0x060020AE RID: 8366 RVA: 0x00099B64 File Offset: 0x00097D64
        private void SubmitSettingTemporary(string newValue)
        {
            string oldValue = this.GetCurrentValue();

            if (newValue == oldValue)
            {
                return;
            }
            this.SubmitSettingInternal(newValue);
            SimpleDialogBox dialogBox      = SimpleDialogBox.Create(null);
            Action          revertFunction = delegate()
            {
                if (dialogBox)
                {
                    this.SubmitSettingInternal(oldValue);
                }
            };
            float    num          = 10f;
            float    timeEnd      = Time.unscaledTime + num;
            MPButton revertButton = dialogBox.AddActionButton(delegate
            {
                revertFunction();
            }, "OPTION_REVERT", Array.Empty <object>());

            dialogBox.AddActionButton(delegate
            {
            }, "OPTION_ACCEPT", Array.Empty <object>());
            Action updateText = null;

            updateText = delegate()
            {
                if (dialogBox)
                {
                    int num2 = Mathf.FloorToInt(timeEnd - Time.unscaledTime);
                    if (num2 < 0)
                    {
                        num2 = 0;
                    }
                    dialogBox.descriptionToken = new SimpleDialogBox.TokenParamsPair
                    {
                        token        = "OPTION_AUTOREVERT_DIALOG_DESCRIPTION",
                        formatParams = new object[]
                        {
                            num2
                        }
                    };
                    if (num2 > 0)
                    {
                        RoR2Application.unscaledTimeTimers.CreateTimer(1f, updateText);
                    }
                }
            };
            updateText();
            RoR2Application.unscaledTimeTimers.CreateTimer(num, delegate
            {
                if (revertButton)
                {
                    revertButton.onClick.Invoke();
                }
            });
        }
Example #8
0
 private bool <UpdateHover> g__IsHoverable | 9_0 (Selectable selectable)
 {
     MPButton mpbutton = selectable as MPButton;
     return(!mpbutton || mpbutton.InputModuleIsAllowed(this));
 }