コード例 #1
0
        private void BuildClustersMenu()
        {
            Clusters.Clear();

            if (Presentation == null)
            {
                return;
            }

            var transformations = Presentation.GetModule <ITransformationModule>();
            var captions        = Presentation.GetModule <ICaptionModule>();

            var clusters = transformations.Graph.Clusters
                           .Union(Presentation.Graph.Clusters)
                           .Select(c => c.Id)
                           .Distinct()
                           .Select(id => new ClusterWithCaption
            {
                Id      = id,
                Caption = captions.Get(id).DisplayText
            })
                           .OrderBy(id => id.Caption);

            foreach (var cluster in clusters)
            {
                Clusters.Add(cluster);
            }
        }
コード例 #2
0
 public void Clear()
 {
     GlyphIndicies.Clear();
     GlyphPositions.Clear();
     Clusters.Clear();
     CodePointXCoords.Clear();
 }
コード例 #3
0
 public void ResetCache()
 {
     try
     {
         ClusterId    = "explore_all:0";
         clusterName_ = "";
         Channel      = null;
         FirstRun     = true;
         Items.Clear();
         ItemsX.Clear();
         Clusters.Clear();
         Pagination   = PaginationParameters.MaxPagesToLoad(1);
         HasMoreItems = true;
         IsLoading    = true;
     }
     catch { }
 }
コード例 #4
0
        public void PaintWorld(WorldLayer layer)
        {
            if ((Hud.Game.SpecialArea != SpecialArea.Rift) && (Hud.Game.SpecialArea != SpecialArea.GreaterRift) && (Hud.Game.SpecialArea != SpecialArea.ChallengeRift))
            {
                return;
            }

            var monsters = Hud.Game.AliveMonsters.Where(x => (x.SnoMonster != null) && (IncludeOffScreen || x.IsOnScreen) && !((x.SummonerAcdDynamicId != 0) && (x.Rarity == ActorRarity.RareMinion)));

            foreach (var monster in monsters)
            {
                var nearMe = monsters.Where(x => x != monster && x.FloorCoordinate.XYDistanceTo(monster.FloorCoordinate) <= Range);
                Clusters.Add(monster, nearMe.Sum(x => x.SnoMonster.RiftProgression) + monster.SnoMonster.RiftProgression);
            }

            var clusters = 0;

            while (Clusters.Count > 0 && clusters < ClustersMax)
            {
                var cluster = Clusters.Aggregate((l, r) => l.Value > r.Value ? l : r);

                if ((cluster.Value / Hud.Game.MaxQuestProgress * 100d) >= ProgressMin)
                {
                    Decorator.Paint(layer, cluster.Key, cluster.Key.FloorCoordinate, (cluster.Value / Hud.Game.MaxQuestProgress * 100d).ToString("F2", CultureInfo.InvariantCulture) + "%");

                    var nearMeAgain = monsters.Where(x => x.FloorCoordinate.XYDistanceTo(cluster.Key.FloorCoordinate) <= Range * 2f);
                    foreach (var monster in nearMeAgain)
                    {
                        Clusters.Remove(monster);
                    }
                    clusters++;
                }
                else
                {
                    clusters = ClustersMax;
                }
            }

            Clusters.Clear();
        }
コード例 #5
0
        async Task LoadMoreItemsAsync(bool refresh = false)
        {
            if (!HasMoreItems && !refresh)
            {
                IsLoading = false;
                return;
            }
            try
            {
                if (refresh)
                {
                    PageCount  = 1;
                    Pagination = PaginationParameters.MaxPagesToLoad(1);
                    try
                    {
                        Views.Main.ExploreView.Current?.ShowTopLoading();
                    }
                    catch { }
                    try
                    {
                        Views.Main.ExploreClusterView.Current?.ShowTopLoading();
                    }
                    catch { }
                    //try
                    //{
                    //    Views.Posts.ScrollableExplorePostView.Current?.ShowTopLoading();
                    //}
                    //catch { }
                }
                else
                {
                    try
                    {
                        Views.Main.ExploreView.Current?.ShowBottomLoading();
                    }
                    catch { }
                    try
                    {
                        Views.Main.ExploreClusterView.Current?.ShowBottomLoading();
                    }
                    catch { }
                    //try
                    //{
                    //    Views.Posts.ScrollableExplorePostView.Current?.ShowBottomLoading();
                    //}
                    //catch { }
                }

                var result = await InstaApi.FeedProcessor.GetTopicalExploreFeedAsync(Pagination, ClusterId);

                //if (DeviceUtil.IsMobile)
                Pagination.MaximumPagesToLoad = 2;
                PageCount++;
                FirstRun = false;
                if (!result.Succeeded)
                {
                    IsLoading = false;
                    if (result.Value == null || result.Value.Medias?.Count == 0)
                    {
                        Hide(refresh);
                        return;
                    }
                }

                HasMoreItems = result.Value.MoreAvailable;

                Pagination.NextMaxId = result.Value.NextMaxId;
                if (refresh)
                {
                    Items.Clear();
                    ItemsX.Clear();
                }
                if (result.Value.Medias?.Count > 0)
                {
                    //Items.AddRange(result.Value.Medias);
                    //ItemsX.AddRange(result.Value.Medias);
                    for (int i = 0; i < result.Value.Medias.Count; i++)
                    {
                        var l = result.Value.Medias[i];
                        if (!Items.Any(x => x.InstaIdentifier == l.InstaIdentifier))
                        {
                            Items.Add(l);
                            //ItemsX.Add(l);
                        }
                    }
                }
                if (result.Value.Clusters?.Count > 0)
                {
                    Clusters.Clear();
                    if (result.Value.Clusters[0].Title.ToLower() == "for you")
                    {
                        result.Value.Clusters.RemoveAt(0);
                    }
                    Clusters.AddRange(result.Value.Clusters);
                }
                if (result.Value.Channel != null)
                {
                    Channel = result.Value.Channel;
                }
                await Task.Delay(1000);

                IsLoading = false;
                if (refresh /*&& DeviceUtil.IsMobile*/)
                {
                    RunLoadMore();
                }
            }
            catch (Exception ex)
            {
                ex.PrintException("ExploreClusterGenerator.LoadMoreItemsAsync");
            }
            FirstRun = IsLoading = false;
            Hide(refresh);
        }
コード例 #6
0
 void Clear()
 {
     Clusters?.Clear();
 }