| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- local BuffEntityAnim = require("buff/BuffEntityAnim")
- local BuffEntityFreezed = class("BuffEntityFreezed", BuffEntityAnim)
- function BuffEntityFreezed:ctor(data)
- BuffEntityFreezed.super.ctor(self, data)
- end
- function BuffEntityFreezed:OnEnter()
- BuffEntityFreezed.super.OnEnter(self)
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- self:disable()
- return false
- end
- if not (actor:IsPlayer() or actor:IsMonster()) then
- self:disable()
- return false
- end
- self:FreezeActor()
- end
- function BuffEntityFreezed:OnExit()
- BuffEntityFreezed.super.OnExit(self)
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return nil
- end
- self:UnfreezeActor()
- end
- function BuffEntityFreezed:FreezeActor()
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return nil
- end
- local function freeze(node)
- if self._buffID == global.MMO.BUFF_ID_FREEZED_GRAY then
- self:ShaderGray(node)
- end
- end
- if actor:IsPlayer() then
- local anim = actor:GetAnimation()
- if anim then
- freeze(anim)
- end
- anim = actor:GetAnimationWeapon()
- if anim then
- freeze(anim)
- end
- anim = actor:GetAnimationShield()
- if anim then
- freeze(anim)
- end
- anim = actor:GetAnimationWings()
- if anim then
- freeze(anim)
- end
- anim = actor:GetAnimationMount()
- if anim then
- freeze(anim)
- end
- anim = actor:GetAnimationHair()
- if anim then
- freeze(anim)
- end
- anim = actor:GetAnimationMonster()
- if anim then
- freeze(anim)
- end
- elseif actor:IsMonster() then
- local anim = actor:GetAnimation()
- if anim then
- freeze(anim)
- end
- end
- end
- function BuffEntityFreezed:UnfreezeActor()
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return nil
- end
- local function unfreeze(node)
- self:ShaderNormal(node)
- end
- if actor:IsPlayer() then
- local anim = actor:GetAnimation()
- if anim then
- unfreeze(anim)
- end
- anim = actor:GetAnimationWeapon()
- if anim then
- unfreeze(anim)
- end
- anim = actor:GetAnimationShield()
- if anim then
- unfreeze(anim)
- end
- anim = actor:GetAnimationWings()
- if anim then
- unfreeze(anim)
- end
- anim = actor:GetAnimationMount()
- if anim then
- unfreeze(anim)
- end
- anim = actor:GetAnimationHair()
- if anim then
- unfreeze(anim)
- end
- anim = actor:GetAnimationMonster()
- if anim then
- unfreeze(anim)
- end
- elseif actor:IsMonster() then
- local anim = actor:GetAnimation()
- if anim then
- unfreeze(anim)
- end
- end
- end
- function BuffEntityFreezed:PauseActor()
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return nil
- end
- local function pause(node)
- local AMgr = global.Director:getActionManager()
- AMgr:pauseTarget(node)
- end
- if actor:IsPlayer() then
- local anim = actor:GetAnimation()
- if anim then
- pause(anim)
- end
- anim = actor:GetAnimationWeapon()
- if anim then
- pause(anim)
- end
- anim = actor:GetAnimationShield()
- if anim then
- pause(anim)
- end
- anim = actor:GetAnimationWings()
- if anim then
- pause(anim)
- end
- anim = actor:GetAnimationMount()
- if anim then
- pause(anim)
- end
- anim = actor:GetAnimationHair()
- if anim then
- pause(anim)
- end
- anim = actor:GetAnimationMonster()
- if anim then
- pause(anim)
- end
- elseif actor:IsMonster() then
- local anim = actor:GetAnimation()
- if anim then
- pause(anim)
- end
- end
- end
- function BuffEntityFreezed:ResumeActor()
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return nil
- end
- local function resume(node)
- local AMgr = global.Director:getActionManager()
- AMgr:resumeTarget(node)
- end
- if actor:IsPlayer() then
- local anim = actor:GetAnimation()
- if anim then
- resume(anim)
- end
- anim = actor:GetAnimationWeapon()
- if anim then
- resume(anim)
- end
- anim = actor:GetAnimationShield()
- if anim then
- resume(anim)
- end
- anim = actor:GetAnimationWings()
- if anim then
- resume(anim)
- end
- anim = actor:GetAnimationMount()
- if anim then
- resume(anim)
- end
- anim = actor:GetAnimationHair()
- if anim then
- resume(anim)
- end
- anim = actor:GetAnimationMonster()
- if anim then
- resume(anim)
- end
- elseif actor:IsMonster() then
- local anim = actor:GetAnimation()
- if anim then
- resume(anim)
- end
- end
- end
- function BuffEntityFreezed:ShaderGray(node)
- if not node then
- return
- end
- local p = global.GLProgramCache:getGLProgram("ShaderUIGrayScale")
- node:setGLProgram(p)
- end
- function BuffEntityFreezed:ShaderGold(node)
- if not node then
- return
- end
- global.Facade:sendNotification(global.NoticeTable.HighLightNodeShader, node, global.MMO.SHADER_TYPE_GOLDEN)
- end
- function BuffEntityFreezed:ShaderNormal(node)
- if not node then
- return
- end
- local p = global.GLProgramCache:getGLProgram("ShaderPositionTextureColor_noMVP")
- node:setGLProgram(p)
- end
- function BuffEntityFreezed:IsAllowAnimUpdate()
- return true
- end
- function BuffEntityFreezed:UpdatePresent()
- local actor = global.actorManager:GetActor(self._actorID)
- if not actor then
- return false
- end
- if not (actor:IsPlayer() or actor:IsMonster()) then
- return false
- end
- self:FreezeActor()
- end
- return BuffEntityFreezed
|