Merge branch 'china/dev' of http://60.1.1.230/gaoxin/JL_Client into china/dev

dev_chengFeng
ZhangBiao 2021-12-24 14:20:06 +08:00
commit fea92ffabc
15 changed files with 131999 additions and 126 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d485bc627bd653c45932afdcb03de1bb
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: lz4/prefabs/map/singlefightplayerview
assetBundleVariant: unity3d

View File

@ -1,5 +1,274 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &62547896
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 62547897}
- component: {fileID: 62547899}
- component: {fileID: 62547898}
m_Layer: 5
m_Name: numText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &62547897
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62547896}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1979223434}
- {fileID: 373578276}
m_Father: {fileID: 1281417492556959677}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 195}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &62547899
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62547896}
m_CullTransparentMesh: 0
--- !u!114 &62547898
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62547896}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 575553740, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 0
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_TextComponent: {fileID: 373578277}
m_Placeholder: {fileID: 1979223435}
m_ContentType: 0
m_InputType: 0
m_AsteriskChar: 42
m_KeyboardType: 0
m_LineType: 0
m_HideMobileInput: 0
m_CharacterValidation: 0
m_CharacterLimit: 0
m_OnEndEdit:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_CustomCaretColor: 0
m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412}
m_Text: 15
m_CaretBlinkRate: 0.85
m_CaretWidth: 1
m_ReadOnly: 0
--- !u!1 &373578275
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 373578276}
- component: {fileID: 373578278}
- component: {fileID: 373578277}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &373578276
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 373578275}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 62547897}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &373578278
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 373578275}
m_CullTransparentMesh: 0
--- !u!114 &373578277
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 373578275}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 4b73e9e4512d17e4daeea351e090d33c, type: 3}
m_FontSize: 40
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 4
m_MaxSize: 60
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 15
--- !u!1 &1979223433
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1979223434}
- component: {fileID: 1979223436}
- component: {fileID: 1979223435}
m_Layer: 5
m_Name: Placeholder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1979223434
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1979223433}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 62547897}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.5}
m_SizeDelta: {x: -20, y: -13}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1979223436
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1979223433}
m_CullTransparentMesh: 0
--- !u!114 &1979223435
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1979223433}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 2
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!1 &18775822987078056
GameObject:
m_ObjectHideFlags: 0
@ -2902,85 +3171,6 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!1 &195717998993473479
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1819065627129480382}
- component: {fileID: 4195599066157626372}
- component: {fileID: 3014676082400837824}
m_Layer: 5
m_Name: numText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1819065627129480382
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 195717998993473479}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1281417492556959677}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 4.1, y: 194.1}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4195599066157626372
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 195717998993473479}
m_CullTransparentMesh: 0
--- !u!114 &3014676082400837824
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 195717998993473479}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 4b73e9e4512d17e4daeea351e090d33c, type: 3}
m_FontSize: 40
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 4
m_MaxSize: 60
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 15
--- !u!1 &207536554222619832
GameObject:
m_ObjectHideFlags: 0
@ -17279,7 +17469,7 @@ RectTransform:
- {fileID: 2766592933532494533}
- {fileID: 1182781833446033168}
- {fileID: 7091090999506925888}
- {fileID: 1819065627129480382}
- {fileID: 62547897}
- {fileID: 4291021022934659164}
- {fileID: 2191399139197227440}
- {fileID: 388565791058996499}

View File

@ -0,0 +1,110 @@
local LongPressEvent = {}
function LongPressEvent:ctor(go)
self.go = go
self.isTriggerPoint = false
self.triggerTime = 0
self.triggerBeatTime = 0
self.isInvoke = false
self.trigger = Util.GetEventTriggerListener(self.go.gameObject)
self.trigger.onPointerDown = self.trigger.onPointerDown + function()
self:onPointerDown()
end
self.trigger.onPointerUp = self.trigger.onPointerUp + function()
self:onPointerUp()
end
self.trigger.onPointerExit = self.trigger.onPointerExit + function()
self:onPointerUp()
end
end
function LongPressEvent:SetPressStartFunc(func)
self.onPressStart = func
end
function LongPressEvent:SetPressEndFunc(func)
self.onPressEnd = func
end
function LongPressEvent:SetPressTime(pressTime)
self.pressTime = pressTime
end
function LongPressEvent:SetPressBeatFunc(func)
self.onPressBeat = func
end
function LongPressEvent:SetPressBeatTime(beatTime)
self.beatTime = beatTime
end
function LongPressEvent:onPointerDown()
self.isTriggerPoint = true
self.triggerTime = Time.time
end
function LongPressEvent:onPointerUp()
self.isTriggerPoint = false
-- 触发过开始就触发结束
if self.isInvoke then
if self.onPressEnd then
self.onPressEnd()
end
self.isInvoke = false
end
end
function LongPressEvent:Update()
if self.isTriggerPoint then
-- 没触发过start
if not self.isInvoke then
-- 触发开始事件
if self.pressTime and Time.time - self.triggerTime > self.pressTime then
if self.onPressStart then
self.onPressStart()
end
self.isInvoke = true
--
self.triggerBeatTime = 0
end
else
-- 长按连续触发事件
if self.beatTime and Time.time - self.triggerBeatTime > self.beatTime then
if self.onPressBeat then
self.onPressBeat()
end
self.triggerBeatTime = Time.time
end
end
end
end
function LongPressEvent:Destroy()
-- 清除原来的事件
if self.trigger then
self.trigger:Destroy()
end
end
LongPressManager = {}
local list = {}
local function update()
for go, o in pairs(list) do
o:Update()
end
end
UpdateBeat:Add(update, LongPressManager)
function LongPressManager.New(go)
if list[go] then
list[go]:Destroy()
list[go] = nil
end
local o = {}
setmetatable(o, {__index = LongPressEvent})
o:ctor(go)
list[go] = o
return o
end

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3a652b12a5b40f5489e86134fa4e9e29
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1008,7 +1008,7 @@ local passivityList = {
if skill and (skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.DeadSkill ) then
local ar1 = floor(BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1))
--local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5)
BattleUtil.FinalDamage(nil, role, defRole, ar1)
BattleUtil.FinalDamageCountShield(nil, role, defRole, ar1)
--lastTrigger = 0
end
end
@ -9012,7 +9012,7 @@ local passivityList = {
return
end
role.Event:RemoveEvent(BattleEventName.RoleTreat,onRoleTreat,nil,nil,role)
local list = skill:GetDirectTargetsNoNoDead()
local list = RoleManager.Query(function(v) return v.camp == role.camp end)
if list and #list>0 then
BattleUtil.SortByHpFactor(list,type)
BattleUtil.FinalTreat(role,list[1],floor(addHp))

View File

@ -145,13 +145,17 @@ function this:SwitchView(isNotAni)
table.insert(list, go)
end
,true,isNotAni)
local t = 1
local t = 0
for k,v in ipairs(dataList) do
if v.state == 1 then
t = k
break
end
end
-- t = 0说明没有找到可以挑战的关卡也就是全部通关了
if t <= 0 then
t = #dataList
end
this.ScrollView:SetIndex(t - 1 < 1 and 1 or (t - 1))
end

