diff --git a/Assets/ManagedResources/Prefabs/UI/Resolve/ResolvePanel.prefab b/Assets/ManagedResources/Prefabs/UI/Resolve/ResolvePanel.prefab index 9c0fca7c8a..5d54f48ba3 100644 --- a/Assets/ManagedResources/Prefabs/UI/Resolve/ResolvePanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Resolve/ResolvePanel.prefab @@ -72,7 +72,7 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} @@ -263,7 +263,7 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} @@ -5107,6 +5107,80 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 +--- !u!1 &3949195491428574319 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1512239318317732478} + - component: {fileID: 1431152599248779388} + - component: {fileID: 3024333516790912748} + m_Layer: 5 + m_Name: GonghMingImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1512239318317732478 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3949195491428574319} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7018165708038573099} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0.00004339218, y: 0} + m_SizeDelta: {x: 150, y: 150} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1431152599248779388 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3949195491428574319} + m_CullTransparentMesh: 0 +--- !u!114 &3024333516790912748 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3949195491428574319} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.78431374} + m_RaycastTarget: 0 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 --- !u!1 &4018097525179881153 GameObject: m_ObjectHideFlags: 0 @@ -6418,7 +6492,7 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} @@ -7598,6 +7672,115 @@ MonoBehaviour: m_FillClockwise: 1 m_FillOrigin: 0 m_UseSpriteMesh: 0 +--- !u!1 &5183623504904120362 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7018165708038573099} + - component: {fileID: 3048962781257783206} + - component: {fileID: 1994351750354935251} + - component: {fileID: 2293607541947535187} + m_Layer: 5 + m_Name: GongMingMask + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7018165708038573099 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5183623504904120362} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1512239318317732478} + m_Father: {fileID: 5211199677466938847} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 20.099945} + m_SizeDelta: {x: 150, y: 150} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3048962781257783206 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5183623504904120362} + m_CullTransparentMesh: 0 +--- !u!114 &1994351750354935251 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5183623504904120362} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2293607541947535187} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &2293607541947535187 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5183623504904120362} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e459a084d8e15a240b58db751097122b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null --- !u!1 &5383076292083543031 GameObject: m_ObjectHideFlags: 0 @@ -8002,7 +8185,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &5709844313583256937 RectTransform: m_ObjectHideFlags: 0 @@ -8057,7 +8240,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1508773176926603313 RectTransform: m_ObjectHideFlags: 0 @@ -8758,6 +8941,7 @@ RectTransform: - {fileID: 9120872265090628817} - {fileID: 3472507072693147027} - {fileID: 320999063321282817} + - {fileID: 7018165708038573099} m_Father: {fileID: 5015499777800791733} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -12517,10 +12701,10 @@ RectTransform: m_Father: {fileID: 5004630571723986136} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 608, y: -50} - m_SizeDelta: {x: 88, y: 88} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7583128553425786306 CanvasRenderer: @@ -12772,10 +12956,10 @@ RectTransform: m_Father: {fileID: 5004630571723986136} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 104, y: -50} - m_SizeDelta: {x: 88, y: 88} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7583128553461871492 CanvasRenderer: @@ -13519,10 +13703,10 @@ RectTransform: m_Father: {fileID: 5004630571723986136} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 440, y: -50} - m_SizeDelta: {x: 88, y: 88} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7583128555069003081 CanvasRenderer: @@ -13675,10 +13859,10 @@ RectTransform: m_Father: {fileID: 5004630571723986136} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 776, y: -50} - m_SizeDelta: {x: 88, y: 88} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7583128555296664243 CanvasRenderer: @@ -13793,10 +13977,10 @@ RectTransform: m_Father: {fileID: 5004630571723986136} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 272, y: -50} - m_SizeDelta: {x: 88, y: 88} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7583128555409597101 CanvasRenderer: @@ -14178,7 +14362,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &5008217291552125824 RectTransform: m_ObjectHideFlags: 0 @@ -15709,10 +15893,10 @@ RectTransform: m_Father: {fileID: 235641477404672219} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 281.05, y: -63.65} - m_SizeDelta: {x: 190, y: 58} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8901378376184270863 CanvasRenderer: diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index c9497d6e57..c2e8e05e74 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -528,6 +528,7 @@ UpViewRechargeType = { QuLingBi = 1205,--驱灵币 YHMF= 21,--妖魂魔符 DingKunShenChu = 1004,-- 定卦神锄 + XuanHuangZhiQi = 999,--玄黄之气 } SHOP_PAGE = { @@ -1492,6 +1493,7 @@ HELP_TYPE = { PokemonResolve=75,--灵兽放生 YiJingBaoKu=77,--易经宝库 LingShouBaoGe=78,--灵兽宝阁 + HongMengZhen = 80,--鸿蒙阵 } NumToComplexFont = { @@ -2200,4 +2202,12 @@ Pokemon_Formation_RefreshType={ UpZhen = 1,--上阵 DownZhen = 2,--下阵 Replace = 3,--替换 +} +--通用弹窗类型 +HarmonyAddType={ + AddLv = 1,--等级加成 + AddEquip = 2,--装备加成 + HunSoulPrint = 3,--魂宝 + LingSoulPrint = 4,--灵宝 + FaBao = 5,--法宝 } \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Common/Managers.lua b/Assets/ManagedResources/~Lua/Common/Managers.lua index c7d5d142ed..adc7374820 100644 --- a/Assets/ManagedResources/~Lua/Common/Managers.lua +++ b/Assets/ManagedResources/~Lua/Common/Managers.lua @@ -24,6 +24,8 @@ local ManagerNames = { --战斗数据管理 "Battle/BattleManager", "Battle/BattleRecordManager", + --鸿蒙阵 + "Harmony/Manager/HarmonyManager", --英雄数据管理 "Hero/HeroManager", --背包数据管理 @@ -177,8 +179,6 @@ local ManagerNames = { --主题活动管理器 "DynamicActivity/DynamicActivityManager", "Hero/HeroSkinManager", - --鸿蒙阵 - "Harmony/Manager/HarmonyManager", --!!!!红点管理(尽量放在最后)!!!!-- "Player/RedpotManager", } diff --git a/Assets/ManagedResources/~Lua/Data/ConfigData.lua b/Assets/ManagedResources/~Lua/Data/ConfigData.lua index 7100250315..811ec4c2d4 100644 --- a/Assets/ManagedResources/~Lua/Data/ConfigData.lua +++ b/Assets/ManagedResources/~Lua/Data/ConfigData.lua @@ -178,7 +178,9 @@ ConfigName = { BlessingConfigNew = "BlessingConfigNew", BlessingRewardPoolNew = "BlessingRewardPoolNew", SpiritAnimalSummon = "SpiritAnimalSummon", - Hongmeng="Hongmeng" + Hongmeng = "Hongmeng", + HongmengUp = "HongmengUp", + } require "Framework/GameDataBase" diff --git a/Assets/ManagedResources/~Lua/Data/UIData.lua b/Assets/ManagedResources/~Lua/Data/UIData.lua index 39ca1cc568..f343ea11e4 100644 --- a/Assets/ManagedResources/~Lua/Data/UIData.lua +++ b/Assets/ManagedResources/~Lua/Data/UIData.lua @@ -360,7 +360,12 @@ UIName = { RoleAwakeTalentPopup = 360,--通用大弹窗界面 RoleAwakeSuccessPanel = 361,--通用大弹窗界面 HongMengPanel = 365,--鸿蒙阵 - HongMengChooseHeroPanel = 366--鸿蒙阵选人界面 + HongMengChooseHeroPanel = 366,--鸿蒙阵选人界面 + HongMengUnLoadPanel = 367, --鸿蒙阵 卸载弹窗 + GongMingResultTips = 368,-- 鸿蒙阵 共鸣弹窗 + GongMingResultPanel = 369, --鸿蒙阵 共鸣结果弹窗 + HongMengEnvoyPanel = 370, --鸿蒙碑 + HongMengEnvoyUnloadPanel = 371 -- 鸿蒙碑卸载弹窗 } SubUIConfig = { diff --git a/Assets/ManagedResources/~Lua/Modules/Equip/EquipManager.lua b/Assets/ManagedResources/~Lua/Modules/Equip/EquipManager.lua index 300954f0fc..c7f6eecf4f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Equip/EquipManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Equip/EquipManager.lua @@ -152,11 +152,10 @@ end --获取单个英雄装备数据 function this.GetSingleHeroSingleEquipData(_equipid, _heroDid) _equipid = tonumber(_equipid) - if - this.equipDatas[_equipid] and this.equipDatas[_equipid].upHeroDidList and - this.equipDatas[_equipid].upHeroDidList[_heroDid] - then + if this.equipDatas[_equipid] and this.equipDatas[_equipid].upHeroDidList and this.equipDatas[_equipid].upHeroDidList[_heroDid] then return this.equipDatas[_equipid] + elseif HarmonyManager.GetSingleAdditions(HarmonyAddType.AddEquip) > 0 and HarmonyManager.IsInfo(_heroDid) then + return HarmonyManager.equipDatas[_equipid]--.upHeroDidList[_heroDid] else return nil end diff --git a/Assets/ManagedResources/~Lua/Modules/Harmony/HarmonyPanel.lua b/Assets/ManagedResources/~Lua/Modules/Harmony/HarmonyPanel.lua index cbf7d003cf..e219eb8019 100644 --- a/Assets/ManagedResources/~Lua/Modules/Harmony/HarmonyPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Harmony/HarmonyPanel.lua @@ -14,46 +14,107 @@ HarmonyPanel.prefab={} function HarmonyPanel:InitComponent() self.btnBack = Util.GetGameObject(self.gameObject, "Back/BackBtn") - - self.panel=Util.GetGameObject(self.gameObject,"Panel") + self.helpBtn = Util.GetGameObject(self.gameObject,"HelpBtn") + self.AddBtn = Util.GetGameObject(self.gameObject,"Panel/HarmonyPanel/AddBtn") + self.GongMingBtn = Util.GetGameObject(self.gameObject,"Panel/HarmonyPanel/KnowGongMing") + self.helpPosition = self.helpBtn:GetComponent("RectTransform").localPosition + self.panel = Util.GetGameObject(self.gameObject,"Panel") + + self.NumText = Util.GetGameObject(self.panel,"HarmonyPanel/itemNumText"):GetComponent("Text") + self.parent = Util.GetGameObject(self.gameObject,"MiddleView") + --初始化格子中的数据 + HarmonyManager:InitGongMingDataList() for i = 1, #self.contents do self.prefab[i]=Util.GetGameObject(self.panel,self.contents[i].panelName); - - self.contents[i].view:InitComponent(self.panel) + self.contents[i].view:InitComponent(self.panel, BagManager.GetTotalItemNum(UpViewRechargeType.Gold),BagManager.GetTotalItemNum(UpViewRechargeType.DemonCrystal),1) end - self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft }) + end +function HarmonyPanel:InitTextMum() + local HeroCount = 0 + local Box = #HarmonyManager.hongmengHeroInfos; + for i = 1, #HarmonyManager.hongmengHeroInfos do + -- body + if HarmonyManager.hongmengHeroInfos[i].heroId ~="" then + HeroCount = HeroCount + 1 + end + end + + + self.NumText.text = string.format("%d/%d",HeroCount,Box) +end --绑定事件(用于子类重写) function HarmonyPanel:BindEvent() Util.AddClick(self.btnBack, function() self:ClosePanel() end) - + Util.AddClick(self.helpBtn,function() + + UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.HongMengZhen,self.helpPosition.x,self.helpPosition.y) + end) + + + Util.AddClick(self.AddBtn,function() + --二级弹窗界面 + + + Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OpenBoxTips) + end) + --共鸣按钮 + Util.AddClick(self.GongMingBtn,function() + --二级共鸣弹窗 + UIManager.OpenPanel(UIName.GongMingResultTips) + end) end +function HarmonyPanel:ReFeshTextFun(data) + local HeroCount = 0 + local Box = 0 + + -- body + HeroCount = data[1] + Box = data[2] + + self.NumText.text = string.format("%d/%d",HeroCount,Box) + +end --添加事件监听(用于子类重写) function HarmonyPanel:AddListener() - for i = 1, #self.contents do - + for i = 1, #self.contents do self.contents[i].view:AddListener() - end + end + Game.GlobalEvent:AddEvent(GameEvent.HongMeng.OnlyRefeshText,self.ReFeshTextFun,self) end --移除事件监听(用于子类重写) function HarmonyPanel:RemoveListener() for i = 1, #self.contents do - self.contents[i].view:RemoveListener() end + Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.OnlyRefeshText,self.ReFeshTextFun,self) end --界面打开时调用(用于子类重写) -function HarmonyPanel:OnOpen(equipSId) +function HarmonyPanel:OnOpen() + NetManager.PlayerInfoRequest(LoadingPanel.OnStep) + --格子 + for i = 1, #self.contents do + self.contents[i].view:OnOpen() + end + --金币 + self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft }) + + --鸿蒙守卫 + self.HarmonyView = SubUIManager.Open(SubUIConfig.HarmonyView,self.parent.transform) + --对选人列表的刷新 + HarmonyManager:SetInitList() + + self:InitTextMum() end --界面打开或者重新打开后,界面刷新时调用(用于子类重写) @@ -63,7 +124,9 @@ end --界面关闭时调用(用于子类重写) function HarmonyPanel:OnClose() - + for i = 1, #self.contents do + self.contents[i].view:OnClose() + end end --界面销毁时调用(用于子类重写) diff --git a/Assets/ManagedResources/~Lua/Modules/Harmony/Manager/HarmonyManager.lua b/Assets/ManagedResources/~Lua/Modules/Harmony/Manager/HarmonyManager.lua index 6bca9bda6a..0ddfbf0636 100644 --- a/Assets/ManagedResources/~Lua/Modules/Harmony/Manager/HarmonyManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Harmony/Manager/HarmonyManager.lua @@ -1,38 +1,441 @@ HarmonyManager = {} local this = HarmonyManager - ---鸿蒙阵数据 +-- +-- 第一阶段 鸿蒙阵数据 this.hongmengGuards = {} this.hongmengHeroInfos = {} this.hongmengTablet = 0 this.hongmengAdditions = {} +this.GuardList = {} +local SelectId = nil + +HarmonyManager.GongMingBox = 0; +HarmonyManager.UnLoadGongMing = 0 +--判断是否鸿蒙共享数据 +local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig) +local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig) + +HarmonyManager.equipCount = 0 +this.hongmengGongMingList = {} +this.ChooseDataList = {} + +-- 第二阶段 鸿蒙塔 数据 +HarmonyManager.EnvoyList = {} --330 鸿蒙使者 数据 + + +-- 鸿蒙塔升级数据表 +local HongmengUp = ConfigManager.GetConfig(ConfigName.HongmengUp) + function this:InitHongMengData(hongmengGuards, hongmengHeroInfos, hongmengTablet, hongmengAdditions) -- body this.hongmengGuards = hongmengGuards + --LogGreen(#this.hongmengGuards) this.hongmengHeroInfos = hongmengHeroInfos + --LogGreen(#this.hongmengHeroInfos) + + --LogBlue("hongmengTablet "..hongmengTablet) + for i = 1, #this.hongmengHeroInfos do + this.hongmengHeroInfos[i].time = this.hongmengHeroInfos[i].time + GetTimeStamp() + end this.hongmengTablet = hongmengTablet this.hongmengAdditions = hongmengAdditions + for i = 1, #this.hongmengAdditions do + if this.hongmengAdditions[i].additionType == HarmonyAddType.AddEquip then + if this.hongmengAdditions[i].value ~= -1 then + local curEquipIdList = {} + local curEquipConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipConfig,"Star",this.hongmengAdditions[i].value) + for i = 1, #curEquipConfigs do + + table.insert(curEquipIdList,curEquipConfigs[i].Id) + end + this.HarmonyUpdateEquipData(curEquipIdList, "") + end + end + end --- print(GameDataBase.SheetBase.GetKeys(this.hongmengGuards)," ~~~~44444444") --- -- print(this.hongmengHeroInfos) --- for key, value in ConfigPairs(this.hongmengHeroInfos) do --- LogGreen(key," ",value) --- end --- print(this.hongmengTablet) --- for key, value in ConfigPairs(this.hongmengAdditions) do --- -- body --- LogGreen(key," ",value) --- end - --print(this.hongmengAdditions) + + end +--初始化共鸣列表数据 +function this:InitGongMingDataList() + for i = 1, #this.hongmengHeroInfos do + local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId) + + if data then + + this.hongmengGongMingList[i] = data + + else + this.hongmengGongMingList[i] = nil + end + end + + +end +--鸿蒙塔上限 +function this:HongMengTowerUpLimit() + local list = HeroManager.GetAllHeroDatas(330) + local temp_list = {} + for i = 1, #list do + -- body + table.insert(temp_list,list[i]) + end + + for k1, v1 in ipairs(list) do + for k2, v2 in ipairs(temp_list) do + --同种英雄同一星级的移除 + if v1.dynamicId ~= v2.dynamicId and v1.value == v2.value and v1.name == v2.name then + table.remove(list, k1) + table.remove(temp_list, k1) + end + end + end + return #temp_list +end -function this:SendHarmonyManagerMsg() - NetManager.HongMengRequset(0,function(msg) - -- +function this.IsInfo(did) + if did ~= "" then + for i = 1, #this.hongmengHeroInfos do + if did == this.hongmengHeroInfos[i].heroId and this.hongmengHeroInfos[i].heroId ~= "" then + return true + end + end + end + return false +end +function this.IsChangeColor(did) + for i = 1, #this.hongmengHeroInfos do + if did == this.hongmengHeroInfos[i].heroId then + return true + end + end + return false +end +function this:IsGongMing(did) + for i = 1, #this.hongmengHeroInfos do + -- body + if did == this.hongmengHeroInfos[i].heroId then + PopupTipPanel.ShowTip("共鸣ing") + return + end + end + -- body +end +function this:SetInitList() + local heroDataList = HeroManager.GetAllHeroDatas(1) + local list = {} + local count = 0; + --LogBlue("this.GuardList长度:"..LengthOfTable(this.GuardList)) + for key, value in pairs(this.GuardList) do + table.insert(list,value) + end + + + + for i = 1, #this.hongmengHeroInfos do + if this.hongmengHeroInfos[i].heroId ~= "" then + -- LogYellow("是否有数据:"..i) + local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId) + table.insert(list,data) + end + + end + + table.sort(list,function(a,b) + return a.dynamicId < b.dynamicId end) + --LogBlue("#list长度:"..#list) + local newList = {} + local index = 0 + local flag = true + + local tempTable = {} + for i = 1, #heroDataList do + table.insert(tempTable,heroDataList[i]) + end + + for i = #heroDataList, 1,-1 do + for k2, v2 in pairs(list) do + if v2.dynamicId == heroDataList[i].dynamicId then + --LogPink("第几个:"..i.." k2"..k2) + table.remove(tempTable,i) + end + end + end + this.ChooseDataList = tempTable + + -- LogBlue("#this.ChooseDataList长度:"..#this.ChooseDataList) +end +--初始化 鸿蒙塔的数据 +function this:SetTowerInit() + + local heroDataList = HeroManager.GetAllHeroDatas(1) + local list = {} + local count = 0; + this.GuardList = HeroManager.GetAllHeroDatas(330) + -- LogBlue("this.GuardList长度:"..LengthOfTable(this.GuardList)) + for key, value in pairs(this.GuardList) do + table.insert(list,value) + end + + + + --LogBlue("#this.hongmengHeroInfos"..#this.hongmengHeroInfos) + for i = 1, #this.hongmengHeroInfos do + if this.hongmengHeroInfos[i].heroId ~= "" then + --LogYellow("是否有数据:"..i) + local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId) + table.insert(list,data) + end + + end + + table.sort(list,function(a,b) + return a.dynamicId < b.dynamicId + end) + --LogBlue("#list长度:"..#list) + local newList = {} + local index = 0 + local flag = true + + local tempTable = {} + for i = 1, #heroDataList do + table.insert(tempTable,heroDataList[i]) + end + + for i = #heroDataList, 1,-1 do + for k2, v2 in pairs(list) do + if v2.dynamicId == heroDataList[i].dynamicId then + -- LogPink("第几个:"..i.." k2"..k2) + table.remove(tempTable,i) + end + end + end + this.ChooseDataList = tempTable end +-- function this:IsEnvoy(did) +-- -- body +-- for i = 1, #this.hongmengGuards do +-- -- body +-- if did==this.hongmengGuards[i] then +-- -- body +-- return true +-- end + +-- end +-- return false +-- end + +--初始化鸿蒙使者的数据 +function this:InitEnvoyList() + for i = 1, #this.hongmengGuards do + -- body + local data = HeroManager.GetSingleHeroData(this.hongmengGuards[i]) + if data then + this.EnvoyList[i] = data + else + this.EnvoyList[i] = nil + end + + end + + +end +--是否是鸿蒙使者 +function this:IsEnvoy(did) + if this.EnvoyList then + -- body + for i = 1, #this.EnvoyList do + -- body + if this.EnvoyList[i] then + -- body + if this.EnvoyList[i].dynamicId == did then + -- body + -- print(did) + return true + end + end + + end + end + + return false +end +-- 设置、获取鸿蒙守卫的列表 +function this:SetGuardList(list,count) + for key, value in pairs(list) do + if key<=count then + -- body + this.GuardList[value.dynamicId] = value + end + end + +end +function this:GetGuardList() + return this.GuardList + -- body +end + +function this:SetGongMingList(Id) + local data = HeroManager.GetSingleHeroData(Id) + table.insert(this.hongmengGongMingList,data) + +end + +function this:RemoveGongMingList(Id) + local data = HeroManager.GetSingleHeroData(Id) + for key, value in pairs(this.hongmengGongMingList) do + if value then + -- body + if value==data then + -- body + value = nil + break + end + end + end +end + +function this:GetGongMingListSingle(Id) + local data = HeroManager.GetSingleHeroData(Id) + --return data + --print(data.dynamicId,"~~~",Id) + for key, value in pairs(this.hongmengGongMingList) do + + if value.dynamicId==data.dynamicId then + + return value + + end + end + +end +function this:SetChooseId(id) + SelectId = id + end +-- 设置、获取卸载的数据 +function this:SetMingListIndexData(index) + SelectId = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[index].heroId).dynamicId +end + + +function this:GetUnLoadData() + -- body + return SelectId +end + + + + + + +--获取加成 +function this:GetAdditions() + + return this.hongmengAdditions +end + +function this.GetSingleAdditions(type) + for i = 1, #this.hongmengAdditions do + if this.hongmengAdditions[i].additionType == type then + return this.hongmengAdditions[i].value + end + end + return 0 +end + +function this:GetHongMengUpData() + + for key, value in ConfigPairs(HongmengUp) do + -- body + if value.HongmengLevel == this.hongmengTablet+1 then + -- body + return ConfigManager.TryGetConfigData(ConfigName.HongmengUp,key) + end + + end + +end + +--鸿蒙共享装备临时数据 +local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) +local equipStarsConfig = ConfigManager.GetConfig(ConfigName.EquipStarsConfig) +local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) +function this.InitUpdateEquipData(id, upHeroDid) + if not this.equipDatas then + this.equipDatas = {} + end + id = tonumber(id) + if this.equipDatas[id] then + if not this.equipDatas[id].upHeroDidList then + this.equipDatas[id].upHeroDidList = {} + end + if upHeroDid and upHeroDid ~= "0" then + this.equipDatas[id].upHeroDidList[upHeroDid] = upHeroDid + end + else + local equipdata = {} + equipdata.equipConfig = equipConfig[id] + equipdata.itemConfig = itemConfig[id] + equipdata.id = id + if itemConfig[equipdata.id] then + equipdata.icon = GetResourcePath(itemConfig[equipdata.id].ResourceID) + else + Log(Language[10483] .. equipdata.id) + return + end + equipdata.frame = GetQuantityImageByquality(equipdata.equipConfig.Quality) + equipdata.quality = equipdata.equipConfig.Quality + equipdata.position = equipdata.equipConfig.Position + + equipdata.mainAttribute = this.GetMainProList(equipdata.equipConfig) + + equipdata.backData = equipdata + equipdata.star = equipStarsConfig[equipdata.equipConfig.Star].Stars + this.equipDatas[id] = equipdata + if not this.equipDatas[id].upHeroDidList then + this.equipDatas[id].upHeroDidList = {} + end + + if upHeroDid and upHeroDid ~= "0" and not this.equipDatas[id].upHeroDidList[upHeroDid] then + this.equipDatas[id].upHeroDidList[upHeroDid] = upHeroDid + end + end +end + +function this.HarmonyUpdateEquipData(idlist, heroDid) + for i = 1, #idlist do + this.InitUpdateEquipData(idlist[i], heroDid, false) + end + +end +--判断神将的装备是否共鸣 +function this:IsShowGongMingEqiup(id) + for i = 1, #this.hongmengHeroInfos do + -- body + if id == this.hongmengHeroInfos[i].heroId then + + return true + else + + end + end + + return false +end + +function this.GetMainProList(equipConfig) + local propList = {} + for index, prop in ipairs(equipConfig.Property) do + propList[index] = {} + propList[index].propertyId = prop[1] + propList[index].propertyValue = prop[2] + propList[index].PropertyConfig = propertyConfig[prop[1]] + end + return propList +end return HarmonyManager \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Harmony/View/HarmonyScrllow.lua b/Assets/ManagedResources/~Lua/Modules/Harmony/View/HarmonyScrllow.lua index b3c3046c67..cf2392b251 100644 --- a/Assets/ManagedResources/~Lua/Modules/Harmony/View/HarmonyScrllow.lua +++ b/Assets/ManagedResources/~Lua/Modules/Harmony/View/HarmonyScrllow.lua @@ -1,10 +1,58 @@ local this={} this.tab=ConfigManager.GetConfig(ConfigName.Hongmeng) -local Box=0; -local OpenBox=2 -function this:InitComponent(gameObject) + + + +local Gold =0; +local DemonCrystal = 0 +local HeroList = {} + +local tempData = nil +local TempItem = nil + +local ItemList = {} +local Box = 0 +local OpenBox = 0 +local HeroCount = 0 + +function this:AwakeLength() + Box = #HarmonyManager.hongmengHeroInfos; + OpenBox = #HarmonyManager.hongmengHeroInfos+2 + for i = 1, #HarmonyManager.hongmengHeroInfos do + -- body + if HarmonyManager.hongmengHeroInfos[i].heroId~="" then + -- body + HeroCount = HeroCount + 1 + end + end + + + if self.stage == 1 then + -- body + this.NumText.text = string.format("%d/%d",HeroCount,Box) + + else + + local count = 0 + for i = 1, #HarmonyManager.EnvoyList do + -- body + if HarmonyManager.EnvoyList[i] then + count = count + 1 + -- body + end + end + print("发送信息",HeroCount + count," ",Box + #HarmonyManager.EnvoyList) + this.NumText.text = string.format("%d/%d",HeroCount + count,Box + #HarmonyManager.EnvoyList) + + end +end +function this:InitComponent(gameObject,Golds,DemonCrystals,stage) + Gold = Golds + DemonCrystal = DemonCrystals + self.stage = stage + -- item预制件 this.item = Util.GetGameObject(gameObject , "HarmonyPanel/item") @@ -12,11 +60,11 @@ function this:InitComponent(gameObject) --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.NumText = Util.GetGameObject(gameObject,"HarmonyPanel/itemNumText"):GetComponent("Text") 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)) @@ -29,118 +77,388 @@ function this:InitComponent(gameObject) this.BoxList=0; + this:AwakeLength() this:InitBox() + --this.RunTimerFun() end - +local TextList = {} +local BoxList = {} 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]) - + this.SingleBoxDataShow(go, this.tab[key], index) + ItemList[go] = index + local TimerText = Util.GetGameObject(go.transform,"Box/Empty/Image/Text"):GetComponent("Text") + TextList[index] = TimerText + local Empty = Util.GetGameObject(go.transform,"Box/Empty") + BoxList[index] = Empty 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 0 then + + if BoxList[value].activeSelf == false then + -- body + BoxList[value]:SetActive(true) + end + local time_content = TimeToFelaxible(HarmonyManager.hongmengHeroInfos[value].time - GetTimeStamp()) + TextList[value].text = string.format("%s\n后恢复",time_content) + else + HarmonyManager.hongmengHeroInfos[value].time = 0 + TextList[value].text = "" + end + + -- else + -- LogError("error: no time nothing") + end + end + + end + this.timerEffect = Timer.New(refreshFunc, 1, -1, true) + this.timerEffect:Start() + refreshFunc() +end +function this.SingleBoxDataShow(go,boxData,index) + -- body + + local mask = Util.GetGameObject(go.transform,"Box/Empty/lock/mask"); + local lock = Util.GetGameObject(go.transform,"Box/Empty/lock"); + local Empty = Util.GetGameObject(go.transform,"Box/Empty") + local TimerText = Util.GetGameObject(go.transform,"Box/Empty/Image/Text"):GetComponent("Text") + + Empty:SetActive(true) + mask:SetActive(true) + lock:SetActive(true) + + local gridData = HarmonyManager.hongmengHeroInfos[boxData.Id] + if gridData then + if gridData.gridId <= Box then + if gridData.heroId ~= "" then + Empty:SetActive(false) + local data = HeroManager.GetSingleHeroData(gridData.heroId) + if data then + this.SingleItemDataShow(go, data) + else + LogError("error: no hero data") + end + else + + if gridData.time == 0 then + -- body + TimerText.text = "" + else + + end + Empty:SetActive(true) + mask:SetActive(false) lock:SetActive(false) end - Util.AddOnceClick(go,function() - Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.RereshNumText); - -- lock:SetActive(false) - end) - else - mask:SetActive(true) - lock:SetActive(true) end - -- body - else - if boxData.Id#itemList and i<=#BoxList then - -- body - + end) + end + end else - + if mask.activeSelf then + -- body + PopupTipPanel.ShowTip("请先解锁前一个格子") + else + if lock.activeSelf then + -- body + this:AddBoxFun(boxData) + end + end end + + end) + + + + +end +--卸载刷新 +function this:UpdateItemShow(go,boxData,msg) + + + +end +function this:AddBoxFun(boxData) + local content = "" + if Gold > boxData.PropPrice[2] then + content =string.format("是否花费%d玄黄之气解锁共鸣位置",boxData.PropPrice[2]) + else + content=string.format("玄黄之气不足%d,是否直接花费%d妖晶解锁共鸣位置?",boxData.PropPrice[2],boxData.MoneyPrice[2]) end - + MsgPanel.ShowTwo(content,function () + + end,function () + if Gold < boxData.PropPrice[2] and DemonCrystal < boxData.MoneyPrice[2] then + + return + end + --向服务器请求消息 + NetManager.HongMengRequset(boxData.Id,function(msg) + -- + Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.RereshNumText,boxData.Id) + end) + end,"取消","确认") +end +function this:BindEvent() + end +function this:OnOpen() + + this:AwakeLength() + this.RunTimerFun() + this.timerEffect:Start() +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)) + LogGreen(clone.name.."||"..Itemdata.heroConfig.Id) + Util.GetGameObject(clone.transform, "GameObject/frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(Itemdata.heroConfig.Quality,Itemdata.star)) + Util.GetGameObject(clone.transform, "GameObject/lv/Text"):GetComponent("Text").text = string.format("%d",Itemdata.lv) + Util.GetGameObject(clone.transform, "GameObject/icon"):GetComponent("Image").sprite = Util.LoadSprite(Itemdata.icon) + --Util.GetGameObject(clone.transform, "GameObject/posIcon"):SetActive(false)--:GetComponent("Image").sprite = Util.LoadSprite(heroData.professionIcon) + Util.GetGameObject(clone.transform, "GameObject/proIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(Itemdata.heroConfig.PropertyName)) + local starGrid = Util.GetGameObject(clone.transform, "GameObject/star") + SetHeroStars(starGrid, Itemdata.star,1,nil,nil,Vector2.New(0,1)) + end -function this:Refesh() +function this:Refesh(id) -- body - Box=Box+1 - OpenBox = OpenBox+1 - this.NumText.text = string.format("%d/%d",0,Box) - + Box = Box + 1 + OpenBox = OpenBox + 1 + if self.stage == 1 then + -- body + Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box, 1}) + else + local count = 0 + for i = 1, #HarmonyManager.EnvoyList do + -- body + if HarmonyManager.EnvoyList[i] then + count = count + 1 + -- body + end + end + Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount + count,Box + #HarmonyManager.EnvoyList, 1}) + end + + local data = {} + data.gridId = id + data.heroId = "" + data.time = 0 + table.insert(HarmonyManager.hongmengHeroInfos,data) local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 this.ScrollView:SetData(keys,function (index, go) local key = keys[index] - this.SingleBoxDataShow(go, this.tab[key]) - + this.SingleBoxDataShow(go, this.tab[key],index) + ItemList[go] = index + local TimerText = Util.GetGameObject(go.transform,"Box/Empty/Image/Text"):GetComponent("Text") + TextList[index] = TimerText + local Empty = Util.GetGameObject(key.transform,"Box/Empty") + BoxList[index] = Empty end) end +function this:OpenBoxFun() + this:AddBoxFun(tempData) +end + +function this:UpdateHero(Herodata) + + print("刷新界面") + for i = 1, #HarmonyManager.hongmengHeroInfos do + -- body + if HarmonyManager.GongMingBox ==HarmonyManager.hongmengHeroInfos[i].gridId then + -- body + + HarmonyManager.hongmengHeroInfos[i].heroId = Herodata.dynamicId + HarmonyManager.hongmengHeroInfos[i].time = 0 + print("更新数据"..i.." ",HarmonyManager.hongmengHeroInfos[i].heroId) + break + end + end + + HeroCount = HeroCount + 1 + if self.stage == 1 then + -- body + Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box}) + else + local count = 0 + for i = 1, #HarmonyManager.EnvoyList do + -- body + if HarmonyManager.EnvoyList[i] then + count = count + 1 + -- body + end + end + Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount + count,Box + #HarmonyManager.EnvoyList,}) + end + --Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box, 1}) + --this.NumText.text = string.format("%d/%d",HeroCount,Box) + local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 + + --刷新选择英雄界面的 数据 + HarmonyManager:SetInitList() + + this.ScrollView:SetData(keys,function (index, go) + local key = keys[index] + this.SingleBoxDataShow(go, this.tab[key],index) + ItemList[go] = index + local TimerText = Util.GetGameObject(go.transform,"Box/Empty/Image/Text"):GetComponent("Text") + TextList[index] = TimerText + local Empty = Util.GetGameObject(key.transform,"Box/Empty") + BoxList[index] = Empty + end) +end + +function this:GetItemList(index) + -- body + for key, value in pairs(ItemList) do + -- body + if value == index then + -- body + return key + end + end +end + +function this:UnLoadFun(msg) + HeroCount = HeroCount - 1 + + for key, value in pairs(ItemList) do + if value == TempItem then + -- body + HarmonyManager.hongmengHeroInfos[value].time = msg.leftTime + GetTimeStamp() + + HarmonyManager.hongmengHeroInfos[value].heroId = "" + + end + + end + --刷新选择英雄界面的 数据 + HarmonyManager:SetInitList() + if self.stage == 1 then + -- body + Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box, 1}) + else + local count = 0 + for i = 1, #HarmonyManager.EnvoyList do + -- body + if HarmonyManager.EnvoyList[i] then + count = count + 1 + -- body + end + end + Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount + count,Box + #HarmonyManager.sEnvoyList}) + end + -- Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box, 1}) + --this.NumText.text = string.format("%d/%d",HeroCount,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],index) + ItemList[go] = index + end) +end +--界面关闭时调用(用于子类重写) +function this:OnClose() + if this.timerEffect then + -- body + this.timerEffect:Stop() + end + +end function this:AddListener() -- body - print(" 注册消息成功") + Game.GlobalEvent:AddEvent(GameEvent.HongMeng.RereshNumText,self.Refesh,self) + Game.GlobalEvent:AddEvent(GameEvent.HongMeng.OpenBoxTips,self.OpenBoxFun,self) + Game.GlobalEvent:AddEvent(GameEvent.HongMeng.ChooseData,self.UpdateHero,self) + Game.GlobalEvent:AddEvent(GameEvent.HongMeng.UnLoadData,self.UnLoadFun,self) end function this:RemoveListener() -- body - Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.RereshNumText,self.Refesh,self) + Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.RereshNumText,self.Refesh,self) + Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.OpenBoxTips,self.OpenBoxFun,self) + Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.ChooseData,self.UpdateHero,self) + Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.UnLoadData,self.UnLoadFun,self) end function this:OnShow(...) -- body @@ -148,11 +466,6 @@ function this:OnShow(...) end -function this:SingleHeroDataShow(_go,_HongMengData) - local clone = _go - local HongMeng = _HongMengData - - -- body -end + return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua index 0fc1076759..c7e46d8c70 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua @@ -1,5 +1,6 @@ HeroManager = {} local this = HeroManager +local HeroData = require("Modules.Hero.HeroData") local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig) local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local heroLevelConfig = ConfigManager.GetConfig(ConfigName.HeroLevelConfig) @@ -64,11 +65,11 @@ function this.InitHeroData(_msgHeroList) for i = 1, #hero_resolve_licence do this.heroResolveLicence[tonumber(hero_resolve_licence[i])] = tonumber(hero_resolve_licence[i]) end + this.UpdateHeroLvEnd() --Log("服务端推送英雄数量:" .. #_msgHeroList) for i = 1, #_msgHeroList do this.UpdateHeroDatas(_msgHeroList[i], true) end - this.UpdateHeroLvEnd() --赋值每个星级的英雄等级上限 -- this.UpdateHeroPower() --赋值英雄战力 @@ -76,11 +77,12 @@ end --刷新本地数据 function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) - local heroData = {} + local heroData = HeroData.new(_msgHeroData, isFindHandBook) heroData.soulPrintList = {} --乘减属性集合 heroData.MLSproList={} heroData.heroBackData = _msgHeroData + heroData.dynamicId = _msgHeroData.id local _id = _msgHeroData.heroId heroData.id = _id @@ -111,6 +113,7 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) --_msgHeroData.actionPower --英雄穿戴的装备 + -- LogPink("_msgHeroData.equipIdList "..#_msgHeroData.equipIdList..heroData.heroConfig.ReadingName) heroData.equipIdList = _msgHeroData.equipIdList heroData.jewels = _msgHeroData.jewels heroData.talismanList = _msgHeroData.especialEquipLevel --法宝等级 @@ -159,6 +162,8 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook) heroData.name = _configData.ReadingName heroData.property = _configData.PropertyName heroData.sortId = #heroDatas + 1 + + heroData.harmonyGongMing = _msgHeroData.createtype table.insert(this.heroDataLists, heroData) heroDatas[heroData.dynamicId] = heroData @@ -537,6 +542,8 @@ function this.CompareWarPower(heroDId) FormationManager.CheckHeroIdExist(heroDId) end + + --更新本地单个英雄技能信息 function this.UpdateSingleHeroSkillData(_heroDId) if heroDatas[_heroDId] then @@ -3333,6 +3340,10 @@ function this.LoadHerolive1(data, _objPoint) return testLive end +function this.GetHongMengData(dynamicId) + return heroDatas[dynamicId] +end + function this.SortHeroDatas(_heroDatas) local teamHero = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL) --上阵最优先,星级优先,同星级等级优先,同星级同等级按sortId排序。排序时降序排序。 diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index d5b0d98e99..e6c3fa3c2c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -202,6 +202,9 @@ function this.PlayerInfoRequest(func) -- 充值金额 VipManager.InitInfoOnLogin(msg) + --进入游戏后拿到鸿蒙阵数据 + HarmonyManager:InitHongMengData(msg.hongmengGuards,msg.hongmengHeroInfos,msg.hongmengTablet,msg.hongmengAdditions) + MapManager.PlayedMapTypes = msg.playedMapTypes for _, type in ipairs(msg.playedMapTypes) do Log(Language[11425]..type) @@ -4781,19 +4784,22 @@ function this.ChengeMonsterChooseRequest(activityId,selectId,func) end end) end +--鸿蒙阵 +-- 鸿蒙阵 游戏开始 拿到的数据 ---鸿蒙阵 + + +--鸿蒙阵 点击开启格子的数据 function this.HongMengRequset(_gridId,func) - --鸿蒙阵数据传递 --- HarmonyManager:InitHongMengData(msg.hongmengGuards,msg.hongmengHeroInfos,msg.hongmengTablet,msg.hongmengAdditions) + local data = HeroInfoProto_pb.OpenResonanceRequest() data.gridId = _gridId - + print("id",data.gridId) local msg = data:SerializeToString() - Network:SendMessageWithCallBack(MessageTypeProto_pb.HERO_SKIN_CHANGE_REQUEST, MessageTypeProto_pb.HERO_SKIN_CHANGE_RESPONSE, msg, function(buffer) + Network:SendMessageWithCallBack(MessageTypeProto_pb.HONGMENG_OPEN_RESONANCE_REQUEST, MessageTypeProto_pb.HONGMENG_OPEN_RESONANCE_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.OpenResonanceResponse() msg:ParseFromString(data) @@ -4802,4 +4808,41 @@ function this.HongMengRequset(_gridId,func) end end) end +--开启共鸣,卸下装备 +function this.SendGongMingBox(heroId,gridId,_type,func) + -- body + local data = HeroInfoProto_pb.ResonanceRequest() + data.heroId = heroId + data.gridId = gridId + data.type = _type + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.HONGMENG_RESONANCE_REQUEST, MessageTypeProto_pb.HONGMENG_RESONANCE_RESPONSE, msg, function(buffer) + if buffer then + local data = buffer:DataByte() + local msg = HeroInfoProto_pb.ResonanceResponse() + msg:ParseFromString(data) + if func then + func(msg) + end + end + + end) +end + +function this.UnlockGrid(gridId,func) + local data = HeroInfoProto_pb.CleanResonanceTimeRequest(); + data.gridId= gridId + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.HONGMENG_CLEAN_TIME_RESQUEST , MessageTypeProto_pb.HONGMENG_CLEAN_TIME_RESPONSE, msg, function(buffer) + if buffer then + local data = buffer:DataByte() + local msg = HeroInfoProto_pb.ResonanceResponse() + msg:ParseFromString(data) + if func then + func(msg) + end + end + + end) +end return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/View/HarmonyView.lua b/Assets/ManagedResources/~Lua/View/HarmonyView.lua index ab928a7fc4..dcdde41dce 100644 --- a/Assets/ManagedResources/~Lua/View/HarmonyView.lua +++ b/Assets/ManagedResources/~Lua/View/HarmonyView.lua @@ -1,9 +1,98 @@ -local HarmonyView={} - -function HarmonyView:New() +HarmonyView={} +-- 鸿蒙守卫脚本 +function HarmonyView:New(gameObject) + local b = {} + b.gameObject = gameObject + b.transform = gameObject.transform + setmetatable(b, { __index = HarmonyView }) + return b +end +HarmonyView.GongMingTable = {} +HarmonyView.HongMengData = {} +function HarmonyView:InitComponent() + local num = self.gameObject.transform.childCount + for i = 0, num-1 do + self.GongMingTable[i] =self.gameObject.transform:GetChild(i).gameObject + end end + +function HarmonyView:BindEvent() +end +function HarmonyView:AddListener() + +end + +function HarmonyView:RemoveListener() + +end + +function HarmonyView:SetGreen(HongMengData) + local min = HongMengData[#self.GongMingTable].lv + for i = 0, #self.GongMingTable do + if HongMengData[i+1].lv == min then + self.count=self.count+1; + end + end + +end +function HarmonyView:InitData(data) + table.sort(data, function(a,b) + if a.lv==b.lv then + return a.warPower > b.warPower + else + return a.lv > b.lv + end + end) + return data +end +function HarmonyView:OnOpen() + -- local heroDataList = HeroManager.GetAllHeroDatas(1); + -- self.HongMengData = self:InitData(heroDataList) + + for i = 1, #HarmonyManager.hongmengGuards do + self.HongMengData[i] = HeroManager.GetHongMengData(HarmonyManager.hongmengGuards[i]) + + end + self.count = 0; + self.HongMengData = self:InitData(self.HongMengData) + + for i = 1, #self.HongMengData do + -- body + for i = 1, #self.HongMengData[i].equipIdList do + -- body + HarmonyManager.equipCount= HarmonyManager.equipCount+1 + end + end + -- print("count",HarmonyManager.equipCount) + self:SetGreen(self.HongMengData) + LogGreen(self.count) + for i = 0, #self.GongMingTable do + if i == 5 then + self:SetItem(self.HongMengData[i+1],self.GongMingTable[i],1) + else + self:SetItem(self.HongMengData[i+1],self.GongMingTable[i],0) + end + + end + HarmonyManager:SetGuardList(self.HongMengData,(#self.GongMingTable+1)) +end + +function HarmonyView:SetItem(data,go,flag) + Util.GetGameObject(go.transform, "GameObject/frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(data.heroConfig.Quality,data.star)) + if flag == 0 then + Util.GetGameObject(go.transform, "GameObject/lv/Text"):GetComponent("Text").text = data.lv + else + Util.GetGameObject(go.transform, "GameObject/lv/Text"):GetComponent("Text").text = string.format("%d",data.lv) + end + + Util.GetGameObject(go.transform, "GameObject/icon"):GetComponent("Image").sprite = Util.LoadSprite(data.icon) + + Util.GetGameObject(go.transform, "GameObject/proIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(data.heroConfig.PropertyName)) + local starGrid = Util.GetGameObject(go.transform, "GameObject/star") + SetHeroStars(starGrid, data.star,1,nil,nil,Vector2.New(0,1)) +end return HarmonyView \ No newline at end of file