46 lines
1.6 KiB
Lua
46 lines
1.6 KiB
Lua
require("Modules/Map/Config/MapConfig")
|
|
local MapPointConfig = ConfigManager.GetConfig(ConfigName.MapPointConfig)
|
|
MonsterLiveView = {}
|
|
|
|
function MonsterLiveView:New(gameObject,iconId)
|
|
local b = {}
|
|
b.gameObject = poolManager:LoadAsset("UI_MapPoint", PoolManager.AssetType.GameObject)
|
|
b.gameObject.name = "EventPoint"
|
|
b.gameObject:SetActive(true)
|
|
b.transform = gameObject.transform
|
|
Util.GetGameObject(b.gameObject, "shadow"):SetActive(true)
|
|
b.resPath = "UI_MapPoint"
|
|
b.livePath = MapFloatingConfig[iconId].name
|
|
b.iconId = iconId
|
|
b.live2d = poolManager:LoadLive(MapFloatingConfig[iconId].name, Util.GetTransform(b.gameObject, "root"),
|
|
MapFloatingConfig[iconId].scale, MapFloatingConfig[iconId].position)
|
|
b.skeleton = b.live2d:GetComponent("SkeletonGraphic")
|
|
setmetatable(b, { __index = MonsterLiveView })
|
|
return b
|
|
end
|
|
|
|
-- 设置事件点动画
|
|
function MonsterLiveView:SetPointAnimation(iconId, index)
|
|
local skeleton = self.live:GetComponent("SkeletonGraphic")
|
|
local animation = ANIMATION[iconId]
|
|
if animation then
|
|
local aniName = ANIMATION[iconId].animation[index]
|
|
if aniName then
|
|
skeleton.AnimationState:SetAnimation(0, aniName, false)
|
|
end
|
|
else
|
|
--Log("当前地图点立绘没有其他动画!")
|
|
end
|
|
end
|
|
|
|
function MonsterLiveView:OnClose()
|
|
if self.live2d then
|
|
poolManager:UnLoadLive(self.livePath, self.live2d)
|
|
end
|
|
self.live2d = nil
|
|
|
|
if self.gameObject then
|
|
poolManager:UnLoadAsset(self.resPath, self.gameObject, PoolManager.AssetType.GameObject)
|
|
self.gameObject = nil
|
|
end
|
|
end |