View File

@ -37,7 +37,7 @@ function this:InitComponent(gameObject)
this.autoCompoundBtn = Util.GetGameObject(gameObject, "CompoundPanel_Equip/autoCompoundBtn")
this.addBtn = Util.GetGameObject(gameObject, "CompoundPanel_Equip/titleGo/addBtn")
this.subtractBtn = Util.GetGameObject(gameObject, "CompoundPanel_Equip/titleGo/subtractBtn")
this.numText = Util.GetGameObject(gameObject, "CompoundPanel_Equip/titleGo/numText"):GetComponent("Text")
this.numText = Util.GetGameObject(gameObject, "CompoundPanel_Equip/titleGo/numText"):GetComponent("InputField")
this.progressText = Util.GetGameObject(gameObject, "CompoundPanel_Equip/titleGo/progressText"):GetComponent("Text")
this.needEquip = Util.GetGameObject(gameObject, "CompoundPanel_Equip/titleGo/needEquip")
this.compoundEquip = Util.GetGameObject(gameObject, "CompoundPanel_Equip/titleGo/compoundEquip")
@ -69,6 +69,36 @@ function this:BindEvent()
Util.AddClick(this.subtractBtn, function()
this.CompoundNumChange(2)
end)
-- 长按加
require("Common.LongPressManager")
local lp = LongPressManager.New(this.addBtn)
lp:SetPressTime(1)
lp:SetPressBeatFunc(function()
this.CompoundNumChange(1)
end)
lp:SetPressBeatTime(0.1)
-- 长按减
local lp = LongPressManager.New(this.subtractBtn)
lp:SetPressTime(1)
lp:SetPressBeatFunc(function()
this.CompoundNumChange(2)
end)
lp:SetPressBeatTime(0.1)
-- 编辑完成回调
Util.AddInputField_OnEndEdit(this.numText.gameObject, function(str)
local num = tonumber(str)
if num then
if num <= 0 then
compoundNum = 1
elseif num >= compoundMaxNum then
compoundNum = compoundMaxNum
else
compoundNum = num
end
end
this.ShowGoldNum(equipStarsConfig[curSelectEquip.Star-1],compoundNum)
end)
end
function this:AddListener()
@ -281,9 +311,16 @@ function this.SingleItemDataShow(_go,_itemData,curEquipStarsConfig)
end
--加减方法
function this.CompoundNumChange(type)
if type == 1 then--加
if compoundNum >= compoundMaxNum then
return
end
compoundNum = compoundNum + 1
else--减
if compoundNum <= 1 then
return
end
compoundNum = compoundNum - 1
end
--LogError("compoundNum "..compoundNum)

View File

