Example #1
0
        public void Show(UnityAction cancelAction)
        {
            gameObject.SetActive(true);
            transform.SetAsLastSibling();

            HostNames.Clear();
            SelectedHost = string.Empty;
            Rebuild(HostNames, SelectHost, SelectedHost);

            CardGameManager.Instance.discovery.lobby = this;
            CardGameManager.Instance.discovery.SearchForHost();
        }
Example #2
0
        /// <summary>
        /// Registers all of the hostnames configured in the database.
        /// </summary>
        public static void RegisterDefaultHostNames()
        {
            // Make sure we don't try to register the host names before
            // the database has been installed.
            if (SysParam.GetByName("SITE_VERSION") != null)
            {
                if (hostNames == null)
                {
                    hostNames = new Dictionary <string, Entities.SiteTree>();
                }

                HostNames.Clear();

                // We need to check version so we don't try to access the column sitetree_hostnames
                // before it's been created in the database.
                if (Data.Database.InstalledVersion > 26)
                {
                    using (var db = new DataContext()) {
                        var sites = db.SiteTrees.ToList();

                        foreach (var site in sites)
                        {
                            if (HttpContext.Current != null)
                            {
                                Page.InvalidateStartpage(site.Id);
                            }

                            if (!String.IsNullOrEmpty(site.HostNames))
                            {
                                var hostnames = site.HostNames.Split(new char[] { ',' });

                                foreach (var host in hostnames)
                                {
                                    if (HostNames.ContainsKey(host))
                                    {
                                        throw new Exception("Duplicates of the hostname [" + host + "] was found configured");
                                    }
                                    HostNames.Add(host.ToLower(), site);
                                }
                            }
                            if (site.Id == Config.DefaultSiteTreeId)
                            {
                                DefaultSite = site;
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        public void Show(UnityAction cancelAction)
        {
            gameObject.SetActive(true);
            transform.SetAsLastSibling();

            cancelButton.onClick.RemoveAllListeners();
            cancelButton.onClick.AddListener(cancelAction);

            HostNames.Clear();
            SelectedHost = string.Empty;
            Rebuild(HostNames, SelectHost, SelectedHost);

            CardGameManager.Instance.Discovery.lobby = this;
            CardGameManager.Instance.Discovery.SearchForHost();
        }
Example #4
0
        public void DisplayHosts(List <string> hostNames)
        {
            if (hostNames == null || hostNames.Equals(HostNames))
            {
                return;
            }

            HostNames.Clear();
            foreach (string hostname in hostNames)
            {
                HostNames.Add(hostname.Split(':').Last());
            }
            if (!HostNames.Contains(SelectedHost))
            {
                SelectedHost            = string.Empty;
                joinButton.interactable = false;
            }

            Rebuild(HostNames, SelectHost, SelectedHost);
        }
Example #5
0
        public void DisplayHosts(List <string> hosts)
        {
            if (hosts == null || hosts.OrderBy(t => t).ToList().SequenceEqual(HostNames.Keys.ToList()))
            {
                return;
            }

            HostNames.Clear();
            foreach (string host in hosts)
            {
                HostNames[host] = host.Split(':').Last();
            }

            if (!HostNames.ContainsValue(SelectedHost))
            {
                SelectedHost            = string.Empty;
                joinButton.interactable = false;
            }
            Rebuild(HostNames, SelectHost, SelectedHost);
        }