装备文字过长、仙缘宝箱优化、充值妖晶提示问题
parent
de119179ca
commit
a2c8352e29
|
@ -1522,4 +1522,63 @@ function ResetItemView(root,rewardRoot,itemList,max,scale,sortingOrder,type,...)
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--计算字符串长度
|
||||
function LengthString(inputstr)
|
||||
-- 计算字符串宽度
|
||||
-- 可以计算出字符宽度,用于显示使用
|
||||
local lenInByte = #inputstr
|
||||
local width = 0
|
||||
local i = 1
|
||||
while (i<=lenInByte)
|
||||
do
|
||||
local curByte = string.byte(inputstr, i)
|
||||
local byteCount = 1;
|
||||
if curByte>0 and curByte<=127 then
|
||||
byteCount = 1 --1字节字符
|
||||
elseif curByte>=192 and curByte<223 then
|
||||
byteCount = 2 --双字节字符
|
||||
elseif curByte>=224 and curByte<239 then
|
||||
byteCount = 3 --汉字
|
||||
elseif curByte>=240 and curByte<=247 then
|
||||
byteCount = 4 --4字节字符
|
||||
end
|
||||
local char = string.sub(inputstr, i, i+byteCount-1)
|
||||
-- print(char)
|
||||
i = i + byteCount -- 重置下一字节的索引
|
||||
width = width + 1 -- 字符的个数(长度)
|
||||
end
|
||||
return width
|
||||
end
|
||||
|
||||
function SubString(inputstr,num)
|
||||
local num = num and num or 0
|
||||
local str = ""
|
||||
local lenInByte = #inputstr
|
||||
local width = 0
|
||||
local i = 1
|
||||
while (i<=lenInByte)
|
||||
do
|
||||
local curByte = string.byte(inputstr, i)
|
||||
local byteCount = 1;
|
||||
if curByte>0 and curByte<=127 then
|
||||
byteCount = 1 --1字节字符
|
||||
elseif curByte>=192 and curByte<223 then
|
||||
byteCount = 2 --双字节字符
|
||||
elseif curByte>=224 and curByte<239 then
|
||||
byteCount = 3 --汉字
|
||||
elseif curByte>=240 and curByte<=247 then
|
||||
byteCount = 4 --4字节字符
|
||||
end
|
||||
local char = string.sub(inputstr, i, i+byteCount-1)
|
||||
-- print(char)
|
||||
str = str..char
|
||||
i = i + byteCount -- 重置下一字节的索引
|
||||
width = width + 1 -- 字符的个数(长度)
|
||||
if width == num then
|
||||
return (str)
|
||||
end
|
||||
end
|
||||
return str
|
||||
end
|
|
@ -255,7 +255,15 @@ function this.SingleItemDataShow(_go, _itemData)
|
|||
Util.GetGameObject(_go.gameObject, "GameObject/item/icon"):GetComponent("Image").sprite = Util.LoadSprite(_itemData.icon)
|
||||
Util.GetGameObject(_go.gameObject, "GameObject/item/icon"):SetActive(true)
|
||||
Util.GetGameObject(_go.gameObject, "GameObject/item/circleFrameBg"):SetActive(false)
|
||||
Util.GetGameObject(_go.gameObject, "GameObject/name"):GetComponent("Text").text = _itemData.itemConfig.Name
|
||||
|
||||
local str=""
|
||||
if LengthString(_itemData.itemConfig.Name)>6 then
|
||||
str=SubString(_itemData.itemConfig.Name,5).."..."
|
||||
else
|
||||
str = _itemData.itemConfig.Name
|
||||
end
|
||||
|
||||
Util.GetGameObject(_go.gameObject, "GameObject/name"):GetComponent("Text").text = str
|
||||
local upHeroInage = Util.GetGameObject(_go.transform, "GameObject/item/upHeroInage")
|
||||
|
||||
local UI_Effect_jinkuang_Fang = Util.GetGameObject(_go.transform, "GameObject/effects/UI_Effect_jinkuang_Fang")
|
||||
|
@ -722,4 +730,5 @@ function this.ShowGuideGo()
|
|||
JumpManager.ShowGuide(UIName.BagPanel, item1Btn)
|
||||
end
|
||||
end
|
||||
|
||||
return BagPanel
|
|
@ -28,6 +28,7 @@ function this:BindEvent()
|
|||
RecruitManager.RecruitRequest(RecruitType.RecruitBox, function(msg)
|
||||
UIManager.OpenPanel(UIName.SingleRecruitPanel, msg.drop.Hero[1],RecruitType.RecruitBox,1)
|
||||
this.curNum.text=string.format(Language[11637],BagManager.GetItemCountById(94))
|
||||
parent:ClosePanel()
|
||||
end)
|
||||
end)
|
||||
|
||||
|
|
|
@ -306,15 +306,15 @@ function UpView:RechargeType(_type)
|
|||
UIManager.OpenPanel(UIName.ElementDrawCardPanel)
|
||||
elseif _type == UpViewRechargeType.DemonCrystal then
|
||||
-- 充值商店
|
||||
if not MapManager.isInMap then
|
||||
-- if not MapManager.isInMap then
|
||||
if not ShopManager.IsActive(SHOP_TYPE.SOUL_STONE_SHOP) then
|
||||
PopupTipPanel.ShowTip(Language[10438])
|
||||
return
|
||||
end
|
||||
UIManager.OpenPanel(UIName.MainRechargePanel, 1)
|
||||
else
|
||||
PopupTipPanel.ShowTip(Language[12099])
|
||||
end
|
||||
-- else
|
||||
-- PopupTipPanel.ShowTip(Language[12099])
|
||||
-- end
|
||||
elseif _type == UpViewRechargeType.SoulCrystal then
|
||||
-- 充值商店
|
||||
if not MapManager.isInMap then
|
||||
|
|
Loading…
Reference in New Issue