public void OnOpItemClickEx(AutoitemLogicEx item) { GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; if (Singleton <ObjManager> .Instance.MainPlayer) { if (m_nType == 1) { Singleton <ObjManager> .Instance.MainPlayer.AutoHpID = item.m_nId; Singleton <ObjManager> .Instance.MainPlayer.HpDrugGUID = BackPack.GetItemGuidByDataID(item.m_nId); Singleton <ObjManager> .Instance.MainPlayer.AutoIsSelectDrug = true; } else if (m_nType == 2) { Singleton <ObjManager> .Instance.MainPlayer.AutoMpID = item.m_nId; Singleton <ObjManager> .Instance.MainPlayer.MpDrugGUID = BackPack.GetItemGuidByDataID(item.m_nId); Singleton <ObjManager> .Instance.MainPlayer.AutoIsSelectDrug = true; } else if (m_nType == 3) { Singleton <ObjManager> .Instance.MainPlayer.AutoEquipGuid = item.m_ItemGuid; } } if (null != m_parent) { m_parent.UpdateDrug(); } UIManager.CloseUI(UIInfo.AutoDrug); }
public void OnClickSelectItem(AutoitemLogicEx temSelectItem) { if (m_SelectItem != null) { m_SelectItem.OnCancelChoose(); } m_SelectItem = temSelectItem; }
public static AutoitemLogicEx CreateItem(GameObject grid, GameObject resItem, int type, Tab_CommonItem CommonItem) { GameObject curItemObject = Utils.BindObjToParent(resItem, grid, CommonItem.Id.ToString()); if (null != curItemObject) { AutoitemLogicEx curItemComponent = curItemObject.GetComponent <AutoitemLogicEx>(); if (null != curItemComponent) { curItemComponent.m_Type = type; curItemComponent.m_ItemName.text = CommonItem.Name; curItemComponent.m_ItemIcon.spriteName = CommonItem.Icon; curItemComponent.m_nId = CommonItem.Id; curItemComponent.m_ItemLevel.text = "LV " + CommonItem.MinLevelRequire.ToString(); curItemComponent.m_ItemIcon.transform.parent.FindChild("LV").GetComponent <UILabel>().text = ""; //curItemComponent.m_parent = parent; curItemComponent.m_ItemGuid = GlobeVar.INVALID_GUID; //curItemComponent.m_BackgroundSprite.spriteName = ""; //curItemComponent.m_QualitySprite.spriteName = ""; curItemComponent.gameObject.SetActive(true); if (type == 1) { if (Singleton <ObjManager> .Instance.MainPlayer.AutoHpID == CommonItem.Id) { curItemComponent._showChoose(); if (AutoFightLogic.Instance() != null) { AutoFightLogic.Instance().SelectItem = curItemComponent; } } } else if (type == 2) { if (Singleton <ObjManager> .Instance.MainPlayer.AutoMpID == CommonItem.Id) { curItemComponent._showChoose(); if (AutoFightLogic.Instance() != null) { AutoFightLogic.Instance().SelectItem = curItemComponent; } } } return(curItemComponent); } } return(null); }
public static AutoitemLogicEx CreateEquip(GameObject grid, GameObject resItem, int type, GameItem equip) { GameObject curItemObject = Utils.BindObjToParent(resItem, grid, equip.DataID.ToString()); if (null != curItemObject) { AutoitemLogicEx curItemComponent = curItemObject.GetComponent <AutoitemLogicEx>(); if (null != curItemComponent) { Tab_CommonItem curItem = TableManager.GetCommonItemByID(equip.DataID, 0); if (null != curItem) { curItemComponent.m_Type = type; curItemComponent.m_ItemName.text = curItem.Name; curItemComponent.m_ItemIcon.spriteName = curItem.Icon; curItemComponent.m_nId = curItem.Id; //curItemComponent.m_parent = parent; curItemComponent.m_ItemGuid = equip.Guid; curItemComponent.m_ItemLevel.text = "LV " + curItem.MinLevelRequire.ToString(); //curItemComponent.m_BackgroundSprite.spriteName = background; //curItemComponent.m_QualitySprite.spriteName = equip.GetQualityFrame(); curItemComponent.m_ItemIcon.transform.parent.GetComponent <UISprite>().spriteName = equip.GetQualityFrame(); curItemComponent.m_ItemIcon.transform.parent.FindChild("LV").GetComponent <UILabel>().text = "+" + equip.EnchanceLevel.ToString(); if (Singleton <ObjManager> .Instance.MainPlayer.AutoEquipGuid == curItemComponent.m_ItemGuid && curItemComponent.m_ItemGuid != GlobeVar.INVALID_GUID) { curItemComponent._showChoose(); if (AutoFightLogic.Instance() != null) { AutoFightLogic.Instance().SelectItem = curItemComponent; } } return(curItemComponent); } } } return(null); }
//====================================================== private void CreateItem(int curType) { Utils.CleanGrid(m_ItemGrid); GameItemContainer BackPack = GameManager.gameManager.PlayerDataPool.BackPack; if (Singleton <ObjManager> .Instance.MainPlayer) { if (curType == 1) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_HP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_HP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoitemLogicEx.CreateItem(m_ItemGrid, m_ResItem, curType, curItem); } } for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYHP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYHP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoitemLogicEx.CreateItem(m_ItemGrid, m_ResItem, curType, curItem); } } } else if (curType == 2) { for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_MP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_MP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoitemLogicEx.CreateItem(m_ItemGrid, m_ResItem, curType, curItem); } } for (int i = (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_START_DYMP; i <= (int)Games.GlobeDefine.GameDefine_Globe.AUTOCOMBAT_DRUG_ID.AUTO_DRUG_END_DYMP; i++) { if (BackPack.GetItemCountByDataId(i) <= 0 && Singleton <ObjManager> .Instance.MainPlayer.AutoHpID != i && Singleton <ObjManager> .Instance.MainPlayer.AutoMpID != i) { continue; } Tab_CommonItem curItem = TableManager.GetCommonItemByID(i, 0); if (null != curItem) { AutoitemLogicEx.CreateItem(m_ItemGrid, m_ResItem, curType, curItem); } } } else if (curType == 3) { GameItemContainer EquipPack = GameManager.gameManager.PlayerDataPool.EquipPack; if (EquipPack != null) { for (int index = 0; index < EquipPack.ContainerSize; index++) { GameItem equip = EquipPack.GetItem(index); if (equip != null && equip.IsValid() && equip.IsBelt() == false) { AutoitemLogicEx.CreateEquip(m_ItemGrid, m_ResItem, curType, equip); } } } } } }