public void JewelCombineResp(byte subType, byte level, byte errorId) { m_isComposing = false; TimerHeap.DelTimer(m_timerId); int type = (int)subType; //int level = m_currentJewel.level; Debug.Log("JewelCombineResp:" + errorId); switch (errorId) { case 0: MogoGlobleUIManager.Instance.ShowComposeSucessSign(true); if (ComposeUIViewManager.Instance != null && InventoryManager.Instance.CurrentView == InventoryManager.View.ComposeView) { ComposeUIViewManager.Instance.PlayUIFXAnim(); } if (MogoUIManager.Instance.CurrentUI == MogoUIManager.Instance.m_ComposeUI) { RefreshUI(); } break; case 4: Debug.Log("JewelCombineResp:" + errorId); //string msg = LanguageData.dataMap[425].Format(ItemJewelData.JewelDic[type][level - 1].Name); //MogoMsgBox.Instance.ShowMsgBox(msg); //在背包点合成时候转到合成界面,合成界面无法点合成所以不会有这个返回 SwitchToCompose(subType, level - 2); //InventoryManager.Instance.CurrentView = InventoryManager.View.ComposeView; //InventoryManager.Instance.m_currentEquipmentView = InventoryManager.View.ComposeView; //EquipTipManager.Instance.CloseEquipTip(); //m_currentJewel = ItemJewelData.JewelDic[subType][level]; //m_currentParentId = subType; //m_currentChildId = level - 2; //m_isSwitchFromBag = true; //MogoUIManager.Instance.SwitchComposeUI();//() => { OnSwitchComposeUIDone(subType, level); } break; default: Debug.Log("JewelCombineResp:" + errorId); Debug.Log("JewelCombineResp:" + type + "," + level); if (ItemJewelData.GetJewelDic()[type][level] == null) { Debug.Log("f**k!"); } else { InsetManager.ShowInfoByErrorId(errorId, ItemJewelData.GetJewelDic()[type][level]); } break; } Debug.Log("JewelCombineResp:" + errorId); EquipTipManager.Instance.CloseEquipTip(); }
private void OnJewelSelect(int parentId, int id) { Debug.Log("parentId:" + parentId + ",id:" + id); ComposeUIViewManager view = ComposeUIViewManager.Instance; m_currentParentId = parentId; m_currentChildId = id; view.SetComposeNowBtnEnable(true); view.SetComposeBtnEnable(true); if (parentId == 0 && m_jewelCanComposeList.Count > id) { ItemJewelData data = ItemJewelData.dataMap[m_jewelCanComposeList[id]]; ItemJewelData composeJewel = ItemJewelData.GetJewelDic()[data.subtype][data.level + 1]; view.SetComposePearlLeftIcon(data.Icon, data.color, data.id); view.SetComposePearlRightIcon(data.Icon, data.color, data.id); view.SetComposePearlUpIcon(data.Icon, data.color, data.id); view.SetComposePearlFinalIcon(composeJewel.Icon, composeJewel.color, composeJewel.id); m_currentJewel = data; //Debug.Log("m_currentParentId:" + m_currentParentId + ",m_currentChildId:" + m_currentChildId); view.SetComposeNowBtnEnable(false); Debug.Log("m_currentJewel:" + m_currentJewel.subtype + ",level:" + m_currentJewel.level); return; } else if (parentId == 0) { m_currentParentId = 1; parentId = 1; m_currentChildId = 0; id = 0; } Debug.Log("m_currentParentId:" + m_currentParentId + ",m_currentChildId:" + m_currentChildId); view.SetComposePearlLeftIcon(IconData.none); view.SetComposePearlRightIcon(IconData.none); view.SetComposePearlUpIcon(IconData.none); int type = parentId; int level = id + 1; m_currentJewel = ItemJewelData.GetJewelDic()[type][level]; ItemJewelData jewel = ItemJewelData.JewelDic[type][level]; ItemJewelData nextJewel = ItemJewelData.JewelDic[type][level + 1]; Debug.Log("nextJewel:" + nextJewel.Name); view.SetComposePearlFinalIcon(nextJewel.Icon, nextJewel.color, nextJewel.id); view.SetComposePearlUpIcon(jewel.Icon); view.SetComposePearlLeftIcon(jewel.Icon); view.SetComposePearlRightIcon(jewel.Icon); if (!m_jewelDic.ContainsKey(type)) { view.SetComposeBtnEnable(false); return; } if (!m_jewelDic[type].ContainsKey(level)) { view.SetComposeBtnEnable(false); return; } int num = m_jewelDic[type][level]; view.SetComposeBtnEnable(false); if (num >= 1) { view.SetComposePearlUpIcon(jewel.Icon, jewel.color, jewel.id); } if (num >= 2) { view.SetComposePearlLeftIcon(jewel.Icon, jewel.color, jewel.id); } if (num >= 3) { view.SetComposePearlRightIcon(jewel.Icon, jewel.color, jewel.id); view.SetComposeNowBtnEnable(false); view.SetComposeBtnEnable(true); } }
public void RefreshUI() { //if (m_versionID >= m_inventoryManager.m_versionId) return; if (ComposeUIViewManager.Instance == null) { return; } if (m_isRefreshing) { //Debug.LogError("Debug.LogError(m_isRefreshing);"); m_isNeedRefresh = true; return; } m_isRefreshing = true; Debug.Log("RefreshUI"); UpdateJewelDic(); Dictionary <int, LanguageData> nameData = LanguageData.dataMap; ComposeUIViewManager view = ComposeUIViewManager.Instance; Dictionary <int, Dictionary <int, ItemJewelData> > jewelDB = ItemJewelData.GetJewelDic(); view.RemoveIconList(); PrivilegeData privilegeData = PrivilegeData.dataMap[MogoWorld.thePlayer.VipLevel]; //可合成宝石 int count = 0; m_jewelCanComposeList.Clear(); List <string> canComposeStrList = new List <string>(); for (int subtype = 1; subtype <= ItemJewelData.TypeNum; subtype++) { if (!m_jewelDic.ContainsKey(subtype)) { continue; } for (int level = privilegeData.jewelSynthesisMaxLevel - 1; level >= 1; level--) { if (!m_jewelDic[subtype].ContainsKey(level)) { continue; } if (m_jewelDic[subtype][level] > 2) { canComposeStrList.Add(string.Concat("[FFFFFF]", jewelDB[subtype][level + 1].NameWithoutColor, "[-]")); count++; m_jewelCanComposeList.Add(jewelDB[subtype][level].id); } } } //计算要加载的条数,用于异步加载 view.IconGridNum = ItemJewelData.TypeNum + 1; view.IconChildGridNum = (privilegeData.jewelSynthesisMaxLevel - 1) * (ItemJewelData.TypeNum) + canComposeStrList.Count; view.AddIconListGrid(nameData[JEWEL_NAME_START_ID].content, 0); for (int i = 0; i < canComposeStrList.Count; i++) { view.AddIconListGridChild(0, i, canComposeStrList[i]); } //核心宝石 //int coreJewelType = 1; //string coreJewelName = nameData[JEWEL_NAME_START_ID + coreJewelType].content; //view.AddIconListGrid(coreJewelName, 1); //for (int j = 0; j < 8; ++j) //{ // int level = j + 2; // if (level > privilegeData.jewelSynthesisMaxLevel) break; // view.AddIconListGridChild(1, j, jewelDB[coreJewelType][j + 2].Name); //} //其他宝石 Debug.Log("ItemJewelData.MaxType:" + ItemJewelData.MaxType); for (int i = 0; i < ItemJewelData.TypeNum; ++i) { int type = i + 1; if (!jewelDB.ContainsKey(type)) { continue; } view.AddIconListGrid(nameData[JEWEL_NAME_START_ID + type].content, type); for (int j = 0; j < ItemJewelData.JewelLevelNum - 1; ++j) { int level = j + 2; if (level > privilegeData.jewelSynthesisMaxLevel) { break; } string name = jewelDB[type][level].NameWithoutColor; //Debug.Log(name); if (m_jewelDic.ContainsKey(type)) { if (m_jewelDic[type].ContainsKey(level - 1)) { if (m_jewelDic[type][level - 1] > 2) { name = string.Concat("[FFFFFF]", name, "[-]"); } } } //Debug.Log("type:" + type + ",j:" + j + ",name:" + name); view.AddIconListGridChild(type, j, name); } } view.SetComposePearlLeftIcon(IconData.none); view.SetComposePearlRightIcon(IconData.none); view.SetComposePearlUpIcon(IconData.none); view.RepositionNow(); if (m_currentJewel == null) { if (m_jewelCanComposeList.Count > 0) { Debug.Log("(0, 0)"); m_currentParentId = 0; m_currentChildId = 0; } else { Debug.Log("(1, 0)"); m_currentParentId = 1; m_currentChildId = 0; } } Debug.Log("m_currentParentId:" + m_currentParentId + ",m_currentChildId:" + m_currentChildId); OnJewelSelect(m_currentParentId, m_currentChildId); m_versionID = m_inventoryManager.m_versionId; Debug.Log("m_currentParentId:" + m_currentParentId + ",m_currentChildId:" + m_currentChildId); MogoUIManager.Instance.SwitchComposeUI(delegate() { //Debug.LogError("SwitchComposeUI done"); view.SetCurrentGridDown(m_currentParentId, m_currentChildId); m_isRefreshing = false; if (m_isNeedRefresh) { //Debug.LogError("m_isNeedRefresh"); m_isNeedRefresh = false; RefreshUI(); } //TimerHeap.AddTimer(400, 0, delegate() //{ // view.SetCurrentGridDown(m_currentParentId, m_currentChildId); //}); }, false); //TimerHeap.AddTimer(500, 0, delegate() //{ // view.SetCurrentGridDown(m_currentParentId, m_currentChildId); //}); Debug.Log("refreshUi done"); }