merge
This commit is contained in:
commit
d0db7b388f
@ -10,6 +10,13 @@ local card = {
|
||||
["hp_6"]=150,
|
||||
["hp_7"]=160,
|
||||
["hp_8"]=170,
|
||||
["hp_9"]=180,
|
||||
["hp_10"]=190,
|
||||
["hp_11"]=200,
|
||||
["hp_12"]=210,
|
||||
["hp_13"]=220,
|
||||
["hp_14"]=230,
|
||||
["hp_15"]=240,
|
||||
["atk_1"]=100,
|
||||
["atk_2"]=110,
|
||||
["atk_3"]=120,
|
||||
@ -17,7 +24,14 @@ local card = {
|
||||
["atk_5"]=140,
|
||||
["atk_6"]=150,
|
||||
["atk_7"]=160,
|
||||
["atk_8"]=170
|
||||
["atk_8"]=170,
|
||||
["atk_9"]=180,
|
||||
["atk_10"]=190,
|
||||
["atk_11"]=200,
|
||||
["atk_12"]=210,
|
||||
["atk_13"]=220,
|
||||
["atk_14"]=230,
|
||||
["atk_15"]=240
|
||||
},
|
||||
[2]={
|
||||
["position"]=2,
|
||||
@ -30,6 +44,13 @@ local card = {
|
||||
["hp_6"]=150,
|
||||
["hp_7"]=160,
|
||||
["hp_8"]=170,
|
||||
["hp_9"]=180,
|
||||
["hp_10"]=190,
|
||||
["hp_11"]=200,
|
||||
["hp_12"]=210,
|
||||
["hp_13"]=220,
|
||||
["hp_14"]=230,
|
||||
["hp_15"]=240,
|
||||
["atk_1"]=100,
|
||||
["atk_2"]=110,
|
||||
["atk_3"]=120,
|
||||
@ -37,7 +58,14 @@ local card = {
|
||||
["atk_5"]=140,
|
||||
["atk_6"]=150,
|
||||
["atk_7"]=160,
|
||||
["atk_8"]=170
|
||||
["atk_8"]=170,
|
||||
["atk_9"]=180,
|
||||
["atk_10"]=190,
|
||||
["atk_11"]=200,
|
||||
["atk_12"]=210,
|
||||
["atk_13"]=220,
|
||||
["atk_14"]=230,
|
||||
["atk_15"]=240
|
||||
},
|
||||
[3]={
|
||||
["position"]=4,
|
||||
@ -50,6 +78,13 @@ local card = {
|
||||
["hp_6"]=150,
|
||||
["hp_7"]=160,
|
||||
["hp_8"]=170,
|
||||
["hp_9"]=180,
|
||||
["hp_10"]=190,
|
||||
["hp_11"]=200,
|
||||
["hp_12"]=210,
|
||||
["hp_13"]=220,
|
||||
["hp_14"]=230,
|
||||
["hp_15"]=240,
|
||||
["atk_1"]=100,
|
||||
["atk_2"]=110,
|
||||
["atk_3"]=120,
|
||||
@ -57,7 +92,14 @@ local card = {
|
||||
["atk_5"]=140,
|
||||
["atk_6"]=150,
|
||||
["atk_7"]=160,
|
||||
["atk_8"]=170
|
||||
["atk_8"]=170,
|
||||
["atk_9"]=180,
|
||||
["atk_10"]=190,
|
||||
["atk_11"]=200,
|
||||
["atk_12"]=210,
|
||||
["atk_13"]=220,
|
||||
["atk_14"]=230,
|
||||
["atk_15"]=240
|
||||
},
|
||||
[4]={
|
||||
["position"]=5,
|
||||
@ -70,6 +112,13 @@ local card = {
|
||||
["hp_6"]=150,
|
||||
["hp_7"]=160,
|
||||
["hp_8"]=170,
|
||||
["hp_9"]=180,
|
||||
["hp_10"]=190,
|
||||
["hp_11"]=200,
|
||||
["hp_12"]=210,
|
||||
["hp_13"]=220,
|
||||
["hp_14"]=230,
|
||||
["hp_15"]=240,
|
||||
["atk_1"]=100,
|
||||
["atk_2"]=110,
|
||||
["atk_3"]=120,
|
||||
@ -77,7 +126,14 @@ local card = {
|
||||
["atk_5"]=140,
|
||||
["atk_6"]=150,
|
||||
["atk_7"]=160,
|
||||
["atk_8"]=170
|
||||
["atk_8"]=170,
|
||||
["atk_9"]=180,
|
||||
["atk_10"]=190,
|
||||
["atk_11"]=200,
|
||||
["atk_12"]=210,
|
||||
["atk_13"]=220,
|
||||
["atk_14"]=230,
|
||||
["atk_15"]=240
|
||||
},
|
||||
[5]={
|
||||
["position"]=1,
|
||||
@ -90,6 +146,13 @@ local card = {
|
||||
["hp_6"]=150,
|
||||
["hp_7"]=160,
|
||||
["hp_8"]=170,
|
||||
["hp_9"]=180,
|
||||
["hp_10"]=190,
|
||||
["hp_11"]=200,
|
||||
["hp_12"]=210,
|
||||
["hp_13"]=220,
|
||||
["hp_14"]=230,
|
||||
["hp_15"]=240,
|
||||
["atk_1"]=100,
|
||||
["atk_2"]=110,
|
||||
["atk_3"]=120,
|
||||
@ -97,7 +160,14 @@ local card = {
|
||||
["atk_5"]=140,
|
||||
["atk_6"]=150,
|
||||
["atk_7"]=160,
|
||||
["atk_8"]=170
|
||||
["atk_8"]=170,
|
||||
["atk_9"]=180,
|
||||
["atk_10"]=190,
|
||||
["atk_11"]=200,
|
||||
["atk_12"]=210,
|
||||
["atk_13"]=220,
|
||||
["atk_14"]=230,
|
||||
["atk_15"]=240
|
||||
},
|
||||
[6]={
|
||||
["position"]=3,
|
||||
@ -110,6 +180,13 @@ local card = {
|
||||
["hp_6"]=225,
|
||||
["hp_7"]=240,
|
||||
["hp_8"]=255,
|
||||
["hp_9"]=270,
|
||||
["hp_10"]=285,
|
||||
["hp_11"]=300,
|
||||
["hp_12"]=315,
|
||||
["hp_13"]=330,
|
||||
["hp_14"]=345,
|
||||
["hp_15"]=360,
|
||||
["atk_1"]=150,
|
||||
["atk_2"]=165,
|
||||
["atk_3"]=180,
|
||||
@ -117,7 +194,14 @@ local card = {
|
||||
["atk_5"]=210,
|
||||
["atk_6"]=225,
|
||||
["atk_7"]=240,
|
||||
["atk_8"]=255
|
||||
["atk_8"]=255,
|
||||
["atk_9"]=270,
|
||||
["atk_10"]=285,
|
||||
["atk_11"]=300,
|
||||
["atk_12"]=315,
|
||||
["atk_13"]=330,
|
||||
["atk_14"]=345,
|
||||
["atk_15"]=360
|
||||
},
|
||||
[7]={
|
||||
["position"]=2,
|
||||
@ -130,6 +214,13 @@ local card = {
|
||||
["hp_6"]=225,
|
||||
["hp_7"]=240,
|
||||
["hp_8"]=255,
|
||||
["hp_9"]=270,
|
||||
["hp_10"]=285,
|
||||
["hp_11"]=300,
|
||||
["hp_12"]=315,
|
||||
["hp_13"]=330,
|
||||
["hp_14"]=345,
|
||||
["hp_15"]=360,
|
||||
["atk_1"]=150,
|
||||
["atk_2"]=165,
|
||||
["atk_3"]=180,
|
||||
@ -137,7 +228,14 @@ local card = {
|
||||
["atk_5"]=210,
|
||||
["atk_6"]=225,
|
||||
["atk_7"]=240,
|
||||
["atk_8"]=255
|
||||
["atk_8"]=255,
|
||||
["atk_9"]=270,
|
||||
["atk_10"]=285,
|
||||
["atk_11"]=300,
|
||||
["atk_12"]=315,
|
||||
["atk_13"]=330,
|
||||
["atk_14"]=345,
|
||||
["atk_15"]=360
|
||||
},
|
||||
[8]={
|
||||
["position"]=4,
|
||||
@ -150,6 +248,13 @@ local card = {
|
||||
["hp_6"]=225,
|
||||
["hp_7"]=240,
|
||||
["hp_8"]=255,
|
||||
["hp_9"]=270,
|
||||
["hp_10"]=285,
|
||||
["hp_11"]=300,
|
||||
["hp_12"]=315,
|
||||
["hp_13"]=330,
|
||||
["hp_14"]=345,
|
||||
["hp_15"]=360,
|
||||
["atk_1"]=150,
|
||||
["atk_2"]=165,
|
||||
["atk_3"]=180,
|
||||
@ -157,7 +262,14 @@ local card = {
|
||||
["atk_5"]=210,
|
||||
["atk_6"]=225,
|
||||
["atk_7"]=240,
|
||||
["atk_8"]=255
|
||||
["atk_8"]=255,
|
||||
["atk_9"]=270,
|
||||
["atk_10"]=285,
|
||||
["atk_11"]=300,
|
||||
["atk_12"]=315,
|
||||
["atk_13"]=330,
|
||||
["atk_14"]=345,
|
||||
["atk_15"]=360
|
||||
},
|
||||
[9]={
|
||||
["position"]=5,
|
||||
@ -170,6 +282,13 @@ local card = {
|
||||
["hp_6"]=225,
|
||||
["hp_7"]=240,
|
||||
["hp_8"]=255,
|
||||
["hp_9"]=270,
|
||||
["hp_10"]=285,
|
||||
["hp_11"]=300,
|
||||
["hp_12"]=315,
|
||||
["hp_13"]=330,
|
||||
["hp_14"]=345,
|
||||
["hp_15"]=360,
|
||||
["atk_1"]=150,
|
||||
["atk_2"]=165,
|
||||
["atk_3"]=180,
|
||||
@ -177,7 +296,14 @@ local card = {
|
||||
["atk_5"]=210,
|
||||
["atk_6"]=225,
|
||||
["atk_7"]=240,
|
||||
["atk_8"]=255
|
||||
["atk_8"]=255,
|
||||
["atk_9"]=270,
|
||||
["atk_10"]=285,
|
||||
["atk_11"]=300,
|
||||
["atk_12"]=315,
|
||||
["atk_13"]=330,
|
||||
["atk_14"]=345,
|
||||
["atk_15"]=360
|
||||
},
|
||||
[10]={
|
||||
["position"]=1,
|
||||
@ -190,6 +316,13 @@ local card = {
|
||||
["hp_6"]=225,
|
||||
["hp_7"]=240,
|
||||
["hp_8"]=255,
|
||||
["hp_9"]=270,
|
||||
["hp_10"]=285,
|
||||
["hp_11"]=300,
|
||||
["hp_12"]=315,
|
||||
["hp_13"]=330,
|
||||
["hp_14"]=345,
|
||||
["hp_15"]=360,
|
||||
["atk_1"]=150,
|
||||
["atk_2"]=165,
|
||||
["atk_3"]=180,
|
||||
@ -197,7 +330,14 @@ local card = {
|
||||
["atk_5"]=210,
|
||||
["atk_6"]=225,
|
||||
["atk_7"]=240,
|
||||
["atk_8"]=255
|
||||
["atk_8"]=255,
|
||||
["atk_9"]=270,
|
||||
["atk_10"]=285,
|
||||
["atk_11"]=300,
|
||||
["atk_12"]=315,
|
||||
["atk_13"]=330,
|
||||
["atk_14"]=345,
|
||||
["atk_15"]=360
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
|
||||
@ -137,6 +137,10 @@ local card_level = {
|
||||
2500,
|
||||
10000
|
||||
},
|
||||
["cost_3"]={
|
||||
1500,
|
||||
10000
|
||||
},
|
||||
["cost_4"]={
|
||||
320,
|
||||
10000
|
||||
@ -147,6 +151,10 @@ local card_level = {
|
||||
3000,
|
||||
10000
|
||||
},
|
||||
["cost_3"]={
|
||||
2000,
|
||||
10000
|
||||
},
|
||||
["cost_4"]={
|
||||
640,
|
||||
10000
|
||||
@ -157,6 +165,10 @@ local card_level = {
|
||||
4000,
|
||||
10000
|
||||
},
|
||||
["cost_3"]={
|
||||
3000,
|
||||
10000
|
||||
},
|
||||
["cost_4"]={
|
||||
1000,
|
||||
10000
|
||||
@ -167,6 +179,10 @@ local card_level = {
|
||||
5000,
|
||||
10000
|
||||
},
|
||||
["cost_3"]={
|
||||
4000,
|
||||
10000
|
||||
},
|
||||
["cost_4"]={
|
||||
1500,
|
||||
10000
|
||||
|
||||
9
lua/app/config/const.lua
Normal file
9
lua/app/config/const.lua
Normal file
@ -0,0 +1,9 @@
|
||||
local const = {
|
||||
["element_combo"]={
|
||||
["value"]=2
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=const,count=1
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/const.lua.meta
Normal file
10
lua/app/config/const.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d8697f998fe2b04798c1c18a2b6eb68
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
7
lua/app/config/skill_box.lua
Normal file
7
lua/app/config/skill_box.lua
Normal file
@ -0,0 +1,7 @@
|
||||
local skill_box = {
|
||||
|
||||
}
|
||||
local config = {
|
||||
data=skill_box,count=0
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/skill_box.lua.meta
Normal file
10
lua/app/config/skill_box.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0e5e92c84e063f43b56758577128e37
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
69
lua/app/config/skill_card.lua
Normal file
69
lua/app/config/skill_card.lua
Normal file
@ -0,0 +1,69 @@
|
||||
local skill_card = {
|
||||
[10]={
|
||||
["method"]=2
|
||||
},
|
||||
[11]={
|
||||
["method"]=2
|
||||
},
|
||||
[20]={
|
||||
["method"]=2
|
||||
},
|
||||
[21]={
|
||||
["method"]=2
|
||||
},
|
||||
[22]={
|
||||
["method"]=2
|
||||
},
|
||||
[30]={
|
||||
["method"]=2
|
||||
},
|
||||
[40]={
|
||||
["method"]=2
|
||||
},
|
||||
[41]={
|
||||
["method"]=2
|
||||
},
|
||||
[50]={
|
||||
["method"]=2
|
||||
},
|
||||
[51]={
|
||||
["method"]=2
|
||||
},
|
||||
[60]={
|
||||
["method"]=2
|
||||
},
|
||||
[61]={
|
||||
["method"]=2
|
||||
},
|
||||
[70]={
|
||||
["method"]=1
|
||||
},
|
||||
[71]={
|
||||
["method"]=1
|
||||
},
|
||||
[80]={
|
||||
["method"]=2
|
||||
},
|
||||
[81]={
|
||||
["method"]=2
|
||||
},
|
||||
[90]={
|
||||
["method"]=2
|
||||
},
|
||||
[91]={
|
||||
["method"]=2
|
||||
},
|
||||
[100]={
|
||||
["method"]=2
|
||||
},
|
||||
[101]={
|
||||
|
||||
},
|
||||
[102]={
|
||||
["method"]=2
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=skill_card,count=21
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/skill_card.lua.meta
Normal file
10
lua/app/config/skill_card.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af9637d329b3bfa4cb0824f4e5a51bae
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
7
lua/app/config/skill_rogue.lua
Normal file
7
lua/app/config/skill_rogue.lua
Normal file
@ -0,0 +1,7 @@
|
||||
local skill_rogue = {
|
||||
|
||||
}
|
||||
local config = {
|
||||
data=skill_rogue,count=0
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/skill_rogue.lua.meta
Normal file
10
lua/app/config/skill_rogue.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 058cd600efafbe74c8af712668807a8d
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
835
lua/app/config/stage.lua
Normal file
835
lua/app/config/stage.lua
Normal file
@ -0,0 +1,835 @@
|
||||
local stage = {
|
||||
[1]={
|
||||
["board"]={
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
}
|
||||
},
|
||||
["control_element"]={
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
5
|
||||
}
|
||||
},
|
||||
[2]={
|
||||
["board"]={
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
}
|
||||
},
|
||||
["control_element"]={
|
||||
1,
|
||||
1,
|
||||
3,
|
||||
5,
|
||||
1,
|
||||
4,
|
||||
3,
|
||||
1,
|
||||
1
|
||||
}
|
||||
},
|
||||
[3]={
|
||||
["board"]={
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
4
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
}
|
||||
},
|
||||
["control_element"]={
|
||||
3,
|
||||
1,
|
||||
5,
|
||||
3
|
||||
}
|
||||
},
|
||||
[4]={
|
||||
["board"]={
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
0,
|
||||
5
|
||||
},
|
||||
{
|
||||
0,
|
||||
1
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
3
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
},
|
||||
{
|
||||
1,
|
||||
0
|
||||
}
|
||||
},
|
||||
["control_element"]={
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=stage,count=4
|
||||
}
|
||||
return config
|
||||
10
lua/app/config/stage.lua.meta
Normal file
10
lua/app/config/stage.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c74f4c0846956944c8e8c94b47d5ee1a
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -9,9 +9,13 @@ local struct = {
|
||||
["parameter2"]="id:int",
|
||||
["parameter3"]="num:int",
|
||||
["parameter4"]="weight:int"
|
||||
},
|
||||
["boardrange"]={
|
||||
["parameter1"]="type:int",
|
||||
["parameter2"]="range:int"
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=struct,count=2
|
||||
data=struct,count=3
|
||||
}
|
||||
return config
|
||||
@ -2,10 +2,21 @@ local BattleConst = {}
|
||||
|
||||
BattleConst.ROW_COUNT = 7
|
||||
BattleConst.COLUMN_COUNT = 7
|
||||
BattleConst.HALF_ROW_COUNT = 4 -- 计算偏移 math.ceil(ROW_COUNT / 2)
|
||||
BattleConst.HALF_COLUMN_COUNT = 4 -- 计算偏移 math.ceil(COLUMN_COUNT / 2)
|
||||
BattleConst.ELIMINATION_MIN_COUNT = 2
|
||||
BattleConst.GRID_STEP_H = 97
|
||||
BattleConst.ROW_STEP = 10
|
||||
BattleConst.ONE_STEP_TIME = 0.2
|
||||
BattleConst.ELEMENT_TYPE_COUNT = 5
|
||||
BattleConst.ELEMENT_WIGHT = 100
|
||||
BattleConst.MAX_ELEMENT_WIGHT = 500
|
||||
|
||||
BattleConst.BATTLE_TYPE = {
|
||||
STAGE = 1,
|
||||
}
|
||||
|
||||
---- 格子类型
|
||||
BattleConst.GRID_TYPE = {
|
||||
EMPTY = 0,
|
||||
OBSTACLE = 1,
|
||||
@ -15,6 +26,28 @@ BattleConst.GRID_TYPE = {
|
||||
ICE = 5,
|
||||
}
|
||||
|
||||
---- 周围格子消除一次后会变成什么格子
|
||||
BattleConst.AROUND_ELIMINATION_TO_TYPE_COUNT = {
|
||||
[BattleConst.GRID_TYPE.SNOW_BOX] = {BattleConst.GRID_TYPE.EMPTY},
|
||||
[BattleConst.GRID_TYPE.SOLID_SNOW] = {BattleConst.GRID_TYPE.SNOW_BOX},
|
||||
[BattleConst.GRID_TYPE.ICE] = {BattleConst.GRID_TYPE.EMPTY},
|
||||
}
|
||||
|
||||
---- 不可下落的格子类型
|
||||
BattleConst.CANT_FALL_GRID_TYPE = {
|
||||
[BattleConst.GRID_TYPE.VINES] = true,
|
||||
[BattleConst.GRID_TYPE.ICE] = true,
|
||||
}
|
||||
|
||||
---- 不可链接的格子类型
|
||||
BattleConst.CANT_LINK_GRID_TYPE = {
|
||||
[BattleConst.GRID_TYPE.OBSTACLE] = true,
|
||||
[BattleConst.GRID_TYPE.SNOW_BOX] = true,
|
||||
[BattleConst.GRID_TYPE.SOLID_SNOW] = true,
|
||||
[BattleConst.GRID_TYPE.ICE] = true,
|
||||
}
|
||||
|
||||
---- 元素类型
|
||||
BattleConst.ELEMENT_TYPE = {
|
||||
RED = 1,
|
||||
YELLOW = 2,
|
||||
@ -36,55 +69,55 @@ BattleConst.RC_2_POS_ID = {}
|
||||
|
||||
---- 格子位置
|
||||
BattleConst.GRID_POS = {
|
||||
[11] = {x = 0, y = 0},
|
||||
[12] = {x = 97, y = 0},
|
||||
[13] = {x = 194, y = 0},
|
||||
[14] = {x = 291, y = 0},
|
||||
[15] = {x = 388, y = 0},
|
||||
[16] = {x = 485, y = 0},
|
||||
[17] = {x = 582, y = 0},
|
||||
[21] = {x = 0, y = -97},
|
||||
[22] = {x = 97, y = -97},
|
||||
[23] = {x = 194, y = -97},
|
||||
[24] = {x = 291, y = -97},
|
||||
[25] = {x = 388, y = -97},
|
||||
[26] = {x = 485, y = -97},
|
||||
[27] = {x = 582, y = -97},
|
||||
[31] = {x = 0, y = -194},
|
||||
[32] = {x = 97, y = -194},
|
||||
[33] = {x = 194, y = -194},
|
||||
[34] = {x = 291, y = -194},
|
||||
[35] = {x = 388, y = -194},
|
||||
[36] = {x = 485, y = -194},
|
||||
[37] = {x = 582, y = -194},
|
||||
[41] = {x = 0, y = -291},
|
||||
[42] = {x = 97, y = -291},
|
||||
[43] = {x = 194, y = -291},
|
||||
[44] = {x = 291, y = -291},
|
||||
[45] = {x = 388, y = -291},
|
||||
[46] = {x = 485, y = -291},
|
||||
[47] = {x = 582, y = -291},
|
||||
[51] = {x = 0, y = -388},
|
||||
[52] = {x = 97, y = -388},
|
||||
[53] = {x = 194, y = -388},
|
||||
[54] = {x = 291, y = -388},
|
||||
[55] = {x = 388, y = -388},
|
||||
[56] = {x = 485, y = -388},
|
||||
[57] = {x = 582, y = -388},
|
||||
[61] = {x = 0, y = -485},
|
||||
[62] = {x = 97, y = -485},
|
||||
[63] = {x = 194, y = -485},
|
||||
[64] = {x = 291, y = -485},
|
||||
[65] = {x = 388, y = -485},
|
||||
[66] = {x = 485, y = -485},
|
||||
[67] = {x = 582, y = -485},
|
||||
[71] = {x = 0, y = -582},
|
||||
[72] = {x = 97, y = -582},
|
||||
[73] = {x = 194, y = -582},
|
||||
[74] = {x = 291, y = -582},
|
||||
[75] = {x = 388, y = -582},
|
||||
[76] = {x = 485, y = -582},
|
||||
[77] = {x = 582, y = -582},
|
||||
[11] = {x = -291, y = 291},
|
||||
[12] = {x = -194, y = 291},
|
||||
[13] = {x = -97, y = 291},
|
||||
[14] = {x = 0, y = 291},
|
||||
[15] = {x = 97, y = 291},
|
||||
[16] = {x = 194, y = 291},
|
||||
[17] = {x = 291, y = 291},
|
||||
[21] = {x = -291, y = 194},
|
||||
[22] = {x = -194, y = 194},
|
||||
[23] = {x = -97, y = 194},
|
||||
[24] = {x = 0, y = 194},
|
||||
[25] = {x = 97, y = 194},
|
||||
[26] = {x = 194, y = 194},
|
||||
[27] = {x = 291, y = 194},
|
||||
[31] = {x = -291, y = 97},
|
||||
[32] = {x = -194, y = 97},
|
||||
[33] = {x = -97, y = 97},
|
||||
[34] = {x = 0, y = 97},
|
||||
[35] = {x = 97, y = 97},
|
||||
[36] = {x = 194, y = 97},
|
||||
[37] = {x = 291, y = 97},
|
||||
[41] = {x = -291, y = 0},
|
||||
[42] = {x = -194, y = 0},
|
||||
[43] = {x = -97, y = 0},
|
||||
[44] = {x = 0, y = 0},
|
||||
[45] = {x = 97, y = 0},
|
||||
[46] = {x = 194, y = 0},
|
||||
[47] = {x = 291, y = 0},
|
||||
[51] = {x = -291, y = -97},
|
||||
[52] = {x = -194, y = -97},
|
||||
[53] = {x = -97, y = -97},
|
||||
[54] = {x = 0, y = -97},
|
||||
[55] = {x = 97, y = -97},
|
||||
[56] = {x = 194, y = -97},
|
||||
[57] = {x = 291, y = -97},
|
||||
[61] = {x = -291, y = -194},
|
||||
[62] = {x = -194, y = -194},
|
||||
[63] = {x = -97, y = -194},
|
||||
[64] = {x = 0, y = -194},
|
||||
[65] = {x = 97, y = -194},
|
||||
[66] = {x = 194, y = -194},
|
||||
[67] = {x = 291, y = -194},
|
||||
[71] = {x = -291, y = -291},
|
||||
[72] = {x = -194, y = -291},
|
||||
[73] = {x = -97, y = -291},
|
||||
[74] = {x = 0, y = -291},
|
||||
[75] = {x = 97, y = -291},
|
||||
[76] = {x = 194, y = -291},
|
||||
[77] = {x = 291, y = -291},
|
||||
}
|
||||
|
||||
---- 每个格子外围一格距离的格子
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
|
||||
local BattleManager = class("BattleManager", BaseModule)
|
||||
local BattleConst = GConst.BattleConst
|
||||
|
||||
local BATTLE_CONTROLLER_BASE = "app/module/battle/controller/battle_controller"
|
||||
local BATTLE_CONTROLLER = {}
|
||||
|
||||
local BATTLE_CONTROLLER = {
|
||||
[BattleConst.BATTLE_TYPE.STAGE] = "app/module/battle/controller/battle_controller_stage"
|
||||
}
|
||||
|
||||
function BattleManager:getPosInfo(posId)
|
||||
local posInfo = GConst.BattleConst.GRID_POS[posId]
|
||||
@ -10,16 +14,11 @@ function BattleManager:getPosInfo(posId)
|
||||
local r = self:getPosRC(posId).r
|
||||
local c = self:getPosRC(posId).c
|
||||
|
||||
local x, y
|
||||
x = (c - 1) * BattleConst.GRID_STEP_H
|
||||
if r > 0 then
|
||||
y = (r - 1) * BattleConst.GRID_STEP_H
|
||||
else
|
||||
y = r * BattleConst.GRID_STEP_H
|
||||
end
|
||||
y = - y
|
||||
local offsetC = c - BattleConst.HALF_COLUMN_COUNT
|
||||
local offsetR = BattleConst.HALF_ROW_COUNT - r
|
||||
local info = {x = offsetC * BattleConst.GRID_STEP_H, y = offsetR * BattleConst.GRID_STEP_H}
|
||||
|
||||
GConst.BattleConst.GRID_POS[posId] = {x = x, y = y}
|
||||
GConst.BattleConst.GRID_POS[posId] = info
|
||||
posInfo = GConst.BattleConst.GRID_POS[posId]
|
||||
end
|
||||
return posInfo
|
||||
@ -28,7 +27,7 @@ end
|
||||
function BattleManager:getElementIcon(elementType)
|
||||
local icon = GConst.BattleConst.ELEMENT_ICON[elementType]
|
||||
if not icon then
|
||||
return GConst.ATLAS_PATH.COMMON, "common_algha"
|
||||
return GConst.ATLAS_PATH.COMMON, "common_alpha"
|
||||
end
|
||||
return GConst.ATLAS_PATH.BATTLE, icon
|
||||
end
|
||||
@ -36,7 +35,7 @@ end
|
||||
function BattleManager:getGridTypeIcon(elementType)
|
||||
local icon = GConst.BattleConst.ELEMENT_ICON[elementType]
|
||||
if not icon then
|
||||
return GConst.ATLAS_PATH.COMMON, "common_algha"
|
||||
return GConst.ATLAS_PATH.COMMON, "common_alpha"
|
||||
end
|
||||
return GConst.ATLAS_PATH.BATTLE, icon
|
||||
end
|
||||
@ -48,9 +47,10 @@ function BattleManager:getPosId(row, column)
|
||||
if not BattleConst.RC_2_POS_ID[row][column] then
|
||||
local posId
|
||||
local rowValue = row * BattleConst.ROW_STEP
|
||||
if rowValue > 0 then
|
||||
if rowValue >= 0 then
|
||||
posId = rowValue + column
|
||||
else
|
||||
rowValue = rowValue + BattleConst.ROW_STEP
|
||||
posId = rowValue - column
|
||||
end
|
||||
BattleConst.RC_2_POS_ID[row][column] = posId
|
||||
@ -58,13 +58,8 @@ function BattleManager:getPosId(row, column)
|
||||
return BattleConst.RC_2_POS_ID[row][column]
|
||||
end
|
||||
|
||||
function BattleManager:getLastRowPosId(row, column)
|
||||
return self:getPosId(row - 1, column)
|
||||
end
|
||||
|
||||
function BattleManager:getLastRowPosIdByPosId(posId)
|
||||
local rc = self:getPosRC(posId)
|
||||
return self:getPosId(rc.r - 1, rc.c)
|
||||
function BattleManager:getFirstLineLastRowPosId(row, column)
|
||||
return self:getPosId(1 - row, column)
|
||||
end
|
||||
|
||||
function BattleManager:getPosRC(posId)
|
||||
@ -82,16 +77,16 @@ function BattleManager:getPosRC(posId)
|
||||
return BattleConst.POS_ID_2_RC[posId]
|
||||
end
|
||||
|
||||
function BattleManager:playBattle(params, returnFunc)
|
||||
function BattleManager:playBattle(params, battleType, returnFunc)
|
||||
if self.battleController then -- 同一时间只能有一场战斗
|
||||
self:clear()
|
||||
end
|
||||
self.returnFunc = returnFunc
|
||||
UIManager:stopCurrentBGM()
|
||||
self:_play(params)
|
||||
self:_play(params, battleType)
|
||||
end
|
||||
|
||||
function BattleManager:_play(params)
|
||||
function BattleManager:_play(params, battleType)
|
||||
local controllerPath = BATTLE_CONTROLLER[battleType] or BATTLE_CONTROLLER_BASE
|
||||
self.battleController = require(controllerPath):create()
|
||||
self.battleController:init(params)
|
||||
|
||||
@ -3,20 +3,37 @@ local BattleController = class("BattleController")
|
||||
local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT
|
||||
local BattleConst = GConst.BattleConst
|
||||
|
||||
-- *************各个子模块的战斗需要重写的方法 START*************
|
||||
function BattleController:getInitBoard()
|
||||
return {}
|
||||
end
|
||||
|
||||
function BattleController:getFixedRandomGrid()
|
||||
return {}
|
||||
end
|
||||
|
||||
-- 战斗对应的ui
|
||||
function BattleController:getBattleUIPath()
|
||||
return "app/ui/battle/battle_ui"
|
||||
end
|
||||
|
||||
-- 战斗结束
|
||||
function BattleController:controllBattleEnd()
|
||||
end
|
||||
|
||||
-- 不同模块的战斗需要初始化的东西
|
||||
function BattleController:initOther()
|
||||
end
|
||||
|
||||
-- *************各个子模块的战斗需要重写的方法 START*************
|
||||
|
||||
function BattleController:ctor()
|
||||
|
||||
end
|
||||
|
||||
function BattleController:init(params)
|
||||
params = params or {}
|
||||
self.initGridList = params.initGridList or {}
|
||||
self.randomGridList = params.randomGridList or {}
|
||||
DataManager.BattleData:init()
|
||||
DataManager.BattleData:init(self:getInitBoard())
|
||||
|
||||
UIManager:closeAllUI()
|
||||
self.battleUI = UIManager:showUI(self:getBattleUIPath())
|
||||
@ -75,196 +92,168 @@ function BattleController:onTouchEvent(eventType, posId)
|
||||
table.insert(cellList, entity:getCell())
|
||||
end
|
||||
self.battleUI:eliminationAni(cellList, function()
|
||||
for _, posId in ipairs(sequence) do
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
entity:setIsIdle(true)
|
||||
end
|
||||
self:fillBoard()
|
||||
DataManager.BattleData:clearGridSequence()
|
||||
self:onEliminationAniOver()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:onEliminationAniOver()
|
||||
local sequence = DataManager.BattleData:getGridSequence()
|
||||
local count = #sequence
|
||||
if count < BattleConst.ELIMINATION_MIN_COUNT then
|
||||
return
|
||||
end
|
||||
|
||||
local boomGridIds = {}
|
||||
local eliminationPosIds = {}
|
||||
for _, posId in ipairs(sequence) do
|
||||
local outline = BattleConst.GRID_OUT_LINE_POS_ID[posId]
|
||||
for aroundPosId, _ in pairs(outline) do
|
||||
boomGridIds[aroundPosId] = true
|
||||
end
|
||||
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
entity:setIsIdle(true)
|
||||
eliminationPosIds[posId] = true
|
||||
end
|
||||
|
||||
for posId, status in pairs(boomGridIds) do
|
||||
if not eliminationPosIds[posId] then
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
if entity then
|
||||
entity:addAroundEliminationCount()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
DataManager.BattleData:clearGridSequence()
|
||||
|
||||
self:fillBoard()
|
||||
end
|
||||
|
||||
function BattleController:fillBoard()
|
||||
-- todo临时暴力求解
|
||||
local pathMap = {}
|
||||
local columnCount = {}
|
||||
|
||||
for c = 1, BattleConst.COLUMN_COUNT do
|
||||
for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
if entity:getIsIdle() then
|
||||
local pathList = {}
|
||||
local targetPosId = self:verticalFall(posId, pathList, columnCount)
|
||||
if targetPosId then
|
||||
Logger.logHighlight(targetPosId)
|
||||
|
||||
local targetEntity = DataManager.BattleData:getGridEntity(targetPosId)
|
||||
local pathInfoList = {}
|
||||
local count = #pathList
|
||||
for i = count, 1, -1 do
|
||||
table.insert(pathInfoList, pathList[i])
|
||||
end
|
||||
pathMap[targetPosId] = {entity = targetEntity, pathInfoList = pathInfoList}
|
||||
DataManager.BattleData:exchangeGridEntities(posId, targetPosId)
|
||||
end
|
||||
self:fillThisPos(posId, columnCount)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- for c = 1, BattleConst.COLUMN_COUNT do
|
||||
-- for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||
-- local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
-- local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
-- if entity:getIsIdle() then
|
||||
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
for c = 1, BattleConst.COLUMN_COUNT do
|
||||
for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
if #entity:getPath() > 0 then
|
||||
pathMap[posId] = entity:getPath()
|
||||
entity:clearPath()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.battleUI:fallGrid(pathMap)
|
||||
end
|
||||
|
||||
function BattleController:verticalFall(startPostId, pathList, columnCount)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(startPostId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
local newStartPosId = ModuleManager.BattleManager:getLastRowPosIdByPosId(startPostId)
|
||||
local entity = DataManager.BattleData:getGridEntity(newStartPosId)
|
||||
if not entity then
|
||||
local rc = ModuleManager.BattleManager:getPosRC(startPostId)
|
||||
local r = rc.r
|
||||
local c = rc.c
|
||||
if not columnCount[c] then
|
||||
columnCount[c] = 0
|
||||
end
|
||||
columnCount[c] = columnCount[c] + 1
|
||||
for i = 1, columnCount[c] do
|
||||
newStartPosId = ModuleManager.BattleManager:getLastRowPosId(r, c)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
end
|
||||
return startPostId
|
||||
end
|
||||
|
||||
if entity:isCantFallType() then
|
||||
return
|
||||
end
|
||||
|
||||
if not entity:getIsIdle() then
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
return newStartPosId
|
||||
else
|
||||
return self:verticalFall(newStartPosId, pathList, columnCount)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:findHorizontalFallPath(startPostId, pathList, columnCount)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(startPostId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
|
||||
local list = BattleConst.UP_LINE_FILL_LIST[startPostId]
|
||||
if not list[1] then -- 第一排
|
||||
local rc = ModuleManager.BattleManager:getPosRC(startPostId)
|
||||
local r = rc.r
|
||||
local c = rc.c
|
||||
if not columnCount[c] then
|
||||
columnCount[c] = 0
|
||||
end
|
||||
columnCount[c] = columnCount[c] + 1
|
||||
local newStartPosId
|
||||
for i = 1, columnCount[c] do
|
||||
newStartPosId = ModuleManager.BattleManager:getLastRowPosId(r, c)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
end
|
||||
return startPostId
|
||||
else
|
||||
for index, posId in ipairs(list) do
|
||||
---- 从一个点直接遍历所有相关的路径
|
||||
function BattleController:fillThisPos(posId, columnCount)
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
if not entity then -- 异常情况,理论上不可能不存在
|
||||
if not entity or not entity:getIsIdle() then
|
||||
return
|
||||
end
|
||||
if entity then
|
||||
if not entity:isCantFallType() and not entity:isIdle() then
|
||||
|
||||
local list = BattleConst.UP_LINE_FILL_LIST[posId]
|
||||
if not list[1] then -- 第一排
|
||||
local rc = ModuleManager.BattleManager:getPosRC(posId)
|
||||
local c = rc.c
|
||||
if not columnCount[c] then
|
||||
columnCount[c] = 0
|
||||
end
|
||||
columnCount[c] = columnCount[c] + 1
|
||||
|
||||
local fallPosId = posId
|
||||
local fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
||||
if not fallEntity then -- 异常情况,理论上不可能不存在
|
||||
return
|
||||
end
|
||||
|
||||
local newStartPosId
|
||||
for i = columnCount[c], 1, -1 do
|
||||
newStartPosId = ModuleManager.BattleManager:getFirstLineLastRowPosId(i, c)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
end
|
||||
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
return posId
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
|
||||
function BattleController:findVerticalFallAllPath(startPostId, pathMap, columnCount)
|
||||
while startPostId ~= nil do
|
||||
startPostId = self:findVerticalFallPath(startPostId, pathMap, columnCount)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:findVerticalFallPath(startPostId, pathList, columnCount)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(startPostId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
local newStartPosId = ModuleManager.BattleManager:getLastRowPosIdByPosId(startPostId)
|
||||
local entity = DataManager.BattleData:getGridEntity(newStartPosId)
|
||||
if not entity then
|
||||
local rc = ModuleManager.BattleManager:getPosRC(startPostId)
|
||||
local r = rc.r
|
||||
local c = rc.c
|
||||
if not columnCount[c] then
|
||||
columnCount[c] = 0
|
||||
end
|
||||
columnCount[c] = columnCount[c] + 1
|
||||
local newStartPosId
|
||||
for i = 1, columnCount[c] do
|
||||
newStartPosId = ModuleManager.BattleManager:getLastRowPosId(r, c)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
end
|
||||
return startPostId
|
||||
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
||||
DataManager.BattleData:setGridInfo(posId, self:getRandomGridInfo())
|
||||
else
|
||||
if not entity:isCantFallType() and not entity:isIdle() then
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
return newStartPosId
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:findVerticalFallPath(startPostId, pathMap, columnCount)
|
||||
local newStartPosId = ModuleManager.BattleManager:getLastRowPosIdByPosId(startPostId)
|
||||
local entity = DataManager.BattleData:getGridEntity(newStartPosId)
|
||||
if not entity then
|
||||
local rc = ModuleManager.BattleManager:getPosRC(startPostId)
|
||||
local r = rc.r
|
||||
local c = rc.c
|
||||
if not columnCount[c] then
|
||||
columnCount[c] = 0
|
||||
end
|
||||
columnCount[c] = columnCount[c] + 1
|
||||
local newStartPosId
|
||||
for i = 1, columnCount[c] do
|
||||
newStartPosId = ModuleManager.BattleManager:getLastRowPosId(r, c)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
if not pathMap[startPostId] then
|
||||
pathMap[startPostId] = {}
|
||||
end
|
||||
table.insert(pathMap[startPostId], {x = curPos.x, y = curPos.y})
|
||||
end
|
||||
return startPostId
|
||||
end
|
||||
|
||||
if entity:isCantFallType() then
|
||||
for index, fallPosId in ipairs(list) do
|
||||
local fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
||||
if not fallEntity then -- 异常情况,理论上不可能不存在
|
||||
return
|
||||
end
|
||||
|
||||
if entity:isIdle() then
|
||||
-- return self:findVerticalFallPath(startPostId, pathMap, columnCount)
|
||||
if fallEntity then
|
||||
if not fallEntity:isCantFallType() then
|
||||
if fallEntity:getIsIdle() then
|
||||
self:fillThisPos(fallPosId, columnCount)
|
||||
end
|
||||
fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
||||
if not fallEntity:getIsIdle() then
|
||||
if not fallEntity:getPath()[1] then
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(fallPosId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
end
|
||||
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
table.insert(pathList, {x = curPos.x, y = curPos.y})
|
||||
return newStartPosId
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
|
||||
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
||||
self:fillThisPos(fallPosId, columnCount)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleController:getRandomGridInfo()
|
||||
if not self.fixedRandomList then
|
||||
self.fixedRandomList = {}
|
||||
for _, elementType in ipairs(self:getFixedRandomGrid()) do
|
||||
table.insert(self.fixedRandomList, elementType)
|
||||
end
|
||||
end
|
||||
|
||||
local gridType = 0
|
||||
local elementType
|
||||
if self.fixedRandomList[1] then
|
||||
elementType = table.remove(self.fixedRandomList, 1)
|
||||
else
|
||||
local map = DataManager.BattleData:getElementTypeMap()
|
||||
local indexs = {}
|
||||
local typeList = {}
|
||||
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do
|
||||
local weight = ((map[typeNum] or 0) + 1) * BattleConst.ELEMENT_WIGHT
|
||||
if weight > BattleConst.MAX_ELEMENT_WIGHT then
|
||||
weight = BattleConst.MAX_ELEMENT_WIGHT
|
||||
end
|
||||
table.insert(indexs, weight)
|
||||
table.insert(typeList, typeNum)
|
||||
end
|
||||
|
||||
local index = GFunc.getRandomIndex(indexs)
|
||||
elementType = typeList[index]
|
||||
end
|
||||
return {gridType = gridType, elementType = elementType}
|
||||
end
|
||||
|
||||
return BattleController
|
||||
15
lua/app/module/battle/controller/battle_controller_stage.lua
Normal file
15
lua/app/module/battle/controller/battle_controller_stage.lua
Normal file
@ -0,0 +1,15 @@
|
||||
local BattleController = require "app/module/battle/controller/battle_controller"
|
||||
local BattleControllerStage = class("BattleControllerStage", BattleController)
|
||||
|
||||
function BattleControllerStage:getInitBoard()
|
||||
local config = ConfigManager:getConfig("stage")[1]
|
||||
return config.board
|
||||
end
|
||||
|
||||
function BattleControllerStage:getFixedRandomGrid()
|
||||
local config = ConfigManager:getConfig("stage")[1]
|
||||
return config.control_element
|
||||
end
|
||||
|
||||
|
||||
return BattleControllerStage
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c95a0ad0ae5e4a74dac2537712340fa8
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -18,7 +18,10 @@ function BattleUI:_display()
|
||||
end
|
||||
|
||||
function BattleUI:_addListeners()
|
||||
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["battle_ui.close_btn"]:addClickListener(function()
|
||||
self:initGridCell()
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:initGridCell()
|
||||
@ -55,11 +58,16 @@ function BattleUI:onInitGridCellOver()
|
||||
for posId, cell in pairs(self.gridCells) do
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
if entity then
|
||||
cell:refresh(entity, function(eventType)
|
||||
cell:refresh(entity)
|
||||
cell:addTouchListener(function(eventType)
|
||||
if self.battleController then
|
||||
self.battleController:onTouchEvent(eventType, entity:getPosId())
|
||||
end
|
||||
end)
|
||||
cell:unBindAll()
|
||||
cell:bind(entity, "isDirty", function()
|
||||
cell:refresh(entity)
|
||||
end)
|
||||
local pos = entity:getPos()
|
||||
cell:getBaseObject():setAnchoredPosition(pos.x, pos.y)
|
||||
entity:setCell(cell)
|
||||
@ -78,11 +86,7 @@ function BattleUI:showBoardMask(elementType)
|
||||
local entities = DataManager.BattleData:getGridEnties()
|
||||
for posId, entity in pairs(entities) do
|
||||
if entity and entity:getCell() then
|
||||
entity:getCell():refresh(entity, function(eventType)
|
||||
if self.battleController then
|
||||
self.battleController:onTouchEvent(eventType, entity:getPosId())
|
||||
end
|
||||
end, elementType)
|
||||
entity:getCell():refresh(entity, elementType)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -109,9 +113,8 @@ function BattleUI:eliminationAni(cellList, callback)
|
||||
end
|
||||
|
||||
function BattleUI:fallGrid(listInfo)
|
||||
for _, info in pairs(listInfo) do
|
||||
local entity = info.entity
|
||||
local pathInfoList = info.pathInfoList
|
||||
for posId, info in pairs(listInfo) do
|
||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
||||
local cell = entity:getCell()
|
||||
local posId = entity:getPosId()
|
||||
if cell then
|
||||
@ -123,14 +126,9 @@ function BattleUI:fallGrid(listInfo)
|
||||
end
|
||||
local baseObject = cell:getBaseObject()
|
||||
cell.fallSeq = baseObject:createBindTweenSequence()
|
||||
-- cell.fallSeq:Append(baseObject:getTransform():DOLocalPath(pathInfoList, 2))
|
||||
for index, pos in ipairs(pathInfoList) do
|
||||
if index == 1 then -- 初始位置,直接0秒直接设置
|
||||
cell.fallSeq:Append(baseObject:getTransform():DOAnchorPos(pos, 0)) -- 暂时使用这种 等待改进dopath
|
||||
else
|
||||
cell.fallSeq:Append(baseObject:getTransform():DOAnchorPos(pos, 1)) -- 暂时使用这种 等待改进dopath
|
||||
end
|
||||
end
|
||||
baseObject:setAnchoredPosition(info[1].x, info[1].y)
|
||||
local count = #info
|
||||
cell.fallSeq:Append(baseObject:getTransform():DOLocalPath(info, GConst.BattleConst.ONE_STEP_TIME * count))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
local GridCell = class("GridCell", BaseCell)
|
||||
|
||||
function GridCell:refresh(gridEntity, func, curElement)
|
||||
function GridCell:refresh(gridEntity, curElement)
|
||||
local atlas, icon = ModuleManager.BattleManager:getElementIcon(gridEntity:getElementType())
|
||||
local uiMap = self:getUIMap()
|
||||
if self.lastIcon ~= icon then
|
||||
@ -8,9 +8,16 @@ function GridCell:refresh(gridEntity, func, curElement)
|
||||
uiMap["grid_cell.touch_node.ani_node.middle_bg"]:setSprite(atlas, icon)
|
||||
end
|
||||
|
||||
uiMap["grid_cell.touch_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_ELIMINATION_TOUCH_EVENT):AddTouchEventListener(func)
|
||||
uiMap["grid_cell.touch_node.ani_node.mask"]:setVisible(curElement and curElement ~= gridEntity:getElementType())
|
||||
uiMap["grid_cell.touch_node.ani_node.obstacle"]:setVisible(gridEntity:isCantFallType())
|
||||
|
||||
--- 测试代码
|
||||
uiMap["grid_cell.touch_node.ani_node.count"]:setText(gridEntity:getAroundEliminationCount())
|
||||
end
|
||||
|
||||
function GridCell:addTouchListener(func)
|
||||
local uiMap = self:getUIMap()
|
||||
uiMap["grid_cell.touch_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_ELIMINATION_TOUCH_EVENT):AddTouchEventListener(func)
|
||||
end
|
||||
|
||||
return GridCell
|
||||
@ -3,62 +3,10 @@ local BattleData = class("BattleData", BaseData)
|
||||
local BattleConst = GConst.BattleConst
|
||||
local BATTLE_GRID_ENTITY = require "app/userdata/battle/battle_grid_entity"
|
||||
|
||||
local TEST_INIT = {
|
||||
{1, 2},
|
||||
{1, 4},
|
||||
{1, 1},
|
||||
{0, 4},
|
||||
{0, 3},
|
||||
{0, 3},
|
||||
{0, 3},
|
||||
{1, 4},
|
||||
{1, 3},
|
||||
{0, 3},
|
||||
{0, 1},
|
||||
{0, 4},
|
||||
{0, 2},
|
||||
{0, 1},
|
||||
{1, 1},
|
||||
{1, 4},
|
||||
{1, 2},
|
||||
{1, 3},
|
||||
{0, 4},
|
||||
{0, 4},
|
||||
{1, 4},
|
||||
{0, 4},
|
||||
{0, 2},
|
||||
{1, 4},
|
||||
{0, 4},
|
||||
{1, 1},
|
||||
{0, 3},
|
||||
{1, 2},
|
||||
{0, 1},
|
||||
{0, 1},
|
||||
{0, 4},
|
||||
{1, 4},
|
||||
{0, 3},
|
||||
{0, 4},
|
||||
{1, 3},
|
||||
{1, 1},
|
||||
{0, 4},
|
||||
{1, 3},
|
||||
{0, 3},
|
||||
{1, 2},
|
||||
{1, 1},
|
||||
{0, 4},
|
||||
{1, 2},
|
||||
{0, 4},
|
||||
{0, 3},
|
||||
{1, 3},
|
||||
{1, 4},
|
||||
{0, 4},
|
||||
{0, 4},
|
||||
}
|
||||
|
||||
function BattleData:init(data)
|
||||
function BattleData:init(board)
|
||||
self:clear()
|
||||
|
||||
for i, info in ipairs(TEST_INIT) do
|
||||
for i, info in ipairs(board) do
|
||||
local r = 1
|
||||
local c = 1
|
||||
local zheng = i // BattleConst.ROW_COUNT
|
||||
@ -78,6 +26,9 @@ function BattleData:init(data)
|
||||
elementType = info[2]
|
||||
}
|
||||
self.gridEntities[data.posId] = BATTLE_GRID_ENTITY:create(data)
|
||||
if self.gridEntities[data.posId]:canLink() then
|
||||
self.elementTypeMap[data.elementType] = (self.elementTypeMap[data.elementType] or 0) + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -85,6 +36,11 @@ function BattleData:clear()
|
||||
self:clearGridSequence()
|
||||
|
||||
self.gridEntities = {}
|
||||
self.elementTypeMap = {} -- 同元素得格子数量
|
||||
end
|
||||
|
||||
function BattleData:getElementTypeMap()
|
||||
return self.elementTypeMap
|
||||
end
|
||||
|
||||
function BattleData:getGridSequence()
|
||||
@ -131,10 +87,39 @@ function BattleData:getGridEntity(posId)
|
||||
end
|
||||
|
||||
function BattleData:exchangeGridEntities(posId1, posId2)
|
||||
self.gridEntities[posId2]:setIsIdle(false)
|
||||
self.gridEntities[posId1]:setPosId(posId2)
|
||||
self.gridEntities[posId2]:setPosId(posId1)
|
||||
self.gridEntities[posId1], self.gridEntities[posId2] = self.gridEntities[posId2], self.gridEntities[posId1]
|
||||
local e1 = self.gridEntities[posId1]
|
||||
local e2 = self.gridEntities[posId2]
|
||||
e1:setPosId(posId2)
|
||||
e2:setPosId(posId1)
|
||||
e2:setIsIdle(false)
|
||||
self.gridEntities[posId1] = e2
|
||||
self.gridEntities[posId2] = e1
|
||||
end
|
||||
|
||||
function BattleData:setGridInfo(posId, gridInfo)
|
||||
local entity = self.gridEntities[posId]
|
||||
if not entity then
|
||||
return
|
||||
end
|
||||
|
||||
if entity:canLink() then
|
||||
local elementType = entity:getElementType()
|
||||
self.elementTypeMap[elementType] = (self.elementTypeMap[elementType] or 0) - 1
|
||||
if self.elementTypeMap[elementType] < 0 then
|
||||
self.elementTypeMap[elementType] = 0
|
||||
end
|
||||
end
|
||||
|
||||
if gridInfo.gridType then
|
||||
entity:setGridType(gridInfo.gridType)
|
||||
end
|
||||
|
||||
if gridInfo.elementType then
|
||||
entity:setElementType(gridInfo.elementType)
|
||||
if entity:canLink() then
|
||||
self.elementTypeMap[gridInfo.elementType] = (self.elementTypeMap[gridInfo.elementType] or 0) + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return BattleData
|
||||
@ -1,11 +1,17 @@
|
||||
local BattleGridEntity = class("BattleGridEntity", BaseData)
|
||||
local BattleConst = GConst.BattleConst
|
||||
|
||||
function BattleGridEntity:ctor(data)
|
||||
self.posId = data.posId or 0
|
||||
self.gridType = data.gridType or GConst.BattleConst.GRID_TYPE.EMPTY
|
||||
self.elementType = data.elementType or GConst.BattleConst.ELEMENT_TYPE.RED
|
||||
self.eliminationCount = data.eliminationCount or 0 -- 周围消除次数
|
||||
self.gridType = data.gridType or BattleConst.GRID_TYPE.EMPTY
|
||||
self.elementType = data.elementType or BattleConst.ELEMENT_TYPE.RED
|
||||
self.aroundEliminationCount = data.aroundEliminationCount or 0 -- 周围消除次数
|
||||
self.isIdle = false
|
||||
self.data.isDirty = false
|
||||
end
|
||||
|
||||
function BattleGridEntity:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
function BattleGridEntity:getPosId()
|
||||
@ -25,11 +31,22 @@ function BattleGridEntity:getElementType()
|
||||
end
|
||||
|
||||
function BattleGridEntity:isCantFallType()
|
||||
return self.elementType == GConst.BattleConst.GRID_TYPE.OBSTACLE
|
||||
return BattleConst.CANT_FALL_GRID_TYPE[self.gridType] or false
|
||||
end
|
||||
|
||||
function BattleGridEntity:getEliminationCount()
|
||||
return self.eliminationCount
|
||||
function BattleGridEntity:getAroundEliminationCount()
|
||||
return self.aroundEliminationCount
|
||||
end
|
||||
|
||||
function BattleGridEntity:addAroundEliminationCount(count)
|
||||
count = count or 1
|
||||
self.aroundEliminationCount = self.aroundEliminationCount + count
|
||||
local gridTypeList = BattleConst.AROUND_ELIMINATION_TO_EMPTY_TYPE_COUNT[self.gridType]
|
||||
if gridTypeList and gridTypeList[self.aroundEliminationCount] then
|
||||
self:setGridType(gridTypeList[self.aroundEliminationCount])
|
||||
self.aroundEliminationCount = self.aroundEliminationCount - 1
|
||||
end
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function BattleGridEntity:getPos()
|
||||
@ -50,15 +67,40 @@ end
|
||||
|
||||
function BattleGridEntity:setIsIdle(isIdle)
|
||||
self.isIdle = isIdle == true
|
||||
if self.isIdle then
|
||||
self.aroundEliminationCount = 0
|
||||
end
|
||||
end
|
||||
|
||||
function BattleGridEntity:canLink()
|
||||
if self:isCantFallType() then
|
||||
return false
|
||||
return not BattleConst.CANT_LINK_GRID_TYPE[self.gridType]
|
||||
end
|
||||
|
||||
-- 其他类型的一些判定
|
||||
return true
|
||||
function BattleGridEntity:addPath(singlePath)
|
||||
self:getPath()
|
||||
table.insert(self.pathList, singlePath)
|
||||
end
|
||||
|
||||
function BattleGridEntity:getPath()
|
||||
if not self.pathList then
|
||||
self.pathList = {}
|
||||
end
|
||||
return self.pathList
|
||||
end
|
||||
|
||||
function BattleGridEntity:clearPath()
|
||||
self.pathList = {}
|
||||
end
|
||||
|
||||
function BattleGridEntity:setGridType(gridType)
|
||||
self.gridType = gridType
|
||||
self.aroundEliminationCount = 0
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function BattleGridEntity:setElementType(elementType)
|
||||
self.elementType = elementType
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
return BattleGridEntity
|
||||
Loading…
x
Reference in New Issue
Block a user