public void InitializeGuilds() { gridGuilds.Clear(); foreach (DiscordGuild guild in DTT.Instance.currentClient.Guilds.Values) { UIGuild uiGuild = new UIGuild(guild); uiGuild.Width.Pixels = 20; uiGuild.Height.Pixels = 20; uiGuild.OnClick += (a, b) => { gridMessages.Clear(); DTT.Instance.currentGuild = guild; DTT.Instance.currentChannel = guild.GetDefaultChannel(); if (Utility.texCache.ContainsKey(guild.IconUrl)) { buttonGuilds.texture = Utility.texCache[guild.IconUrl]; } string name = "#" + DTT.Instance.currentChannel.Name.Replace("_", "-"); textCurrent.SetText(name); textCurrent.Width.Pixels = name.Measure().X; textCurrent.Height.Pixels = name.Measure().Y; textCurrent.Recalculate(); Utility.DownloadLog(DTT.Instance.currentChannel); InitializeChannels(); }; string path = $"{DTT.Guilds}{guild.Id}.png"; Utility.DownloadImage(path, guild.IconUrl, texture => uiGuild.texture = texture); gridGuilds.Add(uiGuild); } }
static public UIGuild GetInstance() { UIGuild self = UIManager.Singleton.GetUIWithoutLoad <UIGuild>(); if (self != null) { return(self); } self = UIManager.Singleton.LoadUI <UIGuild>("UI/UIGuild", UIManager.Anchor.Center); return(self); }