예제 #1
0
        public void PopulateEvents()
        {
            this.listViewItems.Items.Clear();
            for (int i = 0; i < PokeManager.NumEvents; i++)
            {
                EventDistribution eventDist = PokeManager.GetEventAt(i);
                if (eventDist.AllowedGames.HasFlag((GameTypeFlags)(1 << ((int)gameSave.GameType - 1))))
                {
                    listViewItems.Items.Add(new EventDisplayItem(eventDist, gameSave));

                    /*ListViewItem listViewItem = new ListViewItem();
                     *
                     * StackPanel stackPanel = new StackPanel();
                     * stackPanel.Orientation = Orientation.Horizontal;
                     *
                     * int width = 32;
                     *
                     * Image image = new Image();
                     * image.Source = eventDist.SmallSprite;
                     * if (eventDist.SmallSprite.PixelHeight == 32) {
                     *      image.Width = width;
                     *      image.Height = 32;
                     *      image.Margin = new Thickness(-2, -7, -2, -2);
                     *      image.HorizontalAlignment = HorizontalAlignment.Left;
                     *      image.VerticalAlignment = VerticalAlignment.Top;
                     * }
                     * else {
                     *      image.Width = eventDist.SmallSprite.PixelWidth;
                     *      image.Height = eventDist.SmallSprite.PixelHeight;
                     *      image.Margin = new Thickness((28 - image.Width) / 2, (28 - image.Height) / 2, (28 - image.Width) / 2, (28 - image.Height) / 2);
                     *      image.HorizontalAlignment = HorizontalAlignment.Left;
                     *      image.VerticalAlignment = VerticalAlignment.Center;
                     * }
                     *
                     * Label name = new Label();
                     * name.VerticalAlignment = VerticalAlignment.Center;
                     * name.Content = eventDist.Title;
                     * name.Margin = new Thickness(2, 0, 0, 0);
                     *
                     * Label completed = new Label();
                     * completed.VerticalAlignment = VerticalAlignment.Center;
                     * completed.FontWeight = FontWeights.Bold;
                     * completed.Content = "(Completed)";
                     * completed.Margin = new Thickness(0, 0, 0, 0);
                     * completed.Padding = new Thickness(0, 0, 0, 0);
                     * completed.Visibility = (PokeManager.IsEventCompletedBy(eventDist.ID, gameSave) ? Visibility.Visible : Visibility.Hidden);
                     *
                     * stackPanel.Children.Add(image);
                     * stackPanel.Children.Add(name);
                     * stackPanel.Children.Add(completed);
                     *
                     * listViewItem.Content = stackPanel;
                     * listViewItem.Tag = eventDist;
                     * listViewItems.Items.Add(listViewItem);*/
                }
            }
        }
예제 #2
0
        private void UpdateDetails()
        {
            int count     = 0;
            int completed = 0;

            for (int i = 0; i < PokeManager.NumEvents; i++)
            {
                EventDistribution eventDist = PokeManager.GetEventAt(i);
                if (eventDist.AllowedGames.HasFlag((GameTypeFlags)(1 << ((int)gameSave.GameType - 1))))
                {
                    count++;
                    if (PokeManager.IsEventCompletedBy(eventDist.ID, gameSave))
                    {
                        completed++;
                    }
                }
            }
            labelPocket.Content = "Events Completed   " + completed + "/" + count;
        }
예제 #3
0
        private byte[] SaveCompletedEvents()
        {
            List <byte> data = new List <byte>();

            data.AddRange(BitConverter.GetBytes(PokeManager.NumEvents));

            for (int i = 0; i < PokeManager.NumEvents; i++)
            {
                EventDistribution eventDist = PokeManager.GetEventAt(i);
                data.AddRange(ByteHelper.GetStringBytes(eventDist.ID, 40));
                List <uint> completedList = PokeManager.GetCompletedEventsList(eventDist.ID);
                data.AddRange(BitConverter.GetBytes(completedList.Count));
                foreach (uint fullID in completedList)
                {
                    data.AddRange(BitConverter.GetBytes(fullID));
                }
            }

            return(data.ToArray());
        }