【山河社稷图】提交
parent
46fe5a1b8d
commit
68f92b5bd0
File diff suppressed because it is too large
Load Diff
|
@ -1775,6 +1775,48 @@ function SubString(inputstr,num)
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--都截取长度
|
||||||
|
function SpliteAndInsertString(_inputstr,_maxNum,_cutNum,_insert)
|
||||||
|
local str = ""
|
||||||
|
local str2 = ""
|
||||||
|
if not _inputstr or _inputstr == "" then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
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 -- 字符的个数(长度)
|
||||||
|
if width <= _cutNum then
|
||||||
|
str = str..char
|
||||||
|
else
|
||||||
|
str2 = str2..char
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if width <= _maxNum then
|
||||||
|
LogPink("1:"..tostring(_inputstr))
|
||||||
|
return _inputstr
|
||||||
|
else
|
||||||
|
LogPink("2:"..tostring(str.._insert..str2))
|
||||||
|
return str.._insert..str2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function FixableString(inputstr,num)
|
function FixableString(inputstr,num)
|
||||||
if LengthString(inputstr) > num then
|
if LengthString(inputstr) > num then
|
||||||
return SubString(inputstr,num-1).."..."
|
return SubString(inputstr,num-1).."..."
|
||||||
|
|
|
@ -97,7 +97,7 @@ function this.InitView()
|
||||||
getStarImage:SetActive(state)
|
getStarImage:SetActive(state)
|
||||||
Util.GetGameObject(conditionGo, "star/Num"):GetComponent("Text").text = i
|
Util.GetGameObject(conditionGo, "star/Num"):GetComponent("Text").text = i
|
||||||
local color = state and "00FF66" or "FDEBC2"
|
local color = state and "00FF66" or "FDEBC2"
|
||||||
Util.GetGameObject(conditionGo, "Text"):GetComponent("Text").text = string.format( "<color=#%s>%s</color>",color,HardStageCondition[v].Describe)
|
Util.GetGameObject(conditionGo, "Text"):GetComponent("Text").text = string.format( "<color=#%s>%s</color>",color,SpliteAndInsertString(HardStageCondition[v].Describe,7,6,"\n"))
|
||||||
end
|
end
|
||||||
if this.nodeData.isFirst then
|
if this.nodeData.isFirst then
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
|
|
Loading…
Reference in New Issue