@ -0,0 +1,510 @@
require("Base/Stack")
require("Modules/Map/Logic/TileMapController")
require("Modules/Map/Logic/TileMapView")
require("Modules/Map/Config/MapConfig")
require("Modules/Map/View/MapPointView")
local mapIconConfig = ConfigManager.GetConfig(ConfigName.MainMapIconConfig)
local iconAction = require("Modules/Fight/View/FightMapIconShowView")
local this = {}
--地图id
local mapIdList = {
[1] = 5002,
[2] = 5003,
[3] = 5005,
[4] = 4002,
[5] = 5004,
}
-- 临时可生成怪的区域
local monsterArea = {
[5005] = {
x_pos = {min = 8, max = 28},
y_pos = {min = 8, max = 14},
},
[4002] = {
x_pos = {min = 8, max = 24},
y_pos = {min = 9, max = 23},
},
[5002] = {
x_pos = {min = 9, max = 32},
y_pos = {min = 8, max = 16},
},
[5003] = {
x_pos = {min = 8, max = 28},
y_pos = {min = 8, max = 14},
},
[5004] = {
x_pos = {min = 8, max = 27},
y_pos = {min = 8, max = 15},
},
}
--自己角色的出生点
local startUV = {
[5005] = {u = 15, v = 10},
[4002] = {u = 15, v = 15},
[5002] = {u = 15, v = 15},
[5003] = {u = 15, v = 10},
[5004] = {u = 15, v = 10},
}
-- 允许出现的事件点的图标数量
local iconNum = 9
-- 地图图标的上限值
local maxIcon = 9
local mapCtrl = "MapCtrl"
local effectPath = "c_xy_0012_skeff_slidesk_ballistic"
-- 当前关卡地图编号
local m_curMapId = 1011
local m_orginLayer = 0
local m_parent
this.isClose = false
--root FightPointPassMainPanel.gameObject FightPointPassMainPanel脚本
function this:InitComponent(root, parent)
Log("初始化地图资源")
m_orginLayer = 0
m_parent = parent
-- 地图点击拖动
this.root = root
this.dragCtrl = Util.GetGameObject(root, "Bg/Ctrl")
this.effectRoot = Util.GetGameObject(root, "effectRoot")
this.buffTip = Util.GetGameObject(this.effectRoot, "money")
-- 箱子
this.boxEffect = Util.GetGameObject(root, "boxRoot/UI_effect_GuaJi_Box_BaoDian")
this.playerViews = {}
local str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,111).Value
local strList = string.split(str,"#")
if strList and #strList > 0 then
local num = math.random(1,#strList)
FightPointPassManager.randomNum = num
end
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:Init()
this.isClose = false
this.isCanUseIconList = 0
-- 初始化加载地图块数据
this:LoadMapData()
-- 加载一个小人
local tempconfig = ConfigManager.GetConfigData(ConfigName.ChallengeMapConfig,m_curMapId)
if not this.playerViews[0] then
--Log(m_curMapId)
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.guajigongneng) then
iconNum = 20
local randomNum = 8--math.random(2,3)
PlayerManager.GetFightMapPlayerNPCData(randomNum,function(NPCList)
if this.isClose then
return
end
--Log("NPCList:"..LengthOfTable(NPCList))
local index = 1
local area = monsterArea[m_curMapId]
local suv = startUV[m_curMapId]
for k,v in pairs(NPCList) do
local index1 = math.random(area.x_pos.min,suv.u - 3)
local index2 = math.random(suv.u + 3,area.x_pos.max)
local index3 = math.random(1,2)
local index4 = math.random(area.y_pos.min,area.y_pos.max)
this.playerViews[index] = SubUIManager.Open(SubUIConfig.SingleFightPlayerView,this.mapRoot.transform,this)
this.playerViews[index]:SetData((index3 == 1 and index1 or index2),index4,false,v)
index = index + 1
end
end)
else
iconNum = 4
end
this.playerViews[0] = SubUIManager.Open(SubUIConfig.SingleFightPlayerView,this.mapRoot.transform,this)
this.playerViews[0]:SetData(startUV[m_curMapId].u,startUV[m_curMapId].v,true)
end
-- 设置相机初始化位置
local v4 = this.playerViews[0].transform.localPosition
v4.z = -50
TileMapView.SetCameraPos(v4)
-- 初始化两个地图标志
this.LoadMapIcon()
this.SetPlayerViewWalk()
end
function this:LoadMapData()
UIManager.camera.clearFlags = CameraClearFlags.Depth
-- 所有物体的根节点
this.mapRoot = poolManager:LoadAsset(mapCtrl, PoolManager.AssetType.GameObject)
this.mapRoot.name = mapCtrl
this.mapRoot.transform:SetParent(UIManager.uiRoot.transform.parent)
this.mapRoot.transform.position = Vector3.New(0, 0, -100)
TileMapView.fogSize = 2
local curChapter = FightPointPassManager.GetCurChapterIndex()
local index = 1
index = math.floor((curChapter - 1) % 5 + 1)
-- --Log(curChapter)
-- --Log(index)
m_curMapId = mapIdList[index]
-- LogPink("#mapIdList:"..#mapIdList.." m_curMapId:"..m_curMapId.." curChapter:"..curChapter.." index:"..index.." State:"..tostring(FightPointPassManager.isOpenNewChapter))
TileMapView.AwakeInit(this.mapRoot, m_curMapId, nil, Vector2.New(180, 180))
TileMapView.isShowFog = false
TileMapController.IsShieldDrag = function()
--当栈中有逻辑,则拖动可以打断镜头跟随
return false
end
TileMapController.OnClickTile = this.OnClickTile
TileMapController.Init(this.mapRoot, this.dragCtrl)
TileMapView.Init()
-- 设置镜头的尺寸
TileMapView.SetMapScale(Screen.height / 1920)
-- 设置不点击
this.dragCtrl:SetActive(false)
-- 挂机特效
this.moneyEffect = poolManager:LoadAsset(effectPath, PoolManager.AssetType.GameObject)
this.moneyEffect.transform:SetParent(this.effectRoot.transform)
this.moneyEffect.transform.localScale = Vector3.one
this.moneyEffect.transform.localPosition = Vector3.New(0, 0, 0)
this.moneyEffect:SetActive(false)
Util.AddParticleSortLayer(this.moneyEffect, m_parent.sortingOrder - m_orginLayer)
Util.AddParticleSortLayer(this.boxEffect, m_parent.sortingOrder - m_orginLayer)
m_orginLayer = m_parent.sortingOrder
this.boxEffect:SetActive(false)
end
--加载图标icon
function this.LoadMapIcon()
this.iconList = {}
this.selectIconList = {}
--FightPointPassManager.isBeginFight = false
for i = 1, iconNum do
this.LoadPointIcon(false)
end
end
function this.SetPlayerViewWalk()
if this.startTimer then
this.startTimer:Stop()
this.startTimer = nil
end
this.startTimer = Timer.New(function ()
for k,v in pairs(this.playerViews) do
v:SetRoleHitTarget()
end
end,1.5)
this.startTimer:Start()
end
this.isCanUseIconList = 0
function this.RequestIconList()
--Log(" this.isCanUseIconList:".. tostring(this.isCanUseIconList))
if this.isCanUseIconList == 0 then
this.isCanUseIconList = 1
--Log(" this.iconList:".. tostring(this.iconList))
return this.iconList
end
return nil
end
function this.ReleaseIconList()
this.isCanUseIconList = 0
end
function this.AsideTriggerJudge(data,isSelf,_userData)
--Log("data:"..tostring(data).." pos:"..tostring(Map_UV2Pos(data.u - 1, data.v).. " isSelf:"..tostring(isSelf).. " Self:"..tostring(_userData).. " Self:".." "..tostring(_userData.userId)))
local isGetIconList = false
local iconList = this.iconList
if not this.threads then
this.threads = {}
end
if this.threads[_userData.userId] then
coroutine.stop(this.threads[_userData.userId])
this.threads[_userData.userId] = nil
end
this.threads[_userData.userId] = coroutine.start(function()
while(not isGetIconList) do
if this.isClose and this.isClose == true then
coroutine.stop(this.threads[_userData.userId])
this.threads[_userData.userId] = nil
this.ReleaseIconList()
coroutine.yield()
end
--Log("没有得到访问权")
iconList = this.RequestIconList()
if iconList and LengthOfTable(iconList) > 0 then
isGetIconList = true
else
--Log("等待中")
coroutine.wait(0.1)
end
end
--Log("得到了访问权")
-- for k,v in pairs(iconList) do
-- --Log("iconList k:"..tostring(k))
-- end
local selfPos = Map_UV2Pos(data.u, data.v)
--Log("selfPos:"..tostring(selfPos))
local posList = {}
posList[1] = Map_UV2Pos(data.u - 1, data.v)
posList[2] = Map_UV2Pos(data.u + 1, data.v)
posList[3] = Map_UV2Pos(data.u, data.v - 1)
posList[4] = Map_UV2Pos(data.u, data.v + 1)
for k,pos in pairs(posList) do
--Log("posList pos:"..tostring(pos))
if iconList[pos] and this.HasSelectIconList(pos,_userData.userId) then
this.RemoveSelectIconList(_userData.eventPointPos)
this.AddSelectIconList(pos,_userData.userId)
--Log("发送了消息")
Game.GlobalEvent:DispatchEvent(GameEvent.GuaJi.getEvent,{goData = _userData, event = iconList[pos], pos = pos})
coroutine.stop(this.threads[_userData.userId])
this.threads[_userData.userId] = nil
this.ReleaseIconList()
coroutine.yield()
elseif FightPointPassManager.talkingTime == 0 or (GetTimeStamp() - FightPointPassManager.talkingTime >= 60) then
if isSelf and this.playerViews and LengthOfTable(this.playerViews) > 1 then
for k,v in pairs(this.playerViews) do
if not v.isSelf and Map_UV2Pos(v.roleCurPos.u, v.roleCurPos.v) == pos and v.state == 0 then
FightPointPassManager.talkingTime = GetTimeStamp()
--Log("发送了消息")
Game.GlobalEvent:DispatchEvent(GameEvent.GuaJi.getEvent,{goData = _userData,event = v,pos = pos})
coroutine.stop(this.threads[_userData.userId])
this.threads[_userData.userId] = nil
this.ReleaseIconList()
coroutine.yield()
end
end
end
end
end
--Log("周围没有事件")
if this.threads[_userData.userId] then
coroutine.stop( this.threads[_userData.userId])
this.threads[_userData.userId] = nil
end
this.ReleaseIconList()
coroutine.yield()
end)
end
function this.HasSelectIconList(pos,uid)
if this.selectIconList[pos] and this.selectIconList[pos] ~= uid then
return false
else
return true
end
end
function this.AddSelectIconList(pos,uid)
this.selectIconList[pos] = uid
end
function this.RemoveSelectIconList(pos)
if this.selectIconList[pos] then
this.selectIconList[pos] = nil
end
end
--- 生成一个图标, 传入校验权重值rand, 是否使用动画
function this.LoadPointIcon(useAnim)
if LengthOfTable(this.iconList) >= iconNum then
return
end
-- 随机一个坐标
local area = monsterArea[m_curMapId]
--Log("area.x_pos.min:"..tostring(area.x_pos.min).." area.x_pos.max:"..tostring(area.x_pos.max))
local u = math.random(area.x_pos.min, area.x_pos.max)
--Log("area.y_pos.min:"..tostring(area.y_pos.min).." area.y_pos.max:"..tostring(area.y_pos.max))
local v = math.random(area.y_pos.min, area.y_pos.max)
--Log("u:"..tostring(u).." v:"..tostring(v))
local pos = Map_UV2Pos(u, v)
local mapPointId = math.random(1,maxIcon)
-- 随机出来的位置已经有图标,则再次随机
if this.iconList[pos] or pos == 1285 or this.IsHaveBitchNear(pos) then
this.LoadPointIcon()
else
local pointView = MapPointView.New(u, v, mapPointId)
if pointView then
pointView.go.transform:SetParent(Util.GetTransform(this.mapRoot, "uiObj#"))
local targetPos = TileMapView.GetLiveTilePos(u, v) * 100
-- 完了这玩意还能从天而降
if useAnim then
pointView.go:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(targetPos.x, 1000, 0)
pointView.go:GetComponent("RectTransform"):DOAnchorPos(targetPos, 0.5, false):OnComplete(function ()
end)
else
pointView.go:GetComponent("RectTransform").anchoredPosition3D = targetPos
end
pointView:SetPointAnimation(pointView.iconId, 1)
pointView.go.transform.localScale = Vector3.one
-- 额外尺寸设置
if pointView.iconId == MapIconType.ICON_GOLD_BOX or pointView.iconId == MapIconType.ICON_NEW_BOX then
pointView.go.transform.localScale = Vector3.New(1.3, 1.3, 1.3)
elseif pointView.iconId == MapIconType.ICON_SUPPLY then
pointView.go.transform.localScale = Vector3.New(0.8, 0.8, 0.8)
end
pointView:OnShow()
pointView:ShowAtkNum(0, false)
pointView:ShowFreshTime(false)
pointView:ShowDialogue(false)
this.iconList[pos] = pointView
end
end
end
---------------------------------------------------------------------------------------------设置特效层级
function this:OnSortingOrderChange(orginLayer)
if this.moneyEffect then
Util.AddParticleSortLayer(this.moneyEffect, m_parent.sortingOrder - m_orginLayer)
Util.AddParticleSortLayer(this.boxEffect, m_parent.sortingOrder - m_orginLayer)
for k,v in pairs(this.playerViews) do
v:OnSortingOrderChange(m_parent.sortingOrder)
end
m_orginLayer = m_parent.sortingOrder
end
end
function this.GetCurLayer()
return m_orginLayer
end
-------------------------------------------------------------------------------------------------------------
---============== Point Icon Handle =================================
-- 删除一个图标
function this.DeletePointIcon(pos)
if this.iconList[pos] then
this.iconList[pos]:OnRemovePoint()
this.iconList[pos] = nil
end
end
-- 检测当前图标附近是否有图标
function this.IsHaveBitchNear(pos)
local haveBitch = false
local targetU, targetV = Map_Pos2UV(pos)
for i, v in pairs(this.iconList) do
local u0, v0 = Map_Pos2UV(i)
if math.abs(u0 - targetU) + math.abs(v0 - targetV) <= 2 then
haveBitch = true
break
end
end
return haveBitch
end
--- =============== 行动中的表现处理 =====================================================
-- 退出战斗状态
function this.BattleEnd(selectPointPos,isSelf)
--Log("战斗结束回调")
-- 删点前隐藏那个东西
if this.iconList[selectPointPos] then
this.iconList[selectPointPos]:ShowDialogue(false)
end
-- 删除图标
this.DeletePointIcon(selectPointPos)
this.RemoveSelectIconList(selectPointPos)
local str = ConfigManager.GetConfigData(ConfigName.SpecialConfig,111).Value
local strList = string.split(str,"#")
if strList and #strList > 0 then
local num = math.random(1,#strList)
FightPointPassManager.randomNum = num
end
end
--- ==================== 角色行走 =====================================
function this.OnClickTile(u, v)
--Log("UIManager.width is -- " .. UIManager.width .. " and Height is " .. UIManager.height)
local v2 = RectTransformUtility.WorldToScreenPoint(TileMapView.GetCamera(), TileMapView.GetLiveTilePos(u, v))
v2 = v2 / math.min(Screen.width/1080, Screen.height/1920)
--Log(string.format("当前点击坐标(%s, %s)", u, v))
--Log(string.format("转换后的屏幕坐标是(%s, %s)", v2.x, v2.y))
end
-- 停止一切该死的行为
function this.StopAction()
for k,v in pairs(this.playerViews) do
v:StopAction()
end
if this.moneyEffect then
this.moneyEffect.gameObject:SetActive(false)
end
if this.threads then
for k,v in pairs(this.threads) do
coroutine.stop(v)
this.threads[k] = nil
end
end
this.threads = {}
this.ReleaseIconList()
this.isClose = true
end
--- ======================================================================
function this.OnGameOver()
-- Log("OnGameOver")
for i, v in pairs(this.playerViews) do
if v then
SubUIManager.Close(v)
end
end
this.playerViews = {}
for i, v in pairs(this.iconList) do
if v then
v:Dispose()
this.iconList[i] = nil
end
end
if this.mapRoot then -- 避免不是主动退出
-- Log("注销一次地图资源")
poolManager:UnLoadAsset(mapCtrl, this.mapRoot, PoolManager.AssetType.GameObject)
poolManager:UnLoadAsset(effectPath, this.moneyEffect, PoolManager.AssetType.GameObject)
UIManager.camera.clearFlags = CameraClearFlags.Skybox
TileMapView.Exit()
TileMapController.Exit()
end
this.mapRoot = nil
this.moneyEffect = nil
end
function this:OnClose()
-- Log("关闭挂机OnClose")
if this.startTimer then
this.startTimer:Stop()
end
this.startTimer = nil
this.StopAction()
this.OnGameOver()
end
function this:Dispose()
if this.startTimer then
this.startTimer:Stop()
end
this.startTimer = nil
this.StopAction()
this.OnGameOver()
end
return this

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fad1407de48c2e848a3e9cd2245f5e60
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -37,7 +37,6 @@ end
--绑定事件(用于子类重写)
function ArenaTrialPanel:BindEvent()
Util.AddClick(self.btnBack, function()
LogError("self.btnBack....")
self:ClosePanel()
end)

View File

@ -69,7 +69,12 @@ function this.ReceiveShopData(msg)
-- 保存数据
this.allShopData = {}
for _, data in ipairs(msg.storeInfo) do
table.insert(this.allShopData, data)
local storeInfo = ConfigManager.TryGetConfigData(ConfigName.StoreTypeConfig, data.id)
if not storeInfo then
LogError("StoreTypeConfig not find Id:"..data.id)
else
table.insert(this.allShopData, data)
end
end
-- 刷新物品排序
this.SortItemList()
@ -114,7 +119,12 @@ function this.UpdateShopData(msg)
if _index then
this.allShopData[_index] = newdata
else
table.insert(this.allShopData, newdata)
local storeInfo = ConfigManager.TryGetConfigData(ConfigName.StoreTypeConfig, newdata.id)
if not storeInfo then
LogError("StoreTypeConfig not find Id:"..newdata.id)
else
table.insert(this.allShopData, newdata)
end
end
-- 刷新商店红点
@ -390,46 +400,50 @@ function this.SortItemList(shopType)
-- 排序
local shopData = nil
for _, v in ipairs(this.allShopData) do
local storeInfo = ConfigManager.GetConfigData(ConfigName.StoreTypeConfig, v.id)
-- shopType不存在时全部刷新否则按shoptype刷新
if not shopType or storeInfo.StoreType == shopType then
-- 试炼副本商店不按sort字段排序
if storeInfo.StoreType ~= SHOP_TYPE.TRIAL_SHOP then
table.sort(v.storeItem, function(a, b)
local aId = a.id % _StoreItemIdFilter
local bId = b.id % _StoreItemIdFilter
local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId)
local bInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, bId)
local storeInfo = ConfigManager.TryGetConfigData(ConfigName.StoreTypeConfig, v.id)
if not storeInfo then
LogError("StoreTypeConfig not find Id:"..v.id)
else
-- shopType不存在时全部刷新否则按shoptype刷新
if not shopType or storeInfo.StoreType == shopType then
-- 试炼副本商店不按sort字段排序
if storeInfo.StoreType ~= SHOP_TYPE.TRIAL_SHOP then
table.sort(v.storeItem, function(a, b)
local aId = a.id % _StoreItemIdFilter
local bId = b.id % _StoreItemIdFilter
local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId)
local bInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, bId)
-- 公会商店排序未解锁的往后排
if v.id == SHOP_TYPE.GUILD_SHOP and PlayerManager.familyId ~= 0 and MyGuildManager.GetMyGuildInfo() then
local aIsUnLock = MyGuildManager.GetGuildShopSortIsUnLock(aInfo.Sort)
local bIsUnLock = MyGuildManager.GetGuildShopSortIsUnLock(bInfo.Sort)
if aIsUnLock and not bIsUnLock then return true end
if not aIsUnLock and bIsUnLock then return false end
end
-- 免费的往前排
local _, a_price = this.calculateBuyCost(storeInfo.StoreType, aId, 1)
local _, b_price = this.calculateBuyCost(storeInfo.StoreType, bId, 1)
if a_price == 0 and b_price ~= 0 then return true end
if a_price ~= 0 and b_price == 0 then return false end
-- 按sort排序
return aInfo.Sort < bInfo.Sort
end)
else--是试炼商店
table.sort(v.storeItem, function(a, b)
local aId = a.id % _StoreItemIdFilter
local bId = b.id % _StoreItemIdFilter
local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId)
local bInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, bId)
if a.buyNum == 0 and b.buyNum > 0 then
return true
end
if a.buyNum > 0 and b.buyNum == 0 then
return false
end
return aInfo.Sort < bInfo.Sort
end)
-- 公会商店排序未解锁的往后排
if v.id == SHOP_TYPE.GUILD_SHOP and PlayerManager.familyId ~= 0 and MyGuildManager.GetMyGuildInfo() then
local aIsUnLock = MyGuildManager.GetGuildShopSortIsUnLock(aInfo.Sort)
local bIsUnLock = MyGuildManager.GetGuildShopSortIsUnLock(bInfo.Sort)
if aIsUnLock and not bIsUnLock then return true end
if not aIsUnLock and bIsUnLock then return false end
end
-- 免费的往前排
local _, a_price = this.calculateBuyCost(storeInfo.StoreType, aId, 1)
local _, b_price = this.calculateBuyCost(storeInfo.StoreType, bId, 1)
if a_price == 0 and b_price ~= 0 then return true end
if a_price ~= 0 and b_price == 0 then return false end
-- 按sort排序
return aInfo.Sort < bInfo.Sort
end)
else--是试炼商店
table.sort(v.storeItem, function(a, b)
local aId = a.id % _StoreItemIdFilter
local bId = b.id % _StoreItemIdFilter
local aInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, aId)
local bInfo = ConfigManager.GetConfigData(ConfigName.StoreConfig, bId)
if a.buyNum == 0 and b.buyNum > 0 then
return true
end
if a.buyNum > 0 and b.buyNum == 0 then
return false
end
return aInfo.Sort < bInfo.Sort
end)
end
end
end
end

