【称号坐骑时装】 协议 无尽副本修改

dev_chengFeng
zhangqiang 2021-03-29 12:07:28 +08:00
parent 9637337c39
commit 51bb90edce
7 changed files with 213 additions and 136 deletions

View File

@ -311,18 +311,8 @@ function this:BindEvent()
table.insert(curNPCList,view)
end
end)
self.playerView = MainPlayerView.New(true, this.btnClickMove, rect, Vector2.New(-1210, 0))
table.insert(curNPCList,self.playerView)
--角色点击行走
self.trigger.onPointerClick = self.trigger.onPointerClick + function(p, d)
local x, v2 = RectTransformUtility.ScreenPointToLocalPointInRectangle(btnClickMoveTran, Input.mousePosition, UIManager.camera, nil)
if not self.moveTween.enabled then
local b1 = v2.x < rect.xMax and v2.x > rect.xMin and v2.y < rect.yMax and v2.y > rect.yMin
if b1 then
self.playerView:SetRolePos(v2)
end
end
end
--实例化自己
this:OnChangeTitleOrRideOrSkin(rect)
--GM工具
Util.AddClick(this.headBox, function()
@ -792,6 +782,9 @@ function this:OnShow()
this.playerHead:SetLayer(this.sortingOrder)
this.playerHead:SetEffectScale(0.85)
--刷新主城npc
PlayerManager.SetisRefreshMainPanelNpc(true)
this:OnChangeTitleOrRideOrSkin()
Log(string.format("---------------------%s", BagManager.GetItemCountById(14)))
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.Main })
@ -1376,4 +1369,33 @@ function this.OnMainPlayerNPCRefresh()
end
end
end
function this:OnChangeTitleOrRideOrSkin()
local curisRefreshMainPanelNpc = PlayerManager.GetisRefreshMainPanelNpc()
LogBlue("sssssssssssssssssssssssssssssssssssss "..tostring(curisRefreshMainPanelNpc))
if not curisRefreshMainPanelNpc then return end
local btnClickMoveTran = this.btnClickMove:GetComponent("RectTransform")
local rect = btnClickMoveTran.rect
if self.playerView then
for key, value in pairs(curNPCList) do
if value == self.playerView then
LogBlue("移除旧的 self.playerView")
table.remove(curNPCList,key)
end
end
self.playerView.NpcGO:OnClose()
end
self.playerView = MainPlayerView.New(true, this.btnClickMove, rect, Vector2.New(-1210, 0))
table.insert(curNPCList,self.playerView)
--角色点击行走
self.trigger.onPointerClick = self.trigger.onPointerClick + function(p, d)
local x, v2 = RectTransformUtility.ScreenPointToLocalPointInRectangle(btnClickMoveTran, Input.mousePosition, UIManager.camera, nil)
if not self.moveTween.enabled then
local b1 = v2.x < rect.xMax and v2.x > rect.xMin and v2.y < rect.yMax and v2.y > rect.yMin
if b1 then
self.playerView:SetRolePos(v2)
end
end
end
PlayerManager.SetisRefreshMainPanelNpc(false)
end
return MainPanel

View File

@ -3,33 +3,35 @@ local this = {}
local ctrlView = require("Modules/Map/View/MapControllView")
local mapNpcOp = "UI_effect_DiTu_huoguang"
local mapNpc = "live2d_npc_map"
local mapNpc2 = "live2d_npc_map_nv"
-- local mapNpc = "live2d_npc_map"
-- local mapNpc2 = "live2d_npc_map_nv"
local npc, scale
local testAnims = {
"jingya",
"lauch",
"touch"
}
local SkeletonGraphic
-- local testAnims = {
-- "jingya",
-- "lauch",
-- "touch"
-- }
-- local SkeletonGraphic
-- 设置idel动画时角色是否还在行走
local isRoleWalk = false
local idleFunc = function()
if this.bLeaderIsIdle and not isRoleWalk and SkeletonGraphic and SkeletonGraphic.AnimationState then
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
SkeletonGraphic.transform.localEulerAngles = Vector3.zero
if this.bLeaderIsIdle and not isRoleWalk then--and SkeletonGraphic and SkeletonGraphic.AnimationState
-- SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
-- SkeletonGraphic.transform.localEulerAngles = Vector3.zero
this.NpcGO:SetWalkDir(WALK_DIR.IDLE_FRONT)
end
end
local index = 1
local index = Random.Range(9,11)
local AnimTimer = Timer.New(function ()
if SkeletonGraphic and not isRoleWalk and this.leader then
if not isRoleWalk and this.leader then--SkeletonGraphic and
PlayUIAnim(Util.GetGameObject(this.leader, "root/ui/arrow"))
SkeletonGraphic.AnimationState:SetAnimation(0, testAnims[index], false)
index = index + 1
if index > 3 then
index = 1
end
-- SkeletonGraphic.AnimationState:SetAnimation(0, testAnims[index], false)
this.NpcGO:SetWalkDir(index)
-- index = index + 1
-- if index > 3 then
-- index = 1
-- end
end
end, 5, -1, true)
local MapPanel
@ -74,10 +76,14 @@ function this.Init(pos,num)
if num ==1 then
this.InitRolePre(u, v)
end
SkeletonGraphic = Util.GetGameObject(this.leader, "root/ui/roleRoot/npc"):GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idleFunc
SkeletonGraphic.AnimationState:SetAnimation(0, "lauch", false)
SkeletonGraphic.transform.localEulerAngles = Vector3.zero
-- SkeletonGraphic = Util.GetGameObject(this.leader, "root/ui/roleRoot/npc"):GetComponent("SkeletonGraphic")
-- SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idleFunc
-- SkeletonGraphic.AnimationState:SetAnimation(0, "lauch", false)
-- SkeletonGraphic.transform.localEulerAngles = Vector3.zero
if this.NpcGO then
this.NpcGO:CurAnimationCompleteAddFun(idleFunc)
this.NpcGO:SetWalkDir(WALK_DIR.LAUCH)
end
AnimTimer:Start()
this.leader:SetActive(true)
TileMapView.CameraTween(this.leaderMapData.u, this.leaderMapData.v, 0.4)
@ -129,10 +135,15 @@ function this.InitRolePre(u, v)
this.leader.transform.localPosition = Vector3(v3.x, v3.y, v3.z - 10)
this.leader.transform.localScale = Vector3.one * 1.5
npc = NameManager.roleSex == ROLE_SEX.BOY and mapNpc or mapNpc2
scale = NameManager.roleSex == ROLE_SEX.BOY and Vector3.one or Vector3.one * 0.5
this.NpcGO = poolManager:LoadLive(npc, Util.GetTransform(this.leader, "root/ui/roleRoot"), scale, Vector3.zero)
this.NpcGO.name = "npc"
-- npc = NameManager.roleSex == ROLE_SEX.BOY and mapNpc or mapNpc2
-- scale = NameManager.roleSex == ROLE_SEX.BOY and Vector3.one or Vector3.one * 0.5
-- this.NpcGO = poolManager:LoadLive(npc, Util.GetTransform(this.leader, "root/ui/roleRoot"), scale, Vector3.zero)
-- this.NpcGO.name = "npc"
if this.NpcGO then
this.NpcGO:OnClose()
end
this.NpcGO = PlayerLiveView:New(Util.GetTransform(this.leader, "root/ui/roleRoot"),1)
this.NpcGO:OnOpen(100,Vector3.New(0,40,0),WALK_DIR.IDLE_FRONT)
end
function this.RefreshOption()
@ -406,25 +417,25 @@ end
-- ========================== 角色行走管理 ==========================================
-- 设置角色行走方向
local WALK_DIR = {
RIGHT = {animation = "move2", y = 0},
LEFT = {animation = "move2", y = 180},
UP = {animation = "move3", y = 0},
DOWN = {animation = "move", y = 0},
}
-- local WALK_DIR = {
-- RIGHT = {animation = "move2", y = 0},
-- LEFT = {animation = "move2", y = 180},
-- UP = {animation = "move3", y = 0},
-- DOWN = {animation = "move", y = 0},
-- }
function this.SetRoleDirAction(u, v, isBack)
local dU = isBack and this.leaderMapData.u - u or u - this.leaderMapData.u
local dV = isBack and this.leaderMapData.v - v or v - this.leaderMapData.v
if dU > 0 then
this.SetWalkDir(WALK_DIR.RIGHT)
this.SetWalkDir(WALK_DIR.RUN_RIGHT)
elseif dU < 0 then
this.SetWalkDir(WALK_DIR.LEFT)
this.SetWalkDir(WALK_DIR.RUN_LEFT)
elseif dV < 0 then
this.SetWalkDir(WALK_DIR.UP)
this.SetWalkDir(WALK_DIR.RUN_UP)
elseif dV > 0 then
this.SetWalkDir(WALK_DIR.DOWN)
this.SetWalkDir(WALK_DIR.RUN_DOWN)
end
SoundManager.PlaySound(SoundConfig.Sound_FootStep..math.random(1,7))
end
@ -433,20 +444,22 @@ function this.SetWalkDir(dir)
isRoleWalk = true
if not curDir or curDir ~= dir then
curDir = dir
if SkeletonGraphic then
SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, dir.y, 0)
SkeletonGraphic.AnimationState:SetAnimation(0, dir.animation, true)
end
-- if SkeletonGraphic then
-- SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, dir.y, 0)
-- SkeletonGraphic.AnimationState:SetAnimation(0, dir.animation, true)
-- end
this.NpcGO:SetWalkDir(dir)
end
end
function this.SetRoleBattleAction()
curDir = nil
if SkeletonGraphic then
SkeletonGraphic.AnimationState:SetAnimation(0, "jingya", false)
SkeletonGraphic.transform.localEulerAngles = Vector3.zero
end
-- if SkeletonGraphic then
-- SkeletonGraphic.AnimationState:SetAnimation(0, "jingya", false)
-- SkeletonGraphic.transform.localEulerAngles = Vector3.zero
-- end
this.NpcGO:SetWalkDir(WALK_DIR.JINGYA)
end
-- 设置角色的位置
@ -485,9 +498,12 @@ end
function this.PlayerIdle()
this.bLeaderIsIdle = true
AnimTimer:Start()
if SkeletonGraphic and SkeletonGraphic.AnimationState then
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
SkeletonGraphic.transform.localEulerAngles = Vector3.zero
-- if SkeletonGraphic and SkeletonGraphic.AnimationState then
-- SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
-- SkeletonGraphic.transform.localEulerAngles = Vector3.zero
-- end
if this.NpcGO then
this.NpcGO:SetWalkDir(WALK_DIR.IDLE_FRONT)
end
curDir = nil
isRoleWalk = false
@ -502,17 +518,19 @@ end
function this.Dispose()
AnimTimer:Stop()
if this.NpcGO then
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idleFunc
poolManager:UnLoadLive(npc, this.NpcGO)
this.NpcGO:OnClose()
end
-- if this.NpcGO then
-- SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idleFunc
-- poolManager:UnLoadLive(npc, this.NpcGO)
-- end
if this.leader then
poolManager:UnLoadAsset(mapNpcOp, this.leader, PoolManager.AssetType.GameObject)
end
this.leader = nil
this.NpcGO = nil
SkeletonGraphic = nil
-- this.NpcGO = nil
-- SkeletonGraphic = nil
-- buff
Util.SetParticleScale(this.buffEffectRoot, 0.5) -- 重置buff特效回原大小

