Пример #1
0
        public void AddShip(Ship ship)
        {
            ushort[] skills1 = new ushort[ship.Skills.Length];
            for (ushort i = 0; i < skills1.Length; i++)
            {
                skills1[i] = 1;
            }
            MyShip newShip = new MyShip
            {
                Id          = ship.Id,
                HullType    = ship.HullType,
                Rarity      = ship.Rarity,
                CurrentStat = ship.Stats.BaseStats,
                SKillLvs    = skills1
            };

            MyList.Add(newShip);
            ShipDataLists.Add(new ShipDataList {
                MyShip = newShip, Ship = ship
            });
            ShipDataLists  = ShipDataLists.OrderByDescending(x => x.MyShip.Lv).ToList();
            FilterListStat = ShipDataLists;
            RaisePropertyChanged("FilterListStat");
            WriteJson();
        }
Пример #2
0
        private void GetMyList()
        {
            var taskRes = Task.Run(() =>
            {
                return(_alRepository.GetShips());
            });

            taskRes.ConfigureAwait(true).GetAwaiter().OnCompleted(
                () =>
            {
                if (File.Exists(@"D:\AzurLaneAPIList.json"))
                {
                    string json = File.ReadAllText(@"D:\AzurLaneAPIList.json");
                    if (!json.Equals(""))
                    {
                        MyList = JsonConvert.DeserializeObject <List <MyShip> >(json);
                        MyList = MyList.OrderByDescending(x => x.Lv).ToList();
                        foreach (MyShip myShip in MyList)
                        {
                            Ship tShip = taskRes.Result.Find(x => x.Id == myShip.Id);
                            ShipDataLists.Add(new ShipDataList {
                                MyShip = myShip, Ship = tShip
                            });
                        }
                        FilterListStat = ShipDataLists;
                        RaisePropertyChanged("ShipDataLists");
                        RaisePropertyChanged("FilterListStat");
                    }
                }
            });
        }
Пример #3
0
 //-------------------//
 //My Sorting Function//
 //-------------------//
 public void SortByLevel()
 {
     if (ShipDataLists != null && ShipDataLists.Count > 0)
     {
         FilterListStat = ShipDataLists.OrderByDescending(x => x.MyShip.Lv).ToList();
     }
 }
Пример #4
0
 public void UpdateList()
 {
     ShipDataLists  = ShipDataLists.OrderByDescending(x => x.MyShip.Lv).ToList();
     FilterListStat = ShipDataLists;
     RaisePropertyChanged("FilterListStat");
     WriteJson();
 }