View File

@ -0,0 +1,869 @@
SingleFightPlayerView = {}
local mapIconConfig = ConfigManager.GetConfig(ConfigName.MainMapIconConfig)
local iconAction = require("Modules/Fight/View/FightMapIconShowView")
local GlobalSysConfig = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig)
-- 角色对话气泡位置
local m_roleTextPos = {
[3] = {pos = Vector3.New(172, 200, 0), angleOffset = 180}, -- 角色朝左, 气泡在右
[4] = {pos = Vector3.New(-177, 204, 0), angleOffset = 0} -- 反之
}
local namePos = {
[1] = {pos = Vector3.New(-1.86, 185.3, 0)}, -- 角色朝左,气泡在左
[2] = {pos = Vector3.New(-1.86, 273.5, 0)} -- 反之
}
-- 老头对话气泡位置
local m_oldManTextPos = {
[3] = {pos = Vector3.New(-176, 130, 0), angleOffset = 0}, -- 角色朝左,气泡在左
[4] = {pos = Vector3.New(154, 130, 0), angleOffset = 180} -- 反之
}
function SingleFightPlayerView:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.GuaJi.getEvent, self.ReciveData,self)
end
function SingleFightPlayerView:ReciveData(data)
if data.goData.userId == self.userId then
self.eventPointPos = data.event
self.state = 1
self:RoleWalkEnd(data)
elseif (data.event and data.event.userId and data.event.userId == self.userId) then
self.eventPointPos = data.goData
self.state = 1
self:RoleWalkEnd(data)
end
return
end
function SingleFightPlayerView:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.GuaJi.getEvent, self.ReciveData, self)
end
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
self.m_roleFaceDir = Vector2.New(-1, 0)
--角色停止行走时的朝向
self.eventpoint = 0
--当前触发的事件点
self.eventPointPos = nil
self.nameDi = Util.GetGameObject(self.ui, "nemeDi")
self.name = Util.GetGameObject(self.nameDi, "name"):GetComponent("Text")
--修行标识
self.PracticeIcon = Util.GetGameObject(self.name.gameObject, "Icon")
self.PracticeIcon:SetActive(false)
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.isclose = false
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,scale
if self.isSelf then
npc = NameManager.roleSex == ROLE_SEX.BOY and npc1 or npc2
scale = NameManager.roleSex == ROLE_SEX.BOY and 1 or 0.5
self.userId = PlayerManager.uid
self.playerLiveView = PlayerLiveView:New(self.roleRoot,1,nil,sortingorder)
self.playerLiveView:RemoveTitleCanvas()
self.nameDi.gameObject:SetActive(false)
--如果修行开启设置修行标识
if ActTimeCtrlManager.SingleFuncState(108) then
self.PracticeIcon:SetActive(true)
PracticeManager.SetPracticeIcon(self.PracticeIcon,PracticeManager.PracticeLevel)
end
else
npc = data.sex == ROLE_SEX.BOY and npc1 or npc2
scale = data.sex == ROLE_SEX.BOY and 1 or 0.5
self.userId = data.uid or data.roleUid or data.id
self.playerLiveView = PlayerLiveView:New(self.roleRoot,2, {
skin = data.userSkin,
sex = data.sex,
ride = data.userMount,
designation = data.userTitle,
},sortingorder)
self.playerLiveView:SetNameHeight(1.5)
self.playerLiveView:RemoveTitleCanvas()
if data.userMount == 0 then
self.nameDi.transform.localPosition = namePos[1].pos
else
self.nameDi.transform.localPosition = namePos[2].pos
end
self.name.text = data.userName or data.name
self.nameDi.gameObject:SetActive(true)
local _lv = data.lv or data.level or data.userLevel
if _lv and _lv >= GlobalSysConfig[108].OpenRules[2] then
self.PracticeIcon:SetActive(true)
PracticeManager.SetPracticeIcon(self.PracticeIcon,data.practiceLevel)
end
end
self.playerLiveView:OnOpen(GetPlayerRoleSingleConFig().Scale2)
self.playerLiveView:OnSortingOrderChange(sortingorder)
if isSelf then
self.playerLiveView:SetSelfTag()
self.playerLiveView:SetEffectScale(2)
end
self.playerLiveView.name = "npc"
--角色当前的uv
self.roleCurPos = TileMapView.GetMapData():GetMapData(u, v)
-- LogWarn(self.roleCurPos.u.."||"..self.roleCurPos.v)
self.bLeaderIsIdle = true
self:SetWalkDir(WALK_DIR.LAUCH)
self:HideSomeTrash()
self:OnSortingOrderChange(self.parent.GetCurLayer())
--当前状态
self.state = 0
PlayUIAnim(self.gameObject)
end
function SingleFightPlayerView:SetWalkDir(dir)
if self.playerLiveView then
self.playerLiveView:SetWalkDir(dir)
end
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.parent.BattleEnd(pos) -- 战斗结束
if self.isSelf then
self:SetEffect(self.selectPointPos)
self.selectPointPos = nil
end
if self.targetTimer then
self.targetTimer:Stop()
self.targetTimer = nil
end
self:SetRoleHitTarget()
self.targetTimer = Timer.New(function () -- 延迟生成下一个小怪
self.parent.LoadPointIcon(false)
end, 0.5)
self.targetTimer:Start()
end
-- 随机一个位置给大爷走走
function SingleFightPlayerView:SetRoleHitTarget()
if self.thread then
coroutine.stop(self.thread)
self.thread=nil
end
self.thread = coroutine.start(function()
--LogGreen("随机一个位置给大爷走走")
--local eventPoint = self.parent.AsideTriggerJudge(self.roleCurPos,self.isSelf)
--self.parent.AsideTriggerJudge(self.roleCurPos,self.isSelf)
local pos
while not pos do
if self.isclose then
coroutine.yield()
end
coroutine.wait(0.01)
pos = self:SelectTargetPos()
end
--LogGreen("选中的点:"..tostring(pos).." "..tostring(self.userId))
local pathlist = self:SetRoleWalk(pos)
self:RoleMove(pathlist)
end)
end
-- 选择一个目标位置, 就近原则
function SingleFightPlayerView:SelectTargetPos()
local iconList = self.parent.RequestIconList()
--LogGreen("iconList:"..tostring(iconList))
if iconList and LengthOfTable(iconList) > 0 then
--LogGreen("iconList:"..tostring(LengthOfTable(iconList)))
local selectIconList = {}
local minDis = 999
for i, v in pairs(iconList) do
if self.parent.HasSelectIconList(i,self.userId) 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
--LogGreen("#selectIconList:"..#selectIconList.." self.uid:"..self.userId)
if #selectIconList > 1 then
self.parent.AddSelectIconList(selectIconList[1].pos,self.userId)
targetPos = self:GetTargetPos(selectIconList[1].pos)
self.parent.RemoveSelectIconList(self.eventPointPos)
else
self.parent.ReleaseIconList()
return
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 funcCanPass = function(data)
return data.val <= 1
end
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
self.parent.AsideTriggerJudge(self.roleCurPos,self.isSelf,self)
return
end
-- --把最终回调最先入栈
-- self.callList:Push(function ()
-- local eventPoint = self.parent.AsideTriggerJudge(self.roleCurPos,self.isSelf,self)
-- 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.5
self.gameObject.transform:DOLocalMove(Vector3(v3.x, v3.y, v3.z - 10), speed, false):OnStart(function () end):OnUpdate(function() --TODO:测试速度
if self.isSelf and not self.isclose then
self:PlayStepSound()
local v4 = self.gameObject.transform.localPosition
v4.z = TileMapView.ViewCameraPos.z
TileMapView.SetCameraPos(v4)
end
end):OnComplete(function ()
self.parent.AsideTriggerJudge(data,self.isSelf,self)
--self:SetRoleHitTarget()
if self.state == 0 then
self:StackPop()
end
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.. 8) --math.random(1,7))
end
end
-- 角色行走结束
function SingleFightPlayerView:RoleWalkEnd(eventPoint)
self.callList:Clear()
self:PlayerIdle()
if self.eventPointPos then
local iconType = self.eventPointPos.iconId or -1
if iconType == -1 then
self.selectPointPos = Map_UV2Pos(self.eventPointPos.roleCurPos.u,self.eventPointPos.roleCurPos.v)
else
self.selectPointPos = eventPoint.pos
end
--LogGreen("eventPoint.pos:"..tostring(self.selectPointPos))
-- 检测方向
self:SetRoleDir(self.roleCurPos.u * 256 + self.roleCurPos.v, self.selectPointPos)
-- 设置角色纵深
self:SetRoleLayer(self:IsRoleFront(self.selectPointPos))
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 = 2
else
self.m_roleFaceDir = Vector2.New(0, -1)
--LogGreen("他要朝下下下下下下")
self.eventpoint = 1
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 iconType = self.eventPointPos.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 Language[12322]
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]
local boxPos = self.selectPointPos
Timer.New(function()
if self.state == 1 then
self:SetEffect(boxPos)
end
end,1.5):Start()
end
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)
self.eventPointPos:SetDialogueDir(m_oldManTextPos[index].pos, oldManAngle)
self.eventPointPos:ShowDialogue(false)
self.eventPointPos:SetDialogueStr(strList1[num])
Timer.New(function()
if self.dialogueRoot then
if self.dialogueRoot.gameObject then
self.dialogueRoot.gameObject:SetActive(false)
end
end
if self.state == 1 then
self.eventPointPos:ShowDialogue(true)
self:NotBattleShow()
end
end,1):Start()
else
self:NotBattleShow()
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 self.parent.moneyEffect then
self.parent.moneyEffect:GetComponent("RectTransform").anchoredPosition = SetObjPosByUV(pos)
Util.ClearTrailRender(self.parent.moneyEffect)
self:SetBoxEffect(false, Vector3.zero)
self.parent.moneyEffect:SetActive(true)
self.parent.moneyEffect:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(tartPos.x + 88, tartPos.y + 359), 0.6, false):OnComplete(function ()
self:SetBoxEffect(true, boxState)
if self.parent.moneyEffect then
self.parent.moneyEffect:SetActive(false)
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)
if self.isSelf then
SoundManager.PlaySound(SoundConfig.Sound_FightArea_Attack[math.random(1, #SoundConfig.Sound_FightArea_Attack)])
end
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 i = math.floor(index % 3 + 1)
-- 吐血随机值
local hurtNum, isCritical = iconAction.pravite_GetHurtValue(isMonster, iconType, showType)
local v2 = SetObjPosByUV(objPos)
self.hurtNum[i]:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(v2.x, v2.y, 0) + Vector3.New(0, 120, 0)
Util.GetGameObject(self.hurtNum[i], "anim/Image"):SetActive(false)
Util.GetGameObject(self.hurtNum[i], "anim/anim"):GetComponent("Text").text = iconAction.DecodeHurt(hurtNum, isCritical, showType)
self.hurtNum[i]:SetActive(true)
-- if self.hurtNumTimer then
-- self.hurtNumTimer:Stop()
-- self.hurtNumTimer = nil
-- end
-- self.hurtNumTimer =
Timer.New(function()
if self.hurtNum[i] then
self.hurtNum[i]:SetActive(false)
end
if func then func() end
end, 1.5):Start()
-- self.hurtNumTimer
end
-- 震动动画
function SingleFightPlayerView:pravite_ShakeObjOnce(go, isReverse, roleFaceDir, func, mid_func)
if self.isclose then
return
end
--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)
if not IsNull(go) then
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)
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 self.isclose then
return
end
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)
self.hitEffect:SetActive(true)
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:SetRoleHitTarget()
self.state = 0
self.selectPointPos = nil
self.eventPointPos = nil
end, 0.5)
self.targetTimer:Start()
end, 1)
self.battleTimer:Start()
end
-- 进入战斗状态
function SingleFightPlayerView:EnterBattle()
self:SetBattleState(true)
end
function SingleFightPlayerView:StopAction()
self.callList:Clear()
self:SetWalkDir(WALK_DIR.IDLE_FRONT)
self.hitEffect:SetActive(false)
for i = 1, #self.hurtNum do
self.hurtNum[i].gameObject:SetActive(false)
end
if self.targetTimer then
self.targetTimer:Stop()
self.targetTimer = nil
end
if self.callbackTimer then
self.callbackTimer:Stop()
self.callbackTimer = nil
end
-- if self.hurtNumTimer then
-- self.hurtNumTimer:Stop()
-- self.hurtNumTimer = nil
-- end
if self.battleTimer then
self.battleTimer:Stop()
self.battleTimer = nil
end
--LogGreen("停止协程")
if self.thread then
coroutine.stop(self.thread)
self.thread = nil
end
end
function SingleFightPlayerView:OnClose()
self.isclose = true
self.dialogueRoot.gameObject:SetActive(false)
self:StopAction()
self.hurtNum = {}
self.buffTipList = {}
if self.playerLiveView then
self.playerLiveView:OnClose()
self.playerLiveView = nil
end
--角色当前方向
self.curDir = nil
--当前选中点的位置
self.selectPointPos = 0
--角色停止行走时的朝向
self.eventpoint = 0
--当前触发的事件点
self.eventPointPos = nil
self.state = 0
end
return SingleFightPlayerView

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f6f2693984a35f74d8e0311299f459a4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: