【挂机演示优化】挂机界面增加其他玩家
parent
74cc1c48f3
commit
3738137554
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a96f4d8cd3d451f4b9a678f7cf2a5f1d
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -4918,7 +4918,7 @@ ParticleSystem:
|
|||
--- !u!199 &689865173
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -11159,7 +11159,7 @@ ParticleSystem:
|
|||
--- !u!199 &53865032735354669
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -16010,7 +16010,7 @@ ParticleSystem:
|
|||
--- !u!199 &53865032903479894
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -20745,7 +20745,7 @@ ParticleSystem:
|
|||
--- !u!199 &53865033217178009
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -25358,7 +25358,7 @@ ParticleSystem:
|
|||
--- !u!199 &53865033315684810
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -31232,7 +31232,7 @@ ParticleSystem:
|
|||
--- !u!199 &4590674014730051834
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -36818,7 +36818,7 @@ ParticleSystem:
|
|||
--- !u!199 &345244862577150605
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -41838,7 +41838,7 @@ ParticleSystem:
|
|||
--- !u!199 &1416232796398710453
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -46721,7 +46721,7 @@ ParticleSystem:
|
|||
--- !u!199 &1416232796791516457
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -51572,7 +51572,7 @@ ParticleSystem:
|
|||
--- !u!199 &1416232797105522406
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -56255,7 +56255,7 @@ ParticleSystem:
|
|||
--- !u!199 &1416232797563228242
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -62603,7 +62603,7 @@ ParticleSystem:
|
|||
--- !u!199 &4461638917069206421
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -67860,7 +67860,7 @@ ParticleSystem:
|
|||
--- !u!199 &7894323138156412175
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -73670,7 +73670,7 @@ ParticleSystem:
|
|||
--- !u!199 &8153914426121884216
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -78835,7 +78835,7 @@ ParticleSystem:
|
|||
--- !u!199 &4571234231691897658
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -84866,7 +84866,7 @@ ParticleSystem:
|
|||
--- !u!199 &6988990775388982249
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -91516,7 +91516,7 @@ ParticleSystem:
|
|||
--- !u!199 &6133679773105218358
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -96410,7 +96410,7 @@ ParticleSystem:
|
|||
--- !u!199 &6133679773792227019
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -101076,7 +101076,7 @@ ParticleSystem:
|
|||
--- !u!199 &6133679774607836274
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -108238,7 +108238,7 @@ ParticleSystem:
|
|||
--- !u!199 &6340980222856265954
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -112932,7 +112932,7 @@ ParticleSystem:
|
|||
--- !u!199 &4325216380872068964
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -119135,7 +119135,7 @@ ParticleSystem:
|
|||
--- !u!199 &8401744404153833494
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -123912,7 +123912,7 @@ ParticleSystem:
|
|||
--- !u!199 &8401744404278676527
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -128832,7 +128832,7 @@ ParticleSystem:
|
|||
--- !u!199 &5429492888628637653
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
|
|
@ -399,6 +399,7 @@ SubUIConfig = {
|
|||
PlayerInfoView = { name = "PlayerInfoView",assetName = "PlayerInfoView",script = "View/PlayerInfoView" }, -- 玩家信息条
|
||||
RewardPanel = { name = "RewardPanel",assetName = "RewardPanel",script = "View/RewardPanel" }, -- --奖励预览
|
||||
MoneyNumView = { name = "MoneyNumView",assetName = "MoneyNumView",script = "View/MoneyNumView" }, -- 各币种钱数显示
|
||||
SingleFightPlayerView = { name = "SingleFightPlayerView",assetName = "SingleFightPlayerView",script = "View/SingleFightPlayerView" }, -- 挂机界面一个人
|
||||
[1] = {name = "EveryDayGift",assetName = "EveryDayGift",script = "Modules/Recharge/View/EveryDayGift"},
|
||||
[2] = {name = "GiftPre",assetName = "GiftPre",script = "Modules/Recharge/View/GiftPre"},
|
||||
[3] = {name = "RechargeView",assetName = "RechargeView",script = "Modules/Recharge/View/RechargeView"},
|
||||
|
|
|
@ -20,8 +20,11 @@ local function createPanel(uiConfig, parent)
|
|||
transform:SetParent(parent)
|
||||
transform.localScale = Vector3.one
|
||||
local recTransform = transform:GetComponent("RectTransform")
|
||||
recTransform.anchoredPosition3D = Vector3.New(0, 0, 0)
|
||||
recTransform.sizeDelta = Vector2.New(0, 0)
|
||||
if recTransform then
|
||||
recTransform.anchoredPosition3D = Vector3.New(0, 0, 0)
|
||||
recTransform.sizeDelta = Vector2.New(0, 0)
|
||||
end
|
||||
|
||||
transform.localRotation = Quaternion.identity
|
||||
if GetCurLanguage()~=0 then
|
||||
local textArr=gameObject:GetComponentsInChildren(typeof(UnityEngine.UI.Text),true);
|
||||
|
|
|
@ -7,6 +7,8 @@ local this = Game
|
|||
|
||||
--初始化完成,发送链接服务器信息--
|
||||
function Game.Initialize()
|
||||
math.randomseed(os.time())
|
||||
|
||||
this.CurPlatform = tostring(UnityEngine.Application.platform)
|
||||
U3d.Application.runInBackground = true
|
||||
Screen.sleepTimeout = U3d.SleepTimeout.NeverSleep
|
||||
|
|
|
@ -4,6 +4,7 @@ local mainLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig)
|
|||
-- 火洞吊裸
|
||||
local Huo_Dong_Diao_Luo = ConfigManager.GetConfig(ConfigName.ActivityDropReward)
|
||||
local rewardGroupConfig = ConfigManager.GetConfig(ConfigName.RewardGroup)
|
||||
this.talkingTime = 0 --对话时间
|
||||
-- 挂机物品栏位对应vip数值加成特权
|
||||
local _ItemIdToVipPrivilege = {
|
||||
[14] = 1,
|
||||
|
@ -19,6 +20,8 @@ local CHATER_STATE = "CHATER_STATE"
|
|||
|
||||
local OLD_ID = "OLD_ID"
|
||||
local isOpenRewardUpTip = false
|
||||
|
||||
this.randomNum = 1
|
||||
function this.Initialize()
|
||||
this.curOpenFight = 1011 -- 当前开启的关卡
|
||||
this.lastPassFightId = 1011 -- 上一关的ID
|
||||
|
|
|
@ -97,29 +97,39 @@ end
|
|||
--- 遇见一个宝箱
|
||||
--- @parame iconType 图标类型
|
||||
--- @parame roleFaceDir 角色朝向
|
||||
function this.public_MeGetBaby(iconType, roleFaceDir, point, func)
|
||||
function this.public_MeGetBaby(iconType, roleFaceDir, point, func, isSelf)
|
||||
actionCallBack = nil
|
||||
if func then actionCallBack = func end
|
||||
simpleTalk = true
|
||||
-- 对话次数
|
||||
local talktimes = 1
|
||||
|
||||
this.private_SetDialogueBoxDir(roleFaceDir, point, false)
|
||||
this.private_StartBB(talktimes, iconType, point)
|
||||
if isSelf then
|
||||
simpleTalk = true
|
||||
-- 对话次数
|
||||
local talktimes = 1
|
||||
this.private_SetDialogueBoxDir(roleFaceDir, point, false)
|
||||
this.private_StartBB(talktimes, iconType, point)
|
||||
else
|
||||
if actionCallBack then
|
||||
actionCallBack()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- 遇见一个老大爷
|
||||
--- @parame iconType 图标类型
|
||||
--- @parame roleFaceDir 角色朝向
|
||||
function this.public_MeetYourGrandPa(iconType, roleFaceDir, point, func)
|
||||
function this.public_MeetYourGrandPa(iconType, roleFaceDir, point, func, isSelf)
|
||||
actionCallBack = nil
|
||||
if func then actionCallBack = func end
|
||||
simpleTalk = true
|
||||
-- 对话次数
|
||||
local talktimes = 3
|
||||
this.private_SetDialogueBoxDir(roleFaceDir, point, true)
|
||||
this.private_StartBB(talktimes, iconType, point)
|
||||
|
||||
if isSelf then
|
||||
simpleTalk = true
|
||||
-- 对话次数
|
||||
local talktimes = 3
|
||||
this.private_SetDialogueBoxDir(roleFaceDir, point, true)
|
||||
this.private_StartBB(talktimes, iconType, point)
|
||||
else
|
||||
if actionCallBack then
|
||||
actionCallBack()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- 进入战斗
|
||||
|
@ -136,8 +146,6 @@ function this.public_SetBattleTimes(point, roleFaceDir, battleTimes, roleCurPosI
|
|||
if selectPointPos then
|
||||
m_selectPointPos = selectPointPos
|
||||
end
|
||||
|
||||
|
||||
-- 开始战斗
|
||||
this.private_StartBattle(point, roleFaceDir, battleTimes)
|
||||
end
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -332,7 +332,9 @@ end
|
|||
local pathCache = {}
|
||||
function this.ShowPath(u, v, targetU, targetV, funcCanPass)
|
||||
this.ClearPath()
|
||||
if this.IsOutArea(targetU, targetV) then return end
|
||||
if this.IsOutArea(targetU, targetV) then
|
||||
return
|
||||
end
|
||||
local list = _mapData:FindPath(_mapData:GetMapData(u, v), _mapData:GetMapData(targetU, targetV), funcCanPass)
|
||||
if list == nil or #list <= 1 then
|
||||
return nil
|
||||
|
@ -456,6 +458,9 @@ end
|
|||
|
||||
--矩形排列算法(以左上角为原点建立u,v坐标)
|
||||
function this.DrawTilePos(u, v)
|
||||
print(_offsetAngle)
|
||||
print(_offsetAngleValue)
|
||||
print(_tileSize.x, _tileSize.y)
|
||||
return Quaternion.Euler(0,0, _offsetAngle) * Vector3.New(u * _tileSize.x, v * -_tileSize.y, 0) * _offsetAngleValue
|
||||
end
|
||||
|
||||
|
|
|
@ -220,6 +220,9 @@ end
|
|||
function MapPointView:SetPointAnimation(iconId, index)
|
||||
-- 特效资源无动画
|
||||
if MapPointView:IsEffectRes(iconId) then return end
|
||||
if not self.live then
|
||||
return
|
||||
end
|
||||
local skeleton = self.live:GetComponent("SkeletonGraphic")
|
||||
local animation = ANIMATION[iconId]
|
||||
if animation then
|
||||
|
@ -234,6 +237,10 @@ end
|
|||
|
||||
function MapPointView:Dispose()
|
||||
self.hadExit = true
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
-- 特效资源的销毁
|
||||
if MapPointView:IsEffectRes(self.iconId) then
|
||||
if self.live and not self.hadDispose then
|
||||
|
|
|
@ -619,7 +619,7 @@ function this.StarBattleUpLvTipTime(type)
|
|||
if type == 1 and curMianPanleLoginShowTipNum < noShowBattleUpLvTipMaxNum then--主界面
|
||||
battleUpLvTipTime = Timer.New(function()
|
||||
curSecound = curSecound + 1
|
||||
-- LogGreen("主界面停留 "..curSecound)
|
||||
-- ----LogGreen("主界面停留 "..curSecound)
|
||||
if curSecound >= showBattleUpLvTipMaxTime then
|
||||
if battleUpLvTipTime then
|
||||
battleUpLvTipTime:Stop()
|
||||
|
@ -633,7 +633,7 @@ function this.StarBattleUpLvTipTime(type)
|
|||
elseif type == 2 and curLevelPanleLoginShowTipNum < noShowBattleUpLvTipMaxNum then--关卡界面
|
||||
battleUpLvTipTime = Timer.New(function()
|
||||
curSecound = curSecound + 1
|
||||
-- LogGreen("关卡界面停留 "..curSecound)
|
||||
-- ----LogGreen("关卡界面停留 "..curSecound)
|
||||
if curSecound >= showBattleUpLvTipMaxTime then
|
||||
if battleUpLvTipTime then
|
||||
battleUpLvTipTime:Stop()
|
||||
|
@ -672,7 +672,7 @@ function this.GetMainPlayerNPCData(fun)
|
|||
if friendRandomNum == 2 and PlayerManager.familyId == 0 then
|
||||
friendRandomNum = 1
|
||||
end
|
||||
-- LogGreen("friendRandomNum "..friendRandomNum)
|
||||
-- ----LogGreen("friendRandomNum "..friendRandomNum)
|
||||
local curfriendAllList = {}
|
||||
if friendRandomNum == 1 then
|
||||
NetManager.RequestGetFriendInfo(1,function(msg)
|
||||
|
@ -689,10 +689,10 @@ function this.GetMainPlayerNPCData(fun)
|
|||
else
|
||||
for i = 1, #curfriendAllList do
|
||||
friendNPCList[i] = curfriendAllList[i]
|
||||
-- LogGreen("friend "..msg.Friends[i].name)
|
||||
-- ----LogGreen("friend "..msg.Friends[i].name)
|
||||
end
|
||||
end
|
||||
-- LogGreen("#friendNPCList "..#friendNPCList)
|
||||
-- ----LogGreen("#friendNPCList "..#friendNPCList)
|
||||
this.GetMainPlayerNPCData2(fun)
|
||||
end)
|
||||
else
|
||||
|
@ -711,20 +711,127 @@ function this.GetMainPlayerNPCData(fun)
|
|||
else
|
||||
for i = 1, #curfriendAllList do
|
||||
friendNPCList[i] = curfriendAllList[i]
|
||||
-- LogGreen("MyGuildMemList "..MyGuildMemList[i].userName)
|
||||
-- ----LogGreen("MyGuildMemList "..MyGuildMemList[i].userName)
|
||||
end
|
||||
end
|
||||
-- LogGreen("#MyGuildMemList "..#friendNPCList)
|
||||
-- ----LogGreen("#MyGuildMemList "..#friendNPCList)
|
||||
this.GetMainPlayerNPCData2(fun)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function this.GetPlayerViewDataByType(index,randomList,needNum,func)
|
||||
local x = function(index,needNum,randomList)
|
||||
--LogGreen("后 needNum:"..needNum.." randomList:".. LengthOfTable(randomList).." index:"..index)
|
||||
needNum = needNum - LengthOfTable(randomList)
|
||||
if needNum > 0 then
|
||||
this.GetPlayerViewDataByType(index,randomList,needNum,func)
|
||||
else
|
||||
if func then
|
||||
func(randomList)
|
||||
end
|
||||
end
|
||||
end
|
||||
if index == 1 then
|
||||
local friendNPCList1 = {}
|
||||
NetManager.RequestGetFriendInfo(1,function(msg)
|
||||
--LogGreen("发送好友信息")
|
||||
for i = 1, #msg.Friends do
|
||||
if msg.Friends[i].id ~= PlayerManager.uid then
|
||||
LogBlue("msg.Friends[i] "..msg.Friends[i].userSkin.." "..msg.Friends[i].userTitle.." "..msg.Friends[i].userMount.." "..msg.Friends[i].sex)
|
||||
table.insert(friendNPCList1,msg.Friends[i])
|
||||
end
|
||||
end
|
||||
--LogGreen("前 needNum:"..needNum.." randomList:"..LengthOfTable(randomList))
|
||||
randomList = this.AddPlayer(friendNPCList1,randomList,needNum)
|
||||
x(2,needNum,randomList)
|
||||
end)
|
||||
elseif index == 2 then
|
||||
local GuildNPCList1 = {}
|
||||
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.GUILD) and PlayerManager.familyId ~= 0 then
|
||||
MyGuildManager.RequestMyGuildMembers(function()
|
||||
--LogGreen("发送工会成员信息")
|
||||
local MyGuildMemList = MyGuildManager.GetMyGuildMemList()
|
||||
for i = 1, #MyGuildMemList do
|
||||
if MyGuildMemList[i].roleUid ~= PlayerManager.uid then
|
||||
LogBlue("MyGuildMemList[i] "..MyGuildMemList[i].userSkin.." "..MyGuildMemList[i].userTitle.." "..MyGuildMemList[i].userMount.." "..MyGuildMemList[i].sex)
|
||||
table.insert(GuildNPCList1,MyGuildMemList[i])
|
||||
end
|
||||
end
|
||||
--LogGreen("前 needNum:"..needNum.." randomList:"..LengthOfTable(randomList))
|
||||
randomList = this.AddPlayer(GuildNPCList1,randomList,needNum)
|
||||
x(3,needNum,randomList)
|
||||
end)
|
||||
else
|
||||
x(3,needNum,randomList)
|
||||
end
|
||||
|
||||
elseif index == 3 then
|
||||
local rankNPCList1 = {}
|
||||
RankingManager.InitData(rankKingList[1].rankType, function()
|
||||
--LogGreen("发送排行榜信息")
|
||||
local rankAllList = RankingManager.GetRankingInfo()
|
||||
for i = 1, math.max(20,#rankAllList) do
|
||||
if rankAllList[i] and rankAllList[i].uid ~= PlayerManager.uid then
|
||||
LogBlue("rankAllList[i] "..rankAllList[i].userSkin.." "..rankAllList[i].userTitle.." "..rankAllList[i].userMount.." "..rankAllList[i].sex)
|
||||
table.insert(rankNPCList1,rankAllList[i])
|
||||
end
|
||||
end
|
||||
--LogGreen("前 needNum:"..needNum.." randomList:"..LengthOfTable(randomList))
|
||||
randomList = this.AddPlayer(rankNPCList1,randomList,needNum)
|
||||
x(4,needNum,randomList)
|
||||
end)
|
||||
else
|
||||
--LogGreen("机器人 前 needNum:"..needNum.." randomList:"..LengthOfTable(randomList))
|
||||
for i = 1, needNum do
|
||||
local singleUserData = {}
|
||||
singleUserData.userName = NameManager.GetLocalRandomName()
|
||||
singleUserData.sex = math.random(0,1)
|
||||
singleUserData.uid = 1000 + i
|
||||
singleUserData.userSkin = PlayerManager.GetPlayerSkin()
|
||||
singleUserData.userTitle = 0
|
||||
singleUserData.userMount = 0
|
||||
table.insert(randomList,singleUserData)
|
||||
end
|
||||
--LogGreen("机器人 后 needNum:"..needNum.." randomList:"..LengthOfTable(randomList))
|
||||
if func then
|
||||
func(randomList)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function this.AddPlayer(list1,randomList,needNum)
|
||||
if #list1 > needNum then
|
||||
for i = 1, needNum do
|
||||
this.RandomNPC(list1,randomList)
|
||||
end
|
||||
else
|
||||
for i = 1, #list1 do
|
||||
randomList[list1[i]] = list1[i]
|
||||
end
|
||||
end
|
||||
return randomList
|
||||
end
|
||||
|
||||
--获取战斗地图随机人
|
||||
function this.GetFightMapPlayerNPCData(needNum,func)
|
||||
local randomList = {}
|
||||
--LogGreen("初始化数据")
|
||||
--LogGreen("needNum:"..needNum)
|
||||
needNum = needNum - LengthOfTable(randomList)
|
||||
if needNum > 0 then
|
||||
this.GetPlayerViewDataByType(1,randomList,needNum,func)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function this.GetMainPlayerNPCData2(fun)
|
||||
local rankRandomNum = math.random(1, 4)
|
||||
if rankRandomNum == 3 then rankRandomNum = 2 end--如果是公会排行 改成战力排行 (公会排行展示的是公会名字)
|
||||
local curAddNum = needNum - LengthOfTable(friendNPCList)
|
||||
curAddNum = needNum + curAddNum
|
||||
-- LogGreen("rankRandomNum "..rankRandomNum)
|
||||
-- ----LogGreen("rankRandomNum "..rankRandomNum)
|
||||
RankingManager.InitData(rankKingList[rankRandomNum].rankType, function()
|
||||
local rankAllList = RankingManager.GetRankingInfo()
|
||||
local currankAllList = {}
|
||||
|
@ -741,10 +848,10 @@ function this.GetMainPlayerNPCData2(fun)
|
|||
else
|
||||
for i = 1, #currankAllList do
|
||||
rankNPCList[i] = currankAllList[i]
|
||||
-- LogGreen("rank "..currankAllList[i].userName)
|
||||
-- ----LogGreen("rank "..currankAllList[i].userName)
|
||||
end
|
||||
end
|
||||
-- LogGreen("#rankNPCList "..#rankNPCList)
|
||||
-- ----LogGreen("#rankNPCList "..#rankNPCList)
|
||||
this.GetMainPlayerNPCData3(fun)
|
||||
end)
|
||||
end
|
||||
|
@ -778,7 +885,7 @@ function this.GetMainPlayerNPCData3(fun)
|
|||
table.insert(upList,singleUserData)
|
||||
end
|
||||
end
|
||||
-- LogGreen("#upList "..#upList)
|
||||
-- ----LogGreen("#upList "..#upList)
|
||||
if fun then
|
||||
fun(upList)
|
||||
end
|
||||
|
@ -789,7 +896,7 @@ function this.RandomRankNPC(currankAllList)
|
|||
this.RandomRankNPC(currankAllList)
|
||||
else
|
||||
rankNPCList[playerRandomNum] = currankAllList[playerRandomNum]
|
||||
-- LogGreen("rank "..currankAllList[playerRandomNum].userName)
|
||||
-- ----LogGreen("rank "..currankAllList[playerRandomNum].userName)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -799,7 +906,17 @@ function this.RandomFirendNPC(currankAllList)
|
|||
this.RandomFirendNPC(currankAllList)
|
||||
else
|
||||
friendNPCList[playerRandomNum] = currankAllList[playerRandomNum]
|
||||
-- LogGreen("friend "..currankAllList[playerRandomNum].userName)
|
||||
-- ----LogGreen("friend "..currankAllList[playerRandomNum].userName)
|
||||
end
|
||||
end
|
||||
|
||||
function this.RandomNPC(currankAllList,curlist)
|
||||
local playerRandomNum = math.random(1, #currankAllList)
|
||||
if curlist[playerRandomNum] then
|
||||
this.RandomNPC(currankAllList,curlist)
|
||||
else
|
||||
curlist[playerRandomNum] = {}
|
||||
curlist[playerRandomNum] = currankAllList[playerRandomNum]
|
||||
end
|
||||
end
|
||||
---------- 主城NPC 选择 end----------
|
||||
|
|
|
@ -695,9 +695,14 @@ function RoleInfoPanel:OnClose()
|
|||
end
|
||||
this.leftBtn:GetComponent("Button").enabled = true
|
||||
this.rightBtn:GetComponent("Button").enabled = true
|
||||
if _CurPageIndex then
|
||||
this.PageList[_CurPageIndex]:OnClose()
|
||||
this.PageList[_CurPageIndex].gameObject:SetActive(false)
|
||||
|
||||
for _, page in pairs(this.PageList) do
|
||||
if page.OnHide then
|
||||
page:OnHide()
|
||||
end
|
||||
if page.OnClose then
|
||||
page:OnClose()
|
||||
end
|
||||
end
|
||||
Util.ClearChild(this.curObj.transform)
|
||||
Util.ClearChild(this.leftObj.transform)
|
||||
|
|
|
@ -0,0 +1,748 @@
|
|||
SingleFightPlayerView = {}
|
||||
local mapIconConfig = ConfigManager.GetConfig(ConfigName.MainMapIconConfig)
|
||||
local iconAction = require("Modules/Fight/View/FightMapIconShowView")
|
||||
-- 角色对话气泡位置
|
||||
local m_roleTextPos = {
|
||||
[3] = {pos = Vector3.New(172, 200, 0), angleOffset = 180}, -- 角色朝左, 气泡在右
|
||||
[4] = {pos = Vector3.New(-177, 204, 0), angleOffset = 0} -- 反之
|
||||
}
|
||||
|
||||
-- 老头对话气泡位置
|
||||
local m_oldManTextPos = {
|
||||
[3] = {pos = Vector3.New(-176, 130, 0), angleOffset = 0}, -- 角色朝左,气泡在左
|
||||
[4] = {pos = Vector3.New(154, 130, 0), angleOffset = 180} -- 反之
|
||||
}
|
||||
|
||||
function SingleFightPlayerView:New(gameObject)
|
||||
local b = {}
|
||||
b.gameObject = gameObject
|
||||
b.transform = gameObject.transform
|
||||
setmetatable(b, { __index = SingleFightPlayerView })
|
||||
return b
|
||||
end
|
||||
|
||||
local sortingorder = 0
|
||||
local hitRootPath = "UI_Map_XunBaoEffect_hit"
|
||||
local npc1 = "live2d_npc_map_boy"
|
||||
local npc2 = "live2d_npc_map_nv"
|
||||
-- 飘血资源
|
||||
local hurtRes = "FloatingText"
|
||||
function SingleFightPlayerView:InitComponent()
|
||||
self.root = Util.GetGameObject(self.gameObject, "root")
|
||||
self.ui = Util.GetGameObject(self.root, "ui")
|
||||
self.roleRoot = Util.GetGameObject(self.ui,"roleRoot")
|
||||
Util.GetGameObject(self.ui, "lizi effect").gameObject:SetActive(false)
|
||||
self.battleEffect = Util.GetGameObject(self.ui, "quickBattleEffect")
|
||||
self.bLeaderIsIdle = true
|
||||
-- 临时代码
|
||||
self.dialogueRoot = Util.GetGameObject(self.ui, "Dialogue")
|
||||
self.context = Util.GetGameObject(self.dialogueRoot, "Text"):GetComponent("Text")
|
||||
|
||||
-- buff特效
|
||||
self.buffEffectRoot = Util.GetGameObject(self.roleRoot, "effectRoot")
|
||||
Util.SetParticleScale(self.buffEffectRoot, 2)
|
||||
-- 攻击buff
|
||||
self.buffAttack = Util.GetGameObject(self.buffEffectRoot, "r_MapEffect_NewEvent_011")
|
||||
self.buffAttack:SetActive(false)
|
||||
-- 防御buff
|
||||
self.buffDefend = Util.GetGameObject(self.buffEffectRoot, "r_MapEffect_NewEvent_012")
|
||||
self.buffEffectRoot:SetActive(false)
|
||||
|
||||
-- 隐藏一堆东西
|
||||
Util.GetGameObject(self.ui,"arrow"):SetActive(false)
|
||||
Util.GetGameObject(self.ui,"pos"):SetActive(false)
|
||||
Util.GetGameObject(self.ui,"blood"):SetActive(false)
|
||||
Util.GetGameObject(self.ui,"optionCancelBtn"):SetActive(false)
|
||||
Util.GetGameObject(self.ui,"roleOption"):SetActive(false)
|
||||
|
||||
self:SetBattleState(false)
|
||||
|
||||
self.curDir = nil
|
||||
self.gameObject:SetActive(true)
|
||||
--- 注册组件
|
||||
self.callList = Stack.New()
|
||||
self.selectPointPos = 0
|
||||
-- 角色停止行走时的朝向, 上 下 左 右,1 2 3 4
|
||||
self.eventpoint = 0
|
||||
self.state = 0
|
||||
self.m_roleFaceDir = Vector2.New(-1, 0)
|
||||
|
||||
self.name = Util.GetGameObject(self.ui, "name"):GetComponent("Text")
|
||||
|
||||
self.hurtNum = {}
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:OnOpen(parent)
|
||||
self.parent = parent
|
||||
self.hitEffect = poolManager:LoadAsset(hitRootPath, PoolManager.AssetType.GameObject)
|
||||
self.hitEffect.transform:SetParent(parent.effectRoot.transform)
|
||||
self.hitEffect.transform.localScale = Vector3.one
|
||||
self.hitEffect:SetActive(false)
|
||||
|
||||
if not self.buffTipList then
|
||||
self.buffTipList = {}
|
||||
end
|
||||
-- buff飘字
|
||||
for i = 1, 3 do
|
||||
if not self.buffTipList[i] then
|
||||
self.buffTipList[i] = newObjToParent(parent.buffTip, parent.effectRoot)
|
||||
self.buffTipList[i].transform.localScale = Vector3.New(1.2, 1.2, 1.2)
|
||||
self.buffTipList[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
if not self.hurtNum then
|
||||
self.hurtNum = {}
|
||||
end
|
||||
for i = 1, 3 do
|
||||
self.hurtNum[i] = poolManager:LoadAsset(hurtRes, PoolManager.AssetType.GameObject)
|
||||
-- 设置父级
|
||||
self.hurtNum[i].transform:SetParent(parent.effectRoot.transform)
|
||||
self.hurtNum[i].transform.localScale = Vector3.New(0.5, 0.5, 0.5)
|
||||
Util.GetGameObject(self.hurtNum[i], "anim"):GetComponent("Canvas").sortingOrder = parent.GetCurLayer()
|
||||
self.hurtNum[i]:SetActive(false)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:SetData(u,v,isSelf,data)
|
||||
self._PlayTimeStamp = 0
|
||||
if isSelf then
|
||||
self.ui:GetComponent("Canvas").worldCamera = TileMapView.GetCamera()
|
||||
end
|
||||
self.isSelf = isSelf
|
||||
|
||||
local v3 = TileMapView.GetLiveTilePos(u, v)
|
||||
self.gameObject.transform.localPosition = Vector3(v3.x, v3.y, v3.z - 10)
|
||||
self.gameObject.transform.localScale = Vector3.one * 1.5
|
||||
|
||||
if self.playerLiveView then
|
||||
self.playerLiveView:OnClose()
|
||||
self.playerLiveView = nil
|
||||
end
|
||||
|
||||
local npc = NameManager.roleSex == ROLE_SEX.BOY and npc1 or npc2
|
||||
local scale = NameManager.roleSex == ROLE_SEX.BOY and 1 or 0.5
|
||||
|
||||
self.playerLiveView = PlayerLiveView:New(self.roleRoot,1, nil)
|
||||
self.playerLiveView:OnOpen(GetPlayerRoleSingleConFig().Scale2)
|
||||
self.playerLiveView.name = "npc"
|
||||
self.roleCurPos = TileMapView.GetMapData():GetMapData(u, v)
|
||||
self.bLeaderIsIdle = true
|
||||
self:SetWalkDir(WALK_DIR.LAUCH)
|
||||
self:HideSomeTrash()
|
||||
self:OnSortingOrderChange(self.parent.GetCurLayer())
|
||||
if self.isSelf then
|
||||
self.name.gameObject:SetActive(false)
|
||||
else
|
||||
self.name.text = data.userName
|
||||
self.name.gameObject:SetActive(true)
|
||||
end
|
||||
PlayUIAnim(self.gameObject)
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:SetWalkDir(dir)
|
||||
self.playerLiveView:SetWalkDir(dir)
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:SetBattleState(state)
|
||||
self.buffEffectRoot.gameObject:SetActive(state)
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:HideSomeTrash()
|
||||
for i = 1, 3 do
|
||||
self.buffTipList[i]:SetActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:OnSortingOrderChange(orginLayer)
|
||||
Util.AddParticleSortLayer(self.hitEffect, orginLayer - sortingorder)
|
||||
if #self.hurtNum > 0 then -- 初始化完成
|
||||
for i = 1, 3 do
|
||||
Util.GetGameObject(self.hurtNum[i], "anim"):GetComponent("Canvas").sortingOrder = orginLayer - sortingorder
|
||||
end
|
||||
end
|
||||
sortingorder = orginLayer
|
||||
end
|
||||
|
||||
-- 撞击事件结束后的回调
|
||||
function SingleFightPlayerView:hitCallBack(pos)
|
||||
self:SetWalkDir(WALK_DIR.IDLE_FRONT)
|
||||
self.state = 0
|
||||
self.eventPointDataPos = nil
|
||||
self.parent.BattleEnd(pos) -- 战斗结束
|
||||
if self.isSelf then
|
||||
self:SetEffect(self.selectPointPos)
|
||||
end
|
||||
if self.targetTimer then
|
||||
self.targetTimer:Stop()
|
||||
self.targetTimer = nil
|
||||
end
|
||||
self.targetTimer = Timer.New(function () -- 延迟生成下一个小怪
|
||||
self.parent.LoadPointIcon(false)
|
||||
self:SetRoleHitTarget()
|
||||
end, 0.5)
|
||||
self.targetTimer:Start()
|
||||
end
|
||||
|
||||
local funcCanPass = function(data)
|
||||
return data.val <= 1
|
||||
end
|
||||
|
||||
-- 随机一个位置给大爷走走
|
||||
function SingleFightPlayerView:SetRoleHitTarget()
|
||||
coroutine.start(function()
|
||||
local eventPoint = self.parent.AsideTriggerJudge(self.roleCurPos,self.isSelf)
|
||||
if eventPoint then
|
||||
self:RoleWalkEnd(eventPoint)
|
||||
else
|
||||
local pos
|
||||
while not pos do
|
||||
coroutine.wait(0.01)
|
||||
pos = self:SelectTargetPos()
|
||||
end
|
||||
LogGreen("选中的点:"..tostring(pos))
|
||||
local pathlist = self:SetRoleWalk(pos)
|
||||
self:RoleMove(pathlist)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- 选择一个目标位置, 就近原则
|
||||
function SingleFightPlayerView:SelectTargetPos()
|
||||
local iconList = self.parent.RequestIconList()
|
||||
if iconList and LengthOfTable(iconList) > 0 then
|
||||
local selectIconList = {}
|
||||
local minDis = 999
|
||||
for i, v in pairs(iconList) do
|
||||
if not self.parent.selectIconList[i] then
|
||||
local targetU, targetV = Map_Pos2UV(i)
|
||||
-- 计算相对距离
|
||||
local dis = math.abs(self.roleCurPos.u - targetU) + math.abs(self.roleCurPos.v - targetV)
|
||||
minDis = minDis <= dis and minDis or dis
|
||||
local data = {}
|
||||
data.dis = dis
|
||||
data.x_axis = targetU
|
||||
data.pos = i
|
||||
selectIconList[#selectIconList + 1] = data
|
||||
end
|
||||
end
|
||||
|
||||
-- 取出目标值. 相等则要x最小的
|
||||
if #selectIconList > 1 then
|
||||
table.sort(selectIconList, function (a, b)
|
||||
if a.dis == b.dis then
|
||||
return a.x_axis < b.x_axis
|
||||
else
|
||||
return a.dis < b.dis
|
||||
end
|
||||
end )
|
||||
end
|
||||
|
||||
-- 万一图标还没生出来
|
||||
local targetPos = 0
|
||||
if #selectIconList > 1 then
|
||||
targetPos = self:GetTargetPos(selectIconList[1].pos)
|
||||
self.parent.AddSelectIconList(targetPos)
|
||||
else
|
||||
targetPos = self:GetTargetPos(Map_UV2Pos(self.roleCurPos))
|
||||
end
|
||||
self.parent.ReleaseIconList()
|
||||
return targetPos
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- 获取当前图标的目标值,传入图标的坐标值, 就近原则
|
||||
function SingleFightPlayerView:GetTargetPos(iconPos)
|
||||
local u0, v0 = Map_Pos2UV(iconPos)
|
||||
local posList = {
|
||||
[1] = Vector2.New(u0, v0 - 1), -- 上
|
||||
[2] = Vector2.New(u0, v0 + 1), -- 下
|
||||
[3] = Vector2.New(u0 - 1, v0), -- 左
|
||||
[4] = Vector2.New(u0 + 1, v0), -- 右
|
||||
}
|
||||
local newList = {}
|
||||
|
||||
for i = 1, 4 do
|
||||
local dis = math.abs(self.roleCurPos.u - posList[i].x) + math.abs(self.roleCurPos.v - posList[i].y)
|
||||
local data = {}
|
||||
data.dis = dis
|
||||
data.axis = posList[i]
|
||||
data.index = i
|
||||
newList[#newList + 1] = data
|
||||
end
|
||||
|
||||
if #newList > 1 then
|
||||
table.sort(newList, function (a, b)
|
||||
if a.dis == b.dis then
|
||||
return a.axis.x < b.axis.x
|
||||
else
|
||||
return a.dis < b.dis
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local pos = posList[newList[1].index]
|
||||
return pos
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:SetRoleWalk(targetPos)
|
||||
local pathList = TileMapView.ShowPath(self.roleCurPos.u, self.roleCurPos.v, targetPos.x, targetPos.y, funcCanPass)
|
||||
TileMapView.ClearPath()
|
||||
return pathList
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:RoleMove(pathList)
|
||||
if not pathList or #pathList == 0 then
|
||||
local eventPoint = self.parent.AsideTriggerJudge(self.roleCurPos,self.isSelf)
|
||||
self:RoleWalkEnd(eventPoint)
|
||||
return
|
||||
end
|
||||
|
||||
--把最终回调最先入栈
|
||||
self.callList:Push(function ()
|
||||
local eventPoint = self.parent.AsideTriggerJudge(self.roleCurPos,self.isSelf)
|
||||
self:RoleWalkEnd(eventPoint)
|
||||
end)
|
||||
|
||||
for i=1, #pathList-1 do --最后的点为起点,不处理
|
||||
local data = pathList[i]
|
||||
local v3 = TileMapView.GetLiveTilePos(data.u, data.v)
|
||||
self.callList:Push(function ()
|
||||
self:SetRoleDirAction(data.u, data.v)
|
||||
self.roleCurPos = data
|
||||
local speed = 0.7
|
||||
self.gameObject.transform:DOLocalMove(Vector3(v3.x, v3.y, v3.z - 10), speed, false):OnStart(function () end):OnUpdate(function() --TODO:测试速度
|
||||
self:PlayStepSound()
|
||||
if self.isSelf then
|
||||
local v4 = self.gameObject.transform.localPosition
|
||||
v4.z = TileMapView.ViewCameraPos.z
|
||||
TileMapView.SetCameraPos(v4)
|
||||
end
|
||||
end):OnComplete(function ()
|
||||
local eventPoint = self.parent.AsideTriggerJudge(data,self.isSelf)
|
||||
if eventPoint then
|
||||
self:RoleWalkEnd(eventPoint)
|
||||
return
|
||||
end
|
||||
self:StackPop()
|
||||
end):SetEase(Ease.Linear)
|
||||
end)
|
||||
end
|
||||
-- 退出第一个栈
|
||||
self:StackPop()
|
||||
self:PlayerMove()
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:PlayerMove()
|
||||
self.bLeaderIsIdle = false
|
||||
end
|
||||
function SingleFightPlayerView:PlayStepSound()
|
||||
local curTimeStamp = GetTimeStamp()
|
||||
if curTimeStamp - self._PlayTimeStamp >= 0.3 then
|
||||
self._PlayTimeStamp = curTimeStamp
|
||||
SoundManager.PlaySound(SoundConfig.Sound_FootStep..math.random(1,7))
|
||||
end
|
||||
end
|
||||
|
||||
-- 角色行走结束
|
||||
function SingleFightPlayerView:RoleWalkEnd(eventPoint)
|
||||
self.callList:Clear()
|
||||
self:PlayerIdle()
|
||||
if eventPoint then
|
||||
self.selectPointPos = eventPoint.pos
|
||||
LogGreen("eventPoint.pos:"..tostring(eventPoint.pos))
|
||||
-- 检测方向
|
||||
self:SetRoleDir(self.roleCurPos.u * 256 + self.roleCurPos.v, eventPoint.pos)
|
||||
-- 设置角色纵深
|
||||
self:SetRoleLayer(self:IsRoleFront(eventPoint.pos))
|
||||
self.state = 1
|
||||
self.eventPointDataPos = eventPoint.pos
|
||||
self:SetIconShow(eventPoint)
|
||||
else
|
||||
self:SetRoleHitTarget()
|
||||
end
|
||||
end
|
||||
|
||||
---检查角色与图标的纵深关系
|
||||
function SingleFightPlayerView:IsRoleFront(pos)
|
||||
local v0 = self.roleCurPos.v
|
||||
local u, v = Map_Pos2UV(pos)
|
||||
return v0 >= v
|
||||
end
|
||||
|
||||
|
||||
function SingleFightPlayerView:PlayerIdle()
|
||||
self.bLeaderIsIdle = true
|
||||
if self.SkeletonGraphic and self.SkeletonGraphic.AnimationState then
|
||||
self.SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
|
||||
self.SkeletonGraphic.transform.localEulerAngles = Vector3.zero
|
||||
end
|
||||
self.curDir = nil
|
||||
end
|
||||
|
||||
-- 角色停止行走时的朝向
|
||||
function SingleFightPlayerView:SetRoleDir(rolePos, iconPos)
|
||||
local u0, v0 = Map_Pos2UV(rolePos)
|
||||
local u, v = Map_Pos2UV(iconPos)
|
||||
if v0 == v then
|
||||
if u0 > u then
|
||||
self.m_roleFaceDir = Vector2.New(-1, 0)
|
||||
LogGreen("他要朝左左左左左")
|
||||
self.eventpoint = 3
|
||||
else
|
||||
self.m_roleFaceDir = Vector2.New(1, 0)
|
||||
LogGreen("他要朝右右右右")
|
||||
self.eventpoint = 4
|
||||
end
|
||||
else
|
||||
if v0 > v then
|
||||
self.m_roleFaceDir = Vector2.New(0, 1)
|
||||
LogGreen("他要朝上上上上")
|
||||
self.eventpoint = 1
|
||||
else
|
||||
self.m_roleFaceDir = Vector2.New(0, -1)
|
||||
LogGreen("他要朝下下下下下下")
|
||||
self.eventpoint = 2
|
||||
end
|
||||
end
|
||||
self:SetWalkDir(self.eventpoint)
|
||||
end
|
||||
|
||||
---设置角色纵深
|
||||
---@param isFront 设置是否角色在前
|
||||
function SingleFightPlayerView:SetRoleLayer(isFront)
|
||||
local z_axis = isFront and -10 or 10
|
||||
local v3 = self.gameObject.transform.localPosition
|
||||
self.gameObject.transform.localPosition = Vector3(v3.x, v3.y, z_axis)
|
||||
end
|
||||
|
||||
-- 角色相关
|
||||
function SingleFightPlayerView:SetRoleDirAction(u, v, isBack)
|
||||
local dU = isBack and self.roleCurPos.u - u or u - self.roleCurPos.u
|
||||
local dV = isBack and self.roleCurPos.v - v or v - self.roleCurPos.v
|
||||
|
||||
if dU > 0 then
|
||||
self:SetWalkDir(WALK_DIR.RUN_RIGHT)
|
||||
elseif dU < 0 then
|
||||
self:SetWalkDir(WALK_DIR.RUN_LEFT)
|
||||
elseif dV < 0 then
|
||||
self:SetWalkDir(WALK_DIR.RUN_UP)
|
||||
elseif dV > 0 then
|
||||
self:SetWalkDir(WALK_DIR.RUN_DOWN)
|
||||
end
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:StackPop()
|
||||
if self.callList:Count() > 0 then
|
||||
self.callList:Pop()()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- 设置遇到图标时的表现
|
||||
function SingleFightPlayerView:SetIconShow(_eventpoint)
|
||||
local eventpoint = _eventpoint.event
|
||||
local iconType = eventpoint.iconId or -1
|
||||
LogGreen("iconType:"..iconType)
|
||||
local index = (self.eventpoint == 4 or self.eventpoint == 1) and 4 or 3
|
||||
if iconType == -1 then
|
||||
--显示对话框
|
||||
self.dialogueRoot.gameObject:SetActive(true)
|
||||
self.dialogueRoot.transform.localEulerAngles = Vector3.New(0, m_roleTextPos[index].angleOffset, 0)
|
||||
self.context.transform.localEulerAngles = Vector3.New(0, m_roleTextPos[index].angleOffset, 0)
|
||||
self.dialogueRoot.transform.localPosition = m_roleTextPos[index].pos
|
||||
local str = ""
|
||||
local strList = {}
|
||||
if self.isSelf then
|
||||
str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,111).Value
|
||||
else
|
||||
str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,112).Value
|
||||
end
|
||||
strList = string.split(str,"#")
|
||||
self.context.text = strList[FightPointPassManager.randomNum] or "你好"
|
||||
self:NotBattleShow()
|
||||
elseif iconType == 8 or iconType == 11 then -- 宝箱
|
||||
self:SetWalkDir(WALK_DIR.JINGYA)
|
||||
if self.isSelf then
|
||||
self.dialogueRoot.gameObject:SetActive(true)
|
||||
self.dialogueRoot.transform.localEulerAngles = Vector3.New(0, m_roleTextPos[index].angleOffset, 0)
|
||||
self.context.transform.localEulerAngles = Vector3.New(0, m_roleTextPos[index].angleOffset, 0)
|
||||
self.dialogueRoot.transform.localPosition = m_roleTextPos[index].pos
|
||||
local str = ""
|
||||
local strList = {}
|
||||
str = ConfigManager.GetConfigData(ConfigName.MainMapIconConfig,iconType).Desc
|
||||
strList = string.split(str,"#")
|
||||
local num = math.random(1,#strList)
|
||||
self.context.text = strList[num]
|
||||
end
|
||||
|
||||
local boxPos = self.selectPointPos
|
||||
Timer.New(function()
|
||||
if self.isSelf then
|
||||
self:SetEffect(boxPos)
|
||||
end
|
||||
end,2):Start()
|
||||
self:NotBattleShow()
|
||||
elseif iconType == 7 then -- NPC, 不一样的BB
|
||||
self:SetWalkDir(WALK_DIR.JINGYA)
|
||||
if self.isSelf then
|
||||
local str, str1 = ""
|
||||
local strList,strList1 = {}
|
||||
str = ConfigManager.GetConfigData(ConfigName.MainMapIconConfig,iconType).Desc
|
||||
str1 = ConfigManager.GetConfigData(ConfigName.MainMapIconConfig,iconType).DescNPC
|
||||
strList = string.split(str,"#")
|
||||
strList1 = string.split(str1,"#")
|
||||
local num = math.random(1,#strList)
|
||||
|
||||
self.dialogueRoot.gameObject:SetActive(true)
|
||||
self.dialogueRoot.transform.localEulerAngles = Vector3.New(0, m_roleTextPos[index].angleOffset, 0)
|
||||
self.context.transform.localEulerAngles = Vector3.New(0, m_roleTextPos[index].angleOffset, 0)
|
||||
self.dialogueRoot.transform.localPosition = m_roleTextPos[index].pos
|
||||
self.context.text = strList[num]
|
||||
|
||||
-- 设置老头
|
||||
local oldManAngle = Vector3.New(0, m_oldManTextPos[index].angleOffset, 0)
|
||||
eventpoint:SetDialogueDir(m_oldManTextPos[index].pos, oldManAngle)
|
||||
eventpoint:ShowDialogue(true)
|
||||
eventpoint:SetDialogueStr(strList1[num])
|
||||
end
|
||||
self:NotBattleShow()
|
||||
else -- 战斗
|
||||
-- 设置战斗状态
|
||||
self:EnterBattle()
|
||||
self.dialogueRoot.gameObject:SetActive(false)
|
||||
self:private_ShakeByTimes(_eventpoint, self.m_roleFaceDir, mapIconConfig[iconType].HurtNum,1,function()
|
||||
self:hitCallBack(_eventpoint.pos)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- 宝箱特效的位置
|
||||
local boxEffectPos = {
|
||||
[1] = Vector3.New(44, 140, 0),
|
||||
[2] = Vector3.New(35, 188, 0),
|
||||
[3] = Vector3.New(169, 168, 0),
|
||||
}
|
||||
function SingleFightPlayerView:SetEffect(pos)
|
||||
local boxState = FightPointPassManager.GetBoxState()
|
||||
boxState = boxState == 0 and 1 or boxState
|
||||
local tartPos = boxEffectPos[boxState]
|
||||
|
||||
LogGreen("boxState:" ..boxState)
|
||||
if not self.parent.moneyEffect then
|
||||
self.parent.moneyEffect:GetComponent("RectTransform").anchoredPosition = SetObjPosByUV(pos)
|
||||
Util.ClearTrailRender(self.parent.moneyEffect)
|
||||
self:SetBoxEffect(false, Vector3.zero)
|
||||
if not FightPointPassManager.isBeginFight then
|
||||
self.parent.moneyEffect:SetActive(true)
|
||||
end
|
||||
self.parent.moneyEffect:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(tartPos.x + 88, tartPos.y + 359), 0.6, false):OnComplete(function ()
|
||||
if self.parent.moneyEffect then
|
||||
self.parent.moneyEffect:SetActive(false)
|
||||
end
|
||||
if not FightPointPassManager.isBeginFight then
|
||||
self:SetBoxEffect(true, boxState)
|
||||
end
|
||||
end)
|
||||
end
|
||||
SoundManager.PlaySound(SoundConfig.Sound_FightArea_Gold)
|
||||
end
|
||||
|
||||
-- 设置宝箱特效s
|
||||
function SingleFightPlayerView:SetBoxEffect(isShow, state)
|
||||
if not isShow then
|
||||
if self.parent.boxEffect then
|
||||
self.parent.boxEffect:SetActive(false)
|
||||
end
|
||||
else
|
||||
self.parent.boxEffect.transform.localPosition = boxEffectPos[state]
|
||||
self.parent.boxEffect:SetActive(true)
|
||||
end
|
||||
end
|
||||
|
||||
function SingleFightPlayerView:private_ShakeByTimes(_point, roleFaceDir, shakeTime, index, func)
|
||||
local point = _point.event
|
||||
local icon = point.go
|
||||
local start = index
|
||||
local iconType = point.iconId
|
||||
local leftNum = math.floor(start % 2)
|
||||
-- 主动打击者
|
||||
local go = leftNum == 1 and self.roleRoot or icon
|
||||
|
||||
-- 受击对象
|
||||
local hurtGo = leftNum ~= 1 and self.roleRoot or Util.GetGameObject(icon, "root")
|
||||
|
||||
local isReverse = leftNum == 0
|
||||
local objPos = isReverse and self.roleCurPos.u * 256 + self.roleCurPos.v or _point.pos
|
||||
|
||||
local end_callBack = function() -- 受击结束动画
|
||||
self.hitEffect:SetActive(false)
|
||||
LogGreen("end_callBack:"..start)
|
||||
if start >= shakeTime then
|
||||
-- 执行最终回调
|
||||
func()
|
||||
return
|
||||
else
|
||||
start = start + 1
|
||||
self:private_ShakeByTimes(_point, roleFaceDir, shakeTime, start, func)
|
||||
end
|
||||
end
|
||||
|
||||
local mid_callBack = function() -- 打击时间点
|
||||
LogGreen("mid_callBack:")
|
||||
self:private_BloodBlood(objPos, start, iconType, isReverse, 0)
|
||||
self:pravite_PlayHitEffect(objPos)
|
||||
if point then
|
||||
point:SetPointAnimation(iconType, 2)
|
||||
end
|
||||
--整个东西缩一下
|
||||
self:PlayScale(hurtGo, 0.7)
|
||||
|
||||
SoundManager.PlaySound(SoundConfig.Sound_FightArea_Attack[math.random(1, #SoundConfig.Sound_FightArea_Attack)])
|
||||
end
|
||||
|
||||
local func = function()
|
||||
self:pravite_ShakeObjOnce(go, isReverse, roleFaceDir, end_callBack, mid_callBack)
|
||||
end
|
||||
if self.callbackTimer then
|
||||
self.callbackTimer:Stop()
|
||||
self.callbackTimer = nil
|
||||
end
|
||||
self.callbackTimer = Timer.New(function ()
|
||||
func()
|
||||
end, 0.2)
|
||||
self.callbackTimer:Start()
|
||||
end
|
||||
|
||||
-- 怪物被打得吐血
|
||||
--- @param showType 参数为0时表示为掉血,参数大于0时表示为补血
|
||||
function SingleFightPlayerView:private_BloodBlood(objPos, index, iconType, isMonster, showType, func)
|
||||
local go = self.hurtNum[math.floor(index % 3 + 1)]
|
||||
|
||||
-- 吐血随机值
|
||||
local hurtNum, isCritical = iconAction.pravite_GetHurtValue(isMonster, iconType, showType)
|
||||
local v2 = SetObjPosByUV(objPos)
|
||||
go:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(v2.x, v2.y, 0) + Vector3.New(0, 120, 0)
|
||||
Util.GetGameObject(go, "anim/Image"):SetActive(false)
|
||||
Util.GetGameObject(go, "anim/anim"):GetComponent("Text").text = iconAction.DecodeHurt(hurtNum, isCritical, showType)
|
||||
if not FightPointPassManager.isBeginFight then
|
||||
go:SetActive(true)
|
||||
else
|
||||
go:SetActive(false)
|
||||
end
|
||||
|
||||
self.hurtNumTimer = nil
|
||||
self.hurtNumTimer = Timer.New(function()
|
||||
if go then
|
||||
go:SetActive(false)
|
||||
end
|
||||
if func then func() end
|
||||
end, 1.5)
|
||||
self.hurtNumTimer:Start()
|
||||
end
|
||||
|
||||
-- 震动动画
|
||||
function SingleFightPlayerView:pravite_ShakeObjOnce(go, isReverse, roleFaceDir, func, mid_func)
|
||||
LogGreen("pravite_ShakeObjOnce:"..go.name.." isReverse:"..tostring(isReverse).." roleFaceDir:"..tostring(roleFaceDir))
|
||||
local offSet = isReverse and 90 or 120
|
||||
offSet = offSet / math.min(Screen.width/1080, Screen.height/1920)
|
||||
local originPos = go:GetComponent("RectTransform").anchoredPosition
|
||||
local value = isReverse and -1 or 1
|
||||
local targetPos = originPos + Vector2.New(offSet * roleFaceDir.x * value, offSet * roleFaceDir.y * value)
|
||||
|
||||
if go then
|
||||
go:GetComponent("RectTransform"):DOAnchorPos(targetPos, 0.1, false):OnComplete(function ()
|
||||
if mid_func then mid_func() end
|
||||
go:GetComponent("RectTransform"):DOAnchorPos(originPos, 0.1, false):OnComplete(function ()
|
||||
if func then func() end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- 缩放
|
||||
function SingleFightPlayerView:PlayScale(go, scale)
|
||||
if go then
|
||||
local originScale = go.transform.localScale
|
||||
go.transform:DOScale(originScale * scale, 0.1):OnComplete(function ()
|
||||
go.transform:DOScale(originScale, 0.1)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- 受击特效
|
||||
function SingleFightPlayerView:pravite_PlayHitEffect(pos)
|
||||
--local u, v = Map_Pos2UV(pos)
|
||||
--local v2 = RectTransformUtility.WorldToScreenPoint(TileMapView.GetCamera(), TileMapView.GetLiveTilePos(u, v))
|
||||
--v2 = v2 / math.min(Screen.width/1080, Screen.height/1920)
|
||||
LogGreen("self.hitEffect:")
|
||||
self.hitEffect.transform.localPosition = SetObjPosByUV(pos)
|
||||
if not FightPointPassManager.isBeginFight then
|
||||
self.hitEffect:SetActive(true)
|
||||
else
|
||||
self.hitEffect:SetActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- 不是战斗的表现
|
||||
function SingleFightPlayerView:NotBattleShow()
|
||||
if self.battleTimer then
|
||||
self.battleTimer:Stop()
|
||||
self.battleTimer = nil
|
||||
end
|
||||
if self.targetTimer then
|
||||
self.targetTimer:Stop()
|
||||
self.targetTimer = nil
|
||||
end
|
||||
self.battleTimer = Timer.New(function ()
|
||||
self.dialogueRoot.gameObject:SetActive(false)
|
||||
self.parent.BattleEnd(self.selectPointPos)
|
||||
self:SetRoleLayer(true)
|
||||
self:SetBattleState(false)
|
||||
self.targetTimer = Timer.New(function ()
|
||||
self.parent.LoadPointIcon(false)
|
||||
self.state = 0
|
||||
self.eventPointDataPos = nil
|
||||
self:SetRoleHitTarget()
|
||||
end, 0.5)
|
||||
self.targetTimer:Start()
|
||||
end, 1)
|
||||
self.battleTimer:Start()
|
||||
end
|
||||
|
||||
-- 进入战斗状态
|
||||
function SingleFightPlayerView:EnterBattle()
|
||||
self:SetBattleState(true)
|
||||
end
|
||||
|
||||
|
||||
function SingleFightPlayerView:OnClose()
|
||||
self.hitEffect = {}
|
||||
self.hurtNum = {}
|
||||
self.buffTipList = {}
|
||||
if self.playerLiveView then
|
||||
self.playerLiveView:OnClose()
|
||||
self.playerLiveView = nil
|
||||
end
|
||||
if self.targetTimer then
|
||||
self.targetTimer:Stop()
|
||||
self.targetTimer = nil
|
||||
end
|
||||
if self.callbackTimer then
|
||||
self.callbackTimer:Stop()
|
||||
self.callbackTimer = nil
|
||||
end
|
||||
self.callList = {}
|
||||
if self.hurtNumTimer then
|
||||
self.hurtNumTimer:Stop()
|
||||
self.hurtNumTimer = nil
|
||||
end
|
||||
if self.battleTimer then
|
||||
self.battleTimer:Stop()
|
||||
self.battleTimer = nil
|
||||
end
|
||||
end
|
||||
return SingleFightPlayerView
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ff069342c4485454b9497e06630c0234
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue