Esempio n. 1
0
    public static void FormatVersionAndModulePlaylist(AgeControlButton buttonLastPlaylist, AgePrimitiveLabel currentModulePlaylistLabel, AgePrimitiveLabel versionLabel)
    {
        if (currentModulePlaylistLabel != null)
        {
            currentModulePlaylistLabel.Text = "%ModDefaultTitle";
            currentModulePlaylistLabel.GetComponentInParent <AgeTooltip>().Content = string.Empty;
        }
        if (buttonLastPlaylist != null)
        {
            buttonLastPlaylist.AgeTransform.Enable = false;
        }
        if (versionLabel != null)
        {
            versionLabel.Text = Amplitude.Unity.Framework.Application.Name.ToString() + " " + Amplitude.Unity.Framework.Application.Version.ToString();
            string a;
            if (global::Application.ResolveChineseLanguage(out a))
            {
                if (a == "schinese")
                {
                    versionLabel.Text = AgeLocalizer.Instance.LocalizeString("%SChineseApplicationName") + " " + Amplitude.Unity.Framework.Application.Version.ToString();
                }
                else if (a == "tchinese")
                {
                    versionLabel.Text = AgeLocalizer.Instance.LocalizeString("%TChineseApplicationName") + " " + Amplitude.Unity.Framework.Application.Version.ToString();
                }
            }
            versionLabel.AgeTransform.AgeTooltip.Content = string.Empty;
        }
        Amplitude.Unity.Gui.IGuiService service = Services.GetService <Amplitude.Unity.Gui.IGuiService>();
        IRuntimeService service2       = Services.GetService <IRuntimeService>();
        ModulePlaylist  modulePlaylist = Services.GetService <IRuntimeModulePlaylistService>().CurrentModulePlaylist;

        if (modulePlaylist != null && modulePlaylist.Name == "VanillaModulePlaylist")
        {
            modulePlaylist = null;
        }
        if (modulePlaylist != null && modulePlaylist.Configuration.Length == 1 && modulePlaylist.Configuration[0].ModuleName == service2.VanillaModuleName)
        {
            modulePlaylist = null;
        }
        if (modulePlaylist == null)
        {
            string empty  = string.Empty;
            string empty2 = string.Empty;
            if (Amplitude.Unity.Framework.Application.Registry.TryGetValue(global::Application.Registers.LastModulePlaylistActivated, out empty) && Amplitude.Unity.Framework.Application.Registry.TryGetValue(global::Application.Registers.LastModulePlaylistActivatedUrl, out empty2) && empty != "VanillaModulePlaylist")
            {
                if (buttonLastPlaylist != null)
                {
                    buttonLastPlaylist.AgeTransform.Enable = true;
                }
                if (currentModulePlaylistLabel != null)
                {
                    GuiElement guiElement;
                    if (service.GuiPanelHelper.TryGetGuiElement(empty, out guiElement))
                    {
                        currentModulePlaylistLabel.Text = AgeLocalizer.Instance.LocalizeString("%OutgameLastPlaylistTitle").Replace("$PlaylistName", AgeLocalizer.Instance.LocalizeString(guiElement.Title));
                    }
                    else
                    {
                        currentModulePlaylistLabel.Text = AgeLocalizer.Instance.LocalizeString("%OutgameLastPlaylistTitle").Replace("$PlaylistName", empty);
                    }
                    ModulePlaylist modulePlaylist2 = new ModulePlaylist(empty, string.Empty, null, ModulePlaylist.ParseConfigurationUrl(empty2));
                    modulePlaylist2.RepairPlaylistIfInvalid();
                    string newValue = string.Join("\n - ", MenuMainScreen.GetPlaylistModuleTitles(modulePlaylist2));
                    currentModulePlaylistLabel.GetComponentInParent <AgeTooltip>().Content = AgeLocalizer.Instance.LocalizeString("%OutgameLastPlaylistDescription").Replace("$ModuleNames", newValue);
                    return;
                }
            }
        }
        else if (service2 != null && service2.Runtime != null)
        {
            modulePlaylist.RepairPlaylistIfInvalid();
            string newValue2 = modulePlaylist.Name;
            if (modulePlaylist.IsAnonymous)
            {
                newValue2 = AgeLocalizer.Instance.LocalizeString("%AnonymousActiveModulePlaylist");
            }
            string content = string.Join("\n", MenuMainScreen.GetPlaylistModuleTitles(modulePlaylist));
            if (currentModulePlaylistLabel != null)
            {
                currentModulePlaylistLabel.Text = AgeLocalizer.Instance.LocalizeString("%ModPlaylistActiveFormat").Replace("$Playlist", newValue2);
                currentModulePlaylistLabel.GetComponentInParent <AgeTooltip>().Content = content;
            }
            if (versionLabel != null)
            {
                string text = AgeLocalizer.Instance.LocalizeString("%GameMenuPlaylistFormat").Replace("$Playlist", newValue2);
                if (!string.IsNullOrEmpty(text))
                {
                    versionLabel.Text = versionLabel.Text + "\n" + text;
                    versionLabel.AgeTransform.AgeTooltip.Content = content;
                }
            }
        }
    }
