예제 #1
0
        ////////////////

        public override void Load()
        {
            ServerBrowserMod.Instance = this;

            this.Reporter = new ServerBrowserReporter();

            if (!Main.dedServ)
            {
                var theme = new UITheme();
                theme.UrlColor      = Color.Lerp(theme.UrlColor, Color.White, 0.5f);
                theme.UrlLitColor   = Color.Lerp(theme.UrlLitColor, Color.White, 0.5f);
                theme.UrlVisitColor = Color.Lerp(theme.UrlVisitColor, Color.White, 0.5f);

                this.Dialog = new UIServerBrowserDialog(theme);

                MenuItem.AddMenuItem("Browse Servers", MenuItem.MenuTopPos - 80, 12, () => {
                    Main.OpenPlayerSelect(plr_data => {
                        Main.ServerSideCharacter = false;
                        plr_data.SetAsActive();

                        Main.menuMode = 77777;
                        ServerBrowserMod.Instance.Dialog.Open();
                    });
                });

                MenuItem.AddMenuItem("Back", -78, 77777, delegate() {
                    Main.menuMode = 12;
                    ServerBrowserMod.Instance.Dialog.Close();
                });

                Main.OnPostDraw += ServerBrowserMod._DrawBrowser;
            }
        }
예제 #2
0
        public override void Unload()
        {
            if (!Main.dedServ)
            {
                //this.Dialog.Close();    // Just in case?
                this.Dialog = null;

                Main.ClearPendingPlayerSelectCallbacks();
                Main.OnPostDraw -= ServerBrowserMod._DrawBrowser;
            }

            ServerBrowserMod.Instance = null;
        }
예제 #3
0
        ////////////////

        internal bool UpdateToLatestVersion(ServerBrowserMod mymod)
        {
            var new_config = new ServerBrowserConfigData();
            var vers_since = this.VersionSinceUpdate != "" ?
                             new Version(this.VersionSinceUpdate) :
                             new Version();

            if (vers_since >= mymod.Version)
            {
                return(false);
            }

            this.VersionSinceUpdate = mymod.Version.ToString();

            return(true);
        }