void OnNewChannelsAdded(int[] channelHashes) { foreach (var hash in channelHashes) { AddChannelNode(hash, LogChannelInfoCache.GetChannelName(hash)); } Rebuild(); }
// This function is called before rebuild, thus no rebuild is needed to call here public override void OnPrepareToShow() { base.OnPrepareToShow(); _isDirty = false; _channelCategoryNode.children.Clear(); LogChannelInfoCache.OnNewChannelsAdded += OnNewChannelsAdded; List <KeyValuePair <int, string> > channels = LogChannelInfoCache.GetChannels().ToList(); channels.Sort((c1, c2) => c1.Value.CompareTo(c2.Value)); foreach (var channel in channels) { AddChannelNode(channel.Key, channel.Value); } }