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)); }
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); } }
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(); } }
public void RemoveParty(UserParty party) { UserParties.Remove(party); OnRemoveUserParty?.Invoke(party); FileManager.I.SaveJson(UserParties.ToArray()); }
public void AddParty(UserParty party) { UserParties.Add(party); OnAddUserParty?.Invoke(party); FileManager.I.SaveJson(UserParties.ToArray()); }