/// <summary> /// 初始化获取方式 /// </summary> /// <param name="bookId"></param> void InitGetInfoDialog(int bookId) { Utils.CleanGrid(m_GetInfoGrid); Tab_UsableItem book = TableManager.GetUsableItemByID(bookId, 0); if (book == null) { return; } List <int> wayIdList = Utils.GetWayIdByWayIds(book.UseParamE.ToString()); if (wayIdList.Count == 0) { Debug.LogWarning("No get info skill book, id = " + bookId); m_GetInfoBtn.SetActive(false); return; } for (int i = 0; i < wayIdList.Count; i++) { Tab_ItemGetWay way = TableManager.GetItemGetWayByID(wayIdList[i], 0); if (way == null) { Debug.LogWarning("Error ItemGetWay, item id = " + bookId + ", ItemGetWay id = " + wayIdList[i]); continue; } GameObject obj = Utils.BindObjToParent(m_GetInfoItemTemplate, m_GetInfoGrid); GetInfoItem item = obj.GetComponent <GetInfoItem>(); item.SetData(way); } m_GetInfoGrid.GetComponent <UIGrid>().Reposition(); }
/// <summary> /// 显示获取途径界面 /// </summary> /// <param name="itemId"></param> public void ShowGetInfo(int itemId, int index) { Utils.CleanGrid(m_GetInfoGrid); Tab_UsableItem item = TableManager.GetUsableItemByID(itemId, 0); List <int> wayIdList = Utils.GetWayIdByWayIds(item.UseParamE.ToString()); if (wayIdList.Count == 0) { Debug.LogError("No get info skill book, id = " + itemId); return; } for (int i = 0; i < wayIdList.Count; i++) { Tab_ItemGetWay way = TableManager.GetItemGetWayByID(wayIdList[i], 0); if (way == null) { Debug.LogError("Error ItemGetWay, item id = " + itemId + ", ItemGetWay id = " + wayIdList[i]); continue; } GameObject obj = Utils.BindObjToParent(m_GetInfoItemTemplate, m_GetInfoGrid); GetInfoItem infoItem = obj.GetComponent <GetInfoItem>(); infoItem.closeUIHandler = CloseAllUI; infoItem.SetData(way); } Transform t = m_GetInfoPanel.transform; t.parent = m_GetInfoAnchors[index]; t.localPosition = Vector3.zero; t.localRotation = Quaternion.identity; t.localScale = Vector3.one; m_GetInfoPanel.SetActive(true); m_GetInfoGrid.GetComponent <UIGrid>().Reposition(); }