Fan website of IMMORTAL: Gates of Pyre.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

51 lines
1.3 KiB

using Model.Entity.Data;
using Model.Types;
namespace Services.Immortal;
public class ImmortalSelectionService : IImmortalSelectionService {
private string _selectedFaction = FactionType.QRath;
private string _selectedImmortal = DataType.IMMORTAL_Orzum;
public void Subscribe(Action action) {
OnChange += action;
}
public void Unsubscribe(Action action) {
OnChange -= action;
}
public string GetFactionType() {
return _selectedFaction;
}
public string GetImmortalType() {
return _selectedImmortal;
}
public bool SelectFactionType(string factionType) {
if (_selectedFaction == factionType) return false;
_selectedFaction = factionType;
if (_selectedFaction == FactionType.QRath) _selectedImmortal = DataType.IMMORTAL_Orzum;
if (_selectedFaction == FactionType.Aru) _selectedImmortal = DataType.IMMORTAL_Mala;
NotifyDataChanged();
return true;
}
public bool SelectImmortalType(string immortalType) {
if (_selectedImmortal == immortalType) return false;
_selectedImmortal = immortalType;
NotifyDataChanged();
return true;
}
private event Action OnChange = null!;
private void NotifyDataChanged() {
OnChange?.Invoke();
}
}