Ejemplo n.º 1
0
        private void CubeAddItem(LuckyItem item)
        {
            MessagingCenter.Send(this, "AddItem", item);

            //if (CubeItems == null)
            //{
            //    CubeItems = new ObservableCollection<CubeModel>();
            //}

            //CubeItems.Add(new CubeModel(SelectItems[0].Selected, SelectItems[1].Selected, SelectItems[2].Selected));
            //ItemsListView.ItemsSource = CubeItems;
        }
Ejemplo n.º 2
0
        private void RunLucky_Clicked(object sender, EventArgs e)
        {
            LuckyItem item = new LuckyItem(
                ((CubeItem)CubeA_Picker.SelectedItem)?.Id,
                ((CubeItem)CubeB_Picker.SelectedItem)?.Id,
                ((CubeItem)CubeC_Picker.SelectedItem)?.Id
                );

            Predict(item);

            CubeAddItem(item);
        }
Ejemplo n.º 3
0
        public NewItemPage()
        {
            InitializeComponent();

            Item = new LuckyItem
            {
                Text        = "Item name",
                Description = "This is an item description."
            };

            BindingContext = this;
        }
Ejemplo n.º 4
0
        public ItemDetailPage()
        {
            InitializeComponent();

            var item = new LuckyItem
            {
                Text        = "Item 1",
                Description = "This is an item description."
            };

            viewModel      = new ItemDetailViewModel(item);
            BindingContext = viewModel;
        }
Ejemplo n.º 5
0
        private bool IsContainFull(LuckyItem cube, LuckyItem cubeCompare)
        {
            List <string> list = new List <string>
            {
                cube.CubeA,
                cube.CubeB,
                cube.CubeC
            };

            list.Remove(cubeCompare.CubeA);
            list.Remove(cubeCompare.CubeB);
            list.Remove(cubeCompare.CubeC);

            return(list.Count == 0);
        }
Ejemplo n.º 6
0
 // Token: 0x06001702 RID: 5890 RVA: 0x000286EC File Offset: 0x000276EC
 internal virtual void StoreAccolades(Victory.DataLayer.Serialization.Event.Accolades accolades)
 {
     this.accolades = new Interop.Accolades();
     if (accolades.FinalRewards != null)
     {
         this.accolades.Reputation = accolades.FinalRewards.Rep;
         this.accolades.Tokens     = accolades.FinalRewards.Tokens;
     }
     if (accolades.OriginalRewards != null)
     {
         this.accolades.OriginalReputation = accolades.OriginalRewards.Rep;
         this.accolades.OriginalTokens     = accolades.OriginalRewards.Tokens;
     }
     this.accolades.HasLeveledUp = accolades.HasLeveledUp;
     if (accolades.LuckyDrawInfo != null)
     {
         LuckyDraw luckyDraw = this.accolades.GetLuckyDraw();
         luckyDraw.HasLuckyDraw = (accolades.LuckyDrawInfo.Items != null && accolades.LuckyDrawInfo.Items.Count > 0);
         luckyDraw.SetCardDeck(accolades.LuckyDrawInfo.CardDeck);
         luckyDraw.NumCards         = accolades.LuckyDrawInfo.NumCards;
         luckyDraw.NumBoxAnimations = accolades.LuckyDrawInfo.NumBoxAnimations;
         luckyDraw.CurrentStreak    = accolades.LuckyDrawInfo.CurrentStreak;
         luckyDraw.IsStreakBroken   = accolades.LuckyDrawInfo.IsStreakBroken;
         if (accolades.LuckyDrawInfo.Items != null)
         {
             foreach (LuckyDrawItem luckyDrawItem in accolades.LuckyDrawInfo.Items)
             {
                 LuckyItem luckyItem = new LuckyItem();
                 luckyItem.SetVirtualItem(luckyDrawItem.VirtualItem);
                 luckyItem.SetCategory(luckyDrawItem.VirtualItemType);
                 luckyItem.SetDescription(luckyDrawItem.Description);
                 luckyItem.SetIcon(luckyDrawItem.Icon);
                 luckyItem.Value    = luckyDrawItem.RemainingUseCount;
                 luckyItem.Price    = luckyDrawItem.ResellPrice;
                 luckyItem.ItemType = Inventory.GetProductTypeFromString(luckyDrawItem.VirtualItemType);
                 luckyItem.WasSold  = luckyDrawItem.WasSold;
                 luckyItem.PartID   = luckyDrawItem.Hash;
                 luckyDraw.AddItems(luckyItem);
             }
         }
         if (accolades.LuckyDrawInfo.Boxes != null)
         {
             foreach (LuckyDrawBox luckyDrawBox in accolades.LuckyDrawInfo.Boxes)
             {
                 LuckyBox luckyBox = new LuckyBox();
                 luckyBox.IsValid    = luckyDrawBox.IsValid;
                 luckyBox.CategoryId = (LuckyBoxCategory)luckyDrawBox.LuckyDrawSetCategoryId;
                 luckyBox.SetCategoryName(luckyDrawBox.LocalizationString);
                 luckyDraw.AddBoxes(luckyBox);
             }
         }
     }
     if (accolades.RewardInfo != null)
     {
         foreach (Victory.DataLayer.Serialization.Event.RewardPart rewardPart in accolades.RewardInfo)
         {
             Interop.RewardPart rewardPart2 = new Interop.RewardPart();
             rewardPart2.SetCategory(rewardPart.RewardCategory.ToString());
             if (rewardPart.RepPart != 0)
             {
                 rewardPart2.SetName(string.Format("REWARD_TYPE_{0}_REP", rewardPart.RewardType.ToString()));
                 rewardPart2.SetType("rep");
                 rewardPart2.Value = rewardPart.RepPart;
                 this.accolades.AddRewardParts(rewardPart2);
             }
             if (rewardPart.TokenPart != 0)
             {
                 rewardPart2.SetName(string.Format("REWARD_TYPE_{0}_TOKEN", rewardPart.RewardType.ToString()));
                 rewardPart2.SetType("tokens");
                 rewardPart2.Value = rewardPart.TokenPart;
                 this.accolades.AddRewardParts(rewardPart2);
             }
         }
     }
     this.ScoringMethod.AccoladesFetched(this.accolades);
 }
