diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index cb363bbfc1..9894b5c741 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -754,7 +754,7 @@ RedPointType = { challengeCopy = 123, --修行挑战 godsWayTower = 124, --封神之路,多队塔 - + HelpFight = 125, --助阵 ----礼包相关------ Operating = 201, --运营(主界面礼包) CumulativeSignIn = 202, --累计签到 @@ -1858,6 +1858,7 @@ FUNCTION_OPEN_TYPE = { TrainBuild = 151, --特训建筑 Mingge = 152, --命格 Fabaojulingxinyuan = 156, --法宝巨灵招募 + HelpFight = 162, --助阵 } TaskGetBtnIconDef = { @@ -2406,6 +2407,7 @@ FUNC_OPNE_STATE = { HONGMENG = "HONGMENG", GODWEAPON = "GODWEAPON", TRAINBUILD = "TRAINBUILD", + HELPFIGHT = "HELPFIGHT", } -- 开放功能ID作为索引键值,索引对应的字符串 @@ -2441,6 +2443,7 @@ FUNC_OPEN_STR = { [FUNCTION_OPEN_TYPE.HongMengZhen] = FUNC_OPNE_STATE.HONGMENG, [FUNCTION_OPEN_TYPE.GodWeapon] = FUNC_OPNE_STATE.GODWEAPON, [FUNCTION_OPEN_TYPE.TrainBuild] = FUNC_OPNE_STATE.TRAINBUILD, + [FUNCTION_OPEN_TYPE.HelpFight] = FUNC_OPNE_STATE.HELPFIGHT, } -- 地图中图标对应的ID diff --git a/Assets/ManagedResources/~Lua/Common/Managers.lua b/Assets/ManagedResources/~Lua/Common/Managers.lua index e3f4474a83..b34d14f8cb 100644 --- a/Assets/ManagedResources/~Lua/Common/Managers.lua +++ b/Assets/ManagedResources/~Lua/Common/Managers.lua @@ -240,6 +240,7 @@ local ManagerNames = { "WorldArena/GodsWayTowerManager", "GodWeapon/GodWeaponManager", "HomeLand/TrainBuildManager", --特训管理 + "HelpFight/HelpFightManager",--助战管理 --!!!!红点管理(尽量放在最后)!!!!-- "Player/RedpotManager", diff --git a/Assets/ManagedResources/~Lua/Data/UIData.lua b/Assets/ManagedResources/~Lua/Data/UIData.lua index 268ece19e9..2107d7ea66 100644 --- a/Assets/ManagedResources/~Lua/Data/UIData.lua +++ b/Assets/ManagedResources/~Lua/Data/UIData.lua @@ -522,6 +522,7 @@ UIName = { ArenaNewRankRewardPanel = 530, --新竞技场段位奖励界面 ArenaNewUpRankPanel = 531, --新竞技场段位提升界面 ArenaNewTheOnePopup = 532,--新竞技场全服第一弹窗 + HelpFightPanel = 536, --助战界面 TrainHeroAddSpeedPanel=542, --特训英雄加速 } diff --git a/Assets/ManagedResources/~Lua/Modules/HelpFight.meta b/Assets/ManagedResources/~Lua/Modules/HelpFight.meta new file mode 100644 index 0000000000..af512c3956 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/HelpFight.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4492e021d7009e74eab037440f35d119 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightListPanel.lua b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightListPanel.lua new file mode 100644 index 0000000000..793722002e --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightListPanel.lua @@ -0,0 +1,173 @@ +require("Base/BasePanel") +HelpFightListPanel = Inherit(BasePanel) +local this = HelpFightListPanel +local curSelectHeroList = {} +local heroDataList = {} +local curNeedRoleNum +local openThisPanel +local curHeroData = {} +local isChange = false +--初始化组件(用于子类重写) +function HelpFightListPanel:InitComponent() + this.spLoader = SpriteLoader.New() + this.BtnBack = Util.GetGameObject(self.gameObject, "btnBack") + this.title = Util.GetGameObject(self.gameObject, "bg/title"):GetComponent("Text") + this.mask = Util.GetGameObject(self.gameObject, "mask") + this.cardPre = Util.GetGameObject(self.gameObject, "item") + this.upHero = Util.GetGameObject(self.gameObject, "upObj/upHero") + local v = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect + + this.Scrollbar = Util.GetGameObject(self.gameObject, "Scrollbar"):GetComponent("Scrollbar") + this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, + Util.GetGameObject(self.gameObject, "scroll").transform, + this.cardPre, this.Scrollbar, Vector2.New(v.width, v.height), 1, 1, Vector2.New(10, 20)) + this.ScrollView.moveTween.MomentumAmount = 1 + this.ScrollView.moveTween.Strength = 1 + this.NoneImage = Util.GetGameObject(self.gameObject, "NoneImage") + this.NoneImage.gameObject:SetActive(false) +end + +--绑定事件(用于子类重写) +function HelpFightListPanel:BindEvent() + Util.AddClick(this.BtnBack, function() + PlaySoundWithoutClick(SoundConfig.Sound_UICancel) + self:ClosePanel() + end) + Util.AddClick(this.mask, function() + PlaySoundWithoutClick(SoundConfig.Sound_UICancel) + self:ClosePanel() + end) +end + +--添加事件监听(用于子类重写) +function HelpFightListPanel:AddListener() + +end + +--移除事件监听(用于子类重写) +function HelpFightListPanel:RemoveListener() + +end + +--界面打开时调用(用于子类重写) +local curPos = 0 +local limitQua = 0 +local limitPro = 0 +local openPanel = nil +function HelpFightListPanel:OnOpen(data, _openPanel) + openPanel = _openPanel + this.title.text = data.title + curPos = data.pos + limitQua = data.limitQua + limitPro = data.limitPro + this.RefreshWindow(data) +end + +function HelpFightListPanel:OnShow() + isChange = false +end + +local upHeroData = nil +function this.RefreshWindow(data) + local heroDataList = HeroManager.GetHeroDatasByNaturalAndProfession(limitQua, limitPro) + -- this.HeroSortData(heroDataList) + if not heroDataList or #heroDataList < 1 then + this.NoneImage.gameObject:SetActive(true) + else + this.NoneImage.gameObject:SetActive(false) + end + upHeroData = data.hero + this.upHero:SetActive(data.hero ~= nil) + this.ScrollView:SetData(heroDataList, function(index, go) + this.OnShowSingleCardData(go, heroDataList[index], curPos, false) + end, false, false) + if data.hero then + this.OnShowSingleCardData(this.upHero, data.hero, data.pos, true) + end +end + +function this.OnShowSingleCardData(go, heroData, index, isUp) --isSelect 1选择 2 没选择 + Util.GetGameObject(go.transform, "posIcon"):SetActive(false) + local frame = Util.GetGameObject(go.transform, "frame"):GetComponent("Image") + local lvGo = Util.GetGameObject(go.transform, "lv") + local icon = Util.GetGameObject(go.transform, "icon"):GetComponent("Image") + local proIcon = Util.GetGameObject(go.transform, "proIcon") + local name = Util.GetGameObject(go.transform, "name"):GetComponent("Text") + local starGrid = Util.GetGameObject(go.transform, "star") + local cardBtn = Util.GetGameObject(go.transform, "icon") + local proTxt = Util.GetGameObject(go.transform, "proList/pro1"):GetComponent("Text") + + frame.sprite = this.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Natural)) + lvGo:SetActive(true) + Util.GetGameObject(lvGo.transform, "Text"):GetComponent("Text").text = heroData.lv + icon.sprite = this.spLoader:LoadSprite(heroData.icon) + proIcon:GetComponent("Image").sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.changeProId)) + name.text = GetLanguageStrById(heroData.heroConfig.ReadingName) + local star, starType = heroData.GetStar(1) + SetHeroStars(this.spLoader, starGrid, star, starType, nil, nil, Vector2.New(0, 1)) + LogError("hero star==" .. star) + local config = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.AssistanceProperty, "Quality", + heroData.heroConfig.Natural, "Star", heroData.star) + local str = "" + if config then + for i = 1, #config.Property do + local k = config.Property[i][1] + local v = config.Property[i][2] + str = str .. + GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig, i).Info) .. " +" .. v .. "\n" + end + proTxt.text = str + end + Util.SetParticleSortLayer(starGrid, this.sortingOrder + 1) + local btn_up = Util.GetGameObject(go.transform, "btn_up") + Util.GetGameObject(go.transform, "btn_up/Text"):GetComponent("Text").text = Language[11563] + local btn_down = Util.GetGameObject(go.transform, "btn_down") + Util.GetGameObject(go.transform, "btn_down/Text"):GetComponent("Text").text = Language[11564] + btn_up:SetActive(isUp == false and upHeroData == nil) + btn_down:SetActive(isUp) + Util.AddOnceClick(btn_up, function() + NetManager.AssistUpDownRequest(curPos, heroData.dynamicId, 1, function() + local data = {} + data.hero = heroData + data.limitQua = limitQua + data.limitPro = limitPro + data.pos = curPos + this.RefreshWindow(data) + isChange = true + end) + end) + + Util.AddOnceClick(btn_down, function() + LogError("heroData.dynamicId===" .. heroData.dynamicId) + LogError("curpos===================" .. curPos) + NetManager.AssistUpDownRequest(curPos, heroData.dynamicId, 2, function() + local data = {} + data.hero = nil + data.limitQua = limitQua + data.limitPro = limitPro + data.pos = curPos + this.RefreshWindow(data) + isChange = true + end) + end) +end + +function this.HeroSortData(heroData) + +end + +--界面关闭时调用(用于子类重写) +function HelpFightListPanel:OnClose() + if isChange then + openPanel:OnShow() + end +end + +--界面销毁时调用(用于子类重写) +function HelpFightListPanel:OnDestroy() + this.spLoader:Destroy() + + this.ScrollView = nil +end + +return HelpFightListPanel diff --git a/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightListPanel.lua.meta b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightListPanel.lua.meta new file mode 100644 index 0000000000..44877e4a55 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightListPanel.lua.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 12f5087bc09115c49812285e58e7d916 +timeCreated: 1548760998 +licenseType: Pro +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightManager.lua b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightManager.lua new file mode 100644 index 0000000000..24d207903c --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightManager.lua @@ -0,0 +1,123 @@ +HelpFightManager = {} +local this = HelpFightManager +local assConfig=ConfigManager.GetConfig(ConfigName.AssistanceConfig) + + + +function this.Initialize() + + this.upHeroList={} + this.HelpFightList={} +end + +function this.InitData(msg) + this.HelpFightList={} + this.upHeroList={} + for i = 1, #msg.boxs do + local data=msg.boxs[i] + this.HelpFightList[i]=data + LogError("helpfight id========================="..data.id) + table.insert(this.upHeroList,data.heroId) + end + HeroPropManager.SetFuncPropDirty(Func_Prop_Type.HelpFight) +end + +function this.AddOrRemoveHero(_pos,_type,_id) + if _type==1 then + this.HelpFightList[_pos].heroId=_id + table.insert(this.upHeroList,_id) + elseif _type==2 then + this.HelpFightList[_pos].heroId="" + table.removebyvalue(this.upHeroList,_id) + end +end + + +function this.CheckRedPoint() + for i = 1, #this.HelpFightList do + local isCan=this.CheckRedPointByPosition(i) + if isCan then + return isCan + end + end + return false +end +function this.CheckRedPointByPosition(_pos) + if this.HelpFightList[_pos] then + --还没有开启 + if this.HelpFightList[_pos].state==0 then + return false + end + --没有英雄看有没有能上的 有就看有没有能替换的 + local list=HeroManager.GetHeroDatasByNaturalAndProfession(assConfig[_pos].Quality,assConfig[_pos].ProfessionLimit) + if this.HelpFightList[_pos].heroId=="" or this.HelpFightList[_pos].heroId==nil then + if assConfig[_pos] then + if list and #list>0 then + return true + else + return false + end + end + else + local heroData=HeroManager.GetSingleHeroData(this.HelpFightList[_pos].heroId) + if heroData and list and #list>0 then + for k, v in pairs(list) do + if v.star>heroData.star then + return true + end + end + end + end + end + return false +end + +--获取所有的加成属性 +function this.GetAllAddPro() + local allAddPro={} + local addNum=0 + for k, v in pairs(this.HelpFightList) do + if v.heroId~="" and v.heroId~=nil then + local heroData=HeroManager.GetSingleHeroData(v.heroId) + if heroData then + LogError("heroData.heroConfig.Natural==="..heroData.heroConfig.Natural) + LogError("heroData.star==="..heroData.star) + local config=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.AssistanceProperty,"Quality",heroData.heroConfig.Natural,"Star",heroData.star) + if config then + for i = 1, #config.Property do + local key=config.Property[i][1] + local value=config.Property[i][2] + if allAddPro[key] then + allAddPro[key]=allAddPro[key]+value + else + allAddPro[key]=value + end + end + addNum=addNum+assConfig[k].PropertyUp + end + end + end + end + + if addNum>0 then + -- LogError("addNum=================================="..addNum) + -- for k, v in pairs(allAddPro) do + -- LogError("k==========前============"..k.." v============"..v) + -- end + for k, v in pairs(allAddPro) do + allAddPro[k]= math.floor(v*(1+addNum/10000)+0.5) + --LogError("v==============================="..v) + end + end + for k, v in pairs(allAddPro) do + LogError("k==================="..k.." v============"..v) + end + + return allAddPro,addNum +end + + + + + +return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightManager.lua.meta b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightManager.lua.meta new file mode 100644 index 0000000000..551906e188 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightManager.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c712ecc1e9ff640489ee41129e77069c +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightPanel.lua b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightPanel.lua new file mode 100644 index 0000000000..d8f5cf7906 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightPanel.lua @@ -0,0 +1,181 @@ +require("Base/BasePanel") +HelpFightPanel = Inherit(BasePanel) +local assConfig = ConfigManager.GetConfig(ConfigName.AssistanceConfig) + + +--初始化组件(用于子类重写) +function HelpFightPanel:InitComponent() + self.spLoader = SpriteLoader.New() + + self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft }) + self.btnBack = Util.GetGameObject(self.gameObject, "Back/BackBtn") + self.AddProTxt = Util.GetGameObject(self.gameObject, "AddProTxt"):GetComponent("Text") + self.helpBtn = Util.GetGameObject(self.gameObject, "HelpBtn") + self.scrollRect = Util.GetGameObject(self.gameObject, "scroll") + self.prefab = Util.GetGameObject(self.gameObject, "item") + self.tipInfo = Util.GetGameObject(self.gameObject, "tipInfo"):GetComponent("Text") + self.ScrollBar = Util.GetGameObject(self.gameObject, "Scrollbar"):GetComponent("Scrollbar") + local v2 = self.scrollRect:GetComponent("RectTransform").rect + self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scrollRect.transform, self.prefab, + self.ScrollBar, Vector2.New(v2.width, v2.height), 1, 4, Vector2.New(70, 20)) + self.ScrollView.moveTween.MomentumAmount = 1 + self.ScrollView.moveTween.Strength = 1 +end + +--绑定事件(用于子类重写) +function HelpFightPanel:BindEvent() + Util.AddClick(self.btnBack, function() + self:ClosePanel() + end) + Util.AddClick(self.helpBtn, function() + UIManager.OpenPanel(UIName.HelpPopup, 146, 0, 0) + end) +end + +--添加事件监听(用于子类重写) +function HelpFightPanel:AddListener() + +end + +--移除事件监听(用于子类重写) +function HelpFightPanel:RemoveListener() + +end + +--界面打开时调用(用于子类重写) +function HelpFightPanel:OnOpen() + +end + +function HelpFightPanel:OnSortingOrderChange() + +end + +--界面打开或者重新打开后,界面刷新时调用(用于子类重写) +function HelpFightPanel:OnShow() + self.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.HongMengTower }) + local list = {} + local heroList = HelpFightManager.HelpFightList + for key, v in ConfigPairs(assConfig) do + --LogError("id=="..v.Id) + local data = {} + data.config = v + if heroList[key].heroId ~= "" and heroList[key].heroId ~= nil then + data.hero = HeroManager.GetSingleHeroData(heroList[key].heroId) + end + data.state = heroList[key].state + list[key] = data + end + LogError("list len===============" .. #list) + self.ScrollView:SetData(list, function(index, go) + self:SingleItemDataShow(go, list[index], index) + end) + local addProList, addNum = HelpFightManager.GetAllAddPro() + if #addProList == 0 then + local aaa = { 1, 2, 3, 4 } + for i = 1, #aaa do + addProList[aaa[i]] = 0 + end + end + local str = "" + for k, v in pairs(addProList) do + str = str .. + GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig, k).Info) .. + " +" .. v .. " " .. string.format(Language[11565], addNum / 100) + end + self.AddProTxt.text = str + --self.tipInfo.text="" +end + +function HelpFightPanel:SingleItemDataShow(_go, _data, _index) + LogError("_data.id================================" .. _data.config.Id) + local frame = Util.GetGameObject(_go, "Box/Empty/frame"):GetComponent("Image") + local infoTxt = Util.GetGameObject(_go, "infoTxt"):GetComponent("Text") + local lockObj = Util.GetGameObject(_go, "Box/Empty/lock") + local tipObj = Util.GetGameObject(_go, "Box/Empty/tipInfo") + local heroObj = Util.GetGameObject(_go, "GameObject") + local frame1 = Util.GetGameObject(heroObj, "frame"):GetComponent("Image") + local lvGo = Util.GetGameObject(heroObj, "lv") + local icon = Util.GetGameObject(heroObj, "icon"):GetComponent("Image") + local proIcon = Util.GetGameObject(heroObj, "proIcon") + + local redPoint = Util.GetGameObject(_go, "redPoint") + --local name = Util.GetGameObject(heroObj, "name"):GetComponent("Text") + local starGrid = Util.GetGameObject(heroObj, "star") + local tipTxt = Util.GetGameObject(_go, "Box/Empty/tipInfo/Text"):GetComponent("Text") + local proTxt = Util.GetGameObject(_go, "proList/pro1"):GetComponent("Text") + frame.sprite = self.spLoader:LoadSprite(GetBgByHeroNatural(_data.config.Quality)) + local title = GetHeroNaturalStrByNatural(_data.config.Quality) .. + " " .. HeroElementDef[_data.config.ProfessionLimit] + redPoint:SetActive(HelpFightManager.CheckRedPointByPosition(_index)) + infoTxt.text = title + lockObj:SetActive(_data.state == 0) + tipObj:SetActive(_data.state == 0) + local curTime = GetTimeStamp() + local nowTime = math.floor((PlayerManager.userCreateTime + _data.config.Experience * 86400 - curTime) / 86400 + 1) + tipTxt.text = string.format(Language[11331], nowTime) + local proList = {} + if _data.hero then + heroObj:SetActive(true) + frame1.sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(_data.hero.heroConfig.Natural)) + lvGo:SetActive(true) + Util.GetGameObject(lvGo.transform, "Text"):GetComponent("Text").text = _data.hero.lv + icon.sprite = self.spLoader:LoadSprite(_data.hero.icon) + proIcon:GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(_data.hero.changeProId)) + --name.text = SubString2(GetLanguageStrById(_data.hero.heroConfig.ReadingName),8) + local star, starType = _data.hero.GetStar(1) + SetHeroStars(self.spLoader, starGrid, star, starType, nil, nil, Vector2.New(0, 1)) + Util.SetParticleSortLayer(starGrid, self.sortingOrder + 1) + local config = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.AssistanceProperty, "Quality", + _data.hero.heroConfig.Natural, "Star", _data.hero.star) + if config then + proList = config.Property + end + Util.AddClick(icon.gameObject, function() + local data = {} + data.title = title + data.hero = _data.hero + data.limitQua = _data.config.Quality + data.limitPro = _data.config.ProfessionLimit + data.pos = _index + UIManager.OpenPanel(UIName.HelpFightListPanel, data, self) + end) + else + proList = { { 1, 0 }, { 2, 0 }, { 3, 0 }, { 4, 0 } } + heroObj:SetActive(false) + end + + --显示属性 + local str = "" + for i = 1, #proList do + local k = proList[i][1] + local v = proList[i][2] + str = str .. GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig, i).Info) .. " +" .. + v .. "\n" + end + proTxt.text = str + + + Util.AddClick(frame.gameObject, function() + local data = {} + data.title = title + data.hero = nil + data.limitQua = _data.config.Quality + data.limitPro = _data.config.ProfessionLimit + data.pos = _index + UIManager.OpenPanel(UIName.HelpFightListPanel, data, self) + end) +end + +--界面关闭时调用(用于子类重写) +function HelpFightPanel:OnClose() + +end + +--界面销毁时调用(用于子类重写) +function HelpFightPanel:OnDestroy() + self.spLoader:Destroy() + SubUIManager.Close(self.UpView) +end + +return HelpFightPanel diff --git a/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightPanel.lua.meta b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightPanel.lua.meta new file mode 100644 index 0000000000..ab41024b64 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/HelpFight/HelpFightPanel.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e6c3d4976093bc44c9c0496c1860d420 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/PropFunc.lua b/Assets/ManagedResources/~Lua/Modules/Hero/PropFunc.lua index 2fea90d693..a7abbd735f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/PropFunc.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/PropFunc.lua @@ -80,6 +80,14 @@ Func_Prop_Func = { end return profPropList end, + --助战属性加成 + [Func_Prop_Type.HelpFight] = function() + local allPro = HelpFightManager.GetAllAddPro() + -- for key, value in pairs(allPro) do + -- allPro[key] = value + -- end + return allPro + end, -- 四象心法 [Func_Prop_Type.FourQua] = function() local profPropList = {} diff --git a/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua b/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua index 5722f2ae03..1ad39882c5 100644 --- a/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Main/MainPanel.lua @@ -84,7 +84,9 @@ function this:InitComponent() this.timeOpenTips = Util.GetGameObject(self.gameObject, "timeOpen") this.timeOpenTipsText = Util.GetGameObject(self.gameObject, "timeOpen/Text"):GetComponent("Text") ---------------topLeftPart---------------- - + --助阵 + this.btnZhuZhen = Util.GetGameObject(this.gameObject, "scene/layer7/btnZhuZhen") + this.zhuZhenRed = Util.GetGameObject(this.gameObject, "scene/layer7/btnZhuZhen/redPoint") -- 七日登陆奖励预览入口 this.sgBtn=Util.GetGameObject(self.gameObject,"LeftUp/GameObject/seven") this.sgRoot=Util.GetGameObject(this.sgBtn,"sevenGift/root") @@ -228,6 +230,7 @@ function this:InitComponent() [FUNCTION_OPEN_TYPE.GodWeapon] = this:AddFuncItem(this.btnXingYunTanBao, 0),--幸运探宝 [FUNCTION_OPEN_TYPE.JumpServer] = this:AddFuncItem(this.btnJumpServer, 0),--跨服 [FUNCTION_OPEN_TYPE.Explore] = this:AddFuncItem(this.btnExplore, 0),--探索 + [FUNCTION_OPEN_TYPE.HelpFight] = this:AddFuncItem(this.btnZhuZhen, 0), --助阵 } this.operateNewText = { @@ -244,6 +247,7 @@ function this:InitComponent() [FUNCTION_OPEN_TYPE.GodWeapon] = this:InsertNewText(this.btnXingYunTanBao),--幸运探宝 [FUNCTION_OPEN_TYPE.JumpServer] = this:InsertNewText(this.btnJumpServer),--跨服 [FUNCTION_OPEN_TYPE.TrainBuild] = this:InsertNewText(this.btnHomeLand),--特训 + [FUNCTION_OPEN_TYPE.HelpFight] = this:InsertNewText(this.btnZhuZhen), } -- 红点 @@ -436,7 +440,12 @@ function this:BindEvent() end this:SetPosFunc(dv2) end - + Util.AddClick(this.btnZhuZhen, function() + NetManager.AssistInfoRequest(function() + UIManager.OpenPanel(UIName.HelpFightPanel) + end) + this.ScenceBtnClick(FUNCTION_OPEN_TYPE.HelpFight) + end) self.moveTween.OnUpdate = setPosFunc self.moveTween.MomentumAmount = 1 self.moveTween.Strength = 1 @@ -850,6 +859,7 @@ function this.BindRedPoint() BindRedPointObject(RedPointType.HotRank,this.hrRedPoint) BindRedPointObject(RedPointType.GodWeapon,this.weaponRed) BindRedPointObject(RedPointType.DuanQiGe,this.equipCompoundRed) + BindRedPointObject(RedPointType.HelpFight, this.zhuZhenRed) end -- 绑定红点 function this.ClearRedPoint() @@ -883,6 +893,7 @@ function this.ClearRedPoint() ClearRedPointObject(RedPointType.HotRank,this.hrRedPoint) ClearRedPointObject(RedPointType.GodWeapon,this.weaponRed) ClearRedPointObject(RedPointType.DuanQiGe,this.equipCompoundRed) + ClearRedPointObject(RedPointType.HelpFight, this.zhuZhenRed) end --添加事件监听(用于子类重写) diff --git a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua index ff4cd1811a..377ec5edbf 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua @@ -164,7 +164,8 @@ function this.RegisterMessage(network) socket:RegistNetMessage(MessageTypeProto_pb.COMPARENUM_DATA_INDICATION,this.CompareNumDataIndication) --新命格 socket:RegistNetMessage(MessageTypeProto_pb.GemNewInfoIndication,this.NewGemInfoIndition) - + --助阵 + socket:RegistNetMessage(MessageTypeProto_pb.AssistInfoIndication,this.HelpFightIndition) end @@ -177,7 +178,15 @@ function this.NewArenaIndition(buff) PlayerManager.arenaTheOne=msg --UIManager.OpenPanel(UIName.ArenaNewTheOnePopup,msg) end - +--助阵推送 +function this.HelpFightIndition(buff) + local data = buff:DataByte() + local msg = HeroInfoProto_pb.AssistInfoResponse() + msg:ParseFromString(data) + LogError("接受到新的助阵的 indition") + HelpFightManager.InitData(msg) + +end --新的命格推送 function this.NewGemInfoIndition(buff) diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 011c435134..17c2611539 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -8003,7 +8003,56 @@ function NetManager.MoneyBuyGiftRequest(_id,func) end end) end +--助阵***************** +--获取助战信息 +function NetManager.AssistInfoRequest(_func) + local isOpen = CheckFunctionOpen(FUNCTION_OPEN_TYPE.HelpFight) + if isOpen == false then + if _func then + _func() + end + return + end + local data = HeroInfoProto_pb.AssistInfoRequest() + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.AssistInfoRequest, MessageTypeProto_pb.AssistInfoResponse, msg, + function(buffer) + local data = buffer:DataByte() + local msg = HeroInfoProto_pb.AssistInfoResponse() + msg:ParseFromString(data) + HelpFightManager.InitData(msg) + if _func then + _func() + end + end) +end + +--上下阵助战 +function NetManager.AssistUpDownRequest(_id, _heroId, _type, _func) + local data = HeroInfoProto_pb.AssistUpDownRequest() + data.id = _id + data.heroId = _heroId + data.operate = _type + local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.AssistUpDownRequest, MessageTypeProto_pb.AssistUpDownResponse, + msg, function(buffer) + local data = buffer:DataByte() + + HelpFightManager.AddOrRemoveHero(_id, _type, _heroId) + HeroPropManager.SetFuncPropDirty(Func_Prop_Type.HelpFight) + NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL) + local tempPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) + if oldWarPower ~= tempPower then + UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2, { oldValue = oldWarPower, newValue = tempPower }) + end + --HelpFightManager.InitData(msg) + if _func then + _func() + end + end) +end --特训加速 function NetManager.TrainingPropSpeedRequest(_type,_itemId,_num,_heroId,func) local data=HeroInfoProto_pb.TrainingPropSpeedRequest() diff --git a/Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua b/Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua index a1849371e5..464d337f7c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua @@ -724,6 +724,7 @@ function this.RegisterRedCheckFunc() --锻器阁 RPData:AddCheckFunc(RedPointType.HeroGiftCompound,GiftManager.CheckHeroGiftComRed) RPData:AddCheckFunc(RedPointType.PlayerGiftCompound,GiftManager.CheckPlayerGiftComRed) + RPData:AddCheckFunc(RedPointType.HelpFight, HelpFightManager.CheckRedPoint) end -- 向红点绑定物体 diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/HeroReplacePopup.lua b/Assets/ManagedResources/~Lua/Modules/Popup/HeroReplacePopup.lua index c502cfeac2..5a2ab6d7de 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/HeroReplacePopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/HeroReplacePopup.lua @@ -50,6 +50,10 @@ function this:BindEvent() PopupTipPanel.ShowTip("请不要选择同一个英雄!") return end + if CheckListIsContainValue1(HelpFightManager.upHeroList, selectHero1) or CheckListIsContainValue1(HelpFightManager.upHeroList, selectHero2) then + PopupTipPanel.ShowTip("请在助阵功能中下阵再进行置换") + return + end NetManager.SendHeroChangeRequest(selectHero1,selectHero2,useItemId,function() PopupTipPanel.ShowTip("置换成功!") self:ClosePanel() diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/PlayerInfoPopup.lua b/Assets/ManagedResources/~Lua/Modules/Popup/PlayerInfoPopup.lua index e75bce04d1..2a8e0db470 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/PlayerInfoPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/PlayerInfoPopup.lua @@ -136,7 +136,13 @@ local InfoBtns = { this.GiftInfoShow(data, obj) end }, - + [7] = { + name = "助 阵", + gridName = "helpFgithInfo", + func = function(data, obj) + this.HelpFightInfoShow(data, obj) + end + }, } local curPlayerName = "" @@ -217,6 +223,8 @@ function PlayerInfoPopup:InitComponent() this.InfoBtnsList = {} this.ItemPreList = {} this.ItemList = {} + this.helpFightTxt = Util.GetGameObject(self.transform, "tipImage/panel/InfoGrids/Bg/helpFgithInfo/Text") + :GetComponent("Text") end --绑定事件(用于子类重写) @@ -829,7 +837,18 @@ function this.GiftInfoShow(teamInfo, Grid) Grid:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5) end end - +--助战信息 +function this.HelpFightInfoShow(teamInfo, Grid) + LogError("HelpFightInfoShow==========================" .. teamInfo.assistAdd) + local str = "" + for i = 1, #teamInfo.assistAttribute do + local v = teamInfo.assistAttribute[i] + str = str .. + GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.PropertyConfig, v.propertyId).Info) .. + " +" .. v.propertyValue .. string.format(Language[12173], teamInfo.assistAdd / 100) + end + this.helpFightTxt.text = str +end --============================底部按钮显示=========================== function this.RefreshBtnShow() this.btnBox:SetActive(true) diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua index 52960de67f..c7f223111d 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua @@ -184,6 +184,10 @@ function RoleInfoPanel:BindEvent() PopupTipPanel.ShowTip(Language[12263]) return end + if CheckListIsContainValue1(HelpFightManager.upHeroList, curHeroData.dynamicId) then + PopupTipPanel.ShowTip("请在助阵功能中下阵再进行回退") + return + end if HarmonyManager.IsChangeColor(curHeroData.dynamicId) then PopupTipPanel.ShowTip(Language[12184]) return diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua index 5c1e4601b3..763dbb9e85 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua @@ -475,6 +475,9 @@ function RoleUpStarLayout:StarUpClick() NetManager.HeroUpStarEvent(curHeroData.dynamicId,upStarConsumeMaterial ,function (msg) UIManager.OpenPanel(UIName.RoleUpStarSuccessPanel,curHeroData,upStarRankUpConfig.Id,upStarRankUpConfig.OpenLevel,function () local dropItemTabs = BagManager.GetTableByBackDropData(msg) + if CheckListIsContainValue1(HelpFightManager.upHeroList, curHeroData.dynamicId) then + HeroPropManager.SetFuncPropDirty(Func_Prop_Type.HelpFight) + end if #dropItemTabs > 0 then BagManager.SetDropIsSHowEquipPrint(false) UIManager.OpenPanel(UIName.RewardItemPopup, msg, 1, function ()