UIRoleInfo:属性问题调整正常了
This commit is contained in:
parent
2035d5413c
commit
ba78a94949
@ -242,7 +242,7 @@ RectTransform:
|
||||
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: -362, y: -2}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 160, y: 160}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &863215437317865649
|
||||
@ -293,7 +293,7 @@ MonoBehaviour:
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 0}
|
||||
m_TargetGraphic: {fileID: 5883792927636188945}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
@ -609,8 +609,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -362, y: -4}
|
||||
m_SizeDelta: {x: -4, y: 4}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1892140207703742444
|
||||
CanvasRenderer:
|
||||
@ -1540,10 +1540,10 @@ RectTransform:
|
||||
- {fileID: 4627993698013804757}
|
||||
m_Father: {fileID: 660839604683965931}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
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_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 266.25, y: -90}
|
||||
m_SizeDelta: {x: 157.5, y: 180}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7502809275291140041
|
||||
MonoBehaviour:
|
||||
@ -1681,7 +1681,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -362, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &185224424418268682
|
||||
@ -2872,7 +2872,7 @@ RectTransform:
|
||||
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: -362, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 260, y: 140}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &447254296502567714
|
||||
@ -3113,10 +3113,10 @@ RectTransform:
|
||||
- {fileID: 4729414345535605658}
|
||||
m_Father: {fileID: 660839604683965931}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
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_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 453.75, y: -90}
|
||||
m_SizeDelta: {x: 157.5, y: 180}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1191458442755789727
|
||||
MonoBehaviour:
|
||||
@ -3174,7 +3174,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &660839604683965931
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3195,7 +3195,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 178, y: -85}
|
||||
m_AnchoredPosition: {x: 521, y: -85}
|
||||
m_SizeDelta: {x: 720, y: 180}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &7194639264955415111
|
||||
@ -3317,10 +3317,10 @@ RectTransform:
|
||||
- {fileID: 102169492913998227}
|
||||
m_Father: {fileID: 660839604683965931}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
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_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 78.75, y: -90}
|
||||
m_SizeDelta: {x: 157.5, y: 180}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4434577659719784126
|
||||
MonoBehaviour:
|
||||
@ -5006,10 +5006,10 @@ RectTransform:
|
||||
- {fileID: 3248491227544129888}
|
||||
m_Father: {fileID: 660839604683965931}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
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_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 641.25, y: -90}
|
||||
m_SizeDelta: {x: 157.5, y: 180}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &5032539368449434053
|
||||
MonoBehaviour:
|
||||
@ -5088,7 +5088,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -362, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6828762875075468165
|
||||
@ -5680,8 +5680,8 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -362, y: 0}
|
||||
m_SizeDelta: {x: -16, y: -16}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6854200148386788072
|
||||
CanvasRenderer:
|
||||
@ -5814,7 +5814,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: -362, y: -6}
|
||||
m_AnchoredPosition: {x: 0, y: -6}
|
||||
m_SizeDelta: {x: 0, y: 60}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &6166783434162730011
|
||||
@ -6633,7 +6633,7 @@ PrefabInstance:
|
||||
- target: {fileID: 70813078944487029, guid: 9b26fc1c7edbe5e4e8a3fcd925135f79,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: -372
|
||||
value: -29
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 70813078944487029, guid: 9b26fc1c7edbe5e4e8a3fcd925135f79,
|
||||
type: 3}
|
||||
@ -7090,7 +7090,7 @@ PrefabInstance:
|
||||
- target: {fileID: 2596210164378247627, guid: 7fb4cb6a41f0cee40902a79262e26dc8,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: -362
|
||||
value: -19
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2596210164378247627, guid: 7fb4cb6a41f0cee40902a79262e26dc8,
|
||||
type: 3}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@ function RoleEquipSlotItemCtr:SetData(wnd, item, logicData, onClickOwner, onClic
|
||||
item.redPointItem.equipment:SetActive(slotDressRPStatus == Enum.RedPointEnum.EquipDressRP)
|
||||
|
||||
local data = { cfgId = 0, num = 0, slotIndex = slotIndex, slotType = idx, cbOwner = wnd, cb = wnd.ChangeCurEquip, jobType = jobData.JobType }
|
||||
LogError("--1--")
|
||||
--LogError("--1--")
|
||||
wnd.uiBase:AddButtonUniqueEventListener(item.weaponIconGroup.button, onClickOwner, onClickCB, data)
|
||||
end
|
||||
--[[
|
||||
@ -120,7 +120,7 @@ function RoleEquipSlotItemCtr:SetData(wnd, item, logicData, onClickOwner, onClic
|
||||
IconItemCtr:SetData(wnd, item.iconItem, _iconItemLogic, Enum.ItemIEnterType.EquipTips, nil, nil)
|
||||
if jobData then
|
||||
local data = { id = logicData1 and logicData1.id or 0, heroConfigId = logicData1.configId, cfgId = slots[idx].equip_id, num = 0, slotIndex = slotIndex, slotType = idx, cbOwner = wnd, cb = wnd.ChangeCurEquip, cb1 = wnd.PutOffCurEquip, jobType = jobData.JobType, canRefine = slotRefineRPStatus == Enum.RedPointEnum.EquipRefineRP }
|
||||
LogError("--2--")
|
||||
--LogError("--2--")
|
||||
wnd.uiBase:AddButtonUniqueEventListener(item.weaponIconGroup.button, wnd, refreshEquipTips, data)
|
||||
end
|
||||
|
||||
@ -137,7 +137,7 @@ function RoleEquipSlotItemCtr:SetData(wnd, item, logicData, onClickOwner, onClic
|
||||
else
|
||||
if jobData then
|
||||
local data = { cfgId = 0, num = 0, slotIndex = slotIndex, slotType = idx, cbOwner = wnd, cb = wnd.ChangeCurEquip, jobType = jobData.JobType }
|
||||
LogError("--3--")
|
||||
--LogError("--3--")
|
||||
wnd.uiBase:AddButtonUniqueEventListener(item.weaponIconGroup.button, onClickOwner, onClickCB, data)
|
||||
end
|
||||
|
||||
|
||||
@ -709,6 +709,64 @@ function UIRoleInfoCtr:OnDispose()
|
||||
self.view = nil
|
||||
end
|
||||
|
||||
function UIRoleInfoCtr:GetLastBaseAttrs()
|
||||
if isLeader then
|
||||
return ManagerContainer.DataMgr.UserData:GetLastBaseAttrs()
|
||||
else
|
||||
return ManagerContainer.DataMgr.PartnerData:GetLastBaseAttrs(self.data)
|
||||
end
|
||||
end
|
||||
|
||||
function UIRoleInfoCtr:GetRoleDataAttrPoints(id)
|
||||
if id == 1 then
|
||||
return ManagerContainer.DataMgr.UserData:GetRoleDataAttrPoints()
|
||||
else
|
||||
return ManagerContainer.DataMgr.PartnerData:GetRoleDataAttrPoints(id)
|
||||
end
|
||||
end
|
||||
|
||||
function UIRoleInfoCtr:ResetRemainPoints()
|
||||
self.remainPoints = self:GetRoleDataAttrPoints(self.data)
|
||||
end
|
||||
|
||||
function UIRoleInfoCtr:ChangeRemainPoint(num)
|
||||
self.remainPoints = SDataUtil.Add(self.remainPoints, num)
|
||||
return self.remainPoints
|
||||
end
|
||||
|
||||
function UIRoleInfoCtr:GetRemainPoint()
|
||||
return self.remainPoints
|
||||
end
|
||||
|
||||
function UIRoleInfoCtr:SendAttrChange(heroId, addAttrs)
|
||||
if addAttrs == nil then return end
|
||||
|
||||
local table = {}
|
||||
for k,v in pairs(addAttrs) do
|
||||
if v >= 0 then
|
||||
table[#table + 1] = {key = k, value = v}
|
||||
end
|
||||
end
|
||||
local lastBaseAttrs = self:GetLastBaseAttrs(heroId)
|
||||
local isChange = false
|
||||
for k, v in pairs(addAttrs) do
|
||||
if CommonUtil.ToNumber(lastBaseAttrs[k]) ~= (v+1) then
|
||||
isChange = true
|
||||
end
|
||||
end
|
||||
local isNotAddAttr = true
|
||||
for k, v in pairs(lastBaseAttrs) do
|
||||
if k >= Enum.HeroAttrType.STR and k <= Enum.HeroAttrType.LUK and CommonUtil.ToNumber(v) > 1 then
|
||||
isNotAddAttr = false
|
||||
end
|
||||
end
|
||||
if isChange and #table > 0 then
|
||||
if isNotAddAttr == false then
|
||||
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_RESET_ATTR_POINT_REQ, {hero_id = heroId})
|
||||
end
|
||||
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_ADD_ATTR_POINT_REQ, {attr_list = table, hero_id = heroId})
|
||||
end
|
||||
end
|
||||
|
||||
return UIRoleInfoCtr
|
||||
|
||||
|
||||
@ -24,6 +24,9 @@ local recruitCostId
|
||||
local recruitCostNum
|
||||
local animatorNames = {"Lead", "Sword", "Mage", "Priest", "Archer", "Thief"}
|
||||
|
||||
local baseList = {}
|
||||
local addList = {}
|
||||
|
||||
local lastClickLogTime
|
||||
local lastClickNum
|
||||
|
||||
@ -198,6 +201,11 @@ function UIRoleInfoView:FillContent(data, uiBase)
|
||||
self:Init()
|
||||
end
|
||||
|
||||
local function GetBaseAttrsByType(baseAttrs, type)
|
||||
if baseAttrs == nil then return 0 end
|
||||
if baseAttrs[type] == nil then return 0 end
|
||||
return SDataUtil.InvConvert(baseAttrs[type] or 0)
|
||||
end
|
||||
local TAB_TOGGLE_TYPE_NATURE = 1
|
||||
local TAB_TOGGLE_TYPE_SKILL = 2
|
||||
local TAB_TOGGLE_TYPE_WEAPON = 3
|
||||
@ -214,6 +222,155 @@ function UIRoleInfoView:Init()
|
||||
self.pageToggleData = {}
|
||||
self.toggleTabList = {[1] = self.uIAnimator.natureTab, [2] = self.uIAnimator.skillTab, [3] = self.uIAnimator.weaponTab}
|
||||
CommonUtil.CreateToggleMouduleOnlyBtns(self, self.pageToggleData, self.tabToggleGroup, TAB_TOGGLE_TYPE_NATURE, self.OnClickTabToggle)
|
||||
|
||||
--------------------------- TODO ---------------------------
|
||||
LogError("-------Init-------")
|
||||
self.twoAttrAddDic = {}
|
||||
self.controller:ResetRemainPoints()
|
||||
for i = Enum.HeroAttrType.STR, Enum.HeroAttrType.LUK do
|
||||
self["ajustItem"..i].addBtn.repeatButton:AddRepeatClickEventListener(function (idx, isOver)
|
||||
self:ChangeAttrPreview(i, true)
|
||||
end)
|
||||
self["ajustItem"..i].subBtn.repeatButton:AddRepeatClickEventListener(function (idx, isOver)
|
||||
self:ChangeAttrPreview(i, false)
|
||||
end)
|
||||
--self.uiBase:AddButtonUniqueEventListener(self["ajustItem"..i].addBtn.button, self, self.OnChangeAttr, i, 1)
|
||||
--self.uiBase:AddButtonUniqueEventListener(self["ajustItem"..i].subBtn.button, self, self.OnChangeAttr, i, -1)
|
||||
end
|
||||
self.oneAttrAddDic = {}
|
||||
for i = Enum.HeroAttrType.STR, Enum.HeroAttrType.LUK do
|
||||
self.oneAttrAddDic[i] = 0
|
||||
end
|
||||
self:RefreshNatureInfo()
|
||||
end
|
||||
|
||||
function UIRoleInfoView:ChangeAttrPreview(attrType, increase)
|
||||
local baseAttrs = self.controller:GetLastBaseAttrs()
|
||||
--LogError("[ChangeAttrPreview] attrType "..self.oneAttrAddDic[attrType]..", increase "..tostring(increase))
|
||||
--local aa = SDataUtil.InvConvert(baseAttrs[Enum.HeroAttrType.STR])+ self.oneAttrAddDic[attrType] - 1
|
||||
--LogError(tostring(aa))
|
||||
--local bb = ManagerContainer.CfgMgr:GetHeroQualityPointByLv(aa).cost
|
||||
|
||||
if SDataUtil.IsLess(self.controller:GetRemainPoint(), 0) then return end
|
||||
local v = GetBaseAttrsByType(baseAttrs, attrType)
|
||||
if self.oneAttrAddDic then
|
||||
v = v + self.oneAttrAddDic[attrType]
|
||||
end
|
||||
if increase == false and v <= 1 then return end
|
||||
|
||||
local cost = 0
|
||||
if attrType == Enum.HeroAttrType.STR then
|
||||
cost = increase and -ManagerContainer.CfgMgr:GetHeroQualityPointByLv(GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.STR)+ self.oneAttrAddDic[attrType]).cost or ManagerContainer.CfgMgr:GetHeroQualityPointByLv(SDataUtil.InvConvert(baseAttrs[Enum.HeroAttrType.STR])+ self.oneAttrAddDic[attrType] - 1).cost
|
||||
elseif attrType == Enum.HeroAttrType.AGI then
|
||||
cost = increase and -ManagerContainer.CfgMgr:GetHeroQualityPointByLv(GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.AGI) + self.oneAttrAddDic[attrType]).cost or ManagerContainer.CfgMgr:GetHeroQualityPointByLv(SDataUtil.InvConvert(baseAttrs[Enum.HeroAttrType.AGI]) + self.oneAttrAddDic[attrType] - 1).cost
|
||||
elseif attrType == Enum.HeroAttrType.INT then
|
||||
cost = increase and -ManagerContainer.CfgMgr:GetHeroQualityPointByLv(GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.INT)+ self.oneAttrAddDic[attrType]).cost or ManagerContainer.CfgMgr:GetHeroQualityPointByLv(SDataUtil.InvConvert(baseAttrs[Enum.HeroAttrType.INT])+ self.oneAttrAddDic[attrType] - 1).cost
|
||||
elseif attrType == Enum.HeroAttrType.VIT then
|
||||
cost = increase and -ManagerContainer.CfgMgr:GetHeroQualityPointByLv(GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.VIT)+ self.oneAttrAddDic[attrType]).cost or ManagerContainer.CfgMgr:GetHeroQualityPointByLv(SDataUtil.InvConvert(baseAttrs[Enum.HeroAttrType.VIT])+ self.oneAttrAddDic[attrType] - 1).cost
|
||||
elseif attrType == Enum.HeroAttrType.DEX then
|
||||
cost = increase and -ManagerContainer.CfgMgr:GetHeroQualityPointByLv(GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.DEX)+ self.oneAttrAddDic[attrType]).cost or ManagerContainer.CfgMgr:GetHeroQualityPointByLv(SDataUtil.InvConvert(baseAttrs[Enum.HeroAttrType.DEX])+ self.oneAttrAddDic[attrType] - 1).cost
|
||||
elseif attrType == Enum.HeroAttrType.LUK then
|
||||
cost = increase and -ManagerContainer.CfgMgr:GetHeroQualityPointByLv(GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.LUK)+ self.oneAttrAddDic[attrType]).cost or ManagerContainer.CfgMgr:GetHeroQualityPointByLv(SDataUtil.InvConvert(baseAttrs[Enum.HeroAttrType.LUK])+ self.oneAttrAddDic[attrType] - 1).cost
|
||||
end
|
||||
|
||||
if SDataUtil.IsLess(SDataUtil.Add(self.controller:GetRemainPoint(),cost),0) then
|
||||
return
|
||||
end
|
||||
|
||||
local totalPoints = self.controller:ChangeRemainPoint(cost)
|
||||
--self.leadBox.restPoint.number1.text.text = tostring(totalPoints)
|
||||
--LogError("totalPoints: "..tostring(totalPoints))
|
||||
self.oneAttrAddDic[attrType] = self.oneAttrAddDic[attrType] + (increase and 1 or -1)
|
||||
--self:RefreshAllAttr(attrType)
|
||||
-- for k, v in pairs(self.oneAttrAddDic) do
|
||||
-- LogError("totalPoints: "..tostring(k).."-"..tostring(v))
|
||||
-- end
|
||||
self:RefreshNatureInfo()
|
||||
end
|
||||
|
||||
--[[
|
||||
Life = 7,
|
||||
Sp = 8,
|
||||
Attack = 9,
|
||||
MagicAttack = 10,
|
||||
Defense = 11,
|
||||
MagicDefense = 12,
|
||||
Hit = 13,
|
||||
Dodge = 14,
|
||||
Crit = 15,
|
||||
Ten = 16,
|
||||
AttackSpeed = 17,
|
||||
CastAcceleration = 18,
|
||||
]]
|
||||
function UIRoleInfoView:RefreshNatureInfo()
|
||||
local baseAttrs = self.controller:GetLastBaseAttrs()
|
||||
local heroId = self.controller:GetRoleUid()
|
||||
local heroData = self.controller:GetHeroLogicData(heroId)
|
||||
|
||||
if self.oneAttrAddDic == nil then
|
||||
self.oneAttrAddDic = {}
|
||||
for i = Enum.HeroAttrType.STR, Enum.HeroAttrType.LUK do
|
||||
self.oneAttrAddDic[i] = 0
|
||||
end
|
||||
end
|
||||
self.remainPoint.text.text = tostring(self.controller:GetRemainPoint())
|
||||
for i = Enum.HeroAttrType.STR, Enum.HeroAttrType.LUK do
|
||||
local v = GetBaseAttrsByType(baseAttrs, i)
|
||||
if self.oneAttrAddDic then
|
||||
v = v + self.oneAttrAddDic[i]
|
||||
end
|
||||
self["ajustItem"..i].text.text.text = tostring(v)
|
||||
end
|
||||
|
||||
local dic = ManagerContainer.LuaActorDataMgr:GetRoleIncreaseSecondAttrVal(self.controller:GetData(),
|
||||
self.oneAttrAddDic[Enum.HeroAttrType.STR] + GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.STR),
|
||||
self.oneAttrAddDic[Enum.HeroAttrType.AGI] + GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.AGI),
|
||||
self.oneAttrAddDic[Enum.HeroAttrType.INT] + GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.INT),
|
||||
self.oneAttrAddDic[Enum.HeroAttrType.VIT] + GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.VIT),
|
||||
self.oneAttrAddDic[Enum.HeroAttrType.DEX] + GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.DEX),
|
||||
self.oneAttrAddDic[Enum.HeroAttrType.LUK] + GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.LUK)
|
||||
)
|
||||
local iter = dic:GetEnumerator()
|
||||
local twoAttrAddDic = {}
|
||||
while iter:MoveNext() do
|
||||
local newAttrs = heroData.attrs
|
||||
--服务器整数增量 = 取下整(当前本地增量 + 服务器当前 )- 取下整(服务器当前)
|
||||
if newAttrs[iter.Current.Key] ~= nil then
|
||||
local SfServerAdd = SDataUtil.Add(newAttrs[iter.Current.Key] , iter.Current.Value)
|
||||
local ServerAdd = SDataUtil.InvConvertDouble(SfServerAdd)
|
||||
local CurServer = SDataUtil.InvConvertDouble(newAttrs[iter.Current.Key] )
|
||||
twoAttrAddDic[iter.Current.Key] = math.floor(ServerAdd) - math.floor(CurServer)
|
||||
else
|
||||
twoAttrAddDic[iter.Current.Key] = math.floor(iter.Current.Value)
|
||||
end
|
||||
end
|
||||
|
||||
for k,v in pairs(heroData.attrs) do
|
||||
if (k >= Enum.HeroAttrType.Life and k <= Enum.HeroAttrType.CastAcceleration) then
|
||||
local preVal = tostring(math.floor(tonumber(tostring(v))))
|
||||
if twoAttrAddDic[k] > 0 then
|
||||
self["natureInfoItem"..tostring(k)].natureVar.text.text = preVal.." +"..twoAttrAddDic[k]
|
||||
else
|
||||
self["natureInfoItem"..tostring(k)].natureVar.text.text = preVal
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UIRoleInfoView:SaveNatureInfo()
|
||||
if self.oneAttrAddDic == nil or #self.oneAttrAddDic == 0 then return end
|
||||
local saveInfo = {}
|
||||
local baseAttrs = self.controller:GetLastBaseAttrs()
|
||||
for i = Enum.HeroAttrType.STR, Enum.HeroAttrType.LUK do
|
||||
local v = GetBaseAttrsByType(baseAttrs, i)
|
||||
if self.oneAttrAddDic then
|
||||
v = v + self.oneAttrAddDic[i] - 1
|
||||
end
|
||||
saveInfo[i] = v
|
||||
end
|
||||
PrintJson("TAG", saveInfo)
|
||||
self.controller:SendAttrChange(self.controller:GetRoleUid(), saveInfo)
|
||||
self.oneAttrAddDic = {}
|
||||
end
|
||||
|
||||
function UIRoleInfoView:OnClickTabToggle(index)
|
||||
@ -224,11 +381,41 @@ function UIRoleInfoView:OnClickTabToggle(index)
|
||||
|
||||
if index == TAB_TOGGLE_TYPE_NATURE then
|
||||
--self.uIAnimator.weaponTab:SetActive(false)
|
||||
self:SaveNatureInfo()
|
||||
|
||||
elseif index == TAB_TOGGLE_TYPE_SKILL then
|
||||
--self.uIAnimator.weaponTab:SetActive(false)
|
||||
self:SaveNatureInfo()
|
||||
|
||||
elseif index == TAB_TOGGLE_TYPE_WEAPON then
|
||||
self.controller:SendAttrChange(self.controller:GetRoleUid(), self.oneAttrAddDic)
|
||||
--self.uIAnimator.weaponTab:SetActive(true)
|
||||
|
||||
local heroId = self.controller:GetRoleUid()
|
||||
local heroData = self.controller:GetHeroLogicData(heroId)
|
||||
local baseAttrs = self.controller:GetLastBaseAttrs()
|
||||
local jobName, roleName = CommonUtil.GetHeroSplitJobAndNameByUid(heroId, heroData.configId)
|
||||
self.overviewItem1.content.text.text = jobName
|
||||
|
||||
local fightPower = ManagerContainer.DataMgr.UserData:GetAsideFighterSvrPower(heroId, false)
|
||||
self.overviewItem2.content.text.text = tostring(fightPower)
|
||||
|
||||
local str = GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.STR)
|
||||
self.overviewItem3.content.text.text = tostring(str)
|
||||
|
||||
local agi = GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.AGI)
|
||||
self.overviewItem4.content.text.text = tostring(agi)
|
||||
|
||||
local int = GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.INT)
|
||||
self.overviewItem5.content.text.text = tostring(int)
|
||||
|
||||
local vit = GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.VIT)
|
||||
self.overviewItem6.content.text.text = tostring(vit)
|
||||
|
||||
local dex = GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.DEX)
|
||||
self.overviewItem7.content.text.text = tostring(dex)
|
||||
|
||||
local luk = GetBaseAttrsByType(baseAttrs, Enum.HeroAttrType.LUK)
|
||||
self.overviewItem8.content.text.text = tostring(dex)
|
||||
end
|
||||
end
|
||||
|
||||
@ -1236,6 +1423,7 @@ function UIRoleInfoView:AddUIEventListener()
|
||||
end
|
||||
|
||||
function UIRoleInfoView:OnBtnBack()
|
||||
self:SaveNatureInfo()
|
||||
self:UIClose()
|
||||
end
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user