private void UpdateBtn() { //InfoCLogUtil.instance.SendClickLog(ClickEnum.SKILL_UPDATE); OnTipsBtn(-1); int nextLevel = (Global.gApp.gSystemMgr.GetSkillMgr().GetTimes() / m_LevelSkillTimes + 1) * m_LevelSkillTimes; int timesLimit = (Global.gApp.gSystemMgr.GetBaseAttrMgr().GetLevel() / m_LevelSkillTimes) * m_LevelSkillTimes; if (timesLimit <= Global.gApp.gSystemMgr.GetSkillMgr().GetTimes()) { Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 3045, nextLevel.ToString()); return; } if (m_ComsumeItem == null) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 4177); return; } if (m_RandomList.Count == 0) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 3042); return; } if (!GameItemFactory.GetInstance().CanReduce(m_ComsumeItem)) { Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 1006); return; } UpBtn.button.enabled = false; Global.gApp.gGameCtrl.AddGlobalTouchMask(); //UpBtn.button.interactable = false; int lastIndex = 0; //保底逻辑 bool securiy = false; for (int i = 0; i < m_LevelSecurity.Length; i++) { bool tmp = Global.gApp.gSystemMgr.GetSkillMgr().GetTimes() >= m_LevelSecurity[i] && Global.gApp.gSystemMgr.GetSkillMgr().GetSkillLevel(GameConstVal.SExHp) < i + 1; if (tmp) { securiy = tmp; break; } } if (securiy) { for (int i = 0; i < m_RandomList.Count; i++) { if (m_RandomList[i].id.Equals(GameConstVal.SExHp)) { lastIndex = i; break; } } } else { int value = UnityEngine.Random.Range(0, m_RandomMax); int cur = 0; for (int i = 0; i < m_RandomList.Count; i++) { if (value >= cur && value < cur + m_RandomList[i].weight) { lastIndex = i; break; } cur += m_RandomList[i].weight; } } SkillItem finalConfig = m_RandomList[lastIndex]; m_ComsumeItem.paramStr1 = Global.gApp.gSystemMgr.GetSkillMgr().GetTimes().ToString(); m_ComsumeItem.paramStr2 = finalConfig.id; m_ComsumeItem.paramStr3 = Global.gApp.gSystemMgr.GetSkillMgr().GetSkillLevel(finalConfig.id).ToString(); GameItemFactory.GetInstance().ReduceItem(m_ComsumeItem); Global.gApp.gSystemMgr.GetSkillMgr().SetTimes(); Global.gApp.gSystemMgr.GetSkillMgr().LevelUp(finalConfig.id); Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIFresh); if (m_RandomList.Count == 1) { gameObject.AddComponent <DelayCallBack>().SetAction(() => { RandomIndex(lastIndex, 1); }, 0.1f); } else { int m_MaxTime = 52; DelayCallBack callBack = gameObject.AddComponent <DelayCallBack>(); callBack.SetAction( () => { RandomIndex(lastIndex, m_MaxTime); if (m_RanTimes == 15) { callBack.ResteTime(); callBack.SetLiveOffset(0); } else if (m_RanTimes == 40) { callBack.SetLiveTime(0); callBack.ResteTime(); callBack.SetLiveOffset(0.02f); } ; }, 0.2f); callBack.SetCallTimes(m_MaxTime - 1); callBack.SetLiveOffset(-0.016f); RandomIndex(lastIndex, m_MaxTime); } }