/// <summary> /// 武学学习或升级结果,更新武学列表 /// </summary> /// <param name="sMsgActionStudyWuXue_SC">S message action study wu xue_ S.</param> public void UpdatePlayerMartialData(SMsgAcitonStudyWuXue_SC sMsgActionStudyWuXue_SC) { int martialID = sMsgActionStudyWuXue_SC.dwWuXueID; byte martialLevel = sMsgActionStudyWuXue_SC.byWuXueLevel; MartialIndex martialIndex = new MartialIndex() { MartialArtsID = martialID, MartialArtsLevel = (int)martialLevel - 1 }; PlayerMartialArtsData martialArtsData = PlayerDataManager.Instance.GetPlayerMartialArtConfigData(martialIndex); if (martialArtsData.MartialArtsUnlock != 0) //如果有解锁新武学 { MartialDataList.Add(new SSendWuXueData() { dwWuXueID = martialArtsData.MartialArtsUnlock, byWuXueLevel = 0 }); } for (int i = 0; i < MartialDataList.Count; i++) { if (MartialDataList[i].dwWuXueID == martialID) { SSendWuXueData tempData = new SSendWuXueData() { dwWuXueID = martialID, byWuXueLevel = martialLevel }; MartialDataList[i] = tempData; break; } } }
//指定ID的武学学习后是否解锁新武学 public int UnlockNewMartialId(int martialID) { int level = GetMartialLevelByID(martialID); MartialIndex martialIndex = new MartialIndex() { MartialArtsID = martialID, MartialArtsLevel = level - 1 }; PlayerMartialArtsData martialArtsData = PlayerDataManager.Instance.GetPlayerMartialArtConfigData(martialIndex); return(martialArtsData.MartialArtsUnlock != 0 ? martialArtsData.MartialArtsUnlock:0); }
/// <summary> /// 初始化 /// </summary> /// <param name="SendWuXueData">Send wu xue data.</param> /// <param name="Callback">Callback.</param> public void Init(SSendWuXueData SendWuXueData, ButtonCallBack Callback) { MartialIndex martialIndex = new MartialIndex() { MartialArtsID = SendWuXueData.dwWuXueID, MartialArtsLevel = SendWuXueData.byWuXueLevel }; PlayerMartialData = PlayerDataManager.Instance.GetPlayerMartialArtConfigData(martialIndex); MartialId = SendWuXueData.dwWuXueID; GameObject Icon = UI.CreatObjectToNGUI.InstantiateObj(PlayerMartialData.MartialArtsIconPrefab, IconPoint); this.gameObject.GetComponent <SingleButtonCallBack>().SetCallBackFuntion(Callback, MartialId); UpdateIconBg(SendWuXueData.byWuXueLevel); UpdateLevel(SendWuXueData.dwWuXueID); UpdateArrow(); }
//更新某个武学信息 public void UpdateInfo(int martialId) { MartialId = martialId; MartialLevel = PlayerMartialDataManager.Instance.GetMartialLevelByID(martialId); MartialIndex martialIndex = new MartialIndex() { MartialArtsID = MartialId, MartialArtsLevel = MartialLevel }; MartialData = PlayerDataManager.Instance.GetPlayerMartialArtConfigData(martialIndex); IconBG.GetComponent <SpriteSwith>().ChangeSprite(MartialLevel <= 1 ? 1 : MartialLevel); IconPoint.ClearChild(); GameObject icon = UI.CreatObjectToNGUI.InstantiateObj(MartialData.MartialArtsIconPrefab, IconPoint); MartialNameLabel.text = LanguageTextManager.GetString(MartialData.MartialArtsName); MartialDesLabel.text = LanguageTextManager.GetString(MartialData.MartialArtsDes); MartialEffDesLabel.text = LanguageTextManager.GetString(MartialData.MartialArtsParamDes); NeedConLabel.text = MartialData.MartialArtsContribution.ToString(); if (MartialLevel == 0) //没解锁 { EffBackground.transform.localScale = new Vector3(292, 74, 0); ConBackground.transform.localScale = new Vector3(292, 176, 0); LineMartialLevel.SetActive(false); LineHonor.SetActive(true); LineLearnLabel.SetActive(true); LineUpgradeLabel.SetActive(false); MaxHonorN.text = LanguageTextManager.GetString("IDS_I38_23"); MaxHonorLabel.text = MartialData.MartialArtsMaxScore.ToString(); NeedConN.text = LanguageTextManager.GetString("IDS_I38_24"); //Button.GetComponentInChildren<UILabel>().text = LanguageTextManager.GetString("IDS_I38_26"); //学习 Button.SetButtonText(LanguageTextManager.GetString("IDS_I38_26")); } else //已解锁 { EffBackground.transform.localScale = new Vector3(292, 115, 0); ConBackground.transform.localScale = new Vector3(292, 137, 0); LineMartialLevel.SetActive(true); LineHonor.SetActive(false); LineLearnLabel.SetActive(false); LineUpgradeLabel.SetActive(true); MartialLevelN.text = LanguageTextManager.GetString("IDS_I38_25"); MartialLevelLabel.text = MartialLevel.ToString() + "/" + MartialData.MartialArtsMaxLevels; //Button.GetComponentInChildren<UILabel>().text = LanguageTextManager.GetString("IDS_I38_27"); //升级 Button.SetButtonText(LanguageTextManager.GetString("IDS_I38_27")); } }
/// <summary> /// 根据武学类型获取相应列表 /// </summary> /// <returns>The martial list by type.</returns> /// <param name="martialType">Martial type.</param> public List <SSendWuXueData> GetMartialListByType(MartialType martialType) { List <SSendWuXueData> tempWuXueData = new List <SSendWuXueData>(); MartialDataList.ApplyAllItem(p => { MartialIndex martialIndex = new MartialIndex() { MartialArtsID = p.dwWuXueID, MartialArtsLevel = (int)p.byWuXueLevel }; PlayerMartialArtsData martialArtsData = PlayerDataManager.Instance.GetPlayerMartialArtConfigData(martialIndex); if (martialArtsData.MartialArtsType == (byte)martialType) { tempWuXueData.Add(p); } }); return(tempWuXueData); }
public PlayerMartialArtsData GetPlayerMartialArtConfigData(MartialIndex martialIndex) { return(m_martialArtData[martialIndex]); }