功能:事件出发,向上飘出文本或者图片或者两个都有,渐隐消失
虽然是框架下实现的,不过基本逻辑都可以用。
写得不好,先留着。
viewr类的方法,具体实现功能
local this = {}
local ctrl =
nil
local stringList = {}
this.
gameObject =
nil
function
this.Init(
_ctrl)
ctrl = _ctrl
this.
gameObject = lua_function.
LoadInstanceGameObject(
"popMessage")
this.
_endPos = lua_function.
GetChild (this.
gameObject,
"endPos"):
GetComponent(
"Transform")
end
--飘窗的动画控制
function
this.animationController(
_gameObject,
_data)
if _gameObject ==
nil
then
return
end
coroutine.
start(
function()
lua_function.
MoveToWorld(_gameObject, _gameObject.
transform.
position.
x, (_gameObject.
transform.
position.
y +
300), _gameObject.
transform.
position.
z,
1.5,
nil)
coroutine.
wait(
1)
lua_function.
ChangeAlpha(_gameObject,
0,
0.5,
nil)
coroutine.
wait(
0.5)
lua_function.
Destroied(_gameObject)
-- remove掉stringList中储存的message
for k , v
in
pairs(stringList)
do
if v == _data[
"msg"]
then
table.remove(stringList, k)
end
end
end)
end
--参数
--messageType = 1 or 2 1纯文本 2带图片
--mas = "string"
--color = { r = 0, g = 0, b = 0}
--ima = "path"
function
this.Draw(
_data)
--判断没有消失的message里面有没有重复的,如果有重复的返回false,没有true
if
isEnable(_data) ==
false
then
return
end