上传猜颜色代码
This commit is contained in:
parent
f7ac90a153
commit
bb3a292585
@ -2,9 +2,11 @@
|
||||
{
|
||||
"key": 1,
|
||||
"color": 1,
|
||||
"excolor": 1,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
"icon": "sx_fk_dhs",
|
||||
"weight": 1500,
|
||||
"score": 1,
|
||||
"type": 0,
|
||||
@ -13,9 +15,11 @@
|
||||
{
|
||||
"key": 2,
|
||||
"color": 2,
|
||||
"excolor": 2,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
"icon": "sx_fk_ls",
|
||||
"weight": 1500,
|
||||
"score": 1,
|
||||
"type": 0,
|
||||
@ -24,9 +28,11 @@
|
||||
{
|
||||
"key": 3,
|
||||
"color": 3,
|
||||
"excolor": 3,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
"icon": "sx_fk_lvs",
|
||||
"weight": 1500,
|
||||
"score": 1,
|
||||
"type": 0,
|
||||
@ -35,9 +41,11 @@
|
||||
{
|
||||
"key": 4,
|
||||
"color": 4,
|
||||
"excolor": 4,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
"icon": "sx_fk_zs",
|
||||
"weight": 1500,
|
||||
"score": 1,
|
||||
"type": 0,
|
||||
@ -46,9 +54,11 @@
|
||||
{
|
||||
"key": 5,
|
||||
"color": 5,
|
||||
"excolor": 5,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
"icon": "sx_fk_hs",
|
||||
"weight": 1500,
|
||||
"score": 1,
|
||||
"type": 0,
|
||||
@ -57,9 +67,11 @@
|
||||
{
|
||||
"key": 6,
|
||||
"color": 6,
|
||||
"excolor": 6,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
"icon": "sx_fk_fhs",
|
||||
"weight": 1500,
|
||||
"score": 1,
|
||||
"type": 0,
|
||||
@ -68,6 +80,11 @@
|
||||
{
|
||||
"key": 7,
|
||||
"color": 1,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
3,
|
||||
4
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 2,
|
||||
"icon": "",
|
||||
@ -79,6 +96,11 @@
|
||||
{
|
||||
"key": 8,
|
||||
"color": 1,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 3,
|
||||
"icon": "",
|
||||
@ -90,6 +112,11 @@
|
||||
{
|
||||
"key": 9,
|
||||
"color": 2,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
3,
|
||||
4
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 4,
|
||||
"icon": "",
|
||||
@ -101,6 +128,11 @@
|
||||
{
|
||||
"key": 10,
|
||||
"color": 2,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 5,
|
||||
"icon": "",
|
||||
@ -112,6 +144,11 @@
|
||||
{
|
||||
"key": 11,
|
||||
"color": 3,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
3,
|
||||
4
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 6,
|
||||
"icon": "",
|
||||
@ -123,6 +160,11 @@
|
||||
{
|
||||
"key": 12,
|
||||
"color": 3,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 7,
|
||||
"icon": "",
|
||||
@ -134,6 +176,11 @@
|
||||
{
|
||||
"key": 13,
|
||||
"color": 4,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
3,
|
||||
4
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 8,
|
||||
"icon": "",
|
||||
@ -145,6 +192,11 @@
|
||||
{
|
||||
"key": 14,
|
||||
"color": 4,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 9,
|
||||
"icon": "",
|
||||
@ -156,6 +208,11 @@
|
||||
{
|
||||
"key": 15,
|
||||
"color": 5,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
3,
|
||||
4
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 10,
|
||||
"icon": "",
|
||||
@ -167,6 +224,11 @@
|
||||
{
|
||||
"key": 16,
|
||||
"color": 5,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 11,
|
||||
"icon": "",
|
||||
@ -178,6 +240,11 @@
|
||||
{
|
||||
"key": 17,
|
||||
"color": 6,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
3,
|
||||
4
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 12,
|
||||
"icon": "",
|
||||
@ -189,6 +256,11 @@
|
||||
{
|
||||
"key": 18,
|
||||
"color": 6,
|
||||
"excolor": 7,
|
||||
"direction": [
|
||||
1,
|
||||
2
|
||||
],
|
||||
"belongto": 1,
|
||||
"open": 13,
|
||||
"icon": "",
|
||||
@ -200,6 +272,8 @@
|
||||
{
|
||||
"key": 19,
|
||||
"color": 1,
|
||||
"excolor": 8,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 14,
|
||||
"icon": "",
|
||||
@ -211,6 +285,8 @@
|
||||
{
|
||||
"key": 20,
|
||||
"color": 2,
|
||||
"excolor": 8,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 15,
|
||||
"icon": "",
|
||||
@ -222,6 +298,8 @@
|
||||
{
|
||||
"key": 21,
|
||||
"color": 3,
|
||||
"excolor": 8,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 16,
|
||||
"icon": "",
|
||||
@ -233,6 +311,8 @@
|
||||
{
|
||||
"key": 22,
|
||||
"color": 4,
|
||||
"excolor": 8,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 17,
|
||||
"icon": "",
|
||||
@ -244,6 +324,8 @@
|
||||
{
|
||||
"key": 23,
|
||||
"color": 5,
|
||||
"excolor": 8,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 18,
|
||||
"icon": "",
|
||||
@ -255,6 +337,8 @@
|
||||
{
|
||||
"key": 24,
|
||||
"color": 6,
|
||||
"excolor": 8,
|
||||
"direction": [],
|
||||
"belongto": 1,
|
||||
"open": 19,
|
||||
"icon": "",
|
||||
@ -266,6 +350,8 @@
|
||||
{
|
||||
"key": 25,
|
||||
"color": 7,
|
||||
"excolor": 9,
|
||||
"direction": [],
|
||||
"belongto": 2,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -277,6 +363,8 @@
|
||||
{
|
||||
"key": 26,
|
||||
"color": 1,
|
||||
"excolor": 10,
|
||||
"direction": [],
|
||||
"belongto": 3,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -288,6 +376,8 @@
|
||||
{
|
||||
"key": 27,
|
||||
"color": 2,
|
||||
"excolor": 10,
|
||||
"direction": [],
|
||||
"belongto": 3,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -299,6 +389,8 @@
|
||||
{
|
||||
"key": 28,
|
||||
"color": 3,
|
||||
"excolor": 10,
|
||||
"direction": [],
|
||||
"belongto": 3,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -310,6 +402,8 @@
|
||||
{
|
||||
"key": 29,
|
||||
"color": 4,
|
||||
"excolor": 10,
|
||||
"direction": [],
|
||||
"belongto": 3,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -321,6 +415,8 @@
|
||||
{
|
||||
"key": 30,
|
||||
"color": 5,
|
||||
"excolor": 10,
|
||||
"direction": [],
|
||||
"belongto": 3,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -332,6 +428,8 @@
|
||||
{
|
||||
"key": 31,
|
||||
"color": 6,
|
||||
"excolor": 10,
|
||||
"direction": [],
|
||||
"belongto": 3,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -343,6 +441,10 @@
|
||||
{
|
||||
"key": 32,
|
||||
"color": 1,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
3
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -354,6 +456,10 @@
|
||||
{
|
||||
"key": 33,
|
||||
"color": 1,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
4
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -365,6 +471,10 @@
|
||||
{
|
||||
"key": 34,
|
||||
"color": 1,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
1
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -376,6 +486,10 @@
|
||||
{
|
||||
"key": 35,
|
||||
"color": 1,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
2
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -387,6 +501,10 @@
|
||||
{
|
||||
"key": 36,
|
||||
"color": 2,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
3
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -398,6 +516,10 @@
|
||||
{
|
||||
"key": 37,
|
||||
"color": 2,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
4
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -409,6 +531,10 @@
|
||||
{
|
||||
"key": 38,
|
||||
"color": 2,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
1
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -420,6 +546,10 @@
|
||||
{
|
||||
"key": 39,
|
||||
"color": 2,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
2
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -431,6 +561,10 @@
|
||||
{
|
||||
"key": 40,
|
||||
"color": 3,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
3
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -442,6 +576,10 @@
|
||||
{
|
||||
"key": 41,
|
||||
"color": 3,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
4
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -453,6 +591,10 @@
|
||||
{
|
||||
"key": 42,
|
||||
"color": 3,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
1
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -464,6 +606,10 @@
|
||||
{
|
||||
"key": 43,
|
||||
"color": 3,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
2
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -475,6 +621,10 @@
|
||||
{
|
||||
"key": 44,
|
||||
"color": 4,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
3
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -486,6 +636,10 @@
|
||||
{
|
||||
"key": 45,
|
||||
"color": 4,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
4
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -497,6 +651,10 @@
|
||||
{
|
||||
"key": 46,
|
||||
"color": 4,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
1
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -508,6 +666,10 @@
|
||||
{
|
||||
"key": 47,
|
||||
"color": 4,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
2
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -519,6 +681,10 @@
|
||||
{
|
||||
"key": 48,
|
||||
"color": 5,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
3
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -530,6 +696,10 @@
|
||||
{
|
||||
"key": 49,
|
||||
"color": 5,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
4
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -541,6 +711,10 @@
|
||||
{
|
||||
"key": 50,
|
||||
"color": 5,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
1
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -552,6 +726,10 @@
|
||||
{
|
||||
"key": 51,
|
||||
"color": 5,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
2
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -563,6 +741,10 @@
|
||||
{
|
||||
"key": 52,
|
||||
"color": 6,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
3
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -574,6 +756,10 @@
|
||||
{
|
||||
"key": 53,
|
||||
"color": 6,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
4
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -585,6 +771,10 @@
|
||||
{
|
||||
"key": 54,
|
||||
"color": 6,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
1
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
@ -596,6 +786,10 @@
|
||||
{
|
||||
"key": 55,
|
||||
"color": 6,
|
||||
"excolor": 11,
|
||||
"direction": [
|
||||
2
|
||||
],
|
||||
"belongto": 4,
|
||||
"open": 1,
|
||||
"icon": "",
|
||||
|
@ -240,7 +240,7 @@
|
||||
{
|
||||
"key": 2007,
|
||||
"type": 2,
|
||||
"condition": 66,
|
||||
"condition": 21,
|
||||
"reward": [
|
||||
{
|
||||
"a": "item",
|
||||
@ -257,7 +257,7 @@
|
||||
{
|
||||
"key": 2008,
|
||||
"type": 2,
|
||||
"condition": 99,
|
||||
"condition": 24,
|
||||
"reward": [
|
||||
{
|
||||
"a": "item",
|
||||
|
@ -873,6 +873,8 @@
|
||||
"consumeblock": [
|
||||
1,
|
||||
2
|
||||
]
|
||||
],
|
||||
"consume_pvp_time": 40,
|
||||
"consume_pve_time": 60
|
||||
}
|
||||
]
|
@ -236,7 +236,7 @@
|
||||
"key": "GM_GM_text_25",
|
||||
"text": "跳到主线关卡XX关(填关卡Id)"
|
||||
},
|
||||
"data": "1100545",
|
||||
"data": "1104012",
|
||||
"prefix": "bingo:mainline,{0}"
|
||||
},
|
||||
{
|
||||
@ -396,7 +396,7 @@
|
||||
"key": "GM_GM_text_42",
|
||||
"text": "获得X级无牙仔"
|
||||
},
|
||||
"data": "21",
|
||||
"data": "8",
|
||||
"prefix": "bingo:mts,20030001,{0}"
|
||||
},
|
||||
{
|
||||
@ -406,7 +406,7 @@
|
||||
"key": "GM_GM_text_43",
|
||||
"text": "获得X级风里飞"
|
||||
},
|
||||
"data": "21",
|
||||
"data": "8",
|
||||
"prefix": "bingo:mts,20030002,{0}"
|
||||
},
|
||||
{
|
||||
@ -416,7 +416,7 @@
|
||||
"key": "GM_GM_text_44",
|
||||
"text": "获得X级葛伦科"
|
||||
},
|
||||
"data": "21",
|
||||
"data": "8",
|
||||
"prefix": "bingo:mts,20030003,{0}"
|
||||
},
|
||||
{
|
||||
|
@ -244907,20 +244907,20 @@
|
||||
"Id": 1104008,
|
||||
"pos": 1,
|
||||
"captainId": 0,
|
||||
"IsBoss": 0,
|
||||
"IsBoss": 1,
|
||||
"bossHpCnt": 0,
|
||||
"heroid": 51050,
|
||||
"heroid": 55007,
|
||||
"star": 3,
|
||||
"equip": [],
|
||||
"newskill": [],
|
||||
"lv": 24,
|
||||
"hppro": 1,
|
||||
"lv": 18,
|
||||
"hppro": 3,
|
||||
"atkpro": 1,
|
||||
"defpro": 1,
|
||||
"defpro": 3,
|
||||
"skill1": 1,
|
||||
"skill2": 1,
|
||||
"skill3": 1,
|
||||
"speed": 63,
|
||||
"speed": 85,
|
||||
"modelsize": 1
|
||||
},
|
||||
{
|
||||
|
@ -20,11 +20,11 @@
|
||||
"key": "10002",
|
||||
"name": {
|
||||
"key": "title_title_name_02",
|
||||
"text": "最强公会"
|
||||
"text": "寻宝学徒"
|
||||
},
|
||||
"color": 3,
|
||||
"title": "zj_ch_zqgh",
|
||||
"titleicon": "zj_ch_icon_zqgh",
|
||||
"title": "zj_ch_xbxt",
|
||||
"titleicon": "zj_ch_xbxt",
|
||||
"form": [
|
||||
107
|
||||
],
|
||||
@ -37,11 +37,11 @@
|
||||
"key": "10003",
|
||||
"name": {
|
||||
"key": "title_title_name_03",
|
||||
"text": "最强公会"
|
||||
"text": "泰坦驾驭者"
|
||||
},
|
||||
"color": 3,
|
||||
"title": "zj_ch_zqgh",
|
||||
"titleicon": "zj_ch_icon_zqgh",
|
||||
"title": "zj_ch_ttjyz",
|
||||
"titleicon": "zj_ch_ttjyz",
|
||||
"form": [
|
||||
107
|
||||
],
|
||||
@ -54,11 +54,11 @@
|
||||
"key": "10004",
|
||||
"name": {
|
||||
"key": "title_title_name_04",
|
||||
"text": "最强公会"
|
||||
"text": "龙之气息"
|
||||
},
|
||||
"color": 3,
|
||||
"title": "zj_ch_zqgh",
|
||||
"titleicon": "zj_ch_icon_zqgh",
|
||||
"title": "zj_ch_lzqx",
|
||||
"titleicon": "zj_ch_lzqx",
|
||||
"form": [
|
||||
107
|
||||
],
|
||||
@ -71,11 +71,11 @@
|
||||
"key": "10005",
|
||||
"name": {
|
||||
"key": "title_title_name_05",
|
||||
"text": "最强公会"
|
||||
"text": "恐惧驱散者"
|
||||
},
|
||||
"color": 3,
|
||||
"title": "zj_ch_zqgh",
|
||||
"titleicon": "zj_ch_icon_zqgh",
|
||||
"title": "zj_ch_kjqsz",
|
||||
"titleicon": "zj_ch_kjqsz",
|
||||
"form": [
|
||||
107
|
||||
],
|
||||
|
@ -454,15 +454,14 @@ const ( //Rpc
|
||||
|
||||
//PVP 离线托管
|
||||
RPC_PVPTrusteeship core.Rpc_Key = "RPC_PVPTrusteeship"
|
||||
//捕羊大赛加入匹配请求
|
||||
RPC_JoinMatchPools core.Rpc_Key = "RPC_JoinMatchPools" //加入匹配池
|
||||
RPC_CancelMatch core.Rpc_Key = "RPC_CancelMatch" //取消匹配
|
||||
//成功匹配
|
||||
//匹配请求
|
||||
RPC_JoinMatchPools core.Rpc_Key = "RPC_JoinMatchPools" //加入匹配池
|
||||
RPC_CancelMatch core.Rpc_Key = "RPC_CancelMatch" //取消匹配
|
||||
RPC_SuccMatchNotice core.Rpc_Key = "RPC_SuccMatchNotice" //成功匹配
|
||||
//捕羊大赛加入匹配请求
|
||||
RPC_ParkourJoinMatch core.Rpc_Key = "RPC_ParkourJoinMatch" //加入匹配
|
||||
RPC_ParkourCancelMatch core.Rpc_Key = "RPC_ParkourCancelMatch" //取消匹配
|
||||
RPC_ParkourMatchSucc core.Rpc_Key = "RPC_ParkourMatchSucc" //匹配成功
|
||||
// //捕羊大赛加入匹配请求
|
||||
// RPC_ParkourJoinMatch core.Rpc_Key = "RPC_ParkourJoinMatch" //加入匹配
|
||||
// RPC_ParkourCancelMatch core.Rpc_Key = "RPC_ParkourCancelMatch" //取消匹配
|
||||
// RPC_ParkourMatchSucc core.Rpc_Key = "RPC_ParkourMatchSucc" //匹配成功
|
||||
RPC_ParkourTrusteeship core.Rpc_Key = "RPC_ParkourTrusteeship" //捕羊大赛托管
|
||||
|
||||
Rpc_ModuleCaravanSettlement core.Rpc_Key = "Rpc_ModuleCaravanSettlement" //商队比赛结算信息
|
||||
|
@ -29,7 +29,7 @@ type ISC_GateRouteComp interface {
|
||||
// 服务匹配组件
|
||||
type ISC_MatchComp interface {
|
||||
core.IServiceComp
|
||||
RegisterMatchPool(poolName string, comp reflect.Value, msg reflect.Type, handle reflect.Method)
|
||||
RegisterMatchPool(poolName string, handle func(agrs map[string]interface{}) (err error))
|
||||
}
|
||||
|
||||
// 游戏类资源类型
|
||||
|
@ -1,12 +1,12 @@
|
||||
package modules
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/core/cbase"
|
||||
"log"
|
||||
"reflect"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
/*
|
||||
@ -14,9 +14,9 @@ import (
|
||||
*/
|
||||
type MCompMatch struct {
|
||||
cbase.ModuleCompBase
|
||||
service base.IRPCXService //rpc服务对象
|
||||
module core.IModule //当前业务模块
|
||||
comp core.IModuleComp //网关组件自己
|
||||
service comm.IService //rpc服务对象
|
||||
module core.IModule //当前业务模块
|
||||
comp IMatchComp //网关组件自己
|
||||
scomp comm.ISC_MatchComp
|
||||
PoolName string
|
||||
}
|
||||
@ -24,9 +24,9 @@ type MCompMatch struct {
|
||||
//组件初始化接口
|
||||
func (this *MCompMatch) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.ModuleCompBase.Init(service, module, comp, options)
|
||||
this.service = service.(base.IRPCXService)
|
||||
this.service = service.(comm.IService)
|
||||
this.module = module
|
||||
this.comp = comp
|
||||
this.comp = comp.(IMatchComp)
|
||||
return
|
||||
}
|
||||
|
||||
@ -41,21 +41,28 @@ func (this *MCompMatch) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.scomp = comp.(comm.ISC_MatchComp)
|
||||
this.suitableMethods()
|
||||
this.scomp.RegisterMatchPool(this.PoolName, this.comp.MatchNotic)
|
||||
return
|
||||
}
|
||||
|
||||
//反射注册相关接口道services/comp_gateroute.go 对象中
|
||||
func (this *MCompMatch) suitableMethods() {
|
||||
typ := reflect.TypeOf(this.comp)
|
||||
for m := 0; m < typ.NumMethod(); m++ {
|
||||
method := typ.Method(m)
|
||||
mname := method.Name
|
||||
if mname == "MatchNotic" {
|
||||
agrType := typ.In(1)
|
||||
this.scomp.RegisterMatchPool(this.PoolName, reflect.ValueOf(this.comp), agrType, method)
|
||||
return
|
||||
}
|
||||
func (this *MCompMatch) CancelMatch(uid string) (err error) {
|
||||
err = this.service.RpcCall(
|
||||
context.Background(),
|
||||
comm.Service_Mainte,
|
||||
string(comm.RPC_CancelMatch),
|
||||
&pb.CancelMatchReq{
|
||||
Poolname: this.PoolName,
|
||||
Uid: uid,
|
||||
},
|
||||
&pb.JoinMatchPoolResp{})
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
return
|
||||
}
|
||||
log.Panicf("反射注册匹配池处理函数错误 [%s-%s] Api接口格式错误", this.module.GetType(), "MatchNotic")
|
||||
return
|
||||
}
|
||||
|
||||
func (this *MCompMatch) MatchNotic(player map[string]interface{}) (err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type (
|
||||
@ -25,4 +25,9 @@ type (
|
||||
//校验消耗资源
|
||||
CheckConsumeRes(uid string, res []*cfg.Gameatn) (errdata *pb.ErrorData)
|
||||
}
|
||||
|
||||
IMatchComp interface {
|
||||
core.IModuleComp
|
||||
MatchNotic(player map[string]interface{}) (err error)
|
||||
}
|
||||
)
|
||||
|
@ -53,13 +53,13 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.DColorAcceptReq)
|
||||
}
|
||||
return
|
||||
}
|
||||
if redRecord.Status == 1 { //已经在战斗中了
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PracticeQiecuoing,
|
||||
Title: pb.ErrorCode_PracticeQiecuoing.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// if redRecord.Status == 1 { //已经在战斗中了
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_PracticeQiecuoing,
|
||||
// Title: pb.ErrorCode_PracticeQiecuoing.ToString(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
keep = false
|
||||
for _, v := range redRecord.Targets {
|
||||
if v.Uid == session.GetUserId() {
|
||||
@ -128,7 +128,11 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.DColorAcceptReq)
|
||||
})
|
||||
|
||||
if room, err = this.module.rooms.newRoom(&pb.DBDColorRoom{
|
||||
Rid: primitive.NewObjectID().Hex(),
|
||||
Rid: primitive.NewObjectID().Hex(),
|
||||
Difficulty: redRecord.Difficulty,
|
||||
Repeat: redRecord.Repeat,
|
||||
Results: RandomColor(redRecord.Difficulty, redRecord.Repeat),
|
||||
Handles: make([]*pb.DBDColorResult, 0),
|
||||
Red: &pb.DBDColorRoomPlayer{
|
||||
Info: comm.GetUserBaseInfo(red),
|
||||
},
|
||||
@ -139,7 +143,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.DColorAcceptReq)
|
||||
return
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "accept", &pb.PracticeAcceptResp{
|
||||
session.SendMsg(string(this.module.GetType()), "accept", &pb.DColorAcceptResp{
|
||||
IsSucc: true,
|
||||
})
|
||||
go func() {
|
||||
|
48
modules/dcolor/api_loadcomplete copy.go
Normal file
48
modules/dcolor/api_loadcomplete copy.go
Normal file
@ -0,0 +1,48 @@
|
||||
package dcolor
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
//接受切磋
|
||||
func (this *apiComp) HandleCheck(session comm.IUserSession, req *pb.DColorHandleReq) (errdata *pb.ErrorData) {
|
||||
if req.Roomid == "" {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Handle(session comm.IUserSession, req *pb.DColorHandleReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
room *Room
|
||||
err error
|
||||
)
|
||||
|
||||
if errdata = this.HandleCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if room, err = this.module.rooms.queryRoom(req.Roomid); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.String(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err = room.PlayerHandle(session.GetUserId(), req); errdata != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.String(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "handle", &pb.DColorHandleResp{})
|
||||
return
|
||||
}
|
@ -2,7 +2,6 @@ package dcolor
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
"time"
|
||||
@ -24,11 +23,11 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.DColorQiecuoReq)
|
||||
return
|
||||
}
|
||||
var (
|
||||
err error
|
||||
result *pb.DBDColorQiecuoRecord
|
||||
fresult *pb.DBDColorQiecuoRecord
|
||||
user *pb.DBUser
|
||||
keep bool
|
||||
err error
|
||||
result *pb.DBDColorQiecuoRecord
|
||||
// fresult *pb.DBDColorQiecuoRecord
|
||||
user *pb.DBUser
|
||||
keep bool
|
||||
)
|
||||
|
||||
//切磋请求处理
|
||||
@ -40,50 +39,50 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.DColorQiecuoReq)
|
||||
}
|
||||
return
|
||||
}
|
||||
if fresult, err = this.module.modelQiecuo.queryQiecuo(req.Fid); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// if fresult, err = this.module.modelQiecuo.queryQiecuo(req.Fid); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_DBError,
|
||||
// Title: pb.ErrorCode_DBError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
if result.Status == 1 || fresult.Status == 1 { //已经在战斗中了
|
||||
if result.Battid == fresult.Battid { //两个人正在战斗中
|
||||
if _, err = this.module.rooms.queryRoom(result.Battid); err != nil {
|
||||
this.module.Error("查询pvp数据失败!", log.Field{Key: "id", Value: result.Battid}, log.Field{Key: "err", Value: err.Error()})
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
Title: pb.ErrorCode_SystemError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = session.SendMsg(string(this.module.GetType()), "qiecuo", &pb.DColorQiecuoResp{Fid: req.Fid, Isbattle: true}); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
Title: pb.ErrorCode_SystemError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
return
|
||||
} else {
|
||||
if result.Status == 1 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PracticeYouQiecuoing,
|
||||
Title: pb.ErrorCode_PracticeYouQiecuoing.ToString(),
|
||||
}
|
||||
return
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PracticeTargetQiecuoing,
|
||||
Title: pb.ErrorCode_PracticeTargetQiecuoing.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
// if result.Status == 1 || fresult.Status == 1 { //已经在战斗中了
|
||||
// if result.Battid == fresult.Battid { //两个人正在战斗中
|
||||
// if _, err = this.module.rooms.queryRoom(result.Battid); err != nil {
|
||||
// this.module.Error("查询pvp数据失败!", log.Field{Key: "id", Value: result.Battid}, log.Field{Key: "err", Value: err.Error()})
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_SystemError,
|
||||
// Title: pb.ErrorCode_SystemError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// if err = session.SendMsg(string(this.module.GetType()), "qiecuo", &pb.DColorQiecuoResp{Fid: req.Fid, Isbattle: true}); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_SystemError,
|
||||
// Title: pb.ErrorCode_SystemError.ToString(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
// } else {
|
||||
// if result.Status == 1 {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_PracticeYouQiecuoing,
|
||||
// Title: pb.ErrorCode_PracticeYouQiecuoing.ToString(),
|
||||
// }
|
||||
// return
|
||||
// } else {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_PracticeTargetQiecuoing,
|
||||
// Title: pb.ErrorCode_PracticeTargetQiecuoing.ToString(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//目标是否在线
|
||||
if !this.module.ModuleUser.IsOnline(req.Fid) {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -134,7 +133,7 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.DColorQiecuoReq)
|
||||
session.SendMsg(string(this.module.GetType()), "qiecuo", &pb.DColorQiecuoResp{Fid: req.Fid})
|
||||
|
||||
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
||||
&pb.PracticeQiecuonotifyPush{Uid: session.GetUserId(), Name: user.Name, NotifyType: 1}, req.Fid)
|
||||
&pb.DColorQiecuonotifyPush{User: comm.GetUserBaseInfo(user), NotifyType: 1, Difficulty: req.Difficulty, Repeat: req.Repeat}, req.Fid)
|
||||
|
||||
return
|
||||
}
|
||||
|
65
modules/dcolor/api_refuse.go
Normal file
65
modules/dcolor/api_refuse.go
Normal file
@ -0,0 +1,65 @@
|
||||
package dcolor
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
// 切磋终止
|
||||
func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.DColorRefuseReq) (errdata *pb.ErrorData) {
|
||||
return
|
||||
}
|
||||
|
||||
//拒绝切磋
|
||||
func (this *apiComp) Refuse(session comm.IUserSession, req *pb.DColorRefuseReq) (errdata *pb.ErrorData) {
|
||||
if errdata = this.RefuseCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
var (
|
||||
err error
|
||||
user *pb.DBUser
|
||||
result *pb.DBDColorQiecuoRecord
|
||||
keep bool
|
||||
)
|
||||
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//切磋请求处理
|
||||
if result, err = this.module.modelQiecuo.queryQiecuo(req.Uid); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
keep = false
|
||||
for i, v := range result.Targets {
|
||||
if v.Uid == session.GetUserId() {
|
||||
result.Targets = append(result.Targets[0:i], result.Targets[i+1:]...)
|
||||
keep = true
|
||||
}
|
||||
}
|
||||
|
||||
if !keep {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
this.module.modelQiecuo.Change(session.GetUserId(), map[string]interface{}{
|
||||
"targets": result.Targets,
|
||||
})
|
||||
|
||||
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
||||
&pb.DColorQiecuonotifyPush{User: comm.GetUserBaseInfo(user), NotifyType: 3}, req.Uid)
|
||||
return
|
||||
}
|
@ -32,7 +32,7 @@ func (this *DColor) GetType() core.M_Modules {
|
||||
// 模块初始化接口 注册用户创建角色事件
|
||||
func (this *DColor) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
service = service.(comm.IService)
|
||||
this.service = service.(comm.IService)
|
||||
return
|
||||
}
|
||||
func (this *DColor) OnInstallComp() {
|
||||
|
@ -36,8 +36,9 @@ func (this *Room) PlayerLoadEnd(uid string) (err error) {
|
||||
|
||||
if this.data.Red.Ready && this.data.Blue.Ready { //两个人都准备了
|
||||
this.currside = 1
|
||||
if err = this.Broadcast("loadcompletenotice", &pb.DColorGameStartPush{
|
||||
Side: 1,
|
||||
if err = this.Broadcast("gamestart", &pb.DColorGameStartPush{
|
||||
Roomid: this.data.Rid,
|
||||
Side: 1,
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
@ -58,27 +59,25 @@ func (this *Room) PlayerHandle(uid string, handle *pb.DColorHandleReq) (err erro
|
||||
Halfpair: halfpair,
|
||||
}
|
||||
this.data.Handles = append(this.data.Handles, handleopt)
|
||||
|
||||
if err = this.Broadcast("gamehandle", &pb.DColorGameHandlePush{
|
||||
Roomid: this.data.Rid,
|
||||
Uid: uid,
|
||||
Handle: handleopt,
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
if this.currside == 1 {
|
||||
this.currside = 2
|
||||
} else {
|
||||
this.currside = 1
|
||||
}
|
||||
if allright == int32(len(this.data.Results)) { //结束
|
||||
if err = this.Broadcast("gameover", &pb.DColorGameOverPush{
|
||||
Winside: this.currside,
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
} else {
|
||||
if err = this.Broadcast("gamehandle", &pb.DColorGameHandlePush{
|
||||
Uid: uid,
|
||||
Handle: handleopt,
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
if this.currside == 1 {
|
||||
this.currside = 2
|
||||
} else {
|
||||
this.currside = 1
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,8 @@ type roomsComp struct {
|
||||
|
||||
func (this *roomsComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleCompBase.Init(service, module, comp, options)
|
||||
|
||||
this.module = module.(*DColor)
|
||||
this.rooms = make(map[string]*Room)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/core/cbase"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
@ -15,7 +15,8 @@ import (
|
||||
描述:集合项目中所有匹配玩法
|
||||
*/
|
||||
type MatchPool struct {
|
||||
modules.ModuleBase
|
||||
cbase.ModuleBase
|
||||
options *Options
|
||||
service comm.IService
|
||||
pools *poolsComp
|
||||
}
|
||||
@ -28,6 +29,11 @@ func (this *MatchPool) GetType() core.M_Modules {
|
||||
return comm.ModuleMatchPool
|
||||
}
|
||||
|
||||
// NewOptions 模块自定义参数
|
||||
func (this *MatchPool) NewOptions() (options core.IModuleOptions) {
|
||||
return new(Options)
|
||||
}
|
||||
|
||||
func (this *MatchPool) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
if err = this.ModuleBase.Init(service, module, options); err != nil {
|
||||
return
|
||||
@ -51,13 +57,15 @@ func (this *MatchPool) OnInstallComp() {
|
||||
}
|
||||
|
||||
//加入匹配池
|
||||
func (this *MatchPool) JoinMatchPools(ctx context.Context, req *pb.JoinMatchPoolReq, resp *pb.JoinMatchPoolResp) {
|
||||
func (this *MatchPool) JoinMatchPools(ctx context.Context, req *pb.JoinMatchPoolReq, resp *pb.JoinMatchPoolResp) (err error) {
|
||||
this.pools.joinPools(req)
|
||||
return
|
||||
}
|
||||
|
||||
//取消匹配
|
||||
func (this *MatchPool) CancelMatch(ctx context.Context, req *pb.CancelMatchReq, resp *pb.CancelMatchResp) {
|
||||
func (this *MatchPool) CancelMatch(ctx context.Context, req *pb.CancelMatchReq, resp *pb.CancelMatchResp) (err error) {
|
||||
this.pools.cancelMatch(req)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *MatchPool) MatchNotice(req *pb.SuccMatchNoticeReq) {
|
||||
@ -74,3 +82,70 @@ func (this *MatchPool) MatchNotice(req *pb.SuccMatchNoticeReq) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 日志接口
|
||||
func (this *MatchPool) Debug(msg string, args ...log.Field) {
|
||||
this.options.GetLog().Debug(msg, args...)
|
||||
}
|
||||
func (this *MatchPool) Info(msg string, args ...log.Field) {
|
||||
this.options.GetLog().Info(msg, args...)
|
||||
}
|
||||
func (this *MatchPool) Print(msg string, args ...log.Field) {
|
||||
this.options.GetLog().Print(msg, args...)
|
||||
}
|
||||
func (this *MatchPool) Warn(msg string, args ...log.Field) {
|
||||
this.options.GetLog().Warn(msg, args...)
|
||||
}
|
||||
func (this *MatchPool) Error(msg string, args ...log.Field) {
|
||||
this.options.GetLog().Error(msg, args...)
|
||||
}
|
||||
func (this *MatchPool) Panic(msg string, args ...log.Field) {
|
||||
this.options.GetLog().Panic(msg, args...)
|
||||
}
|
||||
func (this *MatchPool) Fatal(msg string, args ...log.Field) {
|
||||
this.options.GetLog().Fatal(msg, args...)
|
||||
}
|
||||
|
||||
func (this *MatchPool) Debugf(format string, args ...interface{}) {
|
||||
this.options.GetLog().Debugf(format, args...)
|
||||
}
|
||||
func (this *MatchPool) Infof(format string, args ...interface{}) {
|
||||
this.options.GetLog().Infof(format, args...)
|
||||
}
|
||||
func (this *MatchPool) Printf(format string, args ...interface{}) {
|
||||
this.options.GetLog().Printf(format, args...)
|
||||
}
|
||||
func (this *MatchPool) Warnf(format string, args ...interface{}) {
|
||||
this.options.GetLog().Warnf(format, args...)
|
||||
}
|
||||
func (this *MatchPool) Errorf(format string, args ...interface{}) {
|
||||
this.options.GetLog().Errorf(format, args...)
|
||||
}
|
||||
func (this *MatchPool) Fatalf(format string, args ...interface{}) {
|
||||
this.options.GetLog().Fatalf(format, args...)
|
||||
}
|
||||
func (this *MatchPool) Panicf(format string, args ...interface{}) {
|
||||
this.options.GetLog().Panicf(format, args...)
|
||||
}
|
||||
|
||||
func (this *MatchPool) Debugln(args ...interface{}) {
|
||||
this.options.GetLog().Debugln(args...)
|
||||
}
|
||||
func (this *MatchPool) Infoln(args ...interface{}) {
|
||||
this.options.GetLog().Infoln(args...)
|
||||
}
|
||||
func (this *MatchPool) Println(args ...interface{}) {
|
||||
this.options.GetLog().Println(args...)
|
||||
}
|
||||
func (this *MatchPool) Warnln(args ...interface{}) {
|
||||
this.options.GetLog().Warnln(args...)
|
||||
}
|
||||
func (this *MatchPool) Errorln(args ...interface{}) {
|
||||
this.options.GetLog().Errorln(args...)
|
||||
}
|
||||
func (this *MatchPool) Fatalln(args ...interface{}) {
|
||||
this.options.GetLog().Fatalln(args...)
|
||||
}
|
||||
func (this *MatchPool) Panicln(args ...interface{}) {
|
||||
this.options.GetLog().Panicln(args...)
|
||||
}
|
||||
|
30
modules/matchpool/options.go
Normal file
30
modules/matchpool/options.go
Normal file
@ -0,0 +1,30 @@
|
||||
package matchpool
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/lego/utils/mapstructure"
|
||||
)
|
||||
|
||||
type (
|
||||
Options struct {
|
||||
Debug bool //日志是否开启
|
||||
Log log.ILogger
|
||||
}
|
||||
)
|
||||
|
||||
func (this *Options) GetLog() log.ILogger {
|
||||
return this.Log
|
||||
}
|
||||
|
||||
func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
|
||||
this.Debug = false
|
||||
if settings != nil {
|
||||
err = mapstructure.Decode(settings, this)
|
||||
}
|
||||
|
||||
if this.Log = log.NewTurnlog(this.Debug, log.Clone("matchpool", 4)); this.Log == nil {
|
||||
err = errors.New("log is nil")
|
||||
}
|
||||
return
|
||||
}
|
@ -22,7 +22,7 @@ type MPool struct {
|
||||
MatchNum int32
|
||||
Timeout int32
|
||||
lock sync.RWMutex
|
||||
state int32
|
||||
State int32
|
||||
Players map[string]*MatchPlayer
|
||||
}
|
||||
|
||||
@ -45,11 +45,11 @@ func (this *MPool) cancel(uid string) {
|
||||
}
|
||||
|
||||
func (this *MPool) match(cd int32) {
|
||||
if !atomic.CompareAndSwapInt32(&this.state, 1, 2) { //正在执行,就不要在进来了
|
||||
if !atomic.CompareAndSwapInt32(&this.State, 1, 2) { //正在执行,就不要在进来了
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
atomic.StoreInt32(&this.state, 1) //执行完毕释放
|
||||
atomic.StoreInt32(&this.State, 1) //执行完毕释放
|
||||
}()
|
||||
var (
|
||||
ok bool
|
||||
|
@ -2,14 +2,14 @@ package matchpool
|
||||
|
||||
import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/core/cbase"
|
||||
"go_dreamfactory/lego/sys/cron"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type poolsComp struct {
|
||||
modules.MCompGate
|
||||
cbase.ModuleCompBase
|
||||
service core.IService
|
||||
module *MatchPool
|
||||
lock sync.RWMutex
|
||||
@ -17,14 +17,15 @@ type poolsComp struct {
|
||||
}
|
||||
|
||||
func (this *poolsComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.MCompGate.Init(service, module, comp, options)
|
||||
this.ModuleCompBase.Init(service, module, comp, options)
|
||||
this.module = module.(*MatchPool)
|
||||
this.service = service
|
||||
this.pools = make(map[string]*MPool)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *poolsComp) Start() (err error) {
|
||||
err = this.MCompGate.Start()
|
||||
err = this.ModuleCompBase.Start()
|
||||
if _, err = cron.AddFunc("*/1 * * * * ?", this.run); err != nil {
|
||||
this.module.Errorf("cron.AddFunc err:%v", err)
|
||||
}
|
||||
@ -46,6 +47,7 @@ func (this *poolsComp) joinPools(req *pb.JoinMatchPoolReq) {
|
||||
MatchNum: req.Matchnum,
|
||||
Timeout: req.Timeout,
|
||||
Players: make(map[string]*MatchPlayer),
|
||||
State: 1,
|
||||
}
|
||||
this.lock.Lock()
|
||||
this.pools[req.Poolname] = pool
|
||||
|
@ -53,89 +53,6 @@ func (this *apiComp) ChangeMts(session comm.IUserSession, req *pb.ParkourChangeM
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "changemts", &pb.CapturesheepChangeMtsResp{Mid: req.Mtsid})
|
||||
// var (
|
||||
// info *pb.DBParkour
|
||||
// team *pb.DBParkour
|
||||
// err error
|
||||
// )
|
||||
// if errdata = this.ChangeMtsCheck(session, req); errdata != nil {
|
||||
// return
|
||||
// }
|
||||
// if info, err = this.module.parkourComp.queryinfo(session.GetUserId()); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_DBError,
|
||||
// Title: pb.ErrorCode_DBError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// if _, ok := info.Mounts[req.Mtsid]; !ok {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_ReqParameterError,
|
||||
// Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// info.Dfmount = req.Mtsid
|
||||
// if info.Captainid != "" {
|
||||
// if info.Captainid == session.GetUserId() {
|
||||
// for _, v := range info.Member {
|
||||
// if v.Uid == session.GetUserId() {
|
||||
// v.Mount = info.Dfmount
|
||||
// v.Maxhp = 10
|
||||
// }
|
||||
// }
|
||||
// if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{
|
||||
// "dfmount": info.Dfmount,
|
||||
// "member": info.Member,
|
||||
// }); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_DBError,
|
||||
// Title: pb.ErrorCode_DBError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// } else {
|
||||
// if team, err = this.module.parkourComp.queryinfo(info.Captainid); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_DBError,
|
||||
// Title: pb.ErrorCode_DBError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// for _, v := range team.Member {
|
||||
// if v.Uid == session.GetUserId() {
|
||||
// v.Mount = info.Dfmount
|
||||
// v.Maxhp = 10
|
||||
// }
|
||||
// }
|
||||
// if err = this.module.parkourComp.Change(team.Captainid, map[string]interface{}{
|
||||
// "member": team.Member,
|
||||
// }); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_DBError,
|
||||
// Title: pb.ErrorCode_DBError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{
|
||||
// "dfmount": info.Dfmount,
|
||||
// }); err != nil {
|
||||
// errdata = &pb.ErrorData{
|
||||
// Code: pb.ErrorCode_DBError,
|
||||
// Title: pb.ErrorCode_DBError.ToString(),
|
||||
// Message: err.Error(),
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
|
||||
// session.SendMsg(string(this.module.GetType()), "changemts", &pb.ParkourChangeMtsResp{Issucc: true, Mtsid: req.Mtsid})
|
||||
session.SendMsg(string(this.module.GetType()), "changemts", &pb.ParkourChangeMtsResp{Issucc: true, Mtsid: req.Mtsid})
|
||||
return
|
||||
}
|
||||
|
@ -19,15 +19,13 @@ func (this *apiComp) RaceMatchCheck(session comm.IUserSession, req *pb.ParkourRa
|
||||
///匹配请求
|
||||
func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMatchReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
team *pb.DBParkour
|
||||
ais []*pb.DBRaceMember
|
||||
users []string
|
||||
err error
|
||||
info *pb.DBParkour
|
||||
err error
|
||||
)
|
||||
if errdata = this.RaceMatchCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
if team, err = this.module.parkourComp.queryinfo(session.GetUserId()); err != nil {
|
||||
if info, err = this.module.parkourComp.queryinfo(session.GetUserId()); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
@ -35,40 +33,21 @@ func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMat
|
||||
}
|
||||
return
|
||||
}
|
||||
if team.Captainid != "" && team.Captainid != session.GetUserId() {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
// if team.Captainid == "" { //为组队情况
|
||||
team.Captainid = team.User.Uid
|
||||
team.State = pb.RaceTeamState_teaming
|
||||
// team.Member = append(team.Member, &pb.DBRaceMember{
|
||||
// Uid: team.Uid,
|
||||
// Name: team.Name,
|
||||
// Skin: team.Skin,
|
||||
// Sex: team.Sex,
|
||||
// Lv: team.Lv,
|
||||
// Dan: team.Dan,
|
||||
// Mount: team.Mount,
|
||||
// Property: team.Property,
|
||||
// Currhp: team.Property[comm.Dhp],
|
||||
// })
|
||||
team.Member = []*pb.DBRaceMember{
|
||||
info.Captainid = session.GetUserId()
|
||||
info.State = pb.RaceTeamState_teaming
|
||||
info.Member = []*pb.DBRaceMember{
|
||||
{
|
||||
User: team.User,
|
||||
Dan: team.Dan,
|
||||
Mount: team.Mount,
|
||||
Property: team.Property,
|
||||
Currhp: team.Property[comm.Dhp],
|
||||
User: info.User,
|
||||
Dan: info.Dan,
|
||||
Mount: info.Mount,
|
||||
Property: info.Property,
|
||||
Currhp: info.Property[comm.Dhp],
|
||||
},
|
||||
}
|
||||
if err = this.module.parkourComp.Change(team.Captainid, map[string]interface{}{
|
||||
"state": team.State,
|
||||
"captainid": team.Captainid,
|
||||
"member": team.Member,
|
||||
if err = this.module.parkourComp.Change(info.Captainid, map[string]interface{}{
|
||||
"state": info.State,
|
||||
"captainid": info.Captainid,
|
||||
"member": info.Member,
|
||||
}); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
@ -77,15 +56,14 @@ func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMat
|
||||
}
|
||||
return
|
||||
}
|
||||
// }
|
||||
if ais, err = this.module.parkourComp.matcheAI(team.Dan, 5); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
if err = this.module.match(team, ais); err != nil {
|
||||
|
||||
if err = this.module.match.MatchReq(&pb.DBMatchPlayer{
|
||||
Suser: info.User,
|
||||
Dan: info.Dan,
|
||||
Mount: info.Mount,
|
||||
Property: info.Property,
|
||||
Mlv: info.Mlv,
|
||||
}); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
@ -94,25 +72,16 @@ func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMat
|
||||
return
|
||||
}
|
||||
|
||||
users = make([]string, len(team.Member))
|
||||
for i, v := range team.Member {
|
||||
if !v.Isai {
|
||||
users[i] = v.User.Uid
|
||||
if err = this.module.parkourComp.Change(v.User.Uid, map[string]interface{}{
|
||||
"state": pb.RaceTeamState_matching,
|
||||
}); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{
|
||||
"state": pb.RaceTeamState_matching,
|
||||
}); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
this.module.SendMsgToUsers(string(this.module.GetType()), "racematchstart",
|
||||
&pb.ParkourRaceMatchStartPush{Team: team}, users...)
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "racematch", &pb.ParkourRaceMatchResp{})
|
||||
return
|
||||
|
@ -19,9 +19,8 @@ func (this *apiComp) RaceMatchCancelCheck(session comm.IUserSession, req *pb.Par
|
||||
///匹配请求
|
||||
func (this *apiComp) RaceMatchCancel(session comm.IUserSession, req *pb.ParkourRaceMatchCancelReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
team *pb.DBParkour
|
||||
users []string
|
||||
err error
|
||||
team *pb.DBParkour
|
||||
err error
|
||||
)
|
||||
if errdata = this.RaceMatchCancelCheck(session, req); errdata != nil {
|
||||
return
|
||||
@ -42,7 +41,7 @@ func (this *apiComp) RaceMatchCancel(session comm.IUserSession, req *pb.ParkourR
|
||||
return
|
||||
}
|
||||
|
||||
if err = this.module.cancelmatch(team); err != nil {
|
||||
if err = this.module.match.CancelMatch(session.GetUserId()); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
@ -50,25 +49,16 @@ func (this *apiComp) RaceMatchCancel(session comm.IUserSession, req *pb.ParkourR
|
||||
}
|
||||
return
|
||||
}
|
||||
users = make([]string, len(team.Member))
|
||||
for i, v := range team.Member {
|
||||
if !v.Isai {
|
||||
users[i] = v.User.Uid
|
||||
if err = this.module.parkourComp.Change(v.User.Uid, map[string]interface{}{
|
||||
"state": pb.RaceTeamState_matching,
|
||||
}); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{
|
||||
"state": pb.RaceTeamState_resting,
|
||||
}); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
this.module.SendMsgToUsers(string(this.module.GetType()), "racematchstart",
|
||||
&pb.ParkourRaceMatchCancelPush{Team: team}, users...)
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "racematch", &pb.ParkourRaceMatchResp{})
|
||||
return
|
||||
}
|
||||
|
@ -35,15 +35,15 @@ func (this *matchComp) Start() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (this *matchComp) MatchReq(player *pb.DBMatchPlayer) (err error) {
|
||||
data, _ := anypb.New(player)
|
||||
func (this *matchComp) MatchReq(v *pb.DBMatchPlayer) (err error) {
|
||||
data, _ := anypb.New(v)
|
||||
err = this.module.service.RpcCall(
|
||||
context.Background(),
|
||||
comm.Service_Mainte,
|
||||
string(comm.RPC_JoinMatchPools),
|
||||
&pb.JoinMatchPoolReq{
|
||||
Poolname: this.PoolName,
|
||||
Uid: player.Suser.Uid,
|
||||
Uid: v.Suser.Uid,
|
||||
Data: data,
|
||||
Matchnum: 6,
|
||||
Timeout: 10,
|
||||
@ -56,16 +56,21 @@ func (this *matchComp) MatchReq(player *pb.DBMatchPlayer) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (this *matchComp) MatchNotic(players []*pb.DBMatchPlayer) (errdata *pb.ErrorData) {
|
||||
func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) {
|
||||
var (
|
||||
red []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 3)
|
||||
bule []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 3)
|
||||
ais []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 6)
|
||||
dan int32
|
||||
leftnum int32
|
||||
err error
|
||||
playerSlice []*pb.DBMatchPlayer
|
||||
red []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 3)
|
||||
bule []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 3)
|
||||
ais []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 6)
|
||||
dan int32
|
||||
leftnum int32
|
||||
)
|
||||
for i, v := range players {
|
||||
playerSlice = make([]*pb.DBMatchPlayer, 0, len(players))
|
||||
for _, v := range players {
|
||||
playerSlice = append(playerSlice, v.(*pb.DBMatchPlayer))
|
||||
}
|
||||
|
||||
for i, v := range playerSlice {
|
||||
if i%2 == 0 {
|
||||
red = append(red, &pb.DBRaceMember{
|
||||
User: v.Suser,
|
||||
@ -92,10 +97,7 @@ func (this *matchComp) MatchNotic(players []*pb.DBMatchPlayer) (errdata *pb.Erro
|
||||
if leftnum > 0 {
|
||||
if ais, err = this.module.parkourComp.matcheAI(dan, leftnum); err != nil {
|
||||
this.module.Error("matcheAI err!", log.Field{Key: "key", Value: err.Error()})
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Message: err.Error(),
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -109,10 +111,6 @@ func (this *matchComp) MatchNotic(players []*pb.DBMatchPlayer) (errdata *pb.Erro
|
||||
}
|
||||
if err = this.module.createbattle(red, bule); err != nil {
|
||||
this.module.Error("createbattle err!", log.Field{Key: "key", Value: err.Error()})
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ type Parkour struct {
|
||||
dragon comm.IDragon
|
||||
api *apiComp
|
||||
ai *aiComp
|
||||
match *matchComp
|
||||
configure *configureComp
|
||||
parkourComp *ModelParkourComp
|
||||
raceComp *ModelRaceComp
|
||||
@ -65,7 +66,7 @@ func (this *Parkour) Start() (err error) {
|
||||
if err = this.ModuleBase.Start(); err != nil {
|
||||
return
|
||||
}
|
||||
this.service.RegisterFunctionName(string(comm.RPC_ParkourMatchSucc), this.createbattle)
|
||||
// this.service.RegisterFunctionName(string(comm.RPC_ParkourMatchSucc), this.createbattle)
|
||||
this.service.RegisterFunctionName(string(comm.RPC_ParkourTrusteeship), this.trusteeship)
|
||||
event.RegisterGO(comm.EventUserOffline, this.useroffline)
|
||||
var module core.IModule
|
||||
@ -81,32 +82,12 @@ func (this *Parkour) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.ai = this.RegisterComp(new(aiComp)).(*aiComp)
|
||||
this.match = this.RegisterComp(new(matchComp)).(*matchComp)
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
this.parkourComp = this.RegisterComp(new(ModelParkourComp)).(*ModelParkourComp)
|
||||
this.raceComp = this.RegisterComp(new(ModelRaceComp)).(*ModelRaceComp)
|
||||
}
|
||||
|
||||
// 匹配
|
||||
func (this *Parkour) match(team *pb.DBParkour, ais []*pb.DBRaceMember) (err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 取消匹配
|
||||
func (this *Parkour) cancelmatch(team *pb.DBParkour) (err error) {
|
||||
err = this.service.RpcCall(
|
||||
context.Background(),
|
||||
comm.Service_Mainte,
|
||||
string(comm.RPC_ParkourCancelMatch),
|
||||
&pb.RPCParkourCancelMatchReq{Captainid: team.Captainid},
|
||||
&pb.RPCParkourCancelMatchResp{})
|
||||
if err != nil {
|
||||
this.Errorln(err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 匹配成功 创建战斗
|
||||
func (this *Parkour) createbattle(red []*pb.DBRaceMember, bule []*pb.DBRaceMember) (err error) {
|
||||
var (
|
||||
@ -621,16 +602,17 @@ func (this *Parkour) useroffline(uid, sessionid string) {
|
||||
}
|
||||
} else if info.State == pb.RaceTeamState_matching {
|
||||
if info.Captainid == uid {
|
||||
err = this.service.RpcCall(
|
||||
context.Background(),
|
||||
comm.Service_Mainte,
|
||||
string(comm.RPC_ParkourCancelMatch),
|
||||
&pb.RPCParkourCancelMatchReq{Captainid: info.Captainid},
|
||||
&pb.RPCParkourCancelMatchResp{})
|
||||
if err != nil {
|
||||
this.Errorln(err)
|
||||
return
|
||||
}
|
||||
// err = this.service.RpcCall(
|
||||
// context.Background(),
|
||||
// comm.Service_Mainte,
|
||||
// string(comm.RPC_ParkourCancelMatch),
|
||||
// &pb.RPCParkourCancelMatchReq{Captainid: info.Captainid},
|
||||
// &pb.RPCParkourCancelMatchResp{})
|
||||
// if err != nil {
|
||||
// this.Errorln(err)
|
||||
// return
|
||||
// }
|
||||
this.match.CancelMatch(info.Currbattid)
|
||||
if err = this.parkourComp.Change(uid, map[string]interface{}{
|
||||
"captainid": "",
|
||||
"state": 0,
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/core/cbase"
|
||||
"go_dreamfactory/pb"
|
||||
"reflect"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -24,8 +23,8 @@ func NewMatchComp() comm.ISC_MatchComp {
|
||||
type SCompMatch struct {
|
||||
cbase.ServiceCompBase
|
||||
options *CompOptions
|
||||
service comm.IService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
|
||||
msghandles map[string]*msghandle //处理函数的管理对象
|
||||
service comm.IService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
|
||||
msghandles map[string]func(agrs map[string]interface{}) (err error) //处理函数的管理对象
|
||||
}
|
||||
|
||||
// 设置服务组件名称 方便业务模块中获取此组件对象
|
||||
@ -42,6 +41,7 @@ func (this *SCompMatch) Init(service core.IService, comp core.IServiceComp, opti
|
||||
err = this.ServiceCompBase.Init(service, comp, options)
|
||||
this.options = options.(*CompOptions)
|
||||
this.service = service.(comm.IService)
|
||||
this.msghandles = make(map[string]func(agrs map[string]interface{}) (err error))
|
||||
return err
|
||||
}
|
||||
|
||||
@ -52,12 +52,8 @@ func (this *SCompMatch) Start() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (this *SCompMatch) RegisterMatchPool(poolName string, comp reflect.Value, msg reflect.Type, handle reflect.Method) {
|
||||
this.msghandles[poolName] = &msghandle{
|
||||
rcvr: comp,
|
||||
msgType: msg,
|
||||
handle: handle,
|
||||
}
|
||||
func (this *SCompMatch) RegisterMatchPool(poolName string, handle func(agrs map[string]interface{}) (err error)) {
|
||||
this.msghandles[poolName] = handle
|
||||
}
|
||||
|
||||
// RPC_NoticeUserClose 接收用户登录通知
|
||||
@ -65,17 +61,18 @@ func (this *SCompMatch) SuccMatchNotice(ctx context.Context, args *pb.SuccMatchN
|
||||
msghandle, ok := this.msghandles[args.Poolname]
|
||||
if ok {
|
||||
var (
|
||||
msg proto.Message
|
||||
msg proto.Message
|
||||
player map[string]interface{} = make(map[string]interface{})
|
||||
)
|
||||
newSlice := reflect.New(msghandle.msgType)
|
||||
for _, v := range args.Players {
|
||||
|
||||
for k, v := range args.Players {
|
||||
if msg, err = v.UnmarshalNew(); err != nil {
|
||||
return
|
||||
}
|
||||
newSlice = reflect.Append(newSlice, reflect.ValueOf(msg))
|
||||
player[k] = msg
|
||||
}
|
||||
//执行处理流
|
||||
msghandle.handle.Func.Call([]reflect.Value{msghandle.rcvr, newSlice})
|
||||
err = msghandle(player)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ import "errors"
|
||||
type GameBlockData struct {
|
||||
Key int32
|
||||
Color int32
|
||||
Excolor int32
|
||||
Direction []int32
|
||||
Belongto int32
|
||||
Open int32
|
||||
Icon string
|
||||
@ -31,6 +33,21 @@ func (*GameBlockData) GetTypeId() int32 {
|
||||
func (_v *GameBlockData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["excolor"].(float64); !_ok_ { err = errors.New("excolor error"); return }; _v.Excolor = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["direction"].([]interface{}); !_ok_ { err = errors.New("direction error"); return }
|
||||
|
||||
_v.Direction = make([]int32, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ int32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
|
||||
_v.Direction = append(_v.Direction, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["belongto"].(float64); !_ok_ { err = errors.New("belongto error"); return }; _v.Belongto = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["open"].(float64); !_ok_ { err = errors.New("open error"); return }; _v.Open = int32(_tempNum_) }
|
||||
{ var _ok_ bool; if _v.Icon, _ok_ = _buf["icon"].(string); !_ok_ { err = errors.New("icon error"); return } }
|
||||
|
@ -297,6 +297,8 @@ type GameGlobalData struct {
|
||||
FastplayInteraction int32
|
||||
FastplayItem *Gameatn
|
||||
Consumeblock []int32
|
||||
ConsumePvpTime int32
|
||||
ConsumePveTime int32
|
||||
}
|
||||
|
||||
const TypeId_GameGlobalData = 477542761
|
||||
@ -1177,6 +1179,8 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["consume_pvp_time"].(float64); !_ok_ { err = errors.New("consume_pvp_time error"); return }; _v.ConsumePvpTime = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["consume_pve_time"].(float64); !_ok_ { err = errors.New("consume_pve_time error"); return }; _v.ConsumePveTime = int32(_tempNum_) }
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user