-- 道具合成按钮 require("LuaUtil") require("TextUtil") newCompoundButton = {} local isCompoundGame = 1 local compoundBtn local myIcon local ItemTooltipsRoot function newCompoundButton.Awake( ... ) compoundBtn = _compoundBtn:GetComponent("Button") myIcon = _myIcon:GetComponent("Image") ItemTooltipsRoot = _ItemTooltipsRoot:GetComponent("Transform") compoundBtn.onClick:RemoveAllListeners() compoundBtn.onClick:AddListener(function() local _CommonItem = CS.GCGame.Table.TableManager.GetCommonItem() for k,v in pairs(_CommonItem) do if v.ClassID == 21 and v.SubClassID == 21 then CS.ItemCombine.ShowCombineUI(v.Id) ItemTooltipsRoot.gameObject:SetActive(false) isCompoundGame = 1 end end end) compoundBtn.gameObject:SetActive(false) end local tames = 0 function newCompoundButton.OnEnable() tames = 0 end function newCompoundButton.Update() tames = tames + CS.UnityEngine.Time.deltaTime if tames == 1 then tames = 0 if CS.UnityEngine.GameObject.Find("BackPackRoot(Clone)") == nil then if isCompoundGame == 1 then for k,v in pairs(CS.GCGame.Table.TableManager.GetCommonItem()) do if v.ClassID == 21 and v.SubClassID == 21 then if myIcon ~= nil then if myIcon.sprite.name == v.Icon then compoundBtn.gameObject:SetActive(true) isCompoundGame = 0 end end end end end end end end function newCompoundButton.OnDisable( ... ) --compoundBtn.onClick:RemoveAllListeners() compoundBtn.gameObject:SetActive(false) isCompoundGame = 1 end