Ejemplo n.º 7
0
        private void Predict(LuckyItem luckyItem)
        {
            var lucky = new Dictionary <string, int>
            {
                { "Bau", 0 },
                { "Cua", 0 },
                { "Tom", 0 },
                { "Ca", 0 },
                { "Ga", 0 },
                { "Nai", 0 }
            };

            var luckyItems = this.viewModel.LuckyItems;
            int sumTotal   = 0;

            for (int i = 0; i < luckyItems.Count - 1; i++)
            {
                var item     = luckyItems[i];
                var nextItem = luckyItems[i + 1];

                if (this.IsContainFull(luckyItem, item))
                {
                    lucky[nextItem.CubeA] += 1 * luckyRate;
                    lucky[nextItem.CubeB] += 1 * luckyRate;
                    lucky[nextItem.CubeC] += 1 * luckyRate;

                    sumTotal += 3 * luckyRate;
                }

                if (item.IsContain(luckyItem.CubeA))
                {
                    lucky[nextItem.CubeA]++;
                    lucky[nextItem.CubeB]++;
                    lucky[nextItem.CubeC]++;

                    sumTotal += 3;
                }

                if (item.IsContain(luckyItem.CubeB))
                {
                    lucky[nextItem.CubeA]++;
                    lucky[nextItem.CubeB]++;
                    lucky[nextItem.CubeC]++;

                    sumTotal += 3;
                }

                if (item.IsContain(luckyItem.CubeC))
                {
                    lucky[nextItem.CubeA]++;
                    lucky[nextItem.CubeB]++;
                    lucky[nextItem.CubeC]++;

                    sumTotal += 3;
                }
            }

            List <PercentItem> percentItems = new List <PercentItem>();

            foreach (string key in lucky.Keys)
            {
                var percent = lucky[key] > 0 ? (double)lucky[key] / sumTotal : 0;
                percent = Math.Round(percent, 4);

                percentItems.Add(new PercentItem(key.ToString(), percent));
            }

            percentItems.Sort((a, b) =>
            {
                if (a.Percent > b.Percent)
                {
                    return(-1);
                }
                else if (a.Percent < b.Percent)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            ShowPercent(percentItems);
        }
Ejemplo n.º 8
0
 public ItemDetailViewModel(LuckyItem item = null)
 {
     //Title = item?.Text;
     //Item = item;
 }