Esempio n. 2
0
    protected override IEnumerator OnShow(params object[] parameters)
    {
        yield return(base.OnShow(parameters));

        base.GuiService.GetGuiPanel <ControlBanner>().OnShowScreen(GameScreenType.Menu);
        ISessionService service = Services.GetService <ISessionService>();

        Diagnostics.Assert(service != null && service.Session != null);
        SessionMode sessionMode = service.Session.SessionMode;

        if (sessionMode != SessionMode.Single)
        {
            if (sessionMode - SessionMode.Private > 2)
            {
                throw new ArgumentOutOfRangeException();
            }
            this.InviteGroup.Visible = true;
        }
        else
        {
            this.InviteGroup.Visible = false;
        }
        this.MenuBar.Width = 0f;
        this.MenuBar.ArrangeChildren();
        this.MenuBar.PixelOffsetLeft           = -0.5f * this.MenuBar.Width;
        this.InviteButton.AgeTransform.Enable &= !TutorialManager.IsActivated;
        if (this.VersionLabel.AgeTransform.Visible)
        {
            MenuMainScreen.FormatVersionAndModulePlaylist(null, null, this.VersionLabel);
        }
        this.DlcIconEnumerator.Load();
        this.DlcIconEnumerator.AccessibilityMask = DownloadableContentAccessibility.Shared;
        this.DlcIconEnumerator.SubscriptionMask  = DownloadableContentAccessibility.Shared;
        this.DlcIconEnumerator.RefreshContent();
        float num = 0f;

        for (int i = 0; i < this.VersionLabel.TextLines.Count; i++)
        {
            float num2 = this.VersionLabel.Font.ComputeTextWidth(this.VersionLabel.TextLines[i], this.VersionLabel.ForceCaps, false);
            if (num2 > num)
            {
                num = num2;
            }
        }
        AgeTransform parent = this.VersionLabel.AgeTransform.GetParent();

        parent.Width  = num + this.VersionLabel.AgeTransform.PixelMarginLeft + 4f;
        parent.Height = ((!AgeUtils.HighDefinition) ? ((float)this.VersionLabel.TextLines.Count * 17f) : ((float)this.VersionLabel.TextLines.Count * 17f * AgeUtils.HighDefinitionFactor));
        this.DlcIconEnumerator.AgeTransform.PixelMarginBottom = parent.PixelMarginBottom + parent.Height;
        this.RefreshContent();
        if (!TutorialManager.IsActivated)
        {
            this.GameSessionInformationPanel.Visible = true;
            GameSessionInformationSetting[] componentsInChildren = this.GameSessionInformationPanel.GetComponentsInChildren <GameSessionInformationSetting>();
            for (int j = 0; j < componentsInChildren.Length; j++)
            {
                componentsInChildren[j].SetContent();
            }
        }
        else
        {
            this.GameSessionInformationPanel.Visible = false;
        }
        yield break;
    }