View File

@ -35,6 +35,7 @@ this.headFrameList = {}
this.MainPanelRoleMonveState = false
--激活的称号 时装 坐骑
this.isRefreshMainPanelNpc = false
this.userSkinList = {}--[id] = {skinId , overTime}
this.userTitleList = {}--[id] = {titleId , overTime}
this.userMountList = {}--[id] = {mountId , overTime}
@ -346,6 +347,12 @@ function this.GetPlayerRide(value)
--加判断是否到时间 卸掉
return PlayerManager.ride
end
function this.SetisRefreshMainPanelNpc(state)
this.isRefreshMainPanelNpc = state
end
function this.GetisRefreshMainPanelNpc(state)
return this.isRefreshMainPanelNpc
end
--初始化所以激活的称号 时装 坐骑
function this.InitSkinTitleMountData(userSkinList,userTitleList,userMountList)
this.userSkinList = {}--[id] = {skinId , overTime}
@ -372,15 +379,15 @@ function this.InitSkinTitleMountData(userSkinList,userTitleList,userMountList)
end
end
--设置称号 时装 坐骑 的限时时间
function this.SetPlayerSkinTime(id,overTime)
function this.SetPlayerSkinTime(id,validTime)
if this.userSkinList then
if overTime then--不为空时是设置时间 没有会新加数据
if validTime then--不为空时是设置时间 没有会新加数据
if this.userSkinList[id] then
this.userSkinList[id].overTime = overTime
this.userSkinList[id].validTime = validTime
else
local singData = {}
singData.skinId = id
singData.overTime = overTime
singData.validTime = validTime
this.userSkinList[singData.skinId] = singData
end
else--为空时是删除数据 倒计时结束时
@ -391,15 +398,15 @@ function this.SetPlayerSkinTime(id,overTime)
end
end
function this.SetPlayerTitleTime(id,overTime)
function this.SetPlayerTitleTime(id,validTime)
if this.userTitleList then
if overTime then--不为空时是设置时间 没有会新加数据
if validTime then--不为空时是设置时间 没有会新加数据
if this.userTitleList[id] then
this.userTitleList[id].overTime = overTime
this.userTitleList[id].validTime = validTime
else
local singData = {}
singData.titleId = id
singData.overTime = overTime
singData.validTime = validTime
this.userTitleList[singData.titleId] = singData
end
else--为空时是删除数据 倒计时结束时
@ -410,15 +417,15 @@ function this.SetPlayerTitleTime(id,overTime)
end
end
function this.SetPlayerMountTime(id,overTime)
function this.SetPlayerMountTime(id,validTime)
if this.userMountList then
if overTime then--不为空时是设置时间 没有会新加数据
if validTime then--不为空时是设置时间 没有会新加数据
if this.userMountList[id] then
this.userMountList[id].overTime = overTime
this.userMountList[id].validTime = validTime
else
local singData = {}
singData.mountId = id
singData.overTime = overTime
singData.validTime = validTime
this.userMountList[singData.mountId] = singData
end
else--为空时是删除数据 倒计时结束时

View File

@ -340,8 +340,9 @@ function RewardItemPopup:SetItemShow(drop)
UIManager.OpenPanel(UIName.DropGetSSRHeroShopPanel,curItemData.backData, func)
elseif curItemData.configData and curItemData.itemType==1 and
(curItemData.configData.ItemType == ItemType.Title or curItemData.configData.ItemType == ItemType.Ride) then--皮肤 坐骑
isPopGetSSR = true
UIManager.OpenPanel(UIName.DropGetPlayerDecorateShopPanel,curItemData.backData, func)
-- isPopGetSSR = true
-- UIManager.OpenPanel(UIName.DropGetPlayerDecorateShopPanel,curItemData.backData, func)
func()
else
func()
end

View File

@ -157,6 +157,22 @@ function RewardItemSingleShowPopup:BindEvent()
PopupTipPanel.ShowTip(Language[12171])
end)
end
elseif itemConfigData.ItemType == ItemType.Ride then
if PlayerManager.userMountList[itemConfigData.Id] then
MsgPanel.ShowTwo("当前已激活该坐骑,是否要重复使用?",nil,function()
NetManager.ActiveUserMountRequest(itemSid,function (msg)
PlayerManager.SetPlayerMountTime(itemSid,msg.validTime)
self:ClosePanel()
PopupTipPanel.ShowTip("成功激活坐骑!")
end)
end)
else
NetManager.ActiveUserMountRequest(itemSid,function (msg)
PlayerManager.SetPlayerMountTime(itemSid,msg.validTime)
self:ClosePanel()
PopupTipPanel.ShowTip("成功激活坐骑!")
end)
end
elseif itemConfigData then
JumpManager.GoJump(itemConfigData.UseJump,function ()
this:ClosePanel()

View File

@ -159,17 +159,16 @@ function this.SingleRideClickShowInfo(data,isGet,isUser)
if not isGet and not isUser then
PopupTipPanel.ShowTip( curItemConfig.ItemDescribe)
elseif isGet and not isUser then
NetManager.ActiveUserMountRequest(curPlayerHeadIconConfig.Id,function(msg)
LogBlue("骑上金牛: "..curPlayerHeadIconConfig.Id)
NetManager.RequestChangeModifyDecoration(3,curPlayerHeadIconConfig.Id,function(msg)
PlayerManager.SetPlayerRide(curPlayerHeadIconConfig.Id)
PlayerManager.SetPlayerMountTime(curPlayerHeadIconConfig.Id,msg.validTime)
--刷新主城自己npc
this.ShowPanelData()
PlayerManager.SetisRefreshMainPanelNpc(true)
end)
elseif isGet and isUser then
NetManager.ActiveUserMountRequest(0,function()
LogBlue("取消骑乘")
NetManager.RequestChangeModifyDecoration(3,0,function()
PlayerManager.SetPlayerRide(0)
--刷新主城自己npc
this.ShowPanelData()
PlayerManager.SetisRefreshMainPanelNpc(true)
end)
end
end)

View File

@ -36,7 +36,6 @@ function PlayerLiveView:New(gameObject,_Type, PlayerLiveViewData,orginLayer)
instance.leader.transform:SetParent(gameObject.transform)
instance.leader.transform.localPosition = Vector3.zero
instance.leader.transform.localScale = Vector3.one
LogBlue("gameObject "..gameObject.name)
instance.liveParent = Util.GetGameObject(instance.leader, "liveParent")
instance.rideLiveGo = Util.GetGameObject(instance.leader, "liveParent/rideLive")
instance.playerLiveGo = Util.GetGameObject(instance.leader, "liveParent/playerLive")
@ -160,54 +159,6 @@ function PlayerLiveView:OnShowLive()
end
end
--设置位置
function PlayerLiveView:SelectRenPos(ChapterRolePosition,localScaleVer,_parent)
if self.liveParent then
self.liveParent:SetActive(true)
if _parent then
self.liveParent.transform:SetParent(_parent.transform)
end
self.liveParent.transform.localScale = Vector3.New(localScaleVer[1],localScaleVer[2],1)
self.liveParent:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(ChapterRolePosition[1], ChapterRolePosition[2], 10)
end
end
-- 走动 传 起始位置 和 目标位置
function PlayerLiveView:SetRoleWalk(_pos,_tagerPos,_fun)
local pos = _pos
local targetPos = _tagerPos
local speed = 5 -- 越大越慢 到时候 会读表
self.liveParent.transform:DOLocalMove(targetPos, speed / 5, false):OnStart(function ()
PlayerLiveView:SetRoleDirAction(targetPos.x, targetPos.y, pos.x, pos.y)
end):OnUpdate(function() --TODO:测试速度
end):OnComplete(function ()
Log("行走完毕")
if self.rideLive then
self.rideLivSkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
else
self.playerLiveSkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
end
if _fun then
_fun()
_fun = nil
end
end):SetEase(Ease.Linear)
end
function PlayerLiveView:SetRoleDirAction(targetU, targetV, u0, v0)
local dU = targetU - u0
local dV = targetV - v0
if dU > 0 then
PlayerLiveView:SetWalkDir(WALK_DIR.RUN_RIGHT)
elseif dU < 0 then
PlayerLiveView:SetWalkDir(WALK_DIR.RUN_LEFT)
elseif dV < 0 then
PlayerLiveView:SetWalkDir(WALK_DIR.RUN_UP)
elseif dV > 0 then
PlayerLiveView:SetWalkDir(WALK_DIR.RUN_DOWN)
end
end
function PlayerLiveView:SetWalkDir(dir)
LogBlue("PlayerLiveView dir : "..dir)
@ -304,7 +255,6 @@ function PlayerLiveView:SetWalkDir(dir)
end
end
function PlayerLiveView:SetWalkDirInfo(playerDir,RideDir)
LogBlue("ssssssssssssssssss")
if playerDir and not RideDir then
LogBlue("PlayerLiveView playerDir : "..playerDir.animation .." ".. playerDir.y)
self.playerLiveSkeletonGraphic.transform.localEulerAngles = Vector3.New(0, playerDir.y, 0)
@ -327,7 +277,6 @@ function PlayerLiveView:SetWalkDirInfo(playerDir,RideDir)
end
end
function PlayerLiveView:SetSiblingIndexPlayerOrRide(type)
LogBlue("type "..type)
if type == 1 then--坐骑靠前
self.playerLiveGo.transform:SetSiblingIndex(2)
self.rideLiveGo.transform:SetSiblingIndex(3)
@ -356,4 +305,69 @@ function PlayerLiveView:OnClose()
end
end
--判断动画是否存在
-- function PlayerLiveView:CurAnimationState()
-- -- SkeletonGraphic and SkeletonGraphic.AnimationState
-- return true
-- end
--判断动画是否存在
function PlayerLiveView:CurAnimationCompleteAddFun(idleFunc)
if self.playerLiveSkeletonGraphic then
if self.PlayerLiveViewData.ride and self.PlayerLiveViewData.ride > 0 then
if self.rideLivSkeletonGraphic then
self.rideLivSkeletonGraphic.AnimationState.Complete = self.rideLivSkeletonGraphic.AnimationState.Complete + idleFunc
end
else
self.playerLiveSkeletonGraphic.AnimationState.Complete = self.playerLiveSkeletonGraphic.AnimationState.Complete + idleFunc
end
end
end
--设置位置
function PlayerLiveView:SelectRenPos(ChapterRolePosition,localScaleVer,_parent)
if self.liveParent then
self.liveParent:SetActive(true)
if _parent then
self.liveParent.transform:SetParent(_parent.transform)
end
self.liveParent.transform.localScale = Vector3.New(localScaleVer[1],localScaleVer[2],1)
self.liveParent:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(ChapterRolePosition[1], ChapterRolePosition[2], 10)
end
end
-- 走动 传 起始位置 和 目标位置
function PlayerLiveView:SetRoleWalk(_pos,_tagerPos,_fun)
local pos = _pos
local targetPos = _tagerPos
local speed = 5 -- 越大越慢 到时候 会读表
self.liveParent.transform:DOLocalMove(targetPos, speed / 5, false):OnStart(function ()
PlayerLiveView:SetRoleDirAction(targetPos.x, targetPos.y, pos.x, pos.y)
end):OnUpdate(function() --TODO:测试速度
end):OnComplete(function ()
Log("行走完毕")
if self.rideLive then
self.rideLivSkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
else
self.playerLiveSkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
end
if _fun then
_fun()
_fun = nil
end
end):SetEase(Ease.Linear)
end
function PlayerLiveView:SetRoleDirAction(targetU, targetV, u0, v0)
local dU = targetU - u0
local dV = targetV - v0
if dU > 0 then
PlayerLiveView:SetWalkDir(WALK_DIR.RUN_RIGHT)
elseif dU < 0 then
PlayerLiveView:SetWalkDir(WALK_DIR.RUN_LEFT)
elseif dV < 0 then
PlayerLiveView:SetWalkDir(WALK_DIR.RUN_UP)
elseif dV > 0 then
PlayerLiveView:SetWalkDir(WALK_DIR.RUN_DOWN)
end
end
return PlayerLiveView