| | |
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class RuneModel : Model, IBeforePlayerDataInitialize
|
| | | public class RuneModel : Model, IBeforePlayerDataInitialize,IPlayerLoginOk
|
| | | {
|
| | | RuneComposeModel m_RuneComposeModel;
|
| | | RuneComposeModel runeComposeModel {
|
| | |
| | | public override void Init()
|
| | | {
|
| | | ParseConfig();
|
| | | for (int i = 0; i < 8; i++)
|
| | | for (int i = 0; i < RUNE_HOLE_COUNT; i++)
|
| | | {
|
| | | Redpoint redpoint = new Redpoint(10801, 1080101 + i);
|
| | | runeHoleRedpoints.Add(redpoint);
|
| | |
| | | }
|
| | |
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
|
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent;
|
| | | }
|
| | |
|
| | | private void OnFuncStateChangeEvent(int func)
|
| | |
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | ClearRuneData();
|
| | | serverInited = false;
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | serverInited = true;
|
| | | }
|
| | |
|
| | | #region 配置
|
| | | public const int RUNE_TYPE = 30;
|
| | | public const int RUNE_CREAMTYPE = 31;
|
| | | public const int RUNE_HOLE_COUNT = 9;
|
| | | public Dictionary<int, Dictionary<int, float>> runeAttrDic = new Dictionary<int, Dictionary<int, float>>();
|
| | | public Dictionary<int, float> runeAttrAdditionDic = new Dictionary<int, float>();
|
| | | public Dictionary<int, float> runeExpDic = new Dictionary<int, float>();
|
| | |
| | | public string runeExpFormula { get; private set; }
|
| | | public int runePackMaxNum { get; private set; }
|
| | | public Dictionary<int, int> doublePropRuneInlayDict { get; private set; }
|
| | |
|
| | | public Dictionary<int,SpecialRuneHoleCondition> specialHoles = new Dictionary<int, SpecialRuneHoleCondition>();
|
| | | int[] specialRedLevels = null;
|
| | | private void ParseConfig()
|
| | | {
|
| | |
|
| | |
| | | runeExpAddition = float.Parse(FuncConfigConfig.GetRuneNeedExpFormula().Numerical3);
|
| | | runeEliteAdditonDic = ConfigParse.GetDic<int, float>(FuncConfigConfig.GetRuneNeedExpFormula().Numerical4);
|
| | | runeExpFormula = FuncConfigConfig.GetRuneNeedExpFormula().Numerical1;
|
| | | FuncConfigConfig cfg = Config.Instance.Get<FuncConfigConfig>("RuneUnlock");
|
| | | if (cfg != null)
|
| | | FuncConfigConfig config = Config.Instance.Get<FuncConfigConfig>("RuneUnlock");
|
| | | if (config != null)
|
| | | {
|
| | | runeUnlockArray = ConfigParse.GetMultipleStr<int>(cfg.Numerical1);
|
| | | runeUnlockArray = ConfigParse.GetMultipleStr<int>(config.Numerical1);
|
| | | var costDict = ConfigParse.GetDic<int, int>(config.Numerical2);
|
| | | var levelDict = ConfigParse.GetDic<int, int>(config.Numerical3);
|
| | | foreach (var _hole in costDict.Keys)
|
| | | {
|
| | | specialHoles.Add(_hole, new SpecialRuneHoleCondition()
|
| | | {
|
| | | cost = costDict[_hole],
|
| | | level = levelDict.ContainsKey(_hole) ? levelDict[_hole] : 0,
|
| | | });
|
| | | }
|
| | | cfg = Config.Instance.Get<FuncConfigConfig>("RunePackageNum");
|
| | | runePackMaxNum = int.Parse(cfg.Numerical1);
|
| | | }
|
| | | config = Config.Instance.Get<FuncConfigConfig>("RunePackageNum");
|
| | | runePackMaxNum = int.Parse(config.Numerical1);
|
| | |
|
| | | var config = Config.Instance.Get<FuncConfigConfig>("RuneMaxLV");
|
| | | config = Config.Instance.Get<FuncConfigConfig>("RuneMaxLV");
|
| | | runeQualityMaxLevel = ConfigParse.GetDic<int, int>(config.Numerical1);
|
| | |
|
| | | var maxlevel = runeQualityMaxLevel != null ? runeQualityMaxLevel.Values.Last() : 0;
|
| | |
| | | doublePropertyRunes.Add(_cfg.TagItemID);
|
| | | }
|
| | |
|
| | | cfg = Config.Instance.Get<FuncConfigConfig>("RuneDoubleInlayCnt");
|
| | | doublePropRuneInlayDict = ConfigParse.GetDic<int, int>(cfg.Numerical1);
|
| | | config = Config.Instance.Get<FuncConfigConfig>("RuneDoubleInlayCnt");
|
| | | doublePropRuneInlayDict = ConfigParse.GetDic<int, int>(config.Numerical1);
|
| | |
|
| | | config = Config.Instance.Get<FuncConfigConfig>("RuneSpecialRedLevel");
|
| | | specialRedLevels = ConfigParse.GetMultipleStr<int>(config.Numerical1);
|
| | | }
|
| | | );
|
| | |
|
| | |
| | |
|
| | | private static StringBuilder _textBuilder = new StringBuilder();
|
| | | static readonly string replaceValStr = "level";
|
| | |
|
| | | bool serverInited = false;
|
| | |
|
| | | private void PlayerDataRefreshInfoEvent(PlayerDataRefresh refreshType)
|
| | | {
|
| | | if (refreshType == PlayerDataRefresh.LV)
|
| | | {
|
| | | UpdateSpecialHoleRedpoint();
|
| | | }
|
| | | }
|
| | |
|
| | | public int GetRuneMaxLevel(int _itemColor)
|
| | | {
|
| | |
| | | public Redpoint runeReplaceRedpoint = new Redpoint(1080130);
|
| | | private List<Redpoint> runeHoleRedpoints = new List<Redpoint>();
|
| | | public Redpoint runeMosaicRedpoint { get { return m_RuneMosaicRedpoint; } }
|
| | |
|
| | | public Redpoint specialRuneRemindRedpoint = new Redpoint(10801, 1080140);
|
| | | public Redpoint GetRedpoint(int _hole)
|
| | | {
|
| | | return runeHoleRedpoints[_hole];
|
| | | }
|
| | |
|
| | | //public void UpdateRedpoint()
|
| | | //{
|
| | | // for (int i = 0; i < runeHoleRedpoints.Count; i++)
|
| | | // {
|
| | | // runeHoleRedpoints[i].state = RedPointState.None;
|
| | | // }
|
| | | // if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Rune))
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // for (int i = 0; i < runeHoleRedpoints.Count; i++)
|
| | | // {
|
| | | // RuneData runeData = GetHoleRune(i);
|
| | | // if (runeData != null)
|
| | | // {
|
| | | // if (RuneSplinters >= GetRuneNeedExp(runeData.id, runeData.lv)
|
| | | // && runeData.lv < RuneMaxLevel)
|
| | | // {
|
| | | // runeHoleRedpoints[i].state = RedPointState.Simple;
|
| | | // }
|
| | | // else if (CanEquipBetterRune(i))
|
| | | // {
|
| | | // runeHoleRedpoints[i].state = RedPointState.Simple;
|
| | | // }
|
| | | // }
|
| | | // else if (CanMosaicRune(i))
|
| | | // {
|
| | | // runeHoleRedpoints[i].state = RedPointState.Simple;
|
| | | // }
|
| | | // }
|
| | | //}
|
| | | void UpdateSpecialHoleRedpoint()
|
| | | {
|
| | | specialRuneRemindRedpoint.state = RedPointState.None;
|
| | | if (DayRemind.Instance.GetDayRemind(DayRemind.RUNE_SPECIAL_HOLE))
|
| | | {
|
| | | return;
|
| | | }
|
| | | foreach (var hole in specialHoles.Keys)
|
| | | {
|
| | | if (IsRuneHoleOpen(hole))
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (PlayerDatas.Instance.baseData.LV >= specialHoles[hole].level
|
| | | && PlayerDatas.Instance.baseData.LV >= specialRedLevels[0]
|
| | | && PlayerDatas.Instance.baseData.LV < specialRedLevels[1])
|
| | | {
|
| | | specialRuneRemindRedpoint.state = RedPointState.Simple;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void SetDayRemind()
|
| | | {
|
| | | if (specialRuneRemindRedpoint.state == RedPointState.Simple)
|
| | | {
|
| | | DayRemind.Instance.SetDayRemind(DayRemind.RUNE_SPECIAL_HOLE, true);
|
| | | UpdateSpecialHoleRedpoint();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /// <summary>
|
| | | /// 新版符印红点
|
| | | ///1.有可操作的时候仅按优先级显示1个红点
|
| | |
| | | public bool CanLevelUpRune(out int _hole)
|
| | | {
|
| | | _hole = 0;
|
| | | for (int i = 0; i < 8; i++)
|
| | | for (int i = 0; i < RUNE_HOLE_COUNT; i++)
|
| | | {
|
| | | if (CanLevelUpRune(i))
|
| | | {
|
| | |
| | | UpdateRedpoint();
|
| | | UpdateBreakRedpoint();
|
| | | }
|
| | |
|
| | | public event Action<int> openNewHoleEvent;
|
| | | public void OnRuneHoleRefresh(HA31F_tagMCRuneInfo vNetData)
|
| | | {
|
| | | uint oldHoleState = holeState;
|
| | | holeState = vNetData.RuneHoleOpenState;
|
| | | for (byte i = 0; i < vNetData.Count; i++)
|
| | | {
|
| | |
| | | {
|
| | | OnRefreshRuneHole();
|
| | | }
|
| | | for (int i = 0; i < RUNE_HOLE_COUNT; i++)
|
| | | {
|
| | | if (!serverInited)
|
| | | {
|
| | | break;
|
| | | }
|
| | | int k = 1 << i;
|
| | | var oldOpen = (holeState & k) == k;
|
| | | if (!oldOpen && IsRuneHoleOpen(i))
|
| | | {
|
| | | if (openNewHoleEvent != null)
|
| | | {
|
| | | openNewHoleEvent(i);
|
| | | }
|
| | | }
|
| | | }
|
| | | UpdateRedpoint();
|
| | | UpdateBreakRedpoint();
|
| | | UpdateSpecialHoleRedpoint();
|
| | | }
|
| | |
|
| | | public void UnlockSpecialHole(int hole)
|
| | | {
|
| | | if (IsSpeicalHole(hole))
|
| | | {
|
| | | if (IsRuneHoleOpen(hole))
|
| | | {
|
| | | return;
|
| | | }
|
| | | int error = 0;
|
| | | if (!TestUnlockSpeicalHole(hole, out error))
|
| | | {
|
| | | ProcessUnlockError(error, specialHoles[hole]);
|
| | | return;
|
| | | }
|
| | | CA513_tagCMUnlockRuneHole pak = new CA513_tagCMUnlockRuneHole();
|
| | | pak.HoleIndex = (byte)hole;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | | }
|
| | |
|
| | | public bool TestUnlockSpeicalHole(int hole, out int error)
|
| | | {
|
| | | error = 0;
|
| | | SpecialRuneHoleCondition speicalHole;
|
| | | if (specialHoles.TryGetValue(hole, out speicalHole))
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.LV < speicalHole.level)
|
| | | {
|
| | | error = 1;
|
| | | return false;
|
| | | }
|
| | | if (PlayerDatas.Instance.baseData.Gold < speicalHole.cost)
|
| | | {
|
| | | error = 2;
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public void ProcessUnlockError(int error, SpecialRuneHoleCondition specialHole)
|
| | | {
|
| | | switch (error)
|
| | | {
|
| | | case 1:
|
| | | SysNotifyMgr.Instance.ShowTip("RuneSpecialHoleLevelError", specialHole.level);
|
| | | break;
|
| | | case 2:
|
| | | WindowCenter.Instance.Open<RechargeTipWin>();
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsSpeicalHole(int hole)
|
| | | {
|
| | | return specialHoles.ContainsKey(hole);
|
| | | }
|
| | |
|
| | | public bool IsRuneHoleOpen(int hole)
|
| | | {
|
| | | if (holeState < 1) return false;
|
| | | if (holeState < 1)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | int k = 1 << hole;
|
| | | if ((holeState & k) == k)
|
| | | {
|
| | |
| | |
|
| | | public bool IsEmptyHole()
|
| | | {
|
| | | for (int i = 0; i < 8; i++)
|
| | | for (int i = 0; i < RUNE_HOLE_COUNT; i++)
|
| | | {
|
| | | if (IsRuneHoleOpen(i) && !runeHoleData.ContainsKey(i))
|
| | | {
|
| | |
| | | public bool CanEquipHoleRune(int id, int _color, out int _hole)
|
| | | {
|
| | | _hole = 0;
|
| | | for (int i = 0; i < 8; i++)
|
| | | for (int i = 0; i < RUNE_HOLE_COUNT; i++)
|
| | | {
|
| | | if (!IsRuneHoleOpen(i))
|
| | | {
|
| | |
| | | public int GetOpenTowerCnt()
|
| | | {
|
| | | int Cnt = 0;
|
| | | for (int i = 0; i < 8; i++)
|
| | | for (int i = 0; i < RUNE_HOLE_COUNT; i++)
|
| | | {
|
| | | if (IsRuneHoleOpen(i))
|
| | | {
|
| | | Cnt++;
|
| | | }
|
| | | else break;
|
| | | else
|
| | | {
|
| | | break;
|
| | | }
|
| | | }
|
| | | return Cnt;
|
| | | }
|
| | |
| | | }
|
| | | #endregion
|
| | | }
|
| | |
|
| | | public struct SpecialRuneHoleCondition
|
| | | {
|
| | | public int level;
|
| | | public int cost;
|
| | | }
|
| | |
|
| | | public class RuneData
|
| | | {
|
| | | /// <summary>
|