private void SetMonsterTeam() { GetNewFinalTrialRankCheckInfoResponse res = DragonBallRankMgr.GetInstance().m_response; if (res.data.detail != null && res.data.detail.monteam != null && res.data.detail.monteam.Length != 0 && res.data.detail.monteam[m_teamindex].mon != null) { m_MonTeam = new MonsterTeam(1, res.data.detail.monteam[m_teamindex].mon.Count); } else { m_MonTeam = new MonsterTeam(1, 1); } foreach (string keys in res.data.detail.monteam[m_teamindex].mon.Keys) { int id = 0; if (res.data.detail.monteam[m_teamindex].mon.TryGetValue(keys, out id)) { for (int i = 0; i < res.data.detail.monster.Length; i++) { if (id == res.data.detail.monster[i].id) { Monster mon = res.data.detail.monster[i].toMonster(Core.Data.monManager); int pos = int.Parse(keys); pos = pos % 100; pos -= 1; m_MonTeam.setMember(mon, pos); EquipInfo info = null; if (res.data.detail.equip != null && res.data.detail.equip.Length != 0) { if (m_equipteamindex >= 0) { if (res.data.detail.equip[m_equipteamindex].EquipIdList[pos] != null) { foreach (int _id in res.data.detail.equip[m_equipteamindex].EquipIdList[pos]) { for (int t = 0; t < res.data.detail.eqip.Length; t++) { if (res.data.detail.eqip[t].id == _id) { info = res.data.detail.eqip[t]; EquipData data = Core.Data.EquipManager.getEquipConfig(info.num); Equipment ment = new Equipment(info, data, Core.Data.gemsManager); m_MonTeam.setEquip(ment, pos); } } } } } } break; } } } } }
public void SetFinalTrialRankData(BaseHttpRequest request, BaseResponse response) { ComLoading.Close(); if (response != null && response.status != BaseResponse.ERROR) { HttpRequest httprequest = request as HttpRequest; if (httprequest.Act == HttpRequestFactory.ACTION_NEW_FINALTRIAL_GETRANK) { GetNewFinalTrialRankResponse mresponse = response as GetNewFinalTrialRankResponse; if (mresponse != null) { if (mresponse.data == null) { ConsoleEx.DebugLog("CheckFinalTrialRankResponse's data is null"); } else { mUIDragonBallRank.OnShow(mresponse); InitRankCell(mresponse); RefreshCell(true, mresponse); UIGrid mm = mRoot.GetComponent <UIGrid>(); mm.Reposition(); if (mresponse.data.ranklist.Length <= 6) { mUIDragonBallRank.SetDragPanel(true); } else { mUIDragonBallRank.SetDragPanel(false); } } } } else if (httprequest.Act == HttpRequestFactory.ACTION_CHECK_TEAMRANKINFO) { GetNewFinalTrialRankCheckInfoResponse mresponse = response as GetNewFinalTrialRankCheckInfoResponse; if (mresponse != null) { if (mUIDragonBallRankCheckInfo != null) { mUIDragonBallRankCheckInfo.gameObject.SetActive(true); mUIDragonBallRankCheckInfo.OnShow(mresponse); } else { m_response = mresponse; SetRankCheckInfoPanel(true); mUIDragonBallRankCheckInfo.OnShow(mresponse); } } } } }
public void OnShow(GetNewFinalTrialRankCheckInfoResponse mresponse) { m_teamindex = 0; if (mGrid == null || mView == null) { FindGrid(); } if (mresponse == null || mresponse.data == null) { return; } int index = 0; if (mresponse.data.detail != null) { _EquipInfo = mresponse.data.detail.eqip; if (mresponse.data.currTeam > 0) { foreach (MonsterTeamInfo monsterteaminfo in mresponse.data.detail.monteam) { if (monsterteaminfo.teamid == mresponse.data.currTeam) { break; } m_teamindex++; } } for (int z = 0; z < mresponse.data.detail.monteam.Length; z++) { if (mresponse.data.detail.monteam[z].teamid == mresponse.data.currTeam) { teaminfo = mresponse.data.detail.monteam[z]; Capacity = Core.Data.playerManager.GetUserLvlInfo(mresponse.data.lv).petSlot; } } } m_equipteamindex = -1; if (mresponse.data.detail != null && mresponse.data.detail.equip != null) { for (int i = 0; i < mresponse.data.detail.equip.Length; i++) { if (mresponse.data.detail.equip[i].id == mresponse.data.currTeam) { m_equipteamindex = i; mresponse.data.detail.equip[m_equipteamindex].HumanReadable(); break; } } } GameObject obj1 = PrefabLoader.loadFromPack("LS/pbLSRankRole") as GameObject; SortedDictionary <string, int> dic = new SortedDictionary <string, int>(); foreach (string key in teaminfo.mon.Keys) { dic.Add(key, teaminfo.mon[key]); } teaminfoTemp = new MonsterTeamInfo(); teaminfoTemp.teamid = teaminfo.teamid; teaminfoTemp.mon = new Dictionary <string, int>(); foreach (string keys in dic.Keys) { for (int i = 0; i < mresponse.data.detail.monster.Length; i++) { int id = 0; if (dic.TryGetValue(keys, out id)) { if (mresponse.data.detail.monster[i].id == id) { _MonsterInfoList.Add(mresponse.data.detail.monster[i]); teaminfoTemp.mon.Add(keys, mresponse.data.detail.monster[i].num); if (obj1 != null) { GameObject go = NGUITools.AddChild(mGrid.gameObject, obj1); // go.gameObject.name = (1000 + i).ToString(); RankRoleIcon mm = go.gameObject.GetComponent <RankRoleIcon>(); DragonBallRankMgr.GetInstance().mRankRoleIcon.Add(mm); mm.gameObject.SetActive(true); Monster mon = mresponse.data.detail.monster[i].toMonster(Core.Data.monManager); if (mresponse.data.detail.equip != null && m_equipteamindex >= 0) { mm.InitUI(mon, index, mresponse.data.detail.equip[m_equipteamindex].EquipIdList[index], mresponse.data.detail.monteam); } else { mm.InitUI(mon, index, new int[] {}, mresponse.data.detail.monteam); } break; } } } } index++; } _RankRoleIcon = DragonBallRankMgr.GetInstance().mRankRoleIcon[0]; _RankRoleIcon.SetChoose(true); DragonBallRankMgr.GetInstance()._NowChooseIndex = 0; SetChoose(); //自己组装monsterteam 用于打开缘界面做准备 SetMonsterTeam(); mGrid.Reposition(); mView.ResetPosition(); }