/// <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(); }
/// <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(); }
void SetItemDynamicDesc(GameItem item, ShowType type) { if (item != null && item.IsValid()) { bool bRet = false; if (item.GetClass() == (int)ItemClass.MEDIC && (item.GetSubClass() == (int)MedicSubClass.HP_DY || item.GetSubClass() == (int)MedicSubClass.MP_DY || item.GetSubClass() == (int)MedicSubClass.HPMP_DY )) { bRet = true; } else if (item.GetClass() == (int)ItemClass.MISSION && item.GetSubClass() == (int)MissionSubClass.SHANGPIAO) { bRet = true; } else if (item.GetClass() == (int)ItemClass.MISSION && item.GetSubClass() == (int)MissionSubClass.HEROCODECARD && type != ShowType.Info) { bRet = true; } if (bRet) { m_ItemDescDynamicLabel.gameObject.SetActive(true); if (item.DataID == GlobeVar.HEROCODE_MAILITEM) { m_ItemDescDynamicLabel.text = StrDictionary.GetClientDictionaryString("#{5542}", item.DynamicData[0], item.DynamicData[1], item.DynamicData[2], item.DynamicData[3]); } else { if (item.DynamicData[0] == 1) { m_ItemDescDynamicLabel.text = StrDictionary.GetClientDictionaryString("#{3159}", item.DynamicData[1]); } else { int dataId = item.DataID; Tab_UsableItem line = TableManager.GetUsableItemByID(dataId, 0); if (line != null) { m_ItemDescDynamicLabel.text = StrDictionary.GetClientDictionaryString("#{3159}", line.UseParamB); } } } } else { m_ItemDescDynamicLabel.gameObject.SetActive(false); } } }
public uint Execute(PacketDistributed ipacket) { GC_USE_ITEM_RET packet = (GC_USE_ITEM_RET )ipacket; if (null == packet) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } //enter your logic Obj_MainPlayer MainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; if (null == MainPlayer) { return((uint)PACKET_EXE.PACKET_EXE_ERROR); } int success = packet.Success; int dataid = packet.Dataid; int _totalCDTime = 0; Tab_UsableItem _UsableInfo = TableManager.GetUsableItemByID(dataid, 0); if (_UsableInfo != null) { int nCoolId = _UsableInfo.CoolDownId; Tab_CoolDownTime _CDTimeInfo = TableManager.GetCoolDownTimeByID(nCoolId, 0); if (_CDTimeInfo != null) { _totalCDTime = _CDTimeInfo.CDTime; } } if (success == 1) { if (_totalCDTime > 0 && PlayerFrameLogic.Instance()) { if (MainPlayer.AutoHpID == dataid) { PlayerFrameLogic.Instance().InitAutoFight(); GameManager.gameManager.PlayerDataPool.HpItemCDTime = _totalCDTime; } else if (MainPlayer.AutoMpID == dataid) { PlayerFrameLogic.Instance().InitAutoFight(); GameManager.gameManager.PlayerDataPool.MpItemCDTime = _totalCDTime; } } } return((uint)PACKET_EXE.PACKET_EXE_CONTINUE); }
string GetMountSpeedValueByItem(int value) { Tab_UsableItem tUsable = TableManager.GetUsableItemByID(value, 0); if (tUsable != null) { int nID = tUsable.UseParamA; Tab_MountBase tMount = TableManager.GetMountBaseByID(nID, 0); if (tMount != null) { int speed = tMount.Speed; return("+" + speed.ToString() + "%"); } } return(""); }
public void UpdateCD() { float ftimeSec = Time.realtimeSinceStartup; float fTimeSpace = ftimeSec - m_fCDTimeSecond; if (fTimeSpace > 0) { m_fCDTimeSecond = ftimeSec; } if (m_fItemDescSecound == 0) { m_fItemDescSecound = Time.realtimeSinceStartup; } if (Time.realtimeSinceStartup - m_fItemDescSecound > 2) { m_fItemDescSecound = ftimeSec; } Obj_MainPlayer User = Singleton <ObjManager> .Instance.MainPlayer; if (User) //更新信息 { if (m_HpItemCDPic.fillAmount < 1f || GameManager.gameManager.PlayerDataPool.HpItemCDTime > 0) { Tab_UsableItem _UsableInfo = TableManager.GetUsableItemByID(User.AutoHpID, 0); if (_UsableInfo != null) { int nCoolId = _UsableInfo.CoolDownId; Tab_CoolDownTime _CDTimeInfo = TableManager.GetCoolDownTimeByID(nCoolId, 0); if (_CDTimeInfo != null) { int _totalCDTime = _CDTimeInfo.CDTime; if (_totalCDTime > 0) { m_HpItemCDPic.fillAmount = (1f - (GameManager.gameManager.PlayerDataPool.HpItemCDTime * 1.0f) / _totalCDTime); } if (m_HpItemCDPic.fillAmount >= 1f) { m_HpItemCDPic.fillAmount = 1f; } if (m_HpItemCDPic.fillAmount.Equals(1f) && !m_LastHp.Equals(1f) && m_HpPSGO != null) { m_HpPSGO.SetActive(true); CancelInvoke("OnDisable"); Invoke("OnDisable", 2f); } m_LastHp = m_HpItemCDPic.fillAmount; } } } if (m_MpItemCDPic.fillAmount < 1 || GameManager.gameManager.PlayerDataPool.MpItemCDTime > 0) { Tab_UsableItem _UsableInfo = TableManager.GetUsableItemByID(User.AutoMpID, 0); if (_UsableInfo != null) { int nCoolId = _UsableInfo.CoolDownId; Tab_CoolDownTime _CDTimeInfo = TableManager.GetCoolDownTimeByID(nCoolId, 0); if (_CDTimeInfo != null) { int _totalCDTime = _CDTimeInfo.CDTime; if (_totalCDTime > 0) { m_MpItemCDPic.fillAmount = (1f - ((GameManager.gameManager.PlayerDataPool.MpItemCDTime * 1.0f) / _totalCDTime)); } if (m_MpItemCDPic.fillAmount >= 1f) { m_MpItemCDPic.fillAmount = 1f; } if (m_MpItemCDPic.fillAmount.Equals(1f) && !m_LastMp.Equals(1f) && m_MpPSGO != null) { m_MpPSGO.SetActive(true); CancelInvoke("OnDisable"); Invoke("OnDisable", 2f); } m_LastMp = m_MpItemCDPic.fillAmount; } } } } }
public void SetGetItemWinData() { if (null == m_itemGetWayList) { m_itemGetWayList = new List <Tab_ItemGetWay>(); } else { m_itemGetWayList.Clear(); } if (null == m_SelectSkillEx) { return; } Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; if (null == _mainPlayer) { return; } int nSkillActiveCount = TableManager.GetSkillActive().Count; int nUsebelItemId = -1; for (int i = 0; i <= nSkillActiveCount; i++) { Tab_SkillActive _skillActive = TableManager.GetSkillActiveByID(i, 0); if (null != _skillActive && _skillActive.Profession == _mainPlayer.Profession && m_SelectSkillEx.SkillExID == _skillActive.SkillId) { nUsebelItemId = _skillActive.SkillItemID; break; } } Tab_UsableItem _useAbleItem = TableManager.GetUsableItemByID(nUsebelItemId, 0); if (null == _useAbleItem) { return; } List <int> wayIdList = Utils.GetWayIdByWayIds(_useAbleItem.UseParamE.ToString()); for (int i = 0; wayIdList != null && i < wayIdList.Count; i++) { Tab_ItemGetWay _itemGetWay = TableManager.GetItemGetWayByID(wayIdList[i], 0); if (null != _itemGetWay) { m_itemGetWayList.Add(_itemGetWay); } } Utils.CleanGrid(m_itemGrid.gameObject); for (int i = 0; i < m_itemGetWayList.Count; i++) { Tab_ItemGetWay _tabItemGetWay = m_itemGetWayList[i]; if (null != _tabItemGetWay) { GameObject obj = Utils.BindObjToParent(m_itemObj, m_itemGrid.gameObject, _tabItemGetWay.Id.ToString()); if (obj != null) { ItemGetWayItem itemGetWayItem = obj.GetComponent <ItemGetWayItem>(); if (null != itemGetWayItem) { itemGetWayItem.SetData(_tabItemGetWay); } } } } m_itemGrid.Reposition(); }