local this={} this.tab=ConfigManager.GetConfig(ConfigName.Hongmeng) local Box=0; local OpenBox=2 function this:InitComponent(gameObject) -- item预制件 this.item = Util.GetGameObject(gameObject , "HarmonyPanel/item") --btn组件 this.addBtn = Util.GetGameObject(gameObject,"HarmonyPanel/AddBtn") this.GongMingMsgBtn = Util.GetGameObject(gameObject,"HarmonyPanel/KnowGongMing") this.NumText = Util.GetGameObject(gameObject,"HarmonyPanel/itemNumText"):GetComponent("Text") this.scrollbar = Util.GetGameObject(gameObject,"HarmonyPanel/Scrollbar"):GetComponent("Scrollbar") local scrollParent = Util.GetGameObject(gameObject, "HarmonyPanel/scroll"):GetComponent("RectTransform").rect this.ScrollView=SubUIManager.Open(SubUIConfig.ScrollCycleView,Util.GetGameObject(gameObject,"HarmonyPanel/scroll").transform, this.item,this.scrollbar,Vector2.New(-scrollParent.x*2,-scrollParent.y*2),1,5,Vector2.New(35,15)) this.ScrollView.moveTween.MomentumAmount = 1 this.ScrollView.moveTween.Strength = 1 -- for key, value in ConfigPairs(this.tab) do -- print("key:",key,"value",value.Id) -- end this.BoxList=0; this:InitBox() end function this:InitBox() this.NumText.text = string.format("%d/%d",0,this.BoxList) local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 this.ScrollView:SetData(keys,function (index, go) local key = keys[index] this.SingleBoxDataShow(go, this.tab[key]) end) end function this.SingleBoxDataShow(go,boxData) -- body print("1111111111s") local mask = Util.GetGameObject(go.transform,"Box/Empty/lock/mask"); local lock=Util.GetGameObject(go.transform,"Box/Empty/lock"); if mask.activeSelf then if boxData.Id#itemList and i<=#BoxList then -- body else end end end function this.SingleItemDataShow(clone,Itemdata) -- Util.GetGameObject(clone.transform,"GameObject/icon"):GetComponent("icon").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(heroData.config.Quality,heroData.star)) -- Util.GetGameObject(clone.transform, "lv"):SetActive(false)-- :GetComponent("Text").text = heroData.lv -- Util.GetGameObject(clone.transform, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(heroData.config.Icon)) -- Util.GetGameObject(clone.transform, "posIcon"):SetActive(false)--:GetComponent("Image").sprite = Util.LoadSprite(heroData.professionIcon) -- Util.GetGameObject(clone.transform, "proIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(heroData.config.PropertyName)) end function this:Refesh() -- body Box=Box+1 OpenBox = OpenBox+1 this.NumText.text = string.format("%d/%d",0,Box) local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 this.ScrollView:SetData(keys,function (index, go) local key = keys[index] this.SingleBoxDataShow(go, this.tab[key]) end) end function this:AddListener() -- body print(" 注册消息成功") Game.GlobalEvent:AddEvent(GameEvent.HongMeng.RereshNumText,self.Refesh,self) end function this:RemoveListener() -- body Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.RereshNumText,self.Refesh,self) end function this:OnShow(...) -- body end function this:SingleHeroDataShow(_go,_HongMengData) local clone = _go local HongMeng = _HongMengData -- body end return this