Example #1
0
        private void OnAddUserParty(UserParty party)
        {
            UserParties.Add(new PartyListElementViewModel(party, OnSelectAttackRoute));
            var parties = UserParties.ToArray();

            UserParties.Clear();
            UserParties.AddRange(parties.OrderByDescending(x => x.Party.Value.CreateTime));
        }
Example #2
0
 public void SaveParty(UserParty party)
 {
     if (UserParties.Contains(party))
     {
         var index = UserParties.FindIndex(x => x.Id == party.Id);
         UserParties[index] = party;
         OnChangeUserParty?.Invoke(party);
         FileManager.I.SaveJson(UserParties.ToArray());
     }
     else
     {
         AddParty(party);
     }
 }
Example #3
0
        private void OnChangeUserParty(UserParty party)
        {
            var userPartyIndex = UserParties.ToList().FindIndex(x => x.Id == party.Id);

            if (userPartyIndex >= 0)
            {
                UserParties[userPartyIndex].UpdateParty(party);;
                var parties = UserParties.ToArray();
                UserParties.Clear();
                UserParties.AddRange(parties.OrderByDescending(x => x.Party.Value.CreateTime));
            }

            var attackRouteIndex = AttackParties.ToList().FindIndex(x => x.Id == party.Id);

            if (attackRouteIndex >= 0)
            {
                AttackParties[attackRouteIndex].UpdateParty(party);
                CheckDoubling();
            }
        }
Example #4
0
 public void RemoveParty(UserParty party)
 {
     UserParties.Remove(party);
     OnRemoveUserParty?.Invoke(party);
     FileManager.I.SaveJson(UserParties.ToArray());
 }
Example #5
0
 public void AddParty(UserParty party)
 {
     UserParties.Add(party);
     OnAddUserParty?.Invoke(party);
     FileManager.I.SaveJson(UserParties.ToArray());
 }