| | |
| | | namespace Snxxz.UI |
| | | { |
| | | [XLua.LuaCallCSharp] |
| | | public class EquipModel : Model |
| | | public class EquipModel : Model, IAfterPlayerDataInitialize |
| | | { |
| | | public static readonly List<int> realmEquipTypes = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; |
| | | |
| | |
| | | get { return LocalSave.GetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "EquipSetUnLockHasShowed"), 1); } |
| | | set { LocalSave.SetInt(StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "EquipSetUnLockHasShowed"), value); } |
| | | } |
| | | |
| | | public readonly List<int> showedSuitPlaceEffect = new List<int>(); |
| | | public readonly List<int> showedSuitLevelEffect = new List<int>(); |
| | | |
| | | public readonly LogicInt selectedLevel = new LogicInt(); |
| | | public readonly LogicString selectedEquip = new LogicString(); |
| | |
| | | public readonly LogicBool isAppearanceLevel = new LogicBool(); |
| | | public readonly LogicList<int> suitPlaces = new LogicList<int>(); |
| | | public readonly LogicStruct<EquipSuitProperty> suitProperty = new LogicStruct<EquipSuitProperty>(); |
| | | |
| | | public readonly LogicList<int> suitPlaceCollectEffects = new LogicList<int>(); |
| | | public readonly LogicStruct<EquipSuitActive> suitActive = new LogicStruct<EquipSuitActive>(); |
| | | |
| | | static Dictionary<int, string> equipSetNames = new Dictionary<int, string>(); |
| | | Dictionary<int, EquipSet> equipSets = new Dictionary<int, EquipSet>(); |
| | |
| | | packModel.refrechPackEvent -= OnItemPackRefresh; |
| | | packModel.refreshItemCountEvent -= OnItemCountRefresh; |
| | | PlayerDatas.Instance.playerDataRefreshEvent -= OnPlayerDataRefresh; |
| | | } |
| | | |
| | | public void OnAfterPlayerDataInitialize() |
| | | { |
| | | var playerId = PlayerDatas.Instance.baseData.PlayerID; |
| | | |
| | | showedSuitPlaceEffect.Clear(); |
| | | var showedSuitPlaceEffectsRecord = LocalSave.GetIntArray(StringUtility.Contact(playerId, "_showedSuitPlaceEffect")); |
| | | if (showedSuitPlaceEffectsRecord != null) |
| | | { |
| | | showedSuitPlaceEffect.AddRange(showedSuitPlaceEffectsRecord); |
| | | } |
| | | |
| | | showedSuitLevelEffect.Clear(); |
| | | var showedSuitLevelEffectsRecord = LocalSave.GetIntArray(StringUtility.Contact(playerId, "_showedSuitLevelEffect")); |
| | | if (showedSuitLevelEffectsRecord != null) |
| | | { |
| | | showedSuitPlaceEffect.AddRange(showedSuitLevelEffectsRecord); |
| | | } |
| | | } |
| | | |
| | | public int GetLastestUnLockEquipSet() |
| | |
| | | suitPlaces.Clear(); |
| | | candidateEquips.Clear(); |
| | | getWays.Clear(); |
| | | suitPlaceCollectEffects.Clear(); |
| | | suitActive.value = default(EquipSuitActive); |
| | | } |
| | | |
| | | private void RefreshCandidateEquips(int level) |
| | |
| | | return entry; |
| | | } |
| | | |
| | | public bool IsSuitPlaceEffectPlayed(Int2 equipPosition) |
| | | { |
| | | var place = EquipSet.ClientPlaceToServerPlace(equipPosition); |
| | | return showedSuitPlaceEffect.Contains(place); |
| | | } |
| | | |
| | | public void RecordSuitPlaceEffectPlay(Int2 equipPosition) |
| | | { |
| | | var place = EquipSet.ClientPlaceToServerPlace(equipPosition); |
| | | if (!showedSuitPlaceEffect.Contains(place)) |
| | | { |
| | | showedSuitPlaceEffect.Add(place); |
| | | var playerId = PlayerDatas.Instance.baseData.PlayerID; |
| | | LocalSave.SetIntArray(StringUtility.Contact(playerId, "_showedSuitPlaceEffect"), showedSuitPlaceEffect.ToArray()); |
| | | } |
| | | } |
| | | |
| | | public bool IsSuitLevelEffectPlayed(Int3 info) |
| | | { |
| | | var place = info.x * 100 + info.y * 10 + info.z; |
| | | return showedSuitLevelEffect.Contains(place); |
| | | } |
| | | |
| | | public void RecordSuitLevelEffectPlay(Int3 info) |
| | | { |
| | | var place = info.x * 100 + info.y * 10 + info.z; |
| | | if (!showedSuitLevelEffect.Contains(place)) |
| | | { |
| | | showedSuitLevelEffect.Add(place); |
| | | var playerId = PlayerDatas.Instance.baseData.PlayerID; |
| | | LocalSave.SetIntArray(StringUtility.Contact(playerId, "_showedSuitLevelEffect"), showedSuitLevelEffect.ToArray()); |
| | | } |
| | | } |
| | | |
| | | private void OnPlayerDataRefresh(PlayerDataType type) |
| | | { |
| | | switch (type) |
| | |
| | | if (hasSuit) |
| | | { |
| | | suitPlaces.Add(i); |
| | | if (!IsSuitPlaceEffectPlayed(new Int2(level, i))) |
| | | { |
| | | suitPlaceCollectEffects.Add(i); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | var property = new EquipSuitProperty(); |
| | | |
| | | property.star = star; |
| | | property.twoSuit = GetEquipSuitEntry(level, star, EquipSuitType.TwoSuit); |
| | | property.fiveSuit = GetEquipSuitEntry(level, star, EquipSuitType.FiveSuit); |
| | | |
| | |
| | | property.eightActived = GetSuitLevel(level, EquipSuitType.EightSuit) >= star; |
| | | |
| | | this.suitProperty.value = property; |
| | | |
| | | var suitActive = new EquipSuitActive(); |
| | | suitActive.level = level; |
| | | suitActive.star = star; |
| | | if (property.twoSuit.actived && !IsSuitLevelEffectPlayed(new Int3(level, star, 2))) |
| | | { |
| | | suitActive.twoActived = true; |
| | | } |
| | | |
| | | if (property.fiveSuit.actived && !IsSuitLevelEffectPlayed(new Int3(level, star, 5))) |
| | | { |
| | | suitActive.fiveActived = true; |
| | | } |
| | | |
| | | if (property.eightActived && !IsSuitLevelEffectPlayed(new Int3(level, star, 8))) |
| | | { |
| | | suitActive.eightActived = true; |
| | | } |
| | | |
| | | this.suitActive.value = suitActive; |
| | | } |
| | | |
| | | private void ParseConfig() |
| | |
| | | |
| | | public struct EquipSuitProperty |
| | | { |
| | | public int star; |
| | | public EquipSuitPropertyEntry twoSuit; |
| | | public EquipSuitPropertyEntry fiveSuit; |
| | | public int eightSuitId; |
| | | public bool eightActived; |
| | | } |
| | | |
| | | public struct EquipSuitActive |
| | | { |
| | | public int level; |
| | | public int star; |
| | | |
| | | public bool twoActived; |
| | | public bool fiveActived; |
| | | public bool eightActived; |
| | | } |
| | | |
| | | } |
| | | |