This commit is contained in:
zhong 2025-04-24 17:03:28 +08:00
parent 73cf608cd0
commit 6f02246f02
10175 changed files with 2595224 additions and 0 deletions

View File

@ -0,0 +1,61 @@
{
"__type__": "cc.AnimationClip",
"_name": "babyemoji",
"_objFlags": 0,
"_native": "",
"_duration": 0.7,
"sample": 10,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "5b7d788b-9f15-4443-8732-277e63df5cec"
}
},
{
"frame": 0.1,
"value": {
"__uuid__": "f4467ed7-17a3-4c5d-a029-19eeacc11d14"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "bd4ca21d-6edd-4c4a-9cc2-fe9e2e2d1b1b"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "c5121bab-a152-445c-a1e7-cbb5f67d619a"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "569d8d04-f10e-48db-a384-e0553930dfc1"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "2504ab60-c0f0-4842-be85-46da10217acc"
}
},
{
"frame": 0.6,
"value": {
"__uuid__": "13e2b188-4edf-48eb-8376-2c7aa4f47cf1"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,67 @@
{
"__type__": "cc.AnimationClip",
"_name": "baolv",
"_objFlags": 0,
"_native": "",
"_duration": 1.1833333333333333,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "861083c5-f03b-4df0-8a21-55a026353343"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "205401b1-6275-4246-acae-91128111a83c"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "51de12f1-173e-4875-b40c-10ee327c8edd"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "69df3a73-d4cd-42f8-a16c-119518dec081"
}
},
{
"frame": 0.6666666666666666,
"value": {
"__uuid__": "ee28fd81-1155-4914-a183-bc8558139f19"
}
},
{
"frame": 0.8333333333333334,
"value": {
"__uuid__": "293aaa29-5c60-4822-8f4b-a5d8c334031e"
}
},
{
"frame": 1,
"value": {
"__uuid__": "4bf127e6-3d18-4178-bb5a-eac44ef5da3b"
}
},
{
"frame": 1.1666666666666667,
"value": {
"__uuid__": "146f0826-13ea-4fb0-8f51-8c039ab33d44"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,73 @@
{
"__type__": "cc.AnimationClip",
"_name": "boy1",
"_objFlags": 0,
"_native": "",
"_duration": 0.6,
"sample": 15,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "f29d9d71-e1c4-4761-b8da-83c294cff64c"
}
},
{
"frame": 0.06666666666666667,
"value": {
"__uuid__": "d2743018-9a8b-4ffb-bfd4-1f06171adf86"
}
},
{
"frame": 0.13333333333333333,
"value": {
"__uuid__": "fe9079d1-e17f-4d99-a8a5-69fae3b6cd5b"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "4d4f3b28-1192-4579-96d3-814190bc4209"
}
},
{
"frame": 0.26666666666666666,
"value": {
"__uuid__": "b7dcdaff-86a4-435c-ac67-9fdfefc4ad05"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "5906e92b-4fa6-460a-9ce7-fffc8f3be2df"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "1a75f091-e281-456e-8a87-f3954d861406"
}
},
{
"frame": 0.4666666666666667,
"value": {
"__uuid__": "a9698687-9371-4b23-8804-f2569369f746"
}
},
{
"frame": 0.5333333333333333,
"value": {
"__uuid__": "f29d9d71-e1c4-4761-b8da-83c294cff64c"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,67 @@
{
"__type__": "cc.AnimationClip",
"_name": "boy2",
"_objFlags": 0,
"_native": "",
"_duration": 0.5333333333333333,
"sample": 15,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "5c7a38d8-a9ef-47ac-82cb-14fe5aa44112"
}
},
{
"frame": 0.06666666666666667,
"value": {
"__uuid__": "768594f1-bdda-49a1-86bb-c64bb8dd75ed"
}
},
{
"frame": 0.13333333333333333,
"value": {
"__uuid__": "36e2d61d-ec5d-41fd-9dc5-779a82e3aeed"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "f17a6d43-133e-4328-acf3-d3cc7810052f"
}
},
{
"frame": 0.26666666666666666,
"value": {
"__uuid__": "52479e18-2d9a-4abc-85da-e53e204a4ac1"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "9c5f2e87-18b7-47de-b3a8-2a5bef1b7995"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "c9396047-f9db-4e98-b94c-d9206bbc4639"
}
},
{
"frame": 0.4666666666666667,
"value": {
"__uuid__": "654e0c22-0f25-41f5-baa1-12a86721b7a7"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,115 @@
{
"__type__": "cc.AnimationClip",
"_name": "bulvweijian",
"_objFlags": 0,
"_native": "",
"_duration": 1.6,
"sample": 10,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "a29c0176-2583-4968-9791-29be1750f600"
}
},
{
"frame": 0.1,
"value": {
"__uuid__": "8e39275f-6da2-4959-8bc0-27ede35c2f78"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "97008895-cef0-4c3b-aa05-715ccf485ec0"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "36a06b51-acac-4831-b472-cb5df228f2e3"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "1dd90583-1db8-4449-9d8f-07ffa6391f09"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "7feb3124-c0a4-4661-b533-9cf09d92c2d3"
}
},
{
"frame": 0.6,
"value": {
"__uuid__": "e70768bf-85f4-4d0b-895d-d5e45bc1ccff"
}
},
{
"frame": 0.7,
"value": {
"__uuid__": "dca365c3-d0a4-488c-908b-c7695ba45650"
}
},
{
"frame": 0.8,
"value": {
"__uuid__": "f8e61a65-0142-4840-afb3-b655dd909335"
}
},
{
"frame": 0.9,
"value": {
"__uuid__": "934f4807-c41b-4eeb-a1e6-d0745d5072be"
}
},
{
"frame": 1,
"value": {
"__uuid__": "299e178d-7622-442a-9419-47a309ff66bd"
}
},
{
"frame": 1.1,
"value": {
"__uuid__": "8b24139b-f30a-44a3-8d3f-308cec41d3fc"
}
},
{
"frame": 1.2,
"value": {
"__uuid__": "a9d39e14-6903-444b-8967-b3eeaf45664a"
}
},
{
"frame": 1.3,
"value": {
"__uuid__": "47bb045c-d325-4ea1-9710-42adfc1c76ee"
}
},
{
"frame": 1.4,
"value": {
"__uuid__": "b2749223-61ec-4a4d-9b9a-4fa295a7be54"
}
},
{
"frame": 1.5,
"value": {
"__uuid__": "589c1d60-7a50-43a3-a295-d92e4e240b66"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,67 @@
{
"__type__": "cc.AnimationClip",
"_name": "girl1",
"_objFlags": 0,
"_native": "",
"_duration": 0.5333333333333333,
"sample": 15,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "8b5237e0-8e56-43fc-acb1-1c46ff13b251"
}
},
{
"frame": 0.06666666666666667,
"value": {
"__uuid__": "b2556c20-2b42-4900-948d-0cf2144c1339"
}
},
{
"frame": 0.13333333333333333,
"value": {
"__uuid__": "af0a2dcd-cebb-4e16-9c53-dd89d4fb976c"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "86fce05c-7c1b-403e-a168-c7f59232dcf7"
}
},
{
"frame": 0.26666666666666666,
"value": {
"__uuid__": "3be7cf15-170a-416f-af86-c7c44845675e"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "18220970-16cd-4294-8eb0-eee3cd739e63"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "2230cabf-bff6-48c9-bd9a-426cbb966c8d"
}
},
{
"frame": 0.4666666666666667,
"value": {
"__uuid__": "00c73eae-321a-4365-9cb9-78c6d23b7240"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,67 @@
{
"__type__": "cc.AnimationClip",
"_name": "girl2",
"_objFlags": 0,
"_native": "",
"_duration": 0.5333333333333333,
"sample": 15,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "a46dc7b4-fb07-4602-92b6-e30ea286d5b0"
}
},
{
"frame": 0.06666666666666667,
"value": {
"__uuid__": "83e93a8a-8d73-4d8e-8025-c45ded9f0e9e"
}
},
{
"frame": 0.13333333333333333,
"value": {
"__uuid__": "109dc2b4-cb93-4438-8304-b014d683b82c"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "f9be282e-3100-447e-82dc-225d3493c9f4"
}
},
{
"frame": 0.26666666666666666,
"value": {
"__uuid__": "da6be033-e083-4be8-bea9-9f9bfcb2a566"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "c41ad908-c6b5-453d-ba78-3bebb872d15e"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "1909760e-87f5-44a4-bd61-69aea1cb36cc"
}
},
{
"frame": 0.4666666666666667,
"value": {
"__uuid__": "5b66be02-9bbc-419b-b47d-3ca41bdabe15"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,31 @@
{
"__type__": "cc.AnimationClip",
"_name": "huangchengPK",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 0.2,
"sample": 10,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "0b580395-1fa5-4284-b0d7-97f67d50d662"
}
},
{
"frame": 0.1,
"value": {
"__uuid__": "47367f09-5988-4ad6-aac3-245df890db88"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,91 @@
{
"__type__": "cc.AnimationClip",
"_name": "huawu",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 0.9333333333333333,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "0c21d828-e605-4ade-a337-c169e0b328f3"
}
},
{
"frame": 0.08333333333333333,
"value": {
"__uuid__": "eef08510-68be-476e-ae79-bbd1f95384cc"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "ea743cfe-81a8-4569-9ba0-9d2a37fcc6d9"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "637f29dd-7764-405b-a6f4-a757437c485e"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "79dc9c10-bc98-4ddc-994b-ddf36e7b9835"
}
},
{
"frame": 0.4166666666666667,
"value": {
"__uuid__": "35f05f4e-2bb2-4158-a546-48fb16dc8550"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "32a4028d-a7e2-48b7-82d7-24f60a670590"
}
},
{
"frame": 0.5833333333333334,
"value": {
"__uuid__": "38c5589f-40d1-49c2-b82f-8cb6a714bbc6"
}
},
{
"frame": 0.6666666666666666,
"value": {
"__uuid__": "f191c26e-fcf5-4e8d-8178-5245cc0fc9f4"
}
},
{
"frame": 0.75,
"value": {
"__uuid__": "973d4c81-5884-4293-93af-b0e648b592f7"
}
},
{
"frame": 0.8333333333333334,
"value": {
"__uuid__": "f4096e20-8b74-4a28-89b4-41e268f7be3c"
}
},
{
"frame": 0.9166666666666666,
"value": {
"__uuid__": "ccf34324-fc48-4f15-9c4e-c4bd4db8d555"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,29 @@
{
"__type__": "cc.AnimationClip",
"_name": "netBreakMove",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 1,
"sample": 60,
"speed": 1,
"wrapMode": 22,
"curveData": {
"paths": {
"bg2/ui_common_icon_load1/move": {
"props": {
"x": [
{
"frame": 0,
"value": -130
},
{
"frame": 1,
"value": 130.2
}
]
}
}
}
},
"events": []
}

View File

@ -0,0 +1,115 @@
{
"__type__": "cc.AnimationClip",
"_name": "palaceNotice",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 1.6,
"sample": 10,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "941a0723-e714-4330-af3d-22e7d4c109d3"
}
},
{
"frame": 0.1,
"value": {
"__uuid__": "75a370b3-e50f-4ff3-bc2b-2de977e3a9fa"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "105899c2-ddfe-4e2e-bb46-574e9c1a9eab"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "a03549cf-95fc-4843-883a-fcbf15e8951e"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "f5cb778f-9b12-48b6-a2b6-41709c212ffa"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "5ea65811-7f3d-4424-8195-f3b6dddc51c9"
}
},
{
"frame": 0.6,
"value": {
"__uuid__": "8a3bb96a-2c46-49c8-836d-0289f5dc6936"
}
},
{
"frame": 0.7,
"value": {
"__uuid__": "850a2486-2d67-4095-a05d-840ba72dadda"
}
},
{
"frame": 0.8,
"value": {
"__uuid__": "9017fa66-df9a-4b50-b3aa-ad36fc74ae34"
}
},
{
"frame": 0.9,
"value": {
"__uuid__": "26bddfbf-c336-4344-9406-2c3cc0d777a2"
}
},
{
"frame": 1,
"value": {
"__uuid__": "201f5312-bcf7-4146-908e-22e84d8e7bdd"
}
},
{
"frame": 1.1,
"value": {
"__uuid__": "0ce07d19-bb5f-47e2-98fa-77d35e8f30c2"
}
},
{
"frame": 1.2,
"value": {
"__uuid__": "ab5eee8a-a982-4041-a0f7-de88f2bed9e9"
}
},
{
"frame": 1.3,
"value": {
"__uuid__": "e9b59d46-d4ce-4acb-98b5-7a6856e14b4a"
}
},
{
"frame": 1.4,
"value": {
"__uuid__": "a68dd6fc-0d88-45a3-bd92-e69bc3a4f2ee"
}
},
{
"frame": 1.5,
"value": {
"__uuid__": "bc0c02c5-cc79-4bdb-a245-5d792039fd2b"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,43 @@
{
"__type__": "cc.AnimationClip",
"_name": "playVoice",
"_objFlags": 0,
"_native": "",
"_duration": 1.0166666666666666,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0.016666666666666666,
"value": {
"__uuid__": "22566ec6-8e8b-42d0-9509-f0622e323925"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "426edc8a-4e8c-4ff6-a4f8-cf94078bd1ff"
}
},
{
"frame": 0.6666666666666666,
"value": {
"__uuid__": "5db3ef11-f339-46d3-a229-30e6d78fa503"
}
},
{
"frame": 1,
"value": {
"__uuid__": "22566ec6-8e8b-42d0-9509-f0622e323925"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,25 @@
{
"__type__": "cc.AnimationClip",
"_name": "runcircle",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 2,
"sample": 60,
"speed": 1,
"wrapMode": 1,
"curveData": {
"props": {
"angle": [
{
"frame": 0,
"value": 0
},
{
"frame": 2,
"value": -360
}
]
}
},
"events": []
}

View File

@ -0,0 +1,73 @@
{
"__type__": "cc.AnimationClip",
"_name": "touchEffect",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 0.5166666666666667,
"sample": 60,
"speed": 1,
"wrapMode": 1,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "5f886d11-d86a-4f80-8678-cc4c69fb1c21"
}
},
{
"frame": 0.05,
"value": {
"__uuid__": "add280ba-6034-49af-8dc8-28b5888fea61"
}
},
{
"frame": 0.11666666666666667,
"value": {
"__uuid__": "06caa747-ad6d-4c0e-a0c0-437c4514e652"
}
},
{
"frame": 0.18333333333333332,
"value": {
"__uuid__": "033a00c9-7578-468e-80ae-19bed4c3d6a8"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "fc9e9a87-926b-4a5d-98b7-bd4f529e29d0"
}
},
{
"frame": 0.31666666666666665,
"value": {
"__uuid__": "2f67742d-f471-4773-99c9-15b4a7a0ac09"
}
},
{
"frame": 0.38333333333333336,
"value": {
"__uuid__": "db8e80a8-66da-4e0d-9c8c-67b3a9fa130b"
}
},
{
"frame": 0.45,
"value": {
"__uuid__": "2f0f426c-4c89-4cb4-96d4-06b9e99fdc97"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "ecb0f8ce-21cf-43ee-8ffc-d58be22030ec"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,73 @@
{
"__type__": "cc.AnimationClip",
"_name": "transfer",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 0.82,
"sample": 50,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "5d319b8a-e9ce-4fe7-b693-f54caa53430a"
}
},
{
"frame": 0.1,
"value": {
"__uuid__": "b00d9a60-26fb-431c-b8b3-ad3105136d53"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "44754700-ac92-4a81-bc92-2d38108b5efd"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "6a215aed-38cd-4ab0-beee-ad530da10c67"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "006d9d0d-3df6-4ddf-a90b-e495a5cfad46"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "bd7a4475-67b5-4424-b753-d0601116f8cd"
}
},
{
"frame": 0.6,
"value": {
"__uuid__": "42afeac1-2fce-4faf-a500-bf091bda8e4d"
}
},
{
"frame": 0.7,
"value": {
"__uuid__": "efdf0cb5-02a7-4be7-bcc5-9ba70d989e8d"
}
},
{
"frame": 0.8,
"value": {
"__uuid__": "8d5638af-78de-42f1-b3f8-31a5b03b5d68"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,61 @@
{
"__type__": "cc.AnimationClip",
"_name": "voiceact",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 1,
"sample": 30,
"speed": 1,
"wrapMode": 2,
"curveData": {
"paths": {
"1": {
"props": {
"active": [
{
"frame": 0,
"value": false
},
{
"frame": 0.16666666666666666,
"value": true
}
]
}
},
"2": {
"props": {
"active": [
{
"frame": 0,
"value": false
},
{
"frame": 0.3333333333333333,
"value": true
}
]
}
},
"3": {
"props": {
"active": [
{
"frame": 0,
"value": false
},
{
"frame": 0.5,
"value": true
},
{
"frame": 1,
"value": true
}
]
}
}
}
},
"events": []
}

View File

@ -0,0 +1,25 @@
{
"__type__": "cc.AnimationClip",
"_name": "xuanren",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 1,
"sample": 30,
"speed": 1,
"wrapMode": 22,
"curveData": {
"props": {
"opacity": [
{
"frame": 0,
"value": 50
},
{
"frame": 1,
"value": 180
}
]
}
},
"events": []
}

View File

@ -0,0 +1,91 @@
{
"__type__": "cc.AnimationClip",
"_name": "yihuan",
"_objFlags": 0,
"_rawFiles": null,
"_duration": 0.9333333333333333,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "ded14a1c-92aa-4416-9414-69382dd2187a"
}
},
{
"frame": 0.08333333333333333,
"value": {
"__uuid__": "bc3aa0ab-b632-4d21-b9bc-6839687164d9"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "9cee2c6b-78e3-4a31-b463-ed21e164f152"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "a692ac49-2370-43c9-addc-b3e78b1acd20"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "06bf5dbe-6468-498a-b2ac-dd694843b0c6"
}
},
{
"frame": 0.4166666666666667,
"value": {
"__uuid__": "3cfbe664-6675-48f7-b213-de5bb2c3eda2"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "0348db58-d6d1-4395-a6fa-30ad07fec683"
}
},
{
"frame": 0.5833333333333334,
"value": {
"__uuid__": "ede92b64-3b1f-45b0-9282-cafa855b9434"
}
},
{
"frame": 0.6666666666666666,
"value": {
"__uuid__": "aa426863-a098-4893-9de9-cc270ec85b33"
}
},
{
"frame": 0.75,
"value": {
"__uuid__": "e1881229-ede2-4a27-999c-251fed5f7779"
}
},
{
"frame": 0.8333333333333334,
"value": {
"__uuid__": "28b9b8e8-a163-49e7-a4c8-3db454fcb20e"
}
},
{
"frame": 0.9166666666666666,
"value": {
"__uuid__": "71fffe0e-624d-4f34-a58e-7b863de72007"
}
}
]
}
}
},
"events": []
}

13543
assets/Scene/Battle.fire Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,862 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": true,
"_id": "bfe671f7-de7d-4366-8ef3-bb4c99eb59b7"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 8
},
{
"__id__": 15
},
{
"__id__": 17
}
],
"_active": true,
"_components": [
{
"__id__": 20
},
{
"__id__": 21
},
{
"__id__": 22
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1024,
"height": 576
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
512,
288,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "6dabvLmfJGFIW00jN19/lN"
},
{
"__type__": "cc.Node",
"_name": "Main Camera",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
496.23255636848336,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "ebSZ5HlfBItaM7HuIwW2tK"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_cullingMask": 4294967295,
"_clearFlags": 7,
"_backgroundColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": -1,
"_zoomRatio": 1,
"_targetTexture": null,
"_fov": 60,
"_orthoSize": 10,
"_nearClip": 1,
"_farClip": 4096,
"_ortho": true,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_renderStages": 1,
"_alignWithScreen": true,
"_id": "93QQCkuapIn4DhmMaaMlEt"
},
{
"__type__": "cc.Node",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
},
{
"__id__": 7
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1024,
"height": 576
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "8fPuZiPcNGTIURYZId2YxZ"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "2e98fe86-8e0c-43ea-b99f-8fe76e01786b"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "6evFeazldGVqXYluJePaaI"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1024,
"_originalHeight": 576,
"_id": "b0+qAGW1ZD+ogOXOSTWoyA"
},
{
"__type__": "cc.Node",
"_name": "ProgressBar",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 9
}
],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
},
{
"__id__": 14
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1024,
"height": 13
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-233.499,
0,
0,
0,
0,
1,
1,
0.7,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "85gvrzRbRBKqMqcZIdvTtz"
},
{
"__type__": "cc.Node",
"_name": "bar",
"_objFlags": 0,
"_parent": {
"__id__": 8
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
},
{
"__id__": 11
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 34,
"height": 16
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-513,
-2.7,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "f3nYldN7FKxZCjnVxsq3Q+"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "cb1794c7-364e-45d8-a7a9-561cd82ece81"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "5bAJQQNKVHSYoANjQdxnaV"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 8,
"_left": -1,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "75CmwBXkdMQZxyRzbwtP1g"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "186807f1-e99f-4062-9d90-4acbd7086ed5"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": false,
"_atlas": null,
"_id": "42dxgMwpZP+4qTURTKvA4o"
},
{
"__type__": "cc.ProgressBar",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_N$totalLength": 1024,
"_N$barSprite": {
"__id__": 10
},
"_N$mode": 0,
"_N$progress": 0,
"_N$reverse": false,
"_id": "71kIv2i4ZDr7c/O9pbJM6H"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"alignMode": 0,
"_target": null,
"_alignFlags": 44,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 49.95099999999999,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 1024,
"_originalHeight": 0,
"_id": "a3UngnYhZMHLnGJ8+VqBud"
},
{
"__type__": "cc.Node",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_id": "03uAxxcTRHPbFndqvl3KDD",
"_prefab": {
"__id__": 16
},
"_name": "login_schedule",
"_active": true,
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-286,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 15
},
"asset": {
"__uuid__": "8e4c5421-958a-4ad0-92aa-60cd51d972e2"
},
"fileId": "9c+gZD045HEIKF5UrPuf99",
"sync": true
},
{
"__type__": "cc.Node",
"_name": "load_lb",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 18
},
{
"__id__": 19
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 97.67,
"height": 26.2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-230,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "16EqoI6EVLRrGoVf0jFCAu"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_useOriginalSize": false,
"_string": "正在加載...",
"_N$string": "正在加載...",
"_fontSize": 20,
"_lineHeight": 20,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "4aMife+f1J7oT821kwKKPr"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_width": 0.5,
"_id": "b1DWuAFB5FGq+QTwsJcCYb"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 1024,
"height": 576
},
"_fitWidth": false,
"_fitHeight": true,
"_id": "2cIieEvLhDRbE75hjkWVM3"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "dby95DqM1MAqClMPFEnLPn"
},
{
"__type__": "19d86D8yYNO54hmAcuTgPaT",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"load_lb": {
"__id__": 18
},
"load_pb": {
"__id__": 13
},
"_id": "8355jI/H5Am5q2iyLfSyPp"
}
]

File diff suppressed because it is too large Load Diff

29559
assets/Scene/LoginScene.fire Normal file

File diff suppressed because it is too large Load Diff

3637
assets/Scene/MainScene.fire Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

BIN
assets/Script/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,68 @@
import AudioUtil from "../ts/core/AudioUtil";
cc.Class({
extends: cc.Component,
properties: {
titleLabel: cc.Label,
title: {
get() {
return this.titleLabel == null ? '' : this.titleLabel.string;
},
set(n) {
this.titleLabel && (this.titleLabel.string = n);
},
},
frameBg: cc.Node,
_isDestroy: false,
isDestroy: {
get() {
return this._isDestroy;
},
set(n) {
this._isDestroy = n;
},
},
dialogWidth: {
get() {
return this.frameBg == null ? 0 : this.frameBg.width;
},
set(n) {
this.frameBg && (this.frameBg.width = n);
},
},
dialogHeight: {
get() {
return this.frameBg == null ? 0 : this.frameBg.height;
},
set(n) {
this.frameBg && (this.frameBg.height = n);
},
}
},
start() {
},
onEnable() {
if (this.frameBg == null) {
return;
}
this.frameBg.scale = 0.5;
this.frameBg.runAction(cc.scaleTo(0.25, 1).easing(cc.easeBackOut()));
},
selfClose() {
this.frameBg.runAction(cc.sequence(cc.scaleTo(0.25, 0.5).easing(cc.easeBackIn()), cc.callFunc(() => {
if (this._isDestroy) {
this.node.destroy();
} else {
this.node.active = false;
}
})));
AudioUtil.playDefaultBtn();
}
});

View File

@ -0,0 +1,45 @@
cc.Class({
extends: cc.Component,
properties: {
titleLabel: cc.Label,
title: {
get(){
return this.titleLabel? this.titleLabel.string : '';
},
set(n){
if(this.titleLabel){
this.titleLabel.string = n;
}
}
},
panel: cc.Node,
width:{
get(){
return this.panel? this.panel.width : 0;
},
set(n){
this.panel && (this.panel.width = n);
}
},
height:{
get(){
return this.panel? this.panel.height : 0;
},
set(n){
this.panel && (this.panel.height = n);
}
},
},
start () {
},
onCloseClicked(e, d){
this.node.destroy();
},
});

View File

@ -0,0 +1,69 @@
cc.Class({
extends: cc.Component,
properties: {
mapdata: '',
},
onLoad() {
// this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegan.bind(this));
// this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMoved.bind(this));
// this.node.on(cc.Node.EventType.TOUCH_END, this.touchEnded.bind(this));
// this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.touchCanceled.bind(this));
// // console.log(this.node)
// // console.log(cc.find("Canvas"))
// let src = this.node.getComponent(cc.Sprite).spriteFrame.getTexture().url;
// this.img = new Image();
// let self = this;
// this.img.onload = function () {
// let canvas = document.createElement("Canvas");
// // console.log(canvas)
// self.ctx = canvas.getContext("2d");
// self.ctx.drawImage(self.img, 0, 0);
// };
// this.img.src = src;
// this.onTouched = false;
},
getAlphaByPos(pos) {
let imgData = this.ctx.getImageData(pos.x, this.node.height - pos.y, 1, 1);
let alpha = imgData.data[3];
// console.log(alpha);
return alpha;
},
touchBegan(event) {
let touchPos = this.node.convertToNodeSpace(event.getLocation());
if (this.getAlphaByPos(touchPos) > 150) {
this.node.runAction(cc.scaleTo(0.1, 1.1));
this.onTouched = true;
}
},
touchMoved(event) {
if (!this.onTouched) {
return;
}
let touchPos = this.node.convertToNodeSpace(event.getLocation());
if (this.getAlphaByPos(touchPos) < 150) {
this.node.runAction(cc.scaleTo(0.1, 1));
this.onTouched = false;
}
},
touchEnded(event) {
if (!this.onTouched) {
return;
}
if (this.mapdata == '1010' ||this.mapdata == '1011') {
this.parentLogic.onMapBtnClicked(this.mapdata);
}
this.node.runAction(cc.scaleTo(0.1, 1));
},
touchCanceled(evene) {
this.node.runAction(cc.scaleTo(0.1, 1));
}
});

View File

@ -0,0 +1,497 @@
import GameModel from "../ts/core/GameModel";
cc.Class({
extends: cc.Component,
properties: {
_type: 0,//0 聊天框 1遊戲右下角ui
type: {
get() {
return this._type;
},
set(t) {
this._type = t;
}
},
_string: '',
string: {
get() {
return this._string;
},
set(t) {
this._string = t;
this.showTextInfo();
}
},
_maxWidth: 0,
maxWidth: {
get() {
return this._maxWidth;
},
set(t) {
this._maxWidth = t;
if (t <= 0) {
this._maxWidth = 100;
}
this.node.width = t;
}
},
_fontSize: 20,
fontSize: {
get() {
return this._fontSize;
},
set(t) {
this._fontSize = t;
}
},
_lineHeight: 22,
lineHeight: {
get() {
return this._lineHeight;
},
set(t) {
this._lineHeight = t;
this.node.height = t;
}
},
_strColor: cc.Color.BLACK,
strColor: {
get() {
return this._strColor;
},
set(c) {
this._strColor = c;
this.node.color = c;
}
},
startX: 0,
startY: 0,
emojiAtlas: cc.SpriteAtlas,
joinTeamBg: cc.SpriteFrame,
item_detail: cc.Prefab,
fontRes: cc.Font
},
onLoad() {
this.node.setAnchorPoint(cc.v2(0, 1));
this.isLoad = true;
},
/**
* showLabInfo creator編輯是顯示用程序裡用不到
*/
showLabInfo() {
this.node.destroyAllChildren();
let lnode = new cc.Node();
lnode.parent = this.node;
lnode.width = this.maxWidth;
lnode.color = cc.Color.BLACK;
let lab = lnode.addComponent(cc.Label);
lab.fontSize = this.fontSize;
lab.lineHeight = this.lineHeight;
lab.string = this.string;
lab.horizontalAlign = cc.Label.HorizontalAlign.LEFT;
lab.verticalAlign = cc.Label.VerticalAlign.TOP;
lab.overflow = cc.Label.Overflow.RESIZE_HEIGHT;
lnode.setPosition(cc.v2(this.startX, this.startY));
lnode.setAnchorPoint(cc.v2(0, 1));
},
showTextInfo() {
if (this.isLoad == null) {
this.showLabInfo();
return;
}
this.node.destroyAllChildren();
this.startX = 0;
this.startY = 0;
if (this.type == 1) {
this.addScaleNode();
this.addNameNode();
}
let textInfo = [];
let msgstr = this.string;
// let patt = /\[(?:[0-9]{1,3}|1000)\]/;
// let pos = msgstr.search(patt);
// while (pos != -1) {
// if (pos > 0) {
// textInfo.push({ type: 'txt', data: msgstr.substring(0, pos) });
// }
// let numend = msgstr.indexOf(']', pos);
// let numstr = msgstr.substring(pos + 1, numend);
// textInfo.push({ type: 'img', data: numstr });
// msgstr = msgstr.substr(numend + 1);
// pos = msgstr.search(patt);
// }
// if (msgstr.length > 0) {
// textInfo.push({ type: 'txt', data: msgstr });
// }
let patt = /\[[\s\S]*?\]/;
// let patt = /\[(?:[0-9]{1,3}|1000)\]/;
let pos = msgstr.search(patt);
while (pos != -1) {
if (pos > 0) {
textInfo.push({ type: 'txt', data: msgstr.substring(0, pos) });
}
let numend = msgstr.indexOf(']', pos);
let numstr = msgstr.substring(pos + 1, numend);
let ppatt1 = /\[(?:[0-9]{1,3}|1000)\]/;
let pnumstr = '[' + numstr + ']';
let ppos1 = pnumstr.search(ppatt1);
if (ppos1 >= 0) {
textInfo.push({ type: 'img', data: numstr });
} else {
textInfo.push({ type: 'link', data: numstr });
}
// textInfo.push({ type: 'img', data: numstr });
msgstr = msgstr.substr(numend + 1);
pos = msgstr.search(patt);
}
if (msgstr.length > 0) {
if (!this.checkColor(textInfo, msgstr))
textInfo.push({ type: 'txt', data: msgstr });
}
for (const info of textInfo) {
if (info.type == 'txt') {
let str = info.data;
let cutPos = this.cutStringByWidth(str, this.maxWidth - this.startX);
while (cutPos != str.length) {
if (cutPos == 0) {
this.startX = 0;
this.startY -= this.lineHeight;
} else {
this.addLabelNode(str.substr(0, cutPos), info.color);
str = str.substr(cutPos);
}
cutPos = this.cutStringByWidth(str, this.maxWidth - this.startX);
}
if (str.length > 0) {
this.addLabelNode(str, info.color);
}
}
if (info.type == 'img') {
this.addImgNode(info.data);
}
if (info.type == 'link') {
this.addLinkNode(info.data);
}
}
if (this.startY < 0) {
this.node.width = this.maxWidth;
}
else {
this.node.width = this.startX;
}
this.node.height = -(this.startY - this.lineHeight) + 5;
},
checkColor(list, str) {
var hasColor = /\<color=#(?:[0-9]|[a-f]){6}[ ]\>.*?\<\/c(olor)?[ ]\>/g;
var arr = str.match(hasColor)
if (arr == null) return false
for (let i in arr) {
var color = arr[i].match(/#(?:[0-9]|[a-f]){6}/)[0]
var t = arr[i].replace(/\<color=#(?:[0-9]|[a-f]){6}[ ]\>/, "");
t = t.replace(/\<\/c(olor)?[ ]\>/, "");
list.push({ type: "txt", data: t, color: color })
}
return true
},
addNameNode() {
if (this.rolename == null || this.rolename == '') {
return;
}
if (this.startX > this.maxWidth - this.fontSize) {
this.startX = 0;
this.startY -= this.lineHeight;
}
let lnode = new cc.Node();
lnode.color = new cc.Color(24, 218, 224);
let title = `[${this.rolename}]`;
if (this.vipLevel > 0) {
title = `V${this.vipLevel}${title}`;
}
let textRT = lnode.addComponent(cc.Label);
// if (this.fontRes)
// textRT.font = this.fontRes;
// else
// textRT.font = GameModel.fontRes;
textRT.cacheMode = cc.Label.CacheMode.BITMAP
textRT.fontSize = this.fontSize;
textRT.lineHeight = this.lineHeight;
textRT.string = title;
lnode.setPosition(cc.v2(this.startX, this.startY));
lnode.setAnchorPoint(cc.v2(0, 1));
lnode.parent = this.node;
this.startX += lnode.width;
},
addLabelNode(str, color) {
let labelColor = this.node.color;
if (color) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color)
if (result)
labelColor = cc.color(parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16));
} else {
if (this.type == 1) {
if (this.scale == 0) {
labelColor = cc.color(22, 196, 88);
} else if (this.scale == 1) {
labelColor = cc.color(0, 194, 141);
} else if (this.scale == 2) {
labelColor = cc.color(54, 171, 253);
} else if (this.scale == 3) {
labelColor = cc.color(255, 90, 90);
}
}
}
if (this.startX > this.maxWidth - this.fontSize) {
this.startX = 0;
this.startY -= this.lineHeight;
}
let lnode = new cc.Node();
lnode.color = labelColor;
let lab = lnode.addComponent(cc.Label);
// if (this.fontRes)
// lab.font = this.fontRes;
// else
// lab.font = GameModel.fontRes;
lab.cacheMode = cc.Label.CacheMode.BITMAP
lab.fontSize = this.fontSize;
lab.lineHeight = this.lineHeight;
lab.string = str;
lnode.setAnchorPoint(cc.v2(0, 1));
lnode.setPosition(cc.v2(this.startX, this.startY));
lnode.parent = this.node;
this.startX += lnode.width;
},
addScaleNode() {
if (this.scale == null) {
return;
}
let scaleFrame = null;
if (this.scale == 0) {
scaleFrame = this.emojiAtlas.getSpriteFrame('font_back_all');
}
else if (this.scale == 1) {
scaleFrame = this.emojiAtlas.getSpriteFrame('font_back_team');
}
else if (this.scale == 2) {
scaleFrame = this.emojiAtlas.getSpriteFrame('font_back_bang');
}
else if (this.scale == 3) {
scaleFrame = this.emojiAtlas.getSpriteFrame('font_back_system');
}
// else if (this.scale == 7) {
// scaleFrame = this.emojiAtlas.getSpriteFrame('font_back_system');
// }
if (scaleFrame == null) {
return;
}
if (this.startX > this.maxWidth - this.fontSize) {
this.startX = 0;
this.startY -= this.lineHeight;
}
let snode = new cc.Node();
let sp = snode.addComponent(cc.Sprite);
sp.spriteFrame = scaleFrame;
snode.setAnchorPoint(cc.v2(0, 0.5));
snode.setPosition(cc.v2(this.startX, this.startY - this.lineHeight / 2));
snode.setScale(this.lineHeight / snode.height);
snode.parent = this.node;
this.startX += snode.width * snode.scaleX;
},
addImgNode(img) {
let emojiFrame = this.emojiAtlas.getSpriteFrame(('000' + img).substr(-3) + '0000');
if (emojiFrame == null) {
return;
}
let emojiFrames = [];
for (let i = 0; ; i++) {
let frame = this.emojiAtlas.getSpriteFrame(('000' + img).substr(-3) + ('0000' + i).substr(-4));
if (frame) emojiFrames.push(frame);
else break;
}
let snode = new cc.Node();
let sp = snode.addComponent(cc.Sprite);
sp.spriteFrame = emojiFrame;
snode.setAnchorPoint(cc.v2(0, 0.5));
snode.setScale(this.lineHeight / snode.height);
snode.parent = this.node;
if (this.startX + snode.width * snode.scaleX > this.maxWidth - this.fontSize) {
this.startX = 0;
this.startY -= this.lineHeight;
}
snode.setPosition(cc.v2(this.startX, this.startY - this.lineHeight / 2));
this.startX += snode.width * snode.scaleX;
if (emojiFrames.length > 0) {
let emojiClip = cc.AnimationClip.createWithSpriteFrames(emojiFrames, 10);
emojiClip.name = 'run';
emojiClip.wrapMode = cc.WrapMode.Loop;
let nodeAni = snode.addComponent(cc.Animation);
nodeAni.addClip(emojiClip);
nodeAni.play('run');
}
},
addLinkNode(link) {
let strs = link.split("@");
if (strs.length < 2) {
this.addLabelNode(link);
return;
}
if (strs[2] == 10) {
// 加入隊伍按鈕
this.addJoinTeamNode(link)
return
}
let labelColor = this.node.color;
labelColor = cc.color(0, 194, 141);
if (this.startX > this.maxWidth - this.fontSize) {
this.startX = 0;
this.startY -= this.lineHeight;
}
let lnode = new cc.Node();
lnode.color = labelColor;
let lab = lnode.addComponent(cc.Label);
// if (this.fontRes)
// lab.font = this.fontRes;
// else
// lab.font = GameModel.fontRes;
lab.cacheMode = cc.Label.CacheMode.BITMAP
lab.fontSize = this.fontSize;
lab.lineHeight = this.lineHeight;
lab.string = '[' + strs[0] + ']';
lnode.setAnchorPoint(cc.v2(0, 1));
lnode.setPosition(cc.v2(this.startX, this.startY));
lnode.parent = this.node;
let btn = lnode.addComponent(cc.Button);
btn.transition = cc.Button.Transition.NONE;
var clickEventHandler = new cc.Component.EventHandler();
clickEventHandler.target = this.node;
clickEventHandler.component = "CustomRichText";
clickEventHandler.handler = "onLinkPropClicked";
clickEventHandler.customEventData = link;
btn.clickEvents.push(clickEventHandler);
this.startX += lnode.width;
},
/**
* 加入隊伍
* @param {*} link
*/
addJoinTeamNode(link) {
if (this.startX > this.maxWidth - this.fontSize) {
this.startX = 0;
this.startY -= this.lineHeight;
}
let snode = new cc.Node();
let sp = snode.addComponent(cc.Sprite);
sp.spriteFrame = this.joinTeamBg;
snode.setAnchorPoint(cc.v2(0, 0.5));
snode.setPosition(cc.v2(this.startX, this.startY - this.lineHeight / 2));
snode.setScale(this.lineHeight / 40);
snode.parent = this.node;
let lnode = new cc.Node();
lnode.color = new cc.Color(100, 60, 60);
let title = "加入";
let textRT = lnode.addComponent(cc.Label);
// if (this.fontRes)
// textRT.font = this.fontRes;
// else
// textRT.font = GameModel.fontRes;
textRT.fontSize = this.fontSize + 6;
textRT.lineHeight = this.lineHeight;
textRT.string = title;
lnode.setPosition(cc.v2(43, 0));
lnode.setAnchorPoint(cc.v2(0.5, 0.5));
lnode.parent = snode;
this.startX += 86 * snode.scaleX;
let btn = snode.addComponent(cc.Button);
btn.transition = cc.Button.Transition.NONE;
var clickEventHandler = new cc.Component.EventHandler();
clickEventHandler.target = this.node;
clickEventHandler.component = "CustomRichText";
if (this.type != 1)
clickEventHandler.handler = "onLinkJoinTeam";
else
clickEventHandler.handler = "onLinkPropClicked";
clickEventHandler.customEventData = link;
btn.clickEvents.push(clickEventHandler);
},
onLinkJoinTeam(event, link) {
console.log(event, link)
let strs = link.split("@");
GameModel.send('c2s_requst_team', {
roleid: GameModel.player.roleid,
teamid: strs[1]
});
},
onLinkJoinTeam1(event, link) {
let strs = link.split("@");
GameModel.send('c2s_requst_team', {
roleid: GameModel.player.roleid,
teamid: strs[1]
});
},
onLinkPropClicked(event, link) {
let datas = link.split("@");
if (datas[2] == 10) datas[2] = 9
GameModel.send("c2c_goods_info", { type: datas[2], id: datas[1] });
},
cutStringByWidth(str, w) {
// TODO : 修改此方法 1 使用池管理 2 取消本方法 使用 RichText
if (w < 0) {
w = 0;
}
let lnode = new cc.Node();
let lab = lnode.addComponent(cc.Label);
lab.fontSize = this.fontSize;
lab.lineHeight = this.lineHeight;
lab.string = str;
lnode.parent = this.node;
let tempLen = str.length;
if (lab.node.width > w) {
tempLen = Math.ceil((w / lab.node.width) * str.length) + 2;
if (tempLen > str.length) {
tempLen = str.length;
}
str = str.substr(0, tempLen);
lab.string = str;
lab._forceUpdateRenderData(true);
while (lab.node.width > w) {
str = str.substr(0, tempLen - 1);
tempLen -= 1;
lab.string = str;
lab._forceUpdateRenderData(true);
}
}
lnode.parent = null;
lnode.destroy();
return tempLen;
}
});

View File

@ -0,0 +1,17 @@
import GameModel from "../ts/core/GameModel";
class Lstorage {
getItem(key) {
let ackey = GameModel.player.account + '_' + key;
return cc.sys.localStorage.getItem(ackey);
}
setItem(key, value) {
let ackey = GameModel.player.account + '_' + key;
cc.sys.localStorage.setItem(ackey, value);
}
}
let lstorage = new Lstorage();
module.exports = lstorage;

View File

@ -0,0 +1,123 @@
import GameUtil from "../ts/core/GameUtil";
import SKSocket from "../ts/gear_2.3.4/net/SKSocket";
let noticeNormalName = 'SysNotice';
let NoticeBox = cc.Class({
extends: cc.Component,
properties: {
},
ctor() {
this.pfab = null;
},
statics: {
init: function () {
var self = this;
cc.loader.loadRes("Prefabs/Notice", function (error, prefab) {
if (error) {
cc.error(`$錯誤:加載Notice預製體失敗`);
return;
}
self.pfab = prefab;
});
},
addMsg: function (type, msg, okfunc, cancelfunc) {
if (!msg) {
return;
}
if (typeof msg == "number") {
if (msg == 100006) {
let code = SKSocket.shared.lastCode;
msg = `連接服務器失敗,請重新登錄!錯誤碼[${code}]`;
} else {
msg = GameUtil.msgText[msg];
}
}
if (!this.pfab) {
return;
}
let node = cc.instantiate(this.pfab);
node.name = noticeNormalName;
let logic = node.getComponent('NoticeLogic');
logic.type = type;
logic.msg = msg;
logic.okCallback = okfunc;
logic.cancelCallback = cancelfunc;
node.setTimeOut = function (t) {
node.runAction(cc.sequence(cc.delayTime(t), cc.removeSelf()));
};
node.parent = cc.director.getScene();
return node;
},
addTimeMsg: function (type, msg, okfunc, cancelfunc, time) {
if (!msg) {
return;
}
if (!this.pfab) {
return;
}
let node = cc.instantiate(this.pfab);
node.name = noticeNormalName;
let logic = node.getComponent('NoticeLogic');
logic.type = type;
logic.msg = msg;
logic.okCallback = okfunc;
logic.cancelCallback = cancelfunc;
logic.overTime = time;
logic.cancelBtn.getChildByName("New Label").getComponent(cc.Label).string ="取消(" + time + ")"
logic.schedule(() => {
if (logic) {
logic.overTime--
logic.cancelBtn.getChildByName("New Label").getComponent(cc.Label).string ="取消(" + logic.overTime + ")"
if(logic.overTime==-1){
node.unscheduleAllCallbacks()
node.destroy()
}
}
}, 1, time)
node.parent = cc.director.getScene();
return node;
},
addTimeMsg2: function (type, msg, okfunc, cancelfunc, time) {
if (!msg) {
return;
}
if (!this.pfab) {
return;
}
let node = cc.instantiate(this.pfab);
node.name = noticeNormalName;
let logic = node.getComponent('NoticeLogic');
logic.type = type;
logic.msg = msg;
logic.okCallback = okfunc;
logic.cancelCallback = cancelfunc;
logic.overTime = time;
logic.okBtn.getChildByName("New Label").getComponent(cc.Label).string ="確定(" + time + ")"
logic.schedule(() => {
if (logic) {
logic.overTime--
logic.okBtn.getChildByName("New Label").getComponent(cc.Label).string ="確定(" + logic.overTime + ")"
if(logic.overTime==-1){
node.unscheduleAllCallbacks()
node.destroy()
}
}
}, 1, time)
node.parent = cc.director.getScene();
return node;
},
removeMsg: function () {
let notice = cc.director.getScene().getChildByName(noticeNormalName);
if (notice) {
notice.destroy();
}
},
},
});

View File

@ -0,0 +1,76 @@
import AudioUtil from "../ts/core/AudioUtil";
let NoticeType = {
ONLY_OK: 0,
OK_CANCEL: 1,
};
cc.Class({
extends: cc.Component,
properties: {
okBtn: cc.Node,
cancelBtn: cc.Node,
titleLabel: cc.Label,
overTime:15,
title: {
get() { return this.titleLabel == null ? "" : this.titleLabel.string; },
set(str) { if (this.titleLabel) { this.titleLabel.string = str; } },
},
msgLabel: cc.Label,
msg: {
get() { return this.msgLabel == null ? "" : this.msgLabel.string; },
set(str) { if (this.msgLabel) { this.msgLabel.string = str; } },
},
_type: NoticeType.OK_CANCEL,
type: {
get() { return this._type; },
set(t) {
if (t == NoticeType.ONLY_OK) {
this.cancelBtn.active = false;
this.okBtn.x = 0;
} else if (t == NoticeType.OK_CANCEL) {
this.cancelBtn.active = true;
this.okBtn.x = -120;
this.cancelBtn.x = 120;
}
this._type = t;
}
},
blackBg: cc.Node,
infoNode: cc.Node,
okCallback: null,
cancelCallback: null,
},
start() {
this.infoNode.scale = 0.8;
this.blackBg.opacity = 0;
this.infoNode.runAction(cc.scaleTo(0.25, 1).easing(cc.easeBackOut()));
this.blackBg.runAction(cc.fadeTo(0.25, 100));
},
deleteself() {
this.infoNode.runAction(cc.sequence(cc.scaleTo(0.25, 0.5).easing(cc.easeBackIn()), cc.callFunc(() => { this.node.destroy(); })));
},
okClick(e, d) {
if (this.okCallback) {
this.okCallback();
}
AudioUtil.playOpenAudio();
this.deleteself();
},
cancelClick(e, d) {
if (this.cancelCallback) {
this.cancelCallback();
}
this.unscheduleAllCallbacks()
AudioUtil.playOpenAudio();
this.deleteself();
}
});

View File

@ -0,0 +1,39 @@
import MsgAlert from "../ts/game/msg/MsgAlert";
class WeChatMgr {
startRecord() {
console.log(jsb.fileUtils.getWritablePath());
if (CC_JSB) {
var soundName = jsb.fileUtils.getWritablePath() + "SoundRecord.wav";
if (cc.sys.OS_IOS == cc.sys.os) {
jsb.reflection.callStaticMethod("IOSWeChatMgr", "beginRecordWithName:", soundName);
return true;
}
else if (cc.sys.OS_ANDROID == cc.sys.os) {
if(jsb.reflection.callStaticMethod("com/jianghu/shouyou/Native", "startSoundRecord", "()I") == 0){
MsgAlert.addMsg("未开启录音权限");
return false;
}
return true;
}
else {
return false;
}
}
}
getLocation() {
if (CC_JSB) {
if (cc.sys.OS_IOS == cc.sys.os) {
return jsb.reflection.callStaticMethod("IOSWeChatMgr", "getLocation");
}
else if (cc.sys.OS_ANDROID == cc.sys.os) {
return jsb.reflection.callStaticMethod("com/jianghu/shouyou/Native", "getLocation", "()Ljava/lang/String;");
}
}
return "位置不可知";
}
}
module.exports = new WeChatMgr();

View File

@ -0,0 +1,29 @@
module.exports = {
"LivingType": {
Unknow: 0,
Player: 1,
NPC: 2,
Monster: 3,
},
"RaceType": {
Unknow: 0,
Demon: 1,
Sky: 2,
Men: 3,
Ghost: 4,
Dragon: 5, //Áú
},
"SexType": {
Unknow: 0,
Male: 1,
Female: 2,
},
"MapType": {
Unknow: 0,
Map: 1,
Instance: 2,
}
};

View File

@ -0,0 +1,255 @@
import Bag from "../../ts/bag/Bag";
import GameModel from "../../ts/core/GameModel";
import ItemUtil from "../../ts/core/ItemUtil";
import SkillUtil from "../../ts/game/skill/core/SkillUtil";
import PopupManager from "../../ts/gear_2.3.4/manager/PopupManager";
import SKDataUtil from "../../ts/gear_2.3.4/util/SKDataUtil";
cc.Class({
extends: cc.Component,
properties: {
leftScrollView: cc.ScrollView,
equitScrollView: cc.ScrollView,
skillScrollView: cc.ScrollView,
leftContent: cc.Node,
typeItem: cc.Node,
suitItem: cc.Node,
equitItem: cc.Node,
suitName: cc.Label,
skillItem: cc.Node,
},
onLoad() {
this.mRace = 11;
this.mRaceIndex = 0;
this.open = false;
this.occups = {
1: [], 2: [], 3: [], 4: [], 5: [], 9: []
};
let baldric_suit = SKDataUtil.clone(GameModel.game_conf.baldric_suit);
let baldric_suits = Object.values(baldric_suit);
// this.baldric_suits = baldric_suits.filter(function(value){
// return value.grade == 1;
// });
let baldric = SKDataUtil.clone(GameModel.game_conf.baldric);
let item = SKDataUtil.clone(GameModel.game_conf.item);
this.baldric = baldric;
this.item = item;
for (let k in baldric_suits) {
let race = baldric_suits[k].race;
this.occups[race].push(baldric_suits[k]);
}
this.RaceTypes = [];
for (let k in this.occups) {
let data = {};
if (k == 1) {
data.name = "男人";
data.race = k + "1";
data.sex = 1;
data.value = this.occups[k];
this.RaceTypes.push(data);
let cdata = SKDataUtil.clone(data)
cdata.name = "女人";
cdata.race = k + "0";
cdata.sex = 2;
this.RaceTypes.push(cdata);
} else if (k == 2) {
data.name = "男仙";
data.race = k + "1";
data.sex = 1;
data.value = this.occups[k];
this.RaceTypes.push(data);
let cdata = SKDataUtil.clone(data)
cdata.name = "女仙";
cdata.race = k + "0";
cdata.sex = 2;
this.RaceTypes.push(cdata);
} else if (k == 3) {
data.name = "男魔";
data.race = k + "1";
data.sex = 1;
data.value = this.occups[k];
this.RaceTypes.push(data);
let cdata = SKDataUtil.clone(data)
cdata.name = "女魔";
cdata.race = k + "0";
cdata.sex = 2;
this.RaceTypes.push(cdata);
} else if (k == 4) {
data.name = "男鬼";
data.race = k + "1";
data.sex = 1;
data.value = this.occups[k];
this.RaceTypes.push(data);
let cdata = SKDataUtil.clone(data)
cdata.name = "女鬼";
cdata.race = k + "0";
cdata.sex = 2;
this.RaceTypes.push(cdata);
} else if (k == 5) {
data.name = "男龍";
data.race = k + "1";
data.sex = 1;
data.value = this.occups[k];
this.RaceTypes.push(data);
let cdata = SKDataUtil.clone(data)
cdata.name = "女龍";
cdata.race = k + "0";
cdata.sex = 2;
this.RaceTypes.push(cdata);
} else if (k == 9) {
data.name = "通用";
data.race = k + "1";
data.sex = 9;
data.value = this.occups[k];
this.RaceTypes.push(data);
}
}
// let tempRaceTypes = [];
for (let k in this.RaceTypes) {
let values = this.RaceTypes[k].value;
this.RaceTypes[k].value = [];
let group = -1;
let name = "";
for (let i = 0; i < values.length; i++) {
if (group != values[i].group && name != values[i].name) {
if (this.RaceTypes[k].sex == this.baldric[values[i].list[0]].Sex || this.baldric[values[i].list[0]].Sex == 9)
this.RaceTypes[k].value.push(values[i]);
group = values[i].group;
name = values[i].name;
}
}
}
this.showLeftList();
this.init();
},
showLeftList() {
this.leftContent.removeAllChildren();
for (let k in this.RaceTypes) {
let item = cc.instantiate(this.typeItem);
item.parent = this.leftContent;
let btn = item.getChildByName("temBtn").getComponent(cc.Button);
btn.clickEvents[0].customEventData = this.RaceTypes[k].race;
item.getChildByName("temBtn").getChildByName("TextName").getComponent(cc.Label).string = this.RaceTypes[k].name;
item.name = "Layout_" + this.RaceTypes[k].race;
let Content = item.getChildByName("Content");
Content.removeAllChildren();
}
},
showTypeList() {
let Layout = this.leftScrollView.content.getChildByName("Layout_" + this.mRace);
if (Layout) {
Layout.getChildByName("temBtn").getChildByName("ImageFold").angle = 180;
let Content = Layout.getChildByName("Content");
// let item = Content.getChildByName("BtnSubTemplete");
let raceTypes = this.getSuitByRace(this.mRace);
Content.removeAllChildren();
for (let i = 0; i < raceTypes.length; i++) {
let ritem = cc.instantiate(this.suitItem);
ritem.active = true;
let equitData = this.baldric[(raceTypes[i].list[0])];
ritem.getChildByName("ImageIcon").getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIconBy(equitData);
ritem.getChildByName("TextName").getComponent(cc.Label).string = raceTypes[i].name;
ritem.parent = Content;
let btn = ritem.getComponent(cc.Button);
btn.clickEvents[0].customEventData = i;
}
}
},
getSuitByRace(race) {
for (let k in this.RaceTypes) {
if (this.RaceTypes[k].race == race) {
return this.RaceTypes[k].value;
}
}
return null;
},
closeLeftList() {
for (let k in this.RaceTypes) {
let typeItem = this.leftContent.getChildByName("Layout_" + this.RaceTypes[k].race);
typeItem.getChildByName("temBtn").getChildByName("ImageFold").angle = 0;
let Content = typeItem.getChildByName("Content");
Content.removeAllChildren();
Content.height = 7;
}
},
onBtnTypeClick(event, customEventData) {
this.closeLeftList();
if (this.mRace == customEventData && this.open) {
this.open = false;
} else {
this.mRace = customEventData;
this.showTypeList();
this.open = true;
}
// let suits = this.getSuitByRace(customEventData);
},
init() {
let suits = this.getSuitByRace(this.mRace);
this.suitInfo = suits[0];
this.showRightSuitInfo();
},
onBtnSuitClick(event, customEventData) {
let suits = this.getSuitByRace(this.mRace);
this.suitInfo = suits[Number(customEventData)];
cc.log(this.suitInfo);
this.showRightSuitInfo();
},
showRightSuitInfo() {
this.suitName.string = this.suitInfo.name;
let skills = ItemUtil.getSuitSkillGroup(this.suitInfo.group);
this.skillScrollView.content.removeAllChildren();
let colors = ['#4AD558', '#3347F6', '#F633E3'];
for (let i = 0; i < skills.length; i++) {
let skill = skills[i];
let item = cc.instantiate(this.skillItem);
item.parent = this.skillScrollView.content;
let key = skill.icon;
let spriteFrame = ItemUtil.getItemIcon(key);
if (!spriteFrame) {
cc.warn(`$警告:缺少配飾技能圖標:${key}`);
} else {
item.getChildByName("ImageSkill").getComponent(cc.Sprite).spriteFrame = spriteFrame;
}
item.getChildByName("TextName").getComponent(cc.Label).string = skill.name;
let skillDesc = skill.getSuitDesc(false);
skillDesc = ("<color=" + colors[i] + ">") + skillDesc + "</color>";
item.getChildByName("TextDesc").getComponent(cc.RichText).string = skillDesc;
}
this.equitScrollView.content.removeAllChildren();
let list = this.suitInfo.list;
for (let i = 0; i < list.length; i++) {
let suit = this.item[list[i]];
let item = cc.instantiate(this.equitItem);
item.parent = this.equitScrollView.content;
item.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIcon(suit.icon);
}
},
onCloseClick() {
PopupManager.closeView(this.node.name);
Bag.Instance.showBagPanel();
},
})

View File

@ -0,0 +1,51 @@

import ItemUtil from "../ts/core/ItemUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties: {
},
onLoad() {
this.vecPrizeIcon = [];
},
start() {
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ActiveDetailUI", "Close", 0));
},
loadInfo(strTitle, strInfo, mapPrize) {
cc.find(`picText/Title`, this.node).getComponent(cc.Label).string = strTitle;
let goLabInfo = cc.find(`labInfo`, this.node);
let goLayoutPeize = cc.find('LayoutPrize', this.node);
let label=goLabInfo.getComponent(cc.Label);
label.getComponent(cc.Label).string = strInfo;
let labelH = SKUIUtil.labelHeightBy(label);
let offsetY=label.node.y - labelH - 10;
goLayoutPeize.y = offsetY;
this.node.height = 500;
this.node.y = this.node.height / 2;
SKUIUtil.destroyList(this.vecPrizeIcon);
cc.loader.loadRes(`Prefabs/preItem`, cc.Prefab, (err, prefab) => {
let nIndex = -1;
for (var it in mapPrize) {
nIndex++;
let nX = 40 + (nIndex % 5) * 70;
let nY = -33 - Math.floor(nIndex / 5) * 70;
let goPrizeIcon = SKUIUtil.createSubNode(goLayoutPeize, cc.v2(nX, nY), prefab, 'preItem');
let stConfigInfo = ItemUtil.getItemData(it);
cc.find('Icon', goPrizeIcon).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIcon(stConfigInfo.icon);
this.vecPrizeIcon.push(goPrizeIcon);
}
});
},
Close() {
this.node.destroy();
},
});

View File

@ -0,0 +1,33 @@
import GameModel from "../../../ts/core/GameModel";
cc.Class({
extends: cc.Component,
properties: {
tipsLab: cc.Label,
tips: {
get(){
return this.tipsLab ? this.tipsLab.string : '';
},
set(n){
this.tipsLab && (this.tipsLab.string = n);
}
}
},
ctor(){
this.clicked = false;
},
start () {
},
sendGetInfo(){
this.clicked = true;
GameModel.send('c2s_shuilu_info');
setTimeout(() => {
this.clicked = false;
}, 2 * 1000);
},
});

View File

@ -0,0 +1,29 @@
cc.Class({
extends: cc.Component,
properties: {
flabel: [cc.Label],
winLayer: cc.Node,
lossLayer: cc.Node,
},
start() {
},
setData(data) {
this.winLayer.active = data.iswin == 1;
this.lossLayer.active = data.iswin == 0;
this.flabel[0].string = data.exp;
this.flabel[1].string = data.petexp;
this.flabel[2].string = data.score;
this.flabel[3].string = data.gongji;
},
clean() {
this.node.destroy();
let ShuiLuMgr = require('./sldh_mgr');
if (ShuiLuMgr)
ShuiLuMgr.justShowShuiLuIcon();
}
});

View File

@ -0,0 +1,118 @@
import GameModel from "../../../ts/core/GameModel";
import MsgAlert from "../../../ts/game/msg/MsgAlert";
let SLDHMgr = require('./sldh_mgr');
cc.Class({
extends: cc.Component,
properties: {
lunciLabel: cc.Label,
winTimesLabel: cc.Label,
lossTimesLabel: cc.Label,
scoreLabel: cc.Label,
gongjiLabel: cc.Label,
signLayer: cc.Node,
fightLayer: cc.Node,
infoRow: cc.Prefab,
roleAtlas: cc.SpriteAtlas,
},
start() {
},
setData(data) {
this.lunciLabel.string = '水陸大會 第' + data.lunci + '輪';
this.scoreLabel.string = data.score;
this.gongjiLabel.string = data.gongji;
this.winTimesLabel.string = data.wtime;
this.lossTimesLabel.string = data.ltime;
this.setSelfTeamHead(data.selfteam);
if (data.gamestate == SLDHMgr.SLDHState.Sign) {
this.signLayer.active = true;
this.fightLayer.active = false;
this.setSignList(data.sign);
} else if (data.gamestate >= SLDHMgr.SLDHState.CalTeam) {
this.signLayer.active = false;
this.fightLayer.active = true;
this.setFightList(data.fight);
}
},
setSelfTeamHead(selfteam) {
for (let i = 0; i < 5; i++) {
let selfteaminfo = selfteam[i];
let item = cc.find('bgPanel/selfteam/selfteam/headicon' + (i + 1), this.node);
let sprite = item.getComponent(cc.Sprite);
if (selfteaminfo) {
sprite.spriteFrame = this.roleAtlas.getSpriteFrame('role_' + selfteaminfo.resid);
} else {
sprite.spriteFrame = '';
}
}
},
setSignList(signlist) {
let bg = cc.find('bgPanel/signLayer/ScrollView/view/content', this.node);
bg.destroyAllChildren();
let height = 0;
for (let i = 0; i < signlist.length; i++) {
const signinfo = signlist[i];
let item = cc.instantiate(this.infoRow);
item.x = 0;
item.y = -24 - 50 * i;
item.parent = bg;
height = Math.abs(item.y);
if (i % 2 == 0) {
item.getComponent(cc.Sprite).spriteFrame = '';
}
cc.find('Index', item).getComponent(cc.Label).string = i + 1;
cc.find('Name', item).getComponent(cc.Label).string = signinfo.name;
cc.find('Race', item).getComponent(cc.Label).string = signinfo.rolenum;
cc.find('EquipScpre', item).getComponent(cc.Label).string = signinfo.score;
}
bg.height = height;
},
setFightList(fightlist) {
let hasfinish = true;
for (let i = 0; i < 5; i++) {
let finfo = fightlist[i];
let winflag = cc.find('bgPanel/figitLayer/changci' + (i + 1) + '/icon_win', this.node);
let lossflag = cc.find('bgPanel/figitLayer/changci' + (i + 1) + '/icon_lose', this.node);
winflag.active = finfo.iswin == 1;
lossflag.active = finfo.iswin == 0;
if (finfo.iswin == 2) {
hasfinish = false;
}
for (let ei = 0; ei < 5; ei++) {
let einfo = finfo.elist[ei];
let item = cc.find('bgPanel/figitLayer/changci' + (i + 1) + '/team/headicon' + (ei + 1), this.node);
let sprite = item.getComponent(cc.Sprite);
if (einfo) {
sprite.spriteFrame = this.roleAtlas.getSpriteFrame('role_' + einfo.resid);
} else {
sprite.spriteFrame = '';
}
}
}
if (hasfinish) {
MsgAlert.addMsg('五場戰鬥已完畢,積分功績均已記錄');
}
},
onBtnClick(e, d) {
if (d == 'unsign') {
GameModel.send('c2s_shuilu_unsign');
} else if (d == 'gongji') {
}
}
});

View File

@ -0,0 +1,113 @@
import SKTimeUtil from "../../../ts/gear_2.3.4/util/SKTimeUtil";
let resAnchor = {
[1001]: { scale: 1.5, x: 0.55, y: 0.4 },
[1002]: { scale: 2, x: 0.55, y: 0.4 },
[1011]: { scale: 1.6, x: 0.3, y: 0.35 },
[1012]: { scale: 1.5, x: 0.55, y: 0.35 },
[1031]: { scale: 1.5, x: 0.55, y: 0.35 },
[1032]: { scale: 1.5, x: 0.6, y: 0.35 },
[1101]: { scale: 1.7, x: 0.52, y: 0.4 },
[1102]: { scale: 1.5, x: 0.65, y: 0.3 },
[1111]: { scale: 1.6, x: 0.65, y: 0.4 },
[1112]: { scale: 1.6, x: 0.65, y: 0.35 },
[1131]: { scale: 1.7, x: 0.55, y: 0.42 },
[1132]: { scale: 1.7, x: 0.5, y: 0.4 },
[2003]: { scale: 1.7, x: 0.52, y: 0.4 },
[2004]: { scale: 1.5, x: 0.65, y: 0.3 },
[2013]: { scale: 1.6, x: 0.65, y: 0.4 },
[2014]: { scale: 1.6, x: 0.65, y: 0.35 },
[2033]: { scale: 1.7, x: 0.55, y: 0.42 },
[2034]: { scale: 1.7, x: 0.5, y: 0.4 },
[3005]: { scale: 1.8, x: 0.52, y: 0.35 },
[3006]: { scale: 1.7, x: 0.45, y: 0.35 },
[3015]: { scale: 1.5, x: 0.55, y: 0.35 },
[3016]: { scale: 1.7, x: 0.55, y: 0.35 },
[3035]: { scale: 1.5, x: 0.45, y: 0.4 },
[3036]: { scale: 1.7, x: 0.45, y: 0.45 },
[4007]: { scale: 1.7, x: 0.45, y: 0.45 },
[4008]: { scale: 1.7, x: 0.58, y: 0.35 },
[4017]: { scale: 1.5, x: 0.5, y: 0.4 },
[4018]: { scale: 1.7, x: 0.58, y: 0.4 },
[4037]: { scale: 1.6, x: 0.55, y: 0.4 },
[4038]: { scale: 1.5, x: 0.68, y: 0.4 },
}
cc.Class({
extends: cc.Component,
properties: {
timeLabel: cc.Label,
roleres: cc.SpriteAtlas,
},
ctor() {
this.timer = 0;
this.timer_n = 10;
},
onDestroy() {
this.timer=SKTimeUtil.cancelLoop(this.timer);
},
start() {
let self=this;
this.timer=SKTimeUtil.loop(()=>{
self.timeLabel.string = this.timer_n
self.timer_n--;
if (self.timer_n < 0) {
self.timer_n = 0;
}
},1000);
},
setData(data) {
for (let i = 0; i < 5; i++) {
const t = data.teamS[i];
if(t == null){
break;
}
let tpinfo = resAnchor[t.resid];
let roleresnode = cc.find('our_side_frame'+ (i+ 1) +'/mask/roleres', this.node);
let sprite = roleresnode.getComponent(cc.Sprite);
sprite.spriteFrame = this.roleres.getSpriteFrame(t.resid);
roleresnode.scale = tpinfo.scale;
roleresnode.anchorX = tpinfo.x;
roleresnode.anchorY = tpinfo.y;
let levelnode = cc.find('our_side_frame'+ (i+ 1) +'/levelbg/level', this.node);
let levellabel = levelnode.getComponent(cc.Label);
levellabel.string = t.level;
let namenode = cc.find('our_side_frame'+ (i+ 1) +'/levelbg/name', this.node);
let namelabel = namenode.getComponent(cc.Label);
namelabel.string = t.name;
}
for (let i = 0; i < 5; i++) {
const t = data.teamE[i];
if(t == null){
break;
}
let tpinfo = resAnchor[t.resid];
let roleresnode = cc.find('enemy_frame'+ (i+ 1) +'/mask/roleres', this.node);
let sprite = roleresnode.getComponent(cc.Sprite);
sprite.spriteFrame = this.roleres.getSpriteFrame(t.resid);
roleresnode.scale = tpinfo.scale;
roleresnode.anchorX = tpinfo.x;
roleresnode.anchorY = tpinfo.y;
let levelnode = cc.find('enemy_frame'+ (i+ 1) +'/levelbg/level', this.node);
let levellabel = levelnode.getComponent(cc.Label);
levellabel.string = t.level;
let namenode = cc.find('enemy_frame'+ (i+ 1) +'/levelbg/name', this.node);
let namelabel = namenode.getComponent(cc.Label);
namelabel.string = t.name;
}
}
});

View File

@ -0,0 +1,236 @@
import SKUIUtil from "../../../ts/gear_2.3.4/util/SKUIUtil";
let IconTag = 'IconTag';
let PanelTag = 'PanelTag';
let BtlTag = 'BtlTag';
let MallTag = 'MallTag';
let BtlEndTag = 'BtlEndTag';
let SLDHMgr = cc.Class({
statics: {
SLDHState: {
Sign: 1,
CalTeam: 2,
Match: 3,
Result: 4,
Close: 5,
},
FightState: {
Wait: 1,
FightEnd: 2,
Fighting: 3,
}
},
ctor() {
this.updateMainUI();
this.sldhstate = 0;
},
updateMainUI() {
this.mainUI = cc.find('Canvas/MainUI');
if(!this.mainUI){
let scene=cc.director.getScene();
cc.warn(`$警告:水陸大會獲得主界面異常,當前場景${scene.name}`);
return;
}
this.mainUIlogic = this.mainUI.getComponent('MainUI');
},
checkMainUI() {
if (!SKUIUtil.isValid(this.mainUI)){
this.updateMainUI();
}
},
changeState(state) {
if (state == SLDHMgr.SLDHState.Sign) {
this.showShuiLuIcon('已報名');
} else if (state == SLDHMgr.SLDHState.CalTeam) {
this.showShuiLuIcon('等待比賽開始');
} else if (state == SLDHMgr.SLDHState.Match) {
this.showShuiLuIcon('請準備對局馬上開始');
} else if (state == SLDHMgr.SLDHState.Close) {
this.destroyShuiLuIcon();
}
this.sldhstate = state;
},
showShuiLuIcon(tips) {
this.checkMainUI();
let shuiluicon = this.mainUI.getChildByName(IconTag);
if (shuiluicon) {
shuiluicon.active = true;
let shuiluiconlogic = shuiluicon.getComponent('MainUIShuiLuIcon');
shuiluiconlogic.tips = tips;
} else {
cc.loader.loadRes("Prefabs/Activity/ShuiLuIcon", (err, prefab) => {
let shuiluicon = cc.instantiate(prefab);
if (shuiluicon) {
shuiluicon.name = IconTag;
shuiluicon.parent = this.mainUI;
let shuiluiconlogic = shuiluicon.getComponent('MainUIShuiLuIcon');
shuiluiconlogic.tips = tips;
}
});
}
},
justShowShuiLuIcon() {
this.checkMainUI();
let shuiluicon = this.mainUI.getChildByName(IconTag);
if (shuiluicon) {
shuiluicon.active = true;
}
},
hideShuiLuIcon() {
this.checkMainUI();
if(!SKUIUtil.isValid(this.mainUI)){
cc.warn(`$警告:水陸大會關閉圖標異常,主界面節點已釋放`);
return;
}
let shuiluicon = this.mainUI.getChildByName(IconTag);
if (shuiluicon) {
shuiluicon.active = false;
}
},
destroyShuiLuIcon() {
this.checkMainUI();
if(!SKUIUtil.isValid(this.mainUI)){
return;
}
let shuiluicon = this.mainUI.getChildByName(IconTag);
if (shuiluicon) {
shuiluicon.destroy();
}
},
showShuiLuPanel(data) {
this.checkMainUI();
if (data.gamestate == 5) {
this.destroyShuiLuIcon();
this.destroyShuiLuPanel();
return;
}
let shuilupanel = this.mainUI.getChildByName(PanelTag);
if (shuilupanel == null) {
cc.loader.loadRes("Prefabs/Activity/ShuiLuPanel", (err, prefab) => {
shuilupanel = cc.instantiate(prefab);
if (shuilupanel) {
shuilupanel.name = PanelTag;
shuilupanel.parent = this.mainUI;
let panellogic = shuilupanel.getComponent('ShuiLuPanel');
panellogic.setData(data);
}
});
} else {
let panellogic = shuilupanel.getComponent('ShuiLuPanel');
panellogic.setData(data);
}
},
destroyShuiLuPanel() {
this.checkMainUI();
let shuilupanel = this.mainUI.getChildByName(PanelTag);
if (shuilupanel) {
shuilupanel.destroy();
}
},
showReadyBattle(data) {
this.checkMainUI();
let btlpanel = this.mainUI.getChildByName(BtlTag);
if (btlpanel == null) {
cc.loader.loadRes("Prefabs/Activity/ShuiLuBattle", (err, prefab) => {
btlpanel = cc.instantiate(prefab);
if (btlpanel) {
btlpanel.name = BtlTag;
btlpanel.parent = this.mainUI;
let btlpanellogic = btlpanel.getComponent('ShuiLuReadyBtl');
btlpanellogic.setData(data);
btlpanel.runAction(cc.sequence(
cc.delayTime(15),
cc.callFunc(() => {
this.destroyShuiLuReadyBtl();
}),
));
}
});
} else {
let btlpanellogic = btlpanel.getComponent('ShuiLuReadyBtl');
btlpanellogic.setData(data);
}
},
destroyShuiLuReadyBtl() {
this.checkMainUI();
if(SKUIUtil.isValid(this.mainUI)){
let btlpanel = this.mainUI.getChildByName(BtlTag);
if (btlpanel) {
btlpanel.destroy();
}
}
},
showShuiLuMall() {
this.checkMainUI();
let mallpanel = this.mainUI.getChildByName(MallTag);
if (mallpanel == null) {
cc.loader.loadRes("Prefabs/Activity/ShuiLuMall", (err, prefab) => {
let mallpanel = cc.instantiate(prefab);
if (mallpanel) {
mallpanel.name = MallTag;
mallpanel.parent = this.mainUI;
}
});
}
},
showBtlEnd(data) {
this.checkMainUI();
let btlendpanel=null;
if(SKUIUtil.isValid(this.mainUI)){
btlendpanel = this.mainUI.getChildByName(BtlEndTag);
}
if (btlendpanel == null) {
cc.loader.loadRes("Prefabs/Activity/ShuiLuBtlEnd", (err, prefab) => {
btlendpanel = cc.instantiate(prefab);
if (btlendpanel) {
btlendpanel.name = BtlEndTag;
btlendpanel.parent = this.mainUI;
let btlendpanellogic = btlendpanel.getComponent('ShuiLuBtlEnd');
btlendpanellogic.setData(data);
}
});
} else {
let btlendpanellogic = btlendpanel.getComponent('ShuiLuBtlEnd');
btlendpanellogic.setData(data);
}
},
destroyShuiLuBtlEnd() {
this.checkMainUI();
let btlendpanel = this.mainUI.getChildByName(BtlEndTag);
if (btlendpanel) {
btlendpanel.destroy();
}
this.changeState(this.sldhstate);
},
});
SLDHMgr._instance = null;
SLDHMgr.getInstance = function () {
if (SLDHMgr._instance == null) {
SLDHMgr._instance = new SLDHMgr();
}
return SLDHMgr._instance;
};
module.exports = SLDHMgr;

View File

@ -0,0 +1,25 @@
let ActivityDefine = {}
ActivityDefine.ActivityKindID = {
HongBao: 1001,
ShuiLuDaHui: 1002,
}
// 1 每天開放 2 每週週幾 3 每月定時 4 固定時段每天開放 5 固定時段全天開放
ActivityDefine.OpenType = {
EveryDay: 1,
EveryWeek: 2,
EveryMonth: 3,
DayTime: 4,
DateTime: 5,
}
let ActivityState = {
Close : 0,
ReadyOpen : 1,
Opening: 2,
ReadyClose:3,
}
ActivityDefine.ActivityState = ActivityState;
module.exports = ActivityDefine;

View File

@ -0,0 +1,127 @@
cc.Class({
extends: cc.Component,
properties: {
fontList: [cc.Font],
numLabel: cc.Label,
num: {
get() {
return this.numLabel ? this.numLabel.string : '';
},
set(n) {
this.numLabel && (this.numLabel.string = n, this.numLabel.node.active = n != 0);
}
},
_font: 0,
subhp: {
get() {
return this._font == 0;
},
set(n) {
this._font = 0;
this.numLabel.font = this.fontList[0];
}
},
addhp: {
get() {
return this._font == 1;
},
set(n) {
this._font = 1;
this.numLabel.font = this.fontList[1];
this.effect.node.active = false;
}
},
mp: {
get() {
return this._font == 2;
},
set(n) {
this._font = 2;
this.numLabel.font = this.fontList[2];
this.effect.node.active = false;
}
},
hpmp: {
get() {
return this._font == 3;
},
set(n) {
this._font = 3;
this.numLabel.font = this.fontList[3];
this.effect.node.active = false;
}
},
effect: cc.Sprite,
flags: [cc.SpriteFrame],
_effnum: 0,
baoji: {
get() {
return this._effnum == 0;
},
set(n) {
if (n) {
this._effnum = 0;
this.effect && (this.effect.spriteFrame = this.flags[0]);
this.numLabel.font = this.fontList[4];
this.effect.node.active = true;
this.effect.node.x = 0;
this.effect.node.y = 0;
} else {
this._effnum = -1;
this.effect.node.active = false;
}
}
},
kuangbao: {
get() {
return this._effnum == 1;
},
set(n) {
if (n) {
this._effnum = 1;
this.effect && (this.effect.spriteFrame = this.flags[1]);
this.numLabel.font = this.fontList[5];
this.effect.node.active = true;
this.effect.node.x = 0;
this.effect.node.y = 0;
} else {
this._effnum = -1;
this.effect.node.active = false;
}
}
},
pofang: {
get() {
return this._effnum == 2;
},
set(n) {
if (n) {
this._effnum = 2;
this.effect && (this.effect.spriteFrame = this.flags[2]);
this.numLabel.font = this.fontList[5];
this.effect.node.active = true;
this.effect.node.x = 5;
this.effect.node.y = -10;
} else {
this._effnum = -1;
this.effect.node.active = false;
}
}
},
},
showFlag(flag) {
for (let i = 0; i < this.flags.length; i++) {
const flagNode = this.flags[i];
flagNode.active = i == flag;
}
}
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
import GameModel from "../../ts/core/GameModel";
cc.Class({
extends: cc.Component,
properties: {
item:cc.Prefab,
itemLayer: cc.Node,
},
ctor(){
this.operid = 0;
this.itemlist = {};
},
onLoad(){
this.initItemPanel();
this.parentLogic = this.node.parent.getComponent('BattleUI');
},
clean(){
this.node.destroy();
},
onDestroy(){
this.parentLogic.closeItemPanel();
},
initItemPanel(operid) {
let itemlist = GameModel.player.itemList;
let propItems = GameModel.game_conf.item;
let n = 0;
for (const itemid in itemlist) {
if (Math.floor(itemid / 10000) == 4) {
let iteminfo = propItems[itemid];
if (!iteminfo) {
continue;
}
let t = null;
try {
t = JSON.parse(iteminfo.json);
} catch (error) {
continue;
}
const count = itemlist[itemid];
let item = cc.instantiate(this.item);
item.parent = this.itemLayer;
let itemlogic = item.getComponent('BattleUIItemPanelItem');
itemlogic.setItemInfo({
itemid:itemid,
num:count,
effect: t.hm,
});
item.x = -96 + (n % 3) * (item.width + 10);
item.y = -50 - Math.floor(n / 3) * (item.height + 10);
itemlogic.operid = operid;
this.itemlist[itemid] = item;
n++;
}
}
},
updateItemList(operid) {
this.itemLayer.destroyAllChildren(true);
this.initItemPanel(operid);
},
// setOperId(operid){
// this.operid = operid;
// for (const itemid in this.itemlist) {
// const item = this.itemlist[itemid];
// let itemlogic = item.getComponent('BattleUIItemPanelItem');
// itemlogic.operid = operid;
// }
// },
});

View File

@ -0,0 +1,69 @@
import GameModel from "../../ts/core/GameModel";
import { EActType } from "../../ts/game/battle/Battle";
import ItemUtil from "../../ts/core/ItemUtil";
import SKLogger from "../../ts/gear_2.3.4/util/SKLogger";
cc.Class({
extends: cc.Component,
properties: {
NumLabel: cc.Label,
iconSpr: cc.Sprite,
effect:[cc.Node],
},
ctor(){
this.selectCallback = null;
this.itemid = 0;
this.operid = 0;
},
setItemInfo(info) {
let conf=ItemUtil.getItemData(info.itemid);
if(conf==null){
SKLogger.warn(`戰鬥:道具${info.itemid}定義找不到`);
return;
}
let iconFrame = ItemUtil.getItemIcon(conf.icon);
this.iconSpr.spriteFrame = iconFrame;
this.NumLabel.string = info.num;
this.itemid = info.itemid;
this.effect[0].active = info.effect == 'hm';
this.effect[1].active = info.effect == 'h';
this.effect[2].active = info.effect == 'm';
this.effect[3].active = info.effect == 't';
},
onItemClick(e, d){
let stage = cc.find('Canvas/BattleLayer/BattleStage');
if (stage) {
let stageLogic = stage.getComponent('BattleStage');
stageLogic.cleanAllRoleSelectFlag();
stageLogic.btlUIlogic.closeItemPanel();
let itemid = this.itemid;
if(itemid == 40017){
stageLogic.selectTarget(2, (targetid) => {
stageLogic.btlUIlogic.backType = 6;
let params={
action: EActType.ITEM,
actionid: itemid,
targetid: targetid,
onlyid: this.operid
};
GameModel.send('c2s_btl_act',params);
});
}else{
stageLogic.selectTarget(1, (targetid) => {
stageLogic.btlUIlogic.backType = 6;
let params={
action: EActType.ITEM,
actionid: itemid,
targetid: targetid,
onlyid: this.operid
};
GameModel.send('c2s_btl_act',params);
});
}
}
},
});

View File

@ -0,0 +1,63 @@
import GameModel from "../../ts/core/GameModel";
import GameUtil from "../../ts/core/GameUtil";
import ItemUtil from "../../ts/core/ItemUtil";
cc.Class({
extends: cc.Component,
properties: {
nameLabel:cc.Label,
levelLabel:cc.Label,
headIcon:cc.Sprite,
curFlag: cc.Node,
zhenwangFlag:cc.Node,
_fight: false,
isFight:{
get(){
return this._fight;
},
set(n){
this._fight = n;
this.curFlag.active = this._fight;
}
},
_dead: false,
isDead: {
get() {
return this._dead;
},
set(n) {
this._dead = n;
this.zhenwangFlag.active = this._dead;
}
},
},
ctor(){
this.selectCallback = null;
},
start () {
},
setHeadIcon(resid){
this.headIcon.spriteFrame = ItemUtil.getItemIcon(resid);
},
setName(str){
this.nameLabel.string = str;
},
setLevel(relive, level){
GameUtil.setReliveLabel(this.levelLabel,0,relive,level);
},
selected(e, d){
if (this.selectCallback){
this.selectCallback();
}
}
});

View File

@ -0,0 +1,93 @@
import GameModel from "../ts/core/GameModel";
import ItemUtil from "../ts/core/ItemUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties: {
NumPad: cc.Prefab,
},
onLoad() {
this.nID = 0;
this.nConfigID = 0;
this.nMax = 0;
this.nPrice = 0;
this.nBuyCnt = 0;
},
start() {
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "BuyUI", "Close", 0));
cc.find('bntBuy', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "BuyUI", "OnBuy", 0));
cc.find('nodNum/btnAdd', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "BuyUI", "ChangeBuyCnt", 1));
cc.find('nodNum/btnCut', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "BuyUI", "ChangeBuyCnt", -1));
cc.find('nodNum/btnPad', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "BuyUI", "OpenNumPad", 0));
this.nBuyCnt = 1;
this.ShowGoodsInfo();
},
Init() {
},
Close() {
this.node.destroy();
},
ShowGoodsInfo() {
if (this.nConfigID <= 0) {
return;
}
let stConfigInfo = ItemUtil.getItemData(this.nConfigID);
let goIcon = cc.find('svItemDetail/view/content/ItemIcon/icon', this.node);
goIcon.getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIconBy(stConfigInfo);
cc.find('svItemDetail/view/content/txTitle', this.node).getComponent(cc.Label).string = stConfigInfo.name;
let strText = stConfigInfo.description;
strText += '\n\n' + '【用途】' + stConfigInfo.usedetail;
cc.find('svItemDetail/view/content/txDetal', this.node).getComponent(cc.Label).string = strText;
let goGoods = cc.find('btnGoodsInfo', this.node);
cc.find('nodItemInfo/Icon', goGoods).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIconBy(stConfigInfo);
cc.find('nodItemInfo/txLap', goGoods).getComponent(cc.Label).string = '';
cc.find('labName', goGoods).getComponent(cc.Label).string = stConfigInfo.name;
cc.find('picText/Label', goGoods).getComponent(cc.Label).string = this.nPrice;
//----------------------------------
cc.find('bntBuy/txNum', this.node).getComponent(cc.Label).string = this.nBuyCnt * this.nPrice;
},
ChangeBuyCnt(stEvent, nAdd) {
this.nBuyCnt = CPubFunction.ChangeNumToRange(parseInt(this.nBuyCnt) + parseInt(nAdd), 1, this.nMax);
cc.find('nodNum/Label', this.node).getComponent(cc.Label).string = this.nBuyCnt;
cc.find('bntBuy/txNum', this.node).getComponent(cc.Label).string = this.nBuyCnt * this.nPrice;
},
OpenNumPad(e, d) {
this.nBuyCnt = 0;
cc.find('nodNum/Label', this.node).getComponent(cc.Label).string = this.nBuyCnt;
let goNumPad = SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(70, 190), this.NumPad, 'NumPad');
goNumPad.getComponent('NumPad').NumPad_Init((nNum) => {
this.nBuyCnt = CPubFunction.ChangeNumToRange(nNum, 1, this.nMax);
cc.find('nodNum/Label', this.node).getComponent(cc.Label).string = this.nBuyCnt;
});
},
OnBuy() {
if (this.nConfigID <= 0 || this.nBuyCnt <= 0 || this.nBuyCnt > this.nMax)
return;
GameModel.send('c2s_buy_goods', { nID: this.nID, nCnt: this.nBuyCnt });
this.Close();
},
});

View File

@ -0,0 +1,58 @@
import GameModel from "../ts/core/GameModel";
cc.Class({
extends: cc.Component,
properties: {
progress: cc.ProgressBar,
jadesum_label: cc.Label,
jade_label: cc.Label,
reward_button: cc.Node,
gained_sprite: cc.Node,
bag_item: cc.Prefab,
},
/*
* 初始化
* @param reward_money 達到獎勵所需money
* @param charge_sum 總充值
* @param has_gain 是否領取
*/
init(reward_money, charge_sum, has_gain, reward_list, id) {
this.id = id;
if (charge_sum > reward_money)
charge_sum = reward_money;
this.jade_label.string = `${charge_sum}元/${reward_money}`;
this.jadesum_label.string = `${reward_money}`;
this.progress.progress = charge_sum / reward_money;
if (charge_sum / reward_money == 1) {
this.progress.node.active = false;
this.jade_label.node.active = false;
this.reward_button.active = !has_gain;
this.gained_sprite.active = has_gain;
}
else
this.progress.node.active = true;
this.reward_button.active = true
let node_list = [];
for (let item of reward_list) {
let node = cc.instantiate(this.bag_item);
let logic = node.getComponent('BagItem');
logic.item_bg.setScale(0.8);
logic.item_selected.opacity = 0;
node_list.push(node);
node.parent = this.node;
node.setContentSize(80, 80);
node.y = 0;
logic.loadInfo({ itemid: item.gid, count: item.count, });
}
for (let i = 0; i < node_list.length; ++i)
node_list[i].x = 28 + (i - (node_list.length - 1) / 2) * 80;
},
onButtonClick(event, param) {
GameModel.player.rewardrecord |= (1 << (this.id - 1));
GameModel.send('c2s_charge_reward', { rewardid: this.id });
this.gained_sprite.active = true;
this.reward_button.active = false;
},
});

View File

@ -0,0 +1,54 @@
import GameModel from "../ts/core/GameModel";
cc.Class({
extends: cc.Component,
properties: {
content: cc.Node,
reward_item: cc.Prefab,
},
start () {
this.initScroll(GameModel.player.chargesum, GameModel.player.rewardrecord);
},
initScroll (charge_sum, reward_record) {
let reward_list = GameModel.conf_charge_reward;
let list = [];
for (let i = 1; reward_list[i]; ++i) {
let item = reward_list[i];
list.push(item);
}
list.sort((a, b) => {
return a.money - b.money;
});
for(let item of list){
let node = cc.instantiate(this.reward_item);
node.parent = this.content;
let has_gain = ((reward_record&(1<<(item.id-1))) > 0);
let logic = node.getComponent('ChargeRewardItem');
let reward = [];
if (item.gid1 && item.gid1>0 && item.count1 && item.count1>0){
reward.push({gid: item.gid1, count: item.count1});
}
if (item.gid2 && item.gid2>0 && item.count2 && item.count2>0){
reward.push({gid: item.gid2, count: item.count2});
}
if (item.gid3 && item.gid3>0 && item.count3 && item.count3>0){
reward.push({gid: item.gid3, count: item.count3});
}
if (item.gid4 && item.gid4>0 && item.count4 && item.count4>0){
reward.push({gid: item.gid4, count: item.count4});
}
if (item.gid5 && item.gid5>0 && item.count5 && item.count5>0){
reward.push({gid: item.gid5, count: item.count5});
}
logic.init(item.money, charge_sum, has_gain, reward, item.id);
}
},
onButtonClick (event, param) {
if (param == 'close')
this.node.destroy();
},
});

View File

@ -0,0 +1,67 @@
import GameModel from "../ts/core/GameModel";
import MsgAlert from "../ts/game/msg/MsgAlert";
import SKNetTask,{NetCode} from "../ts/gear_2.3.4/net/SKNetTask";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
cc.Class({
extends: cc.Component,
properties: {
money_label: cc.Label,
name_label: cc.Label,
web_view: cc.WebView,
},
setData(data) {
this.data = data;
let item = GameModel.conf_charge[data.goodsid];
if (item) {
this.name_label.string = item.name;
this.money_label.string = '¥' + item.money.toFixed(2);
}
else {
this.name_label.string = 'XianYu' + data.money * 100;
this.money_label.string = '¥' + data.money.toFixed(2);
}
},
openWebView(pay_bankcode, webview) {
this.data.pay_bankcode = pay_bankcode;
let self=this;
SKNetTask.getWithJson("/charge",this.data,(code,result)=>{
if(code != NetCode.SUCCESS){
MsgAlert.addMsg(`充值失敗,請檢查網絡!錯誤碼[${code}]`);
return;
}
if(!result.data){
return;
}
let url = result.data.url;
if(SKDataUtil.isEmptyString(url)){
return;
}
if (webview) {
if(SKUIUtil.isValid(self.web_view.node)){
self.web_view.node.active = true;
self.web_view.url = encodeURI(url);
}
} else {
cc.sys.openURL(encodeURI(url));
}
});
},
onButtonClick(event, param) {
if (param == 'close') {
this.node.destroy();
} else if (param == 'ali') {
this.openWebView(220);
} else if (param == 'ali_saoma') {
this.openWebView(210, true);
} else if (param == 'wx') {
this.openWebView(330);
} else if (param == 'wx_saoma') {
this.openWebView(310, true);
}
},
});

View File

@ -0,0 +1,200 @@
import GameModel from "../ts/core/GameModel";
import GameUtil from "../ts/core/GameUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties: {
svPartnerList: cc.Prefab,
btnPartner: cc.Prefab,
nodChuanGongSuccess: cc.Prefab,
PartnerUI: cc.Prefab,
},
onLoad() {
this.vecInfo = [];
this.nLeftSelect = -1;
this.nRightSelect = -1;
this.nodLeft = null;
this.nodRight = null;
this.nodAdd = null;
this.nCostWhat = 0;
},
Init(vecInfo, nCurSelect) {
this.vecInfo = vecInfo;
this.nLeftSelect = nCurSelect;
},
start() {
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ChuanGongUI", "Close", 0));
//-------------------
this.btnUseMoney = cc.find('btnUseMoney', this.node);
this.btnUseItem = cc.find('btnUseItem', this.node);
this.nodLeft = cc.find('nodLeft', this.node);
this.nodRight = cc.find('nodRight', this.node);
this.nodAdd = cc.find('nodAdd', this.node);
cc.find('nodAdd/btnAdd', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ChuanGongUI", "OpenPartnerList", 0));
for (let nIndex = 0; nIndex < 2; nIndex++) {
let strPath = `ToggleContainer/toggle${nIndex}`;
let goToggle = cc.find(strPath, this.node);
goToggle.getComponent(cc.Toggle).checkEvents.push(CPubFunction.CreateEventHandler(this.node, "ChuanGongUI", "OnCheck", nIndex));
}
this.OnCheck(0, 0);
cc.find('btnUseItem', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ChuanGongUI", "OnOK", 0));
cc.find('btnUseMoney', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ChuanGongUI", "OnOK", 0));
this.RefreshPartnerInfo();
},
OnCheck(e, nIndex) {
this.nCostWhat = nIndex;
CPubFunction.ChangeTeamNodeState([this.btnUseItem, this.btnUseMoney], nIndex);
},
RefreshPartnerInfo() {
if (this.nLeftSelect < 0 || this.nLeftSelect >= this.vecInfo.length)
return;
this.SetPartnerInfo(this.nodLeft, this.vecInfo[this.nLeftSelect]);
if (this.nRightSelect != -1) {
this.nodRight.active = true;
this.nodAdd.active = false;
this.SetPartnerInfo(this.nodRight, this.vecInfo[this.nRightSelect]);
}
else {
this.nodRight.active = false;
this.nodAdd.active = true;
}
},
OpenPartnerList() {
let svPartnerList = SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(0, 0), this.svPartnerList, 'svPartnerList');
cc.find('btnClose', svPartnerList).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ChuanGongUI", "ClosePartnerList", svPartnerList));
let content = cc.find('ScrollView/view/content', svPartnerList);
let nY = 30;
for (var it in this.vecInfo) {
if (it == this.nLeftSelect)
continue;
let stInfo = this.vecInfo[it];
nY -= 90;
let goPartner = SKUIUtil.createSubNode(content,cc.v2(140,nY), this.btnPartner, 'btnPartner');
goPartner.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ChuanGongUI", "SetRight", it));
SKUIUtil.setSpriteFrame(cc.find('HeadPic/Icon', goPartner), 'Common/huoban', 'huoban_' + stInfo.resid);
cc.find('Name', goPartner).getComponent(cc.Label).string = stInfo.name;
let level_lb = cc.find('Level', goPartner).getComponent(cc.Label);
GameUtil.setReliveLabel(level_lb, 0, stInfo.relive, stInfo.level);
cc.find('picState', goPartner).active = false;
}
content.height = Math.max(content.height, this.vecInfo.length * 90);
},
ClosePartnerList(stEvent, goItem) {
goItem.destroy();
},
SetRight(stEvet, stData) {
this.nRightSelect = stData;
this.RefreshPartnerInfo();
CPubFunction.FindAndDeleteNode(cc.find('Canvas/MainUI'), 'svPartnerList');
},
SetPartnerInfo(nodPartner, stInfo) {
SKUIUtil.setSpriteFrame(cc.find('btnHeadPic', nodPartner), 'Common/huoban', 'huoban_' + stInfo.resid);
cc.find('Name', nodPartner).getComponent(cc.Label).string = stInfo.name;
let level_lb = cc.find('Level', nodPartner).getComponent(cc.Label);
GameUtil.setReliveLabel(level_lb, 0, stInfo.relive, stInfo.level);
let nPercent = Math.floor(this.GetPercent(stInfo) * 100);
let nNewLen = cc.find('picPecent', nodPartner).width * (nPercent / 100);
cc.find('picPecent/picBar', nodPartner).width = nNewLen;
cc.find('picPecent/Label', nodPartner).getComponent(cc.Label).string = `${nPercent}%`;
},
GetPercent(stInfo) {
let stData = CPubFunction.GetLevel(stInfo.exp);
return stData.nCur / stData.nMax;
},
Close() {
this.node.destroy();
},
OnOK() {
if (this.nLeftSelect < 0 || this.nLeftSelect >= this.vecInfo.length || this.nRightSelect < 0 || this.nRightSelect >= this.vecInfo.length)
return;
GameModel.send('c2s_partner_exchange_exp', { nRoleID: GameModel.player.roleid, nPartnerA: this.vecInfo[this.nLeftSelect].resid, nPartnerB: this.vecInfo[this.nRightSelect].resid, nCostWhat: this.nCostWhat });
},
GetInfoByID(nID) {
for (var it in this.vecInfo) {
if (this.vecInfo[it].resid == nID)
return this.vecInfo[it];
}
return null;
},
OnChuanGongOK(vecInfo, data) {
this.vecInfo = vecInfo; // 刷新vecInfo
let stAInfo = this.GetInfoByID(data.nPartnerA);
stAInfo.exp = data.nAExp;
let stBInfo = this.GetInfoByID(data.nPartnerB);
stBInfo.exp = data.nBExp;
let goSuccess = SKUIUtil.createSubNode(cc.find('Canvas/MainUI'),cc.v2(0,0), this.nodChuanGongSuccess, 'nodChuanGongSuccess');
this.SetPartnerInfo(cc.find('Panel/nodLeft', goSuccess), stAInfo);
this.SetPartnerInfo(cc.find('Panel/nodRight', goSuccess), stBInfo);
cc.find('btnClose', goSuccess).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(cc.find('Canvas/MainUI'), "MainUI", "CloseUIByName", "nodChuanGongSuccess"));
let comPartnerUI = cc.find('Canvas/MainUI/PartnerUI');
if (!comPartnerUI) {
return;
}
let comPartner = comPartnerUI.getComponent('PartnerUI');
comPartner.ChangePartnerExp(data.nPartnerA, data.nAExp);
comPartner.ChangePartnerExp(data.nPartnerB, data.nBExp);
comPartner.ShowPartnerList();
this.Close();
},
});

View File

@ -0,0 +1,175 @@
import GameModel from "../ts/core/GameModel";
import ItemUtil from "../ts/core/ItemUtil";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let CPubFunction = require('./PubFunction');
let CMainPlayerInfo = require('./MainPlayerInfo');
cc.Class({
extends: cc.Component,
properties:
{
selectedItem:{
default:0,
type:cc.Integer,
},
nodComposItem: cc.Prefab,
NumPad: cc.Prefab,
num_bar: {
default: null,
type: cc.ProgressBar,
},
num_slider:{
default: null,
type: cc.Slider,
}
},
onLoad() {
this.num_slider.progress=0;
this.num_bar.progress=0;
},
start() {
this.btnFatherItem = cc.find('btnFatherItem', this.node);
this.stFatherItemInfo = null;
this.vecTempA = [];
this.vecTempB = [];
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ComposUI", "Close", 0));
cc.find('btnFatherItem', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ComposUI", "OpenNumPad", 0));
cc.find('btnOK', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ComposUI", "OnOK", 0));
if(this.selectedItem != 0){
this.stFatherItemInfo = { nItemID:this.selectedItem, nNum: 1 };
}
this.InitFatherItemList();
},
Close() {
this.node.destroy();
},
onSliderClicked(slider, data) {
this.num_bar.progress = slider.progress;
this.resetSendCount();
},
resetSendCount(){
let n = Math.floor(this.currNum / this.needNum);
let label = cc.find('numStr', this.node).getComponent(cc.Label);
let m = Math.floor(this.num_slider.progress * n);
if (n > 0 && m <= 0) {
m = 1;
}
this.numSend = m;
label.string = m + '/' + n;
},
InitFatherItemList() {
let goContent = cc.find('scvFather/view/content', this.node);
SKUIUtil.destroyList(this.vecTempA);
let stStart = { nX: -90, nY: -58 };
let nIndex = -1;
let synthesis=ItemUtil.synthesisMap();
for (let key in synthesis) {
nIndex++;
let stPos = cc.v2(stStart.nX + (nIndex % 3) * 90, stStart.nY - Math.floor(nIndex / 3) * 90);
let goItem = SKUIUtil.createSubNode(goContent, stPos, this.nodComposItem, '');
goItem.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node,"ComposUI",'SetFatherItem',{ nItemID:key, nNum: 1 }));
if (this.stFatherItemInfo == null) {
this.stFatherItemInfo = { nItemID:key, nNum: 1 };
}
this.SetItemInfo(goItem,key, '');
this.vecTempA.push(goItem);
}
this.SetFatherItem(0, this.stFatherItemInfo);
let height=Math.max(goContent.height, Math.ceil((SKDataUtil.getLength(synthesis) + 1) / 3) * 90 + 20);
goContent.height = height;
},
SetItemInfo(goItem, nID, strText) {
let data = ItemUtil.getItemData(nID);
cc.find('Icon', goItem).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIconBy(data);
if (Math.floor(this.cunt) < 1 && strText.length >= 3) {
cc.find('Label', goItem).getComponent(cc.Label).node.color = new cc.color(255, 0, 0, 255);
}
cc.find('Label', goItem).getComponent(cc.Label).string = strText;
},
SetFatherItem(event, data) {
if(data==null){
cc.warn(`$警告:設置父道具為空!`);
return;
}
this.stFatherItemInfo = data;
this.SetItemInfo(this.btnFatherItem, data.nItemID, data.nNum);
SKUIUtil.destroyList(this.vecTempB);
let goContent = cc.find('scvSon/view/content', this.node);
let vecSonItem = ItemUtil.getSynthesisItem(data.nItemID);
let nLen = vecSonItem.length;
let index=0;
for (let key in vecSonItem) {
let vecData = vecSonItem[key].split(':');
let stSonInfo = { nItemID: parseInt(vecData[0]), nNum: parseInt(vecData[1]) };
let stPos = cc.v2( - 90 * (nLen - 1) / 2 + index * 90, 0 );
let goSun = SKUIUtil.createSubNode(goContent, stPos, this.nodComposItem, '');
this.currNum = CMainPlayerInfo.GetBagItemCnt(stSonInfo.nItemID);
this.needNum = this.stFatherItemInfo.nNum * stSonInfo.nNum;
let n = 0;
this.cunt = this.currNum / this.needNum;
if (Math.floor(this.cunt) >= 1) {
n = 1;
}
let show=n + '/' + Math.floor(this.cunt);
cc.find('numStr', this.node).getComponent(cc.Label).string = show;
this.SetItemInfo(goSun, stSonInfo.nItemID, `${CMainPlayerInfo.GetBagItemCnt(stSonInfo.nItemID)}/${this.stFatherItemInfo.nNum * stSonInfo.nNum}`);
this.vecTempB.push(goSun);
index++;
}
this.num_slider.progress=(this.cunt<1 ?0:1);
this.num_bar.progress=(this.cunt<1 ?0:1);
this.resetSendCount();
},
OpenNumPad(e, d) {
if (null == this.stFatherItemInfo)
return;
CPubFunction.FindAndDeleteNode(this.node, 'NumPad');
let goNumPad = SKUIUtil.createSubNode(this.node,cc.v2(177,188), this.NumPad, 'NumPad');
goNumPad.getComponent('NumPad').NumPad_Init((nNum) => {
let nCnt = CPubFunction.ChangeNumToRange(nNum, 1, 10000);
this.SetComposCnt(nCnt);
});
},
SetComposCnt(nCnt) {
if (null == this.stFatherItemInfo)
return;
this.stFatherItemInfo.nNum = nCnt;
this.SetFatherItem(this.btnFatherItem, this.stFatherItemInfo);
},
OnReceiveBagItem() {
this.SetFatherItem(0, this.stFatherItemInfo);
},
OnOK() {
let num = 0;
if (null == this.stFatherItemInfo)
return;
if (Math.floor(this.cunt) == 0) {
num = 1;
} else {
if (this.numSend == null || this.numSend == 0) {
num = 1;
} else {
num = this.numSend;
}
}
GameModel.send('c2s_compose', { nFatherItem: this.stFatherItemInfo.nItemID, nNum: num });
},
});

View File

@ -0,0 +1,334 @@
import GameModel from "../ts/core/GameModel";
import ItemUtil from "../ts/core/ItemUtil";
import AudioUtil from "../ts/core/AudioUtil";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import GameUtil from "../ts/core/GameUtil";
import MsgAlert from "../ts/game/msg/MsgAlert";
let CPubFunction = require('./PubFunction');
let CNpcMgr = require('./NpcMgr');
cc.Class({
extends: cc.Component,
properties: {
ActiveDetailUI: cc.Prefab,
},
onLoad() {
this.vecPrize =
[
{ 90002: 0, 900002: 0, 10404: 1 }, // 幫派任務獎勵
{ 90002: 0, 900002: 0, 10404: 1 }, // 師門任務獎勵
{ 90004: 0 }, // 五環任務獎勵
{ 90002: 0, 900002: 0, 10404: 1 }, // 鍾馗抓鬼獎勵
{ 90002: 0, 900002: 0, 10404: 1 }, // 天庭降妖獎勵
{ 10301: 1, 10302: 1, 10303: 0 }, // 寶圖任務獎勵
{ 90002: 0, 900002: 0, 10102: 1, 10103: 1 }, // 大雁塔獎勵
{ 90002: 0, 900002: 0, 10120: 1, 10404: 1 }, // 尋芳獎勵
{ 90002: 0, 900002: 0, 10120: 1, 10103: 1 }, // 地宮獎勵
{ 90002: 0, 900002: 0, 10404: 1, 10301: 1, 10302: 1, 10303: 0 }, // 野外封妖獎勵
{ 90002: 0, 900002: 0, 10404: 1, 50004: 1 }, //三界妖王獎勵
{ 90002: 0, 900002: 0, 50004: 1 }, // 地煞星獎勵
{ 90002: 0, 900002: 0, 10301: 1, 10302: 1, 10303: 0, 50004: 1, 90004: 1 }, // 鎮壓心魔獎勵
{ 90002: 0, 900002: 0, 10404: 1, 10301: 1, 10302: 1, 10303: 0, 67292: 1 }, // 魔王窟獎勵
{ 90002: 0, 900002: 0, 10404: 1 }, // 修羅出沒獎勵
{ 90002: 0, 900002: 0, 10301: 1, 10302: 1, 10303: 0, 50004: 1, 90004: 1 }, // 八卦降魔獎勵
{ 90002: 0, 10204: 0, 10401: 0 }, // 競技場獎勵
//{ 90002: 0, 10204: 0, 10401: 0 }, // 天元盛典獎勵
{ 90002: 0, 900002: 0, 67292: 1,90004: 0 ,50033: 0}, //天星獎勵
{ 90002: 0,900002: 0 }, //文曲星
{ 90002: 0, 90088: 0, 900002: 0, 67293: 0}, //證道大會
{ 90002: 0, 900002: 0, 50023: 0, 67293: 0} //海盜入侵
];
this.vecBtnEvent = [];
this.vecBtnPrize = [0, 0, 0, 0, 0, 0];
this.mapDailyStart = {};
this.mapFuBenCnt = {};
},
start() {
let node = cc.find('btnClose', this.node);
if (SKUIUtil.isValid(node)) {
node.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "DailyUI", "Close", 0));
} else {
cc.warn(`$警告:活動面板btnClose節點無效`);
}
let goContent = cc.find(`ScrollView/view/content`, this.node);
for (let i = 0; i <= 20; i++) {
this.vecBtnEvent.push(goContent.children[i]);
let iconNode = cc.find("nodItemInfo/Icon", this.vecBtnEvent[i]);
if (iconNode) {
let sprite = iconNode.getComponent(cc.Sprite);
if (sprite) {
let conf = GameUtil.getDailyData(i + 1);
if (conf) {
sprite.spriteFrame = ItemUtil.getItemIcon(conf.icon);
}
}
}
let node = this.vecBtnEvent[i];
if (SKUIUtil.isValid(node)) {
let button = node.getComponent(cc.Button);
if (button) {
button.clickEvents.push(CPubFunction.CreateEventHandler(this.node, "DailyUI", "OnDailyEvent", i));
}
}
}
for (let i = 0; i <= 20; i++) {
if (i == 11||i == 17||i == 18) continue;
cc.find(`btnGo`, this.vecBtnEvent[i]).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "DailyUI", "OnGo", i));
}
// cc.find(`btnGo`, this.vecBtnEvent[12]).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "DailyUI", "OnGo", 12));
// cc.find(`btnGo`, this.vecBtnEvent[13]).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "DailyUI", "OnGo", 13));
// cc.find(`btnGo`, this.vecBtnEvent[14]).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "DailyUI", "OnGo", 14));
// cc.find(`btnGo`, this.vecBtnEvent[15]).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "DailyUI", "OnGo", 15));
let nodPrize = cc.find('nodPrize', this.node);
for (let i = 0; i < 6; i++) {
this.vecBtnPrize[i] = nodPrize.children[i];
this.vecBtnPrize[i].getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "DailyUI", "TakeActivePrize", i));
}
GameModel.send('c2s_ask_daily_info', {});
this.SetMoneyInfo();
},
TakeActivePrize(stEvetn, nIndex) {
if (stEvetn.target.children[3].active == true)
return;
if (CPubFunction.GetMapSum(this.mapActiveScore) < (nIndex + 1) * 20)
return;
GameModel.send('c2s_take_active_prize', { nIndex: nIndex });
},
OnReceiveDailyInfo(strJson) {
let stData = SKDataUtil.jsonBy(strJson);
console.log(stData)
this.mapActiveScore = stData.mapActiveScore;
// 活躍度進度條
cc.find('nodPrize/nodExp/picText/picBar', this.node).width = Math.min(CPubFunction.GetMapSum(this.mapActiveScore) / 140, 1) * 680;
// 每日活躍度足夠後的6個獎勵內容是否領取的對勾
for (let i = 0; i < 6; i++) {
let item = this.vecBtnPrize[i];
if (item && item.children && item.children.length >= 3) {
let node = item.children[3];
if (node) {
node.active = parseInt(stData.szBeenTake[i]);
} else {
cc.warn(`$警告:每日限購節點無效!`);
}
} else {
cc.warn(`$警告:每日限購節點無效!`);
}
}
// 每日活躍度足夠後的6個獎勵內容
for (let i = 0; i < 6; i++) {
let vecTmp = stData.szActivePrize[i].split(",");
this.SetPrizesInfo(this.vecBtnPrize[i], parseInt(vecTmp[0]), parseInt(vecTmp[1]));
}
this.mapDailyStart = stData.mapDailyStart;
this.mapDailyCnt = stData.mapDailyCnt;
this.mapFuBenCnt = stData.mapFuBenCnt;
let vecKind = [{ group: 2, cnt: 20, active: 20 }, { group: 3, cnt: 20, active: 20 }, { group: 5, cnt: 5, active: 5 }, { group: 6, cnt: 120, active: 60 }, { group: 7, cnt: 20, active: 20 }, { group: 4, cnt: 15, active: 15 }, { group: 17, cnt: 20, active: 15 }];
for (let nIndex = 0; nIndex <= 5; nIndex++) {
let stDaily = vecKind[nIndex];
let nCurCnt = CPubFunction.GetDefault(this.mapDailyCnt[stDaily.group], 0);
let countNode = cc.find("labCnt", this.vecBtnEvent[nIndex]);
if (SKUIUtil.isValid(countNode)) {
let countLabel = countNode.getComponent(cc.Label);
if (countLabel) {
countLabel.string = `日次數:${nCurCnt}/${stDaily.cnt}`;
}
}
let nCurActive = CPubFunction.GetDefault(this.mapActiveScore[stDaily.group], 0);
let activeNode = cc.find(`labActive`, this.vecBtnEvent[nIndex]);
if (SKUIUtil.isValid(activeNode)) {
let activeLabel = activeNode.getComponent(cc.Label);
if (activeLabel) {
activeLabel.string = `活躍度:${Math.floor(nCurActive)}/${stDaily.active}`;
}
}
}
let vecFuBen = [{ taskid: 1001, active: 21 }, { taskid: 1002, active: 14 }, { taskid: 1004, active: 12 }];
for (let nIndex2 = 0; nIndex2 <= 2; nIndex2++) {
let nBtnIndex = 6 + nIndex2;
let stFuBen = vecFuBen[nIndex2];
let nCurActive = 0;
if (nBtnIndex == 8) //地宮
{
let nCur = this.IsAllReadyInceptFuBenTask(1004) + this.IsAllReadyInceptFuBenTask(1005) + this.IsAllReadyInceptFuBenTask(1006);
cc.find(`labCnt`, this.vecBtnEvent[nBtnIndex]).getComponent(cc.Label).string = `日次數:${nCur}/3`;
nCurActive = CPubFunction.GetDefault(this.mapActiveScore[1004], 0) + CPubFunction.GetDefault(this.mapActiveScore[1005], 0) + CPubFunction.GetDefault(this.mapActiveScore[1006], 0);
} else {
cc.find(`labCnt`, this.vecBtnEvent[nBtnIndex]).getComponent(cc.Label).string = `日次數:${this.IsAllReadyInceptFuBenTask(stFuBen.taskid)}/1`;
nCurActive = CPubFunction.GetDefault(this.mapActiveScore[stFuBen.taskid], 0);
}
cc.find(`labActive`, this.vecBtnEvent[nBtnIndex]).getComponent(cc.Label).string = `活躍度:${nCurActive}/${stFuBen.active}`;
}
// 新增競技場活躍度顯示
let arena = { group: 16, cnt: 10, active: 20 }
let nCurCnt = CPubFunction.GetDefault(this.mapDailyCnt[arena.group], 0);
let countNode = cc.find("labCnt", this.vecBtnEvent[16]);
if (SKUIUtil.isValid(countNode)) {
let countLabel = countNode.getComponent(cc.Label);
if (countLabel) {
countLabel.string = `日次數:${nCurCnt}/${arena.cnt}`;
}
}
let nCurActive = CPubFunction.GetDefault(this.mapActiveScore[arena.group], 0);
let activeNode = cc.find(`labActive`, this.vecBtnEvent[16]);
if (SKUIUtil.isValid(activeNode)) {
let activeLabel = activeNode.getComponent(cc.Label);
if (activeLabel) {
activeLabel.string = `活躍度:${Math.floor(nCurActive)}/${arena.active}`;
}
}
},
IsAllReadyInceptDailyTask(nTeam) {
return SKDataUtil.hasProperty(this.mapDailyStart, nTeam);
},
IsAllReadyInceptFuBenTask(nTask) {
if (SKDataUtil.hasProperty(this.mapFuBenCnt, nTask))
return 1;
return 0;
},
SetPrizesInfo(goItem, nItem, nNum) {
let stConfigInfo = ItemUtil.getItemData(nItem);
cc.find('Icon', goItem).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIcon(stConfigInfo.icon);
cc.find('txLap', goItem).getComponent(cc.Label).string = SKDataUtil.transform(nNum);
},
SetMoneyInfo() {
// cc.find('layMoney/yinliang/ui_common_icon_yinliang/yinliangLabel', this.node).getComponent(cc.Label).string = GameModel.player.gameData.money;
// cc.find('layMoney/xianyu/ui_common_icon_xianyu/xianyuLabel', this.node).getComponent(cc.Label).string = GameModel.player.gameData.jade;
let topnode = cc.find('topInfo', this.node);
let toplogic = topnode.getComponent('TopInfo');
toplogic.updateGameMoney();
},
CloseAndClickNpc(nNpc) {
let stPos = CNpcMgr.GetNpcPos(nNpc);
GameUtil.myPlayerToDo(stPos.nMap, stPos.nX, stPos.nY, () => {
let temp = CNpcMgr.FindNpcByConfigID(nNpc);
if (temp) {
let npc = temp.getComponent("Npc");
npc.OnNpcClick();
}
});
},
OnDailyEvent(e, i) {
CPubFunction.FindAndDeleteNode(this.node, "ActiveDetailUI");
let goActiveDetailUI = SKUIUtil.createSubNode(this.node, cc.v2(-200, 215), this.ActiveDetailUI, 'ActiveDetailUI');
let conf = GameUtil.getDailyData(i + 1);
if (conf == null) {
return;
}
let desc = conf.desc;
desc = desc.replace(/\\n/g, "\n");
let title = conf.name;
let prize = SKDataUtil.getItemByList(this.vecPrize, i);
let detail = goActiveDetailUI.getComponent('ActiveDetailUI');
if (detail) {
detail.loadInfo(title, desc, prize);
}
},
OnGo(e, d) {
if (d == 0) //幫派任務
{
if (GameModel.player.bangid != 0)
this.CloseAndClickNpc(10054);
else
MsgAlert.addMsg("請先加入幫派")
}
if (d == 1) //師門任務
{
if (GameModel.player.race == 1)
this.CloseAndClickNpc(30062);
if (GameModel.player.race == 2)
this.CloseAndClickNpc(10118);
if (GameModel.player.race == 3)
this.CloseAndClickNpc(30063);
if (GameModel.player.race == 4)
this.CloseAndClickNpc(30065);
if (GameModel.player.race == 5)
this.CloseAndClickNpc(70006);
}
if (d == 2) // 五環
{
this.CloseAndClickNpc(10080);
}
if (d == 3) //鍾馗抓鬼
{
this.CloseAndClickNpc(10112);
}
if (d == 4) //天庭降妖
{
this.CloseAndClickNpc(10221);
}
if (d == 5) //寶圖
{
this.CloseAndClickNpc(10013);
}
if (d == 6) //大雁塔
{
this.CloseAndClickNpc(10062);
}
if (d == 7) //尋芳
{
this.CloseAndClickNpc(10058);
}
if (d == 8) //地宮
{
this.CloseAndClickNpc(10051);
}
if (d == 9) //野外封妖
{
d;
}
if (d == 10) //三界妖王
{
d;
}
if (d == 12) {
this.CloseAndClickNpc(70004);
}
if (d == 13) {
this.CloseAndClickNpc(80015);
}
if (d == 14) {
this.CloseAndClickNpc(30138);
}
if (d == 15) {
this.CloseAndClickNpc(70003);
}
if (d == 16) {
this.CloseAndClickNpc(10240);
}
if (d == 19) {
this.CloseAndClickNpc(60005);
}
},
Close() {
AudioUtil.playCloseAudio();
this.node.destroy();
},
});

View File

@ -0,0 +1,34 @@
cc.Class({
extends: cc.Component,
properties: {
},
onLoad() {},
start() {},
onDestroy() {},
CreateAndPlayAnimation(curClip, callback) {
let comAnimation = this.node.getComponent(cc.Animation);
comAnimation.addClip(curClip);
comAnimation.play(curClip.name);
let self = this;
comAnimation.on('stop', function () {
if (callback){
callback();
}
if (self.node) {
self.node.destroy();
}
}, this);
},
});

View File

@ -0,0 +1,350 @@
import {
EAttrTypeL1
} from "../ts/core/EEnum";
let EquipTypeNumerical = [
EAttrTypeL1.ATK,
EAttrTypeL1.SPD,
EAttrTypeL1.DEFEND_ADD,
EAttrTypeL1.PHY_COMBO,
EAttrTypeL1.HP_MAX,
EAttrTypeL1.MP_MAX,
EAttrTypeL1.BONE,
EAttrTypeL1.SPIRIT,
EAttrTypeL1.STRENGTH,
EAttrTypeL1.DEXTERITY,
EAttrTypeL1.GOLD,
EAttrTypeL1.WOOD,
EAttrTypeL1.WATER,
EAttrTypeL1.FIRE,
EAttrTypeL1.SOIL,
];
exports.EquipTypeNumerical = EquipTypeNumerical;
// 戰鬥回合動作
let ActType = {
Skill: 1,
Item: 2,
Summon: 3,
RunAway: 4, // 逃跑
Protect: 5, // 保護
Catch: 6, //捕捉
SummonBack: 7, //召還
};
exports.ActType = ActType;
// 戰鬥回合內 響應
let BtlRespone = {
NoThing: 0, // 無響應
Defense: 1, // 防禦
Dodge: 2, // 閃避
CriticalHit: 3, // 暴擊
Catched: 4, // 被抓
NoCatch: 5, // 不能被抓
CatchFail: 6, // 捕捉失敗
Protect: 7,
BeProtected: 8, //被保護
SummonBack: 9,
Summon: 10,
SummonFaild: 11,
PoFang: 12,
};
exports.BtlRespone = BtlRespone;
class CArriveCallBack {
constructor(x, y, callback, data) {
this.x = x;
this.y = y;
this.callback = callback;
this.data = data;
}
}
exports.CArriveCallBack = CArriveCallBack;
let EChuZhanState = {
ERest: 0,
EFight: 1
};
module.exports.EChuZhanState = EChuZhanState;
let limitWordList = [
'系統',
'官方',
'測試',
'gm',
'Gm',
'GM',
'管理',
'Q群',
'QQ',
'微信',
'內測',
'內部',
'技術',
'公告',
'公測',
'垃圾',
'裙',
'毛澤東',
'周恩來',
'劉少奇',
'習近平',
'李克強',
'群',
'君羊',
'朱德',
'丁磊',
'操',
'日',
'幹',
'你媽',
];
exports.limitWordList = limitWordList;
let TitleType = {
IMGTitle: 0, //圖片類稱謂
CommonTitle: 1, //普通文字稱謂,如幫派類稱謂
BroTitle: 2, //結拜類稱謂
CoupleTitle: 3, //夫妻類稱謂
};
exports.TitleType = TitleType;
let RoleTitleInfoType = {
Admin: 1,
ShuiLuZhanShen: 86,
SanCaiTongZi: 43,
Couple: 200,
Brother: 201,
BangZhong: 221,
TangZhu: 222,
ZhangLao: 223,
YouHuFa: 224,
ZuoHuFa: 225,
FuBangZhu: 226,
BangZhu: 227,
};
exports.RoleTitleInfoType = RoleTitleInfoType;
let RoleTitleList = [{
id: 1,
name: '遊戲管理員',
desc: '負責管理遊戲內各種違規現象',
type: 0
},
{
id: 20,
name: '天人合一',
desc: '天與地合,人與天合',
type: 0
},
{
id: 29,
name: '馳騁江湖',
desc: '馳騁江湖,快意恩仇',
type: 0
},
{
id: 30,
name: '馬到成功',
desc: '馬都到了,事能不成嗎? ',
type: 0
},
{
id: 43,
name: '財大氣粗',
desc: '有錢,說話就是硬氣',
type: 0
},
{
id: 44,
name: '超群絕倫',
desc: '人群中你最亮眼',
type: 0
},
{
id: 46,
name: '豐功偉績',
desc: '前無古人,後無來者',
type: 0
},
{
id: 47,
name: '富甲天下',
desc: '天底下最有錢的人',
type: 0
},
{
id: 56,
name: '武林高手',
desc: '武林中已經有你這號人了',
type: 0
},
{
id: 57,
name: '武林奇才',
desc: '骨骼驚奇,練武奇才',
type: 0
},
{
id: 58,
name: '武林英傑',
desc: '天下武林,英雄豪傑',
type: 0
},
{
id: 59,
name: '武林至尊',
desc: '武林上下,唯吾獨尊',
type: 0
},
{
id: 60,
name: '武林宗師',
desc: '武林中,德高望重,人人敬仰',
type: 0
},
{
id: 65,
name: '三界豪傑',
desc: '三界之內,英雄豪傑',
type: 0
},
{
id: 78,
name: '三界首善',
desc: '三界之內的大善人',
type: 0
},
{
id: 86,
name: '水陸戰神',
desc: '水陸大會的不敗戰神',
type: 0
},
{
id: 96,
name: '天地英雄',
desc: '天地之間,汝為英雄',
type: 0
},
{
id: 200,
name: '夫妻',
desc: '夫妻搭配,幹活不累',
type: 3
},
{
id: 201,
name: '結拜',
desc: '打架,拼的就是人多',
type: 2
},
{
id: 221,
name: '幫眾',
desc: '的小蝦米,只能打醬油',
type: 1
},
{
id: 222,
name: '堂主',
desc: '的堂主,大小也算是個乾部了',
type: 1
},
{
id: 223,
name: '長老',
desc: '的長老,幫會中層,有望更上一層',
type: 1
},
{
id: 224,
name: '右護法',
desc: '的右護法,幫會高層,參與幫務管理',
type: 1
},
{
id: 225,
name: '左護法',
desc: '的左護法,幫會高層,參與幫務管理',
type: 1
},
{
id: 226,
name: '副幫主',
desc: '的副幫主,一人之上,萬人之下',
type: 1
},
{
id: 227,
name: '幫主',
desc: '的幫主,幫會上下,唯吾獨尊',
type: 1
},
];
exports.RoleTitleList = RoleTitleList;
let RelationType = {
Brother: 0, // 結拜
Couple: 1, // 結婚
};
exports.RelationType = RelationType;
let RelationTypeMembersCount = {
[RelationType.Brother]: 5,
[RelationType.Couple]: 2,
};
exports.RelationTypeMembersCount = RelationTypeMembersCount;
let relationActionType = {
Bro_Create: 0,
Bro_Leave: 1,
Bro_Destroy: 2,
};
exports.relationActionType = relationActionType;
//target:1 玩家2 NPC
let relationMsg = [{
action: 0,
msg1: '蒼天在上,我與',
msg2: '在此義結金蘭,今後有福同享有難同當[32]',
target: 1
},
{
action: 0,
msg1: '不求同年同月同日生,但求同年同月日死[32]',
msg2: '',
target: 1
},
{
action: 0,
msg1: '皇天在上,厚土在下,此心明鑑,永不負約[32]',
msg2: '',
target: 1
},
{
action: 0,
msg1: '[23]樹有雙生之宜,人有同心之交,恭喜',
msg2: '人能遇見有緣的對方[23]',
target: 2
},
{
action: 0,
msg1: '望',
msg2: '人能夠相伴終生,祝此情永存[23]',
target: 2
},
];
exports.relationMsg = relationMsg;
exports.schemeUseMoney = 10000000;
exports.schemeActiveMoney = 100000;
exports.resetXiulian = 200000;

View File

@ -0,0 +1,39 @@
let gameDefine = require('../common/define');
cc.Class({
extends: cc.Component,
properties: {
NameLabel: cc.Label,
HeadIcon: cc.Sprite,
PerLabel: cc.Label,
Race: cc.Sprite,
RaceFont: cc.Sprite,
RaceList: [cc.SpriteFrame],
RaceFontList: [cc.SpriteFrame],
},
ctor(){
this._accountid = 0;
this._race = 0;
},
start() {
},
setInfo(accountid, name, race, headicon){
this._accountid = accountid;
this._race = race;
this.NameLabel.string = name;
this.Race.spriteFrame = this.RaceList[this.race];
if (this.RaceFont && this.RaceFontList.length > 0){
this.RaceFont.spriteFrame = this.RaceFontList[this.race];
}
},
setLoadPercent(pre){
this.PerLabel.string = pre;
}
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,72 @@
class GameRes {
constructor() {
this.reslist = {};
this.mapResList = {};
this.roleResList = {};
this.petResList = {};
this.partnerResList = {};
this.roleHeadAtlas = null;
this.petHeadAtlas = null;
this.huobanHeadAtlas = null;
this.emojiAtlas = null;
this.itemIconAtlas = null;
this.skillIconAtlas = null;
this.buffIconAtlas = null;
this.m_mapEffectRes = {};
this.m_mapPrefab = {};
this.m_ChatEmojiAtlas = null;
}
setMapRes(mapid, sRes) {
this.mapResList[mapid] = sRes;
}
setRoleRes(resid, sRes) {
this.roleResList[resid] = sRes;
}
getRoleRes(resid) {
return this.roleResList[resid];
}
setPetAtlas(resid, atlas) {
this.petResList[resid] = atlas;
}
getPetRes(resid) {
return this.petResList[resid];
}
setPartnerAtlas(resid, atlas) {
this.partnerResList[resid] = atlas;
}
getPartnerRes(resid) {
return this.partnerResList[resid];
}
GetClipFromAtlas(strAtlas) {
let vecFrame = [];
for (let i = 1;; i++) {
let stFrame = this.m_mapEffectRes[strAtlas].getSpriteFrame(i);
if (null == stFrame)
break;
vecFrame.push(stFrame);
}
let curClip = cc.AnimationClip.createWithSpriteFrames(vecFrame, 15);
return curClip;
}
}
let gameres = null;
module.exports = (() => {
if (gameres == null) {
gameres = new GameRes();
}
return gameres;
})();

View File

@ -0,0 +1,46 @@
cc.Class({
extends: cc.Component,
properties: {
roleNode: cc.Node,
soldierIcons: [cc.Node],
addNode: cc.Node,
skill1Node: cc.Node,
skill2Node: cc.Node,
},
onLoad() {
this.soldierList = [];
},
loadSoldierInfo(p){
p = p == null ? -1 : p;
let self = this;
if (p != -1) {
const sid = this.soldierList[p].sid;
cc.loader.loadRes(`Dragonbones/soldiers/icons/${sid}`, cc.SpriteFrame, function (err, spriteframe) {
self.soldierIcons[p].getChildByName('icon').getComponent(cc.Sprite).spriteframe = spriteframe;
});
return;
}
for (let index = 0; index < this.soldierList.length; index++) {
const sid = this.soldierList[index].sid;
cc.loader.loadRes(`Dragonbones/soldiers/icons/${sid}`, cc.SpriteFrame, function (err, spriteframe) {
let icon = self.soldierIcons[index].getChildByName('icon');
let sp = icon.getComponent(cc.Sprite);
self.soldierIcons[index].getChildByName('icon').getComponent(cc.Sprite).spriteFrame = spriteframe;
});
}
if (this.soldierList.length < 5) {
this.addNode.active = true;
this.addNode.active.x = this.soldierIcons[this.soldierList.length].x;
}else{
this.addNode.active = false;
}
},
onChangeBtnClicked(e){
},
});

View File

@ -0,0 +1,33 @@
cc.Class({
extends: cc.Component,
properties: {
soldierIcon: cc.Sprite,
soldierName: cc.Label,
soldierInfo: cc.Label,
soldierAttack: cc.Label,
soldierDefense: cc.Label,
},
onLoad() {
},
loadSoldierInfo(data){
this.soldierName.string = data.name;
this.soldierInfo.string = data.info;
this.soldierAttack.string = data.attack;
this.soldierDefense.string = data.defense;
},
onChangeBtnClicked(e){
},
onPathBtnClicked(e, d){
},
onCloseBtnClicked(e){
this.node.destroy();
},
});

View File

@ -0,0 +1,27 @@
cc.Class({
extends: cc.Component,
properties: {
},
onLoad() {
this.soldierIcons = [];
for (let index = 0; ;index++) {
let soldierIcon = cc.find('soldier_icon${index}', this.node);
if (soldierIcon != null) {
this.soldierIcons.push(soldierIcon);
}
else{
return;
}
}
},
soldierClicked(e, d){
},
onCloseBtnClicked(e){
this.node.destroy();
},
});

View File

@ -0,0 +1,54 @@
cc.Class({
extends: cc.Component,
properties: {
typeLab: cc.Label,
nameLabel: cc.Label,
nameTitleLabel: cc.Label,
nameInfoLabel: cc.Label,
descTitleLabel: cc.Label,
descInfoLabel: cc.Label,
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.typearr = ['', '', '', '', '', '稱謂', '任務'];
},
loadInfo(info) {
this.iteminfo = info;
this.nameTitleLabel.node.active = true;
if(info.type == 5){ // 稱謂
this.nameLabel.string = info.name;
this.typeLab.string = '稱謂';
this.nameTitleLabel.node.active = false;
this.nameInfoLabel.string = info.name;
this.descTitleLabel.string = '【描述】';
this.descInfoLabel.string = info.desc;
}else if(info.type == 6){ // 任務
this.typeLab.string = '任務';
this.nameTitleLabel.string = '任務追踪';
this.descTitleLabel.string = '任務描述';
this.nameLabel.string = info.strTaskName;
let vecEventInfo = info.vecEvent[0];
let npcId = (vecEventInfo.vecNpc)[0];
let infoStr = vecEventInfo.strTip;
this.nameInfoLabel.string = npcId + "正在找我呢";
this.descInfoLabel.string = infoStr;
}
},
Close() {
this.node.destroy();
},
start () {
},
// update (dt) {},
});

View File

@ -0,0 +1,63 @@
import GameModel from "../ts/core/GameModel";
import ItemUtil from "../ts/core/ItemUtil";
class GoodsMgr {
constructor() {
// this.Init();
}
Init() {
cc.loader.loadRes(`Prefabs/WorkShopPanel`, cc.Prefab, (err, prefab) => {
this.WorkShopPanel = prefab;
});
}
getItem(itemid) {
let itemInfo = ItemUtil.getItemData(itemid);
if (!itemInfo){
return null;
}
let count = GameModel.player.itemList[itemid];
if (count == null) {
count = 0;
}
itemInfo.count = count;
return itemInfo;
}
subItem(itemid) {
let itemInfo = this.getItem(itemid);
if (itemInfo == null || itemInfo.count <= 0) {
return;
}
let params={
roleid: GameModel.player.roleid,
itemid: itemid,
count: itemInfo.count,
operation: 0
};
GameModel.send('c2s_update_bagitem',params);
}
addItem(itemid) {
let itemInfo = this.getItem(itemid);
if (itemInfo == null) {
return;
}
GameModel.send('c2s_update_bagitem', {
roleid: GameModel.player.roleid,
itemid: itemid,
count: 1,
operation: 1
});
}
}
let goodsmgr = null;
module.exports = (() => {
if (goodsmgr == null) {
goodsmgr = new GoodsMgr();
}
return goodsmgr;
})();

View File

@ -0,0 +1,20 @@
cc.Class({
extends: cc.Component,
properties: {
lockerPre: cc.Prefab,
},
onLoad() {
},
onLockerClicked(e, d){
let canvas = cc.find('Canvas');
if (!canvas.getChildByName('LockerPanel')){
let locker = cc.instantiate(this.lockerPre);
locker.parent = canvas;
locker.name = 'LockerPanel';
}
}
});

View File

@ -0,0 +1,123 @@
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import GameModel from "../ts/core/GameModel";
import Report from "../ts/gear_2.3.4/net/Report";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
import SkillUtil from "../ts/game/skill/core/SkillUtil";
import AudioUtil from "../ts/core/AudioUtil";
import PetUtil from "../ts/game/pet/PetUtil";
import {EAttrTypeL1} from "../ts/core/EEnum";
import GameUtil from "../ts/core/GameUtil";
import ItemUtil from "../ts/core/ItemUtil";
import MsgAlert from "../ts/game/msg/MsgAlert";
import SKLogger from "../ts/gear_2.3.4/util/SKLogger";
import ChangeNameAlert from "../ts/game/role/ChangeNameAlert";
let logic = require('../game/PetLogic');
cc.Class({
extends: cc.Component,
properties: {
petNode: cc.Node,
nameLabel: cc.Label,
scoreLabel: cc.Label,
levelLabel: cc.Label,
rateLabel: cc.Label,
longguLabel: cc.Label,
tiliLabel: cc.Label,
skillItem: cc.Node,
skillContent: cc.Node,
propertyItem: cc.Node,
propertyContent: cc.Node,
},
onLoad() {
this.petLogic = new logic.PetLogic();
},
loadInfo(info) {
this.petLogic.setInfo(info);
cc.log(this.petLogic);
this.showInfo();
},
showInfo() {
let info = {
rate: this.petLogic.rate,
cur_hp: this.petLogic.hp,
cur_mp: this.petLogic.mp,
cur_atk: this.petLogic.atk,
cur_spd: this.petLogic.spd,
max_rate: this.petLogic.maxRate
};
for (let key in GameModel.conf_pet) {
if (SKDataUtil.hasProperty(GameModel.conf_pet, key)) {
let item = GameModel.conf_pet[key];
if (item.id== this.petLogic.dataid) {
//info.max_rate = SKDataUtil.jsonBy(item.rate)[1];
info.max_hp = SKDataUtil.jsonBy(item.hp)[1];
info.max_mp = SKDataUtil.jsonBy(item.mp)[1];
info.max_atk = SKDataUtil.jsonBy(item.atk)[1];
info.max_spd = SKDataUtil.jsonBy(item.spd)[1];
}
}
}
let hp_progress = this.hpNode.getChildByName('ImageLoadingBg');
let hp_label = hp_progress.getChildByName('progressLabel').getComponent(cc.Label);
let hpProgress = (info.cur_hp == 0) ? 0 : (info.cur_hp / info.max_hp);
hp_progress.getComponent(cc.ProgressBar).progress = hpProgress > 1 ? 1 : hpProgress;
hp_label.string = info.cur_hp + '/' + info.max_hp;
let mp_progress = this.mpNode.getChildByName('ImageLoadingBg');
let mp_label = mp_progress.getChildByName('progressLabel').getComponent(cc.Label);
let mpProgress = (info.cur_mp == 0) ? 0 : (info.cur_mp / info.max_mp);
mp_progress.getComponent(cc.ProgressBar).progress = mpProgress > 1 ? 1 : mpProgress;
mp_label.string = info.cur_mp + '/' + info.max_mp;
let att_progress = this.attNode.getChildByName('ImageLoadingBg');
let att_label = att_progress.getChildByName('progressLabel').getComponent(cc.Label);
let atkProgress = (info.cur_atk == 0) ? 0 : (info.cur_atk / info.max_atk);
att_progress.getComponent(cc.ProgressBar).progress = atkProgress > 1 ? 1 : atkProgress;
att_label.string = info.cur_atk + '/' + info.max_atk;
let spe_progress = this.speedNode.getChildByName('ImageLoadingBg');
let spe_label = spe_progress.getChildByName('progressLabel').getComponent(cc.Label);
let spdProgress = (info.cur_spd == 0) ? 0 : (info.cur_spd / info.max_spd);
spe_progress.getComponent(cc.ProgressBar).progress = spdProgress > 1 ? 1 : spdProgress;
spe_label.string = info.cur_spd + '/' + info.max_spd;
//let currate = info.rate + this.petLogic.longgu * 0.01;
this.rateLabel.string = info.rate.toFixed(3) + '/' + info.max_rate.toFixed(3);
let petcolor = null;
if (this.petLogic && this.petLogic.petinfo) {
petcolor = this.petLogic.petinfo.color;
} else {
cc.warn(`$警告:召喚獸變色信息異常!`);
}
this.petNode.getComponent('UIRole').setInfo({
resid: this.petLogic.resid,
name: '',
petcolor: petcolor
});
this.longguLabel.string = `龍骨x${this.petLogic.getMaxLongGu()}`;
},
Close() {
this.node.destroy();
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
},
// update (dt) {},
});

View File

@ -0,0 +1,149 @@

var EItemType =
{
Material: 0,
Equip: 1,
Pet: 2,
Medicine: 4,
BestBook: 5,
BetterBook: 6,
CommonBook: 7,
FiveElemeBook: 8,
Treasure: 9,
QualityCard:10,
ChangeBody: 11,
FeastDay: 12,
TianCeFu: 13
};
class CItemType
{
constructor( nItemKind,nParam, strTypeName,strIcon )
{
this.nItemKind = nItemKind;
this.nParam = nParam; //當 nItemType 為裝備時nParam 為裝備類型。當 nItemType 為 藥品材料寵物書時nParam 為 ItemID
this.strTypeName = strTypeName;
this.strIcon = strIcon;
}
}
/********************************************************************* */
let g_ctCItemMgr = null;
class CItemMgr
{
constructor()
{
this.mapItemKind = {};
this.mapEquipType = {};
this.mapPet = {};
this.mapMaterial = {};
this.LoadDataFromJson();
}
LoadDataFromJson()
{
//一級分類:物品分類
this.mapItemKind[EItemType.Equip] = '珍品裝備';
this.mapItemKind[EItemType.Pet] = '珍品寵物';
this.mapItemKind[EItemType.Material] = '強化材料';
this.mapItemKind[EItemType.Medicine] = '藥品道具';
this.mapItemKind[EItemType.BestBook] = '終極技能書';
this.mapItemKind[EItemType.BetterBook] = '高級技能書';
this.mapItemKind[EItemType.CommonBook] = '普通技能書';
this.mapItemKind[EItemType.FiveElemeBook] = '五行天書';
this.mapItemKind[EItemType.Treasure] = '奇珍異寶';
this.mapItemKind[EItemType.QualityCard] = '屬性卡';
this.mapItemKind[EItemType.ChangeBody] = '變身卡';
this.mapItemKind[EItemType.FeastDay] = '節日珍品';
this.mapItemKind[EItemType.TianCeFu] = '天策符';
//裝備分類
this.mapEquipType[0] = new CItemType(EItemType.Equip, 0, '全部', '');
this.mapEquipType[1] = new CItemType(EItemType.Equip,1, '祭劍魂', '');
this.mapEquipType[2] = new CItemType(EItemType.Equip, 2, '男衣', '');
this.mapEquipType[3] = new CItemType(EItemType.Equip, 3, '男帽', '');
this.mapEquipType[4] = new CItemType(EItemType.Equip, 4, '項鍊', '');
this.mapEquipType[5] = new CItemType(EItemType.Equip, 5, '鞋子', '');
this.mapEquipType[6] = new CItemType(EItemType.Equip, 6, '男性挂件', '');
this.mapEquipType[7] = new CItemType(EItemType.Equip,7, '男性腰帶', '');
this.mapEquipType[8] = new CItemType(EItemType.Equip, 8,'戒指', '');
this.mapEquipType[9] = new CItemType(EItemType.Equip, 9,'披風', '');
this.mapEquipType[10] = new CItemType(EItemType.Equip, 10,'逍遙生-扇', '');
this.mapEquipType[11] = new CItemType(EItemType.Equip, 11,'俏千金-刀', '');
this.mapEquipType[12] = new CItemType(EItemType.Equip, 12,'神天兵-槍', '');
this.mapEquipType[13] = new CItemType(EItemType.Equip, 13,'玄劍娥-劍', '');
this.mapEquipType[14] = new CItemType(EItemType.Equip, 14,'虎頭怪-棍', '');
this.mapEquipType[15] = new CItemType(EItemType.Equip, 15,'狐美人-鞭', '');
this.mapEquipType[16] = new CItemType(EItemType.Equip, 16,'夜溪靈-燈', '');
this.mapEquipType[17] = new CItemType(EItemType.Equip, 17,'飛劍俠-劍', '');
this.mapEquipType[18] = new CItemType(EItemType.Equip, 18,'燕山雪-劍', '');
this.mapEquipType[19] = new CItemType(EItemType.Equip, 19,'武神尊-槍', '');
this.mapEquipType[20] = new CItemType(EItemType.Equip, 20,'媚靈狐-刀', '');
this.mapEquipType[21] = new CItemType(EItemType.Equip, 21,'無崖子-書', '');
this.mapEquipType[22] = new CItemType(EItemType.Equip, 22,'燕山雪-劍', '');
this.mapEquipType[23] = new CItemType(EItemType.Equip, 23,'武神尊-槍', '');
this.mapEquipType[24] = new CItemType(EItemType.Equip, 24,'媚靈狐-刀', '');
this.mapEquipType[25] = new CItemType(EItemType.Equip, 25,'無崖子-書', '');
this.mapEquipType[26] = new CItemType(EItemType.Equip, 26,'幽夢影-帶', '');
this.mapEquipType[27] = new CItemType(EItemType.Equip, 27,'神秀生-筆', '');
this.mapEquipType[28] = new CItemType(EItemType.Equip, 28,'紅拂女-劍', '');
this.mapEquipType[29] = new CItemType(EItemType.Equip, 29,'龍戰將-棍', '');
this.mapEquipType[30] = new CItemType(EItemType.Equip, 30,'雲中君-環', '');
this.mapEquipType[31] = new CItemType(EItemType.Equip, 31,'混天魔-刀', '');
this.mapEquipType[32] = new CItemType(EItemType.Equip, 32,'九尾狐-爪', '');
this.mapEquipType[33] = new CItemType(EItemType.Equip, 33,'南冠客-刀', '');
this.mapEquipType[34] = new CItemType(EItemType.Equip, 34,'鏡花影-劍', '');
this.mapEquipType[35] = new CItemType(EItemType.Equip, 35,'女衣', '');
this.mapEquipType[36] = new CItemType(EItemType.Equip, 36,'女帽', '');
this.mapEquipType[37] = new CItemType(EItemType.Equip, 37,'女性挂件', '');
this.mapEquipType[38] = new CItemType(EItemType.Equip, 38,'女性腰帶', '');
}
GetItem( nConfigID )
{
for (let it in this.mapSkill)
{
if ( it == nID)
return this.mapSkill[it];
}
return null;
}
}
module.exports = { g_ctCItemMgr: new CItemMgr(), EItemType, CItemType };

View File

@ -0,0 +1,358 @@
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import GameModel from "../ts/core/GameModel";
import MsgAlert from "../ts/game/msg/MsgAlert";
import AudioUtil from "../ts/core/AudioUtil";
cc.Class({
extends: cc.Component,
properties: {
mainLayer: cc.Node,
aboveLayer: cc.Node,
aboveMapNode: cc.Node,
aboveCloseNode: cc.Node,
mapBtnNode: [cc.Node],
moveNode: cc.Node,
endNode: cc.Node,
roleNode: cc.Node,
},
onLoad() {
this.aboveMapNode.on(cc.Node.EventType.TOUCH_START, this.touchBegan.bind(this));
this.aboveMapNode.on(cc.Node.EventType.TOUCH_MOVE, this.touchMoved.bind(this));
this.aboveMapNode.on(cc.Node.EventType.TOUCH_END, this.touchEnded.bind(this));
this.aboveMapNode.on(cc.Node.EventType.TOUCH_CANCEL, this.touchCanceled.bind(this));
// this.aboveMapNode.on(cc.Node.EventType.TOUCH_START, this.aboveTouchBegan.bind(this));
this.moveNodes = [];
this.gameLogic = this.node.parent.getComponent('GameLogic');
this.roleNode.zIndex = 2;
},
init() {
this.mainLayer.active = true;
this.aboveLayer.active = false;
},
start() {
cc.log('mainmap start');
},
onDisable() {
if (this.mapId) {
// cc.loader.releaseRes(`Map/map/${this.mapId}`);
cc.loader.releaseRes(`Map/map/${this.mapId}`, cc.Texture2D);
cc.loader.releaseRes(`Map/map/${this.mapId}`, cc.SpriteFrame);
}
},
onMapBtnClicked(e, d) {
this.showAboveNode(d);
},
showAboveNode(mapid) {
this.aboveMapNode.destroyAllChildren();
this.mapId = mapid;
let pPos = this.getPlayerPos();
this.roleNode.setPosition(pPos);
this.roleNode.active = false;
this.unschedule(this.checkPlayerMove);
for (let j = 0; j < this.moveNodes.length; j++) {
this.moveNodes[j].active = false;
}
this.endNode.active = false;
if (this.mapId == GameModel.player.mapid) {
this.roleNode.active = true;
this.unschedule(this.checkPlayerMove);
for (let j = 0; j < this.moveNodes.length; j++) {
this.moveNodes[j].active = true;
}
if (this.moveNodes.length > 0) {
this.endNode.active = true;
}
this.schedule(this.checkPlayerMove, 0.02, cc.macro.REPEAT_FOREVER);
}
let self = this;
let mapres = GameModel.conf_map[this.mapId].mapid;
cc.loader.loadRes(`Map/map/${mapres}`, cc.SpriteFrame, function (err, frame) {
if (!err) {
frame.ensureLoadTexture();
self.aboveMapNode.getComponent(cc.Sprite).spriteFrame = frame;
self.aboveLayer.active = true;
self.scheduleOnce(() => {
self.aboveCloseNode.x = self.aboveMapNode.width / 2;
// self.aboveLayer.getChildByName('mapbg').width = self.aboveMapNode.width + 110;,,
// self.aboveLayer.getChildByName('titleline').width = self.aboveMapNode.width + 120;
self.aboveLayer.getChildByName('mapbg').width = frame.getTexture().width + 110;
self.aboveLayer.getChildByName('titleline').width = frame.getTexture().width + 120;
self.aboveLayer.getChildByName('pos').getComponent(cc.Label).string = GameModel.conf_map[mapid].map_name;
self.addMapNode();
}, 0);
}
else {
self.node.active = false;
}
});
},
addMapNode() {
for (const key in GameModel.conf_npc) {
if (key == 'datatype') {
continue;
}
let npc = GameModel.conf_npc[key];
let vecTmp = npc.auto_create.split(';');
if (vecTmp.length < 3 || vecTmp[0] != this.mapId) {
continue;
}
let npcNode = cc.instantiate(this.aboveLayer.getChildByName('npc'));
npcNode.active = true;
npcNode.parent = this.aboveMapNode;
npcNode.getComponent(cc.Label).string = npc.name;
npcNode.setPosition(this.getMapPosByGrid({ l: vecTmp[1], r: vecTmp[2] }));
}
for (const key in GameModel.conf_transfer) {
if (key == 'datatype') {
continue;
}
let trans = GameModel.conf_transfer[key];
if (trans.mapid != this.mapId) {
continue;
}
let transferNode = cc.instantiate(this.aboveLayer.getChildByName('transfer'));
transferNode.active = true;
transferNode.parent = this.aboveMapNode;
transferNode.getComponent(cc.Label).string = '至' + GameModel.conf_map[trans.tomap].map_name;
transferNode.setPosition(this.getMapPosByGrid({ l: trans.mapx, r: trans.mapy }));
}
},
onCloseBtnClicked(e, d) {
AudioUtil.playCloseAudio();
this.node.active = false;
},
onSearchBtnClicked(e, d) {
},
onBackBtnClicked(e, d) {
this.mainLayer.active = false;
if (GameModel.conf_map[GameModel.player.mapid].bmap == 0) {
this.node.active = false;
return;
}
this.showAboveNode(GameModel.player.mapid);
},
onHomeBtnClicked(e, d) {
if (GameModel.player.mapid == 1201) {
MsgAlert.addMsg("本場景禁止傳送,請與天牢守衛對話離開。");
return;
} else if (GameModel.player.mapid == 4004) {
MsgAlert.addMsg(`本場景禁止傳送,請與逐鹿對話離開。`);
return;
} else if (GameModel.player.mapid == 3001) {
MsgAlert.addMsg(`本場景禁止傳送,請與幫戰傳送人對話離開。`);
return;
} else if (GameModel.player.mapid == 1213) {
MsgAlert.addMsg(`本場景禁止傳送,請與魏徵對話離開。`);
return;
}
this.gameLogic.mapLogic.changeMap(4001);
this.node.active = false;
},
onAboveCloseBtnClicked(e, d) {
AudioUtil.playCloseAudio();
this.aboveLayer.active = false;
if (this.mainLayer.active == false) {
this.node.active = false;
}
},
getPlayerPos() {
let pPos = this.gameLogic.mapLogic.roleNode.getPosition();
return this.getMapPos(pPos);
},
checkPlayerMove() {
if (this.moveNodes.length == 0 && this.endNode.active == false) {
this.unschedule(this.checkPlayerMove);
this.gameLogic.autoNode.active = false;
}
let realpos = this.gameLogic.mapLogic.myRole.netInfo;
this.aboveLayer.getChildByName('pos').getComponent(cc.Label).string = GameModel.conf_map[this.mapId].map_name + `(${realpos.x},${realpos.y})`;
let pPos = this.getPlayerPos();
this.roleNode.setPosition(pPos);
let curIndex = -1;
for (let i = 0; i < this.moveNodes.length; i++) {
const n = this.moveNodes[i];
if (SKUIUtil.distanceByVec2(pPos, n.getPosition()) < 20) {
curIndex = i;
}
}
if (SKUIUtil.distanceByVec2(pPos, this.endNode.getPosition()) < 20) {
this.endNode.active = false;
curIndex = this.moveNodes.length - 1;
}
if (curIndex != -1) {
for (let j = 0; j <= curIndex; j++) {
this.moveNodes[j].destroy();
}
this.moveNodes.splice(0, curIndex + 1);
}
},
removePathNodes() {
this.unschedule(this.checkPlayerMove);
for (let j = 0; j < this.moveNodes.length; j++) {
this.moveNodes[j].destroy();
}
this.moveNodes = [];
this.endNode.active = false;
},
showMovePoints(result) {
for (const n of this.moveNodes) {
n.destroy();
}
this.moveNodes = [];
// cc.v2g()
this.endNode.active = true;
let showPoints = [];
let MAP_RES_WIDTH = GameModel.conf_map[this.mapId].width;
let dotdistance = MAP_RES_WIDTH / this.aboveMapNode.width * 1.5;
let prepoint = result[0];
for (let index = 0; index < result.length - 5; index++) {
if (SKUIUtil.distanceByVec2(cc.v2(prepoint.l, prepoint.r), cc.v2(result[index].l, result[index].r)) > dotdistance) {
prepoint = result[index];
showPoints.push(result[index]);
}
}
// for (let index = dotdistance; index < result.length - dotdistance; index += dotdistance) {
// showPoints.push(result[index]);
// }
for (let index = 0; index < showPoints.length; index++) {
let move = cc.instantiate(this.moveNode);
move.active = true;
move.setPosition(this.getMapPosByGrid(showPoints[index]));
move.parent = this.aboveLayer;
this.moveNodes.push(move);
}
this.endNode.setPosition(this.getMapPosByGrid(result[result.length - 1]));
this.roleNode.active = true;
this.schedule(this.checkPlayerMove, 0, cc.macro.REPEAT_FOREVER);
},
getMapPosByGrid(info) {
let mapres = GameModel.conf_map[this.mapId].mapid;
let mapData = GameModel.conf_map_list[mapres];
let gridwidth = mapData.baseInfo.grid_width;
let gridheight = mapData.baseInfo.grid_height;
let realPos = cc.v2(gridwidth * (0.5 + Number(info.l)), gridheight * (0.5 + Number(info.r)));
return this.getMapPos(realPos);
},
getMapPos(realPos) {
let MAP_RES_WIDTH = GameModel.conf_map[this.mapId].width;
let MAP_RES_HEIGHT = GameModel.conf_map[this.mapId].height;
let mapPosX = realPos.x * (this.aboveMapNode.width / MAP_RES_WIDTH) - this.aboveMapNode.width / 2;
let mapPosY = realPos.y * (this.aboveMapNode.height / MAP_RES_HEIGHT) - this.aboveMapNode.height / 2;
return cc.v2(mapPosX, mapPosY);
},
mapNodeClicked(e, d) {
this.touchPos(SKUIUtil.add(e.target.getPosition(), cc.v2(this.aboveMapNode.width / 2, this.aboveMapNode.height / 2)));
this.gameLogic.autoNode.active = true;
},
touchPos(mapPos) {
if (GameModel.player.teamid > 0 && (!GameModel.player.isleader && !GameModel.player.tempLeave)) {
return;
}
if (this.mapId != GameModel.player.mapid) {
if (GameModel.player.mapid == 1201) {
if (GameModel.player.shane > 0) {
MsgAlert.addMsg("天牢不是你想來就來想走就能走的。");
} else {
MsgAlert.addMsg("本場景禁止傳送,請與天牢守衛對話離開。");
}
return;
} else if (GameModel.player.mapid == 4004) {
MsgAlert.addMsg(`本場景禁止傳送,請與逐鹿對話離開。`);
return;
}
else if (GameModel.player.mapid == 3001) {
MsgAlert.addMsg(`本場景禁止傳送,請與幫戰傳送人對話離開。`);
return;
} else if (GameModel.player.mapid == 1213) {
MsgAlert.addMsg(`本場景禁止傳送,請與魏徵對話離開。`);
return;
}
this.gameLogic.mapLogic.changeMap(this.mapId);
}
let realPosX = mapPos.x / this.aboveMapNode.width * this.gameLogic.mapLogic.MAP_RES_WIDTH;
let realPosY = mapPos.y / this.aboveMapNode.height * this.gameLogic.mapLogic.MAP_RES_HEIGHT;
let result = this.gameLogic.mapLogic.touchPos(cc.v2(realPosX, realPosY));
if (result.length > 0) {
this.showMovePoints(result);
this.mainLayer.active = false;
}
},
touchBegan(event) {
if (this.node.active == false) {
return;
}
if (this.aboveLayer.active == true) {
let touchLoc = event.getLocation();
if (!this.aboveLayer.active || !this.aboveMapNode.getBoundingBoxToWorld().contains(touchLoc)) {
return;
}
let mapPos = this.aboveMapNode.convertToNodeSpace(touchLoc);
this.touchPos(mapPos);
return;
}
// for (const btn of this.mapBtnNode) {
// btn.getComponent('CustomButton').touchBegan(event);
// }
},
touchMoved(event) {
if (this.node.active == false || this.aboveLayer.active == true) {
return;
}
// for (const btn of this.mapBtnNode) {
// btn.getComponent('CustomButton').touchMoved(event);
// }
},
touchEnded(event) {
if (this.node.active == false || this.aboveLayer.active == true) {
return;
}
// for (const btn of this.mapBtnNode) {
// btn.getComponent('CustomButton').touchEnded(event);
// }
},
touchCanceled(evene) {
if (this.node.active == false || this.aboveLayer.active == true) {
return;
}
// for (const btn of this.mapBtnNode) {
// btn.getComponent('CustomButton').touchCanceled(event);
// }
}
});

View File

@ -0,0 +1,196 @@
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil"
let GameRes = require('./GameRes');
let pTaskConfigMgr = require('./task_config').g_pTaskConfigMgr;
let ETaskKind = require('./task_config').ETaskKind;
class CMainPlayerInfo {
constructor() {
this.vecBagItem = [];
this.vecMyGoods = [];
this.vecTaskState = [];
this.mapDailyCnt = {};
this.vecPartnerInfo = [];
this.vecChuZhan = [0, 0, 0, 0];
}
IsHasPartner(nID) {
for (var it in this.vecPartnerInfo) {
if (this.vecPartnerInfo[it].id == nID)
return it;
}
return -1;
}
GetPartner(nID) {
for (var it in this.vecPartnerInfo) {
if (this.vecPartnerInfo[it].id == nID)
return this.vecPartnerInfo[it];
}
return null;
}
GetParterChuZhanPos(nPartnerID) {
for (var it in this.vecChuZhan) {
if (this.vecChuZhan[it] == nPartnerID)
return it;
}
return -1;
}
GetFreeChuZhanPos() {
for (var it in this.vecChuZhan) {
if (this.vecChuZhan[it] == 0)
return it;
}
return -1;
}
ChangeChuZhan(nPos, nPartnerID) {
this.vecChuZhan[nPos] = nPartnerID;
this.ReplaceChuZhanPos();
}
ReplaceChuZhanPos() {
let vecTmp = this.vecChuZhan.slice(0);
this.vecChuZhan = [0, 0, 0, 0];
let nPos = -1;
for (var it in vecTmp) {
if (vecTmp[it] == 0)
continue;
nPos++;
this.vecChuZhan[nPos] = vecTmp[it];
}
}
FindDailyTask(nGrop) {
for (let itTask in this.vecTaskState) {
let pTaskInfo = pTaskConfigMgr.GetTaskInfo(this.vecTaskState[itTask].nTaskID);
if (null == pTaskInfo)
continue;
if (pTaskInfo.nKind != ETaskKind.EDaily)
continue;
if (pTaskInfo.nTaskGrop == nGrop)
return pTaskInfo.nTaskID;
}
return 0;
}
IsHasCurTask(nTaskID) {
for (let itTask in this.vecTaskState) {
if (this.vecTaskState[itTask].nTaskID == nTaskID)
return this.vecTaskState[itTask];
}
return null;
}
GetTaskCurStep(nTaskID) {
let pTaskState = this.IsHasCurTask(nTaskID);
if (pTaskState == null)
return -1;
for (let nStep in pTaskState.vecStepState) {
if (pTaskState.vecStepState[nStep].nState == 1)
return nStep;
}
return -1;
}
GetTaskStepState(nTaskID, nStep) {
for (let itTask in this.vecTaskState) {
let stTaskState = this.vecTaskState[itTask];
if (stTaskState.nTaskID != nTaskID)
continue;
return stTaskState.vecStepState[nStep];
}
return null;
}
IsAlreadyHasThisGropTask(nGroup) {
for (let itTask in this.vecTaskState) {
let stTaskState = this.vecTaskState[itTask];
let pTaskInfo = pTaskConfigMgr.GetTaskInfo(stTaskState.nTaskID);
if (pTaskInfo.nTaskGrop == nGroup)
return true;
}
return false;
}
GetDailyCnt(nTaskGrop) {
if (this.mapDailyCnt.hasOwnProperty(nTaskGrop))
return this.mapDailyCnt[nTaskGrop];
return 0;
}
GetBagItemCnt(nItemID) {
for (var it in this.vecBagItem) {
if (this.vecBagItem[it].itemid == nItemID)
return this.vecBagItem[it].count;
}
return 0;
}
GetBagItem(nItemID) {
for (var it in this.vecBagItem) {
if (this.vecBagItem[it].itemid == nItemID)
return this.vecBagItem[it];
}
return null;
}
OnReceiveRoleTask(stData) {
let vecData = stData.vecTask;
this.vecTaskState = [];
for (let it in vecData) {
let stData = vecData[it];
let stTaskState = {};
stTaskState.nTaskID = stData.nTaskID;
stTaskState.vecStepState = [];
if(!stData.vecStep){
continue;
}
for (let itStep in stData.vecStep) {
let json=stData.vecStep[itStep];
let stInfo=SKDataUtil.jsonBy(json);
stTaskState.vecStepState.push(stInfo);
}
this.vecTaskState.push(stTaskState);
}
this.mapDailyCnt = SKDataUtil.jsonBy(stData.strJsonDaily);
}
}
let g_ctMainPlayerInfo = null;
module.exports = (() => {
if (g_ctMainPlayerInfo == null) {
g_ctMainPlayerInfo = new CMainPlayerInfo();
}
return g_ctMainPlayerInfo;
})();

1061
assets/Script/game/MainUI.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
import GameModel from "../ts/core/GameModel";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let GameRes = require('./GameRes');
cc.Class({
extends: cc.Component,
properties: {
MainTeamPanel: cc.Prefab,
leave_auto: cc.SpriteFrame,
leave: cc.SpriteFrame,
leaveIcon: cc.Sprite,
border: cc.Sprite
},
setInfo(info) {
this.objInfo = info;
if (info.livingtype == 1) {
cc.find('headicon', this.node).getComponent(cc.Sprite).spriteFrame = GameModel.getRoleHead(info.resid);
var headNode = cc.find("headBorder", this.node);
var headBorderId = info.portrait ? info.portrait : 555100;
SKUIUtil.setHeadBorder(headNode, headBorderId);
// cc.find('levelback', this.node).active = false;
cc.find('Level', this.node).getComponent(cc.Label).string = info.level;
cc.find('huoban', this.node).active = false;
if (info.pause == 1) {
if (info.ischeck == 1)
this.leaveIcon.spriteFrame = this.leave_auto
else
this.leaveIcon.spriteFrame = this.leave
} else
this.leaveIcon.spriteFrame = null
}
else {
cc.find('headicon', this.node).getComponent(cc.Sprite).spriteFrame = GameModel.getHouBanHead(info.resid);
cc.find('Level', this.node).getComponent(cc.Label).string = info.level;
var headNode = cc.find("headBorder", this.node);
SKUIUtil.setHeadBorder(headNode, 0)
// cc.find('levelback', this.node).active = false;
cc.find('huoban', this.node).active = true;
this.leaveIcon.spriteFrame = null
}
},
openMemberPanel() {
if (GameModel.player.mapid == 4004) return;
if (GameModel.player.mapid == 1213) return;
if (this.objInfo.livingtype == 1) {
let memberPanel = cc.instantiate(this.MainTeamPanel);
memberPanel.parent = cc.find('Canvas');
memberPanel.getComponent('MainUITeamPanel').setInfo(this.objInfo);
}
}
});

View File

@ -0,0 +1,66 @@
import GameModel from "../ts/core/GameModel";
let GameRes = require('./GameRes');
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties: {
itemList: [cc.Node],
openBtn: cc.Node,
},
onLoad() {
this.memberCnt = 0;
this.isOpen = true;
},
setTeamListInfo() {
if (GameModel.player.teamInfo.teamid == 0||GameModel.player.teamInfo.teamid==null) {
this.node.active = false;
return;
}
this.memberCnt = 0;
this.node.active = true;
for (const obj of GameModel.player.teamInfo.objlist) {
if(!this.itemList[this.memberCnt])continue
this.itemList[this.memberCnt].getComponent('MainUITeamItem').setInfo(obj);
if (this.isOpen) {
this.itemList[this.memberCnt].x = -this.memberCnt * 67;
this.itemList[this.memberCnt].opacity = 255;
}
this.memberCnt++;
}
if (this.isOpen) {
this.openBtn.x = -(this.memberCnt - 1) * 67 - 40;
}
for (let index = this.memberCnt; index < this.itemList.length; index++) {
this.itemList[index].x = 0;
this.itemList[index].opacity = 0;
}
},
openTeamList(e, d) {
if (this.isOpen) {
this.openBtn.angle = 180;
this.isOpen = false;
for (let index = 1; index < this.itemList.length; index++) {
this.itemList[index].stopAllActions();
this.itemList[index].runAction(cc.spawn(cc.moveTo(0.2, cc.v2(0, 0)), cc.fadeOut(0.2)));
}
this.openBtn.stopAllActions();
this.openBtn.runAction(cc.moveTo(0.2, cc.v2(-40, 0)));
}
else {
this.openBtn.angle = 0;
this.isOpen = true;
for (let index = 1; index < this.memberCnt; index++) {
this.itemList[index].stopAllActions();
this.itemList[index].runAction(cc.spawn(cc.moveTo(0.2, cc.v2(-index * 67, 0)), cc.fadeIn(0.2)));
}
this.openBtn.stopAllActions();
this.openBtn.runAction(cc.moveTo(0.2, cc.v2(-(this.memberCnt - 1) * 67 - 40, 0)));
}
}
});

View File

@ -0,0 +1,112 @@
import GameModel from "../ts/core/GameModel";
import GameUtil from "../ts/core/GameUtil";
import MsgAlert from "../ts/game/msg/MsgAlert";
cc.Class({
extends: cc.Component,
properties: {
nameLab: cc.Label,
headIcon: cc.Sprite,
idLabel: cc.Label,
leaveBtn: cc.Node,
kickBtn: cc.Node,
transferBtn: cc.Node,
beLeader: cc.Node,
tempLeave: cc.Node
},
onLoad() {
},
setInfo(info) {
this.objInfo = info;
this.leaveBtn.active = false;
this.kickBtn.active = false;
this.transferBtn.active = false;
this.beLeader.active = false;
if (GameModel.player.onlyid == info.onlyid) {
this.leaveBtn.active = true;
if (!GameModel.player.isleader) {
this.tempLeave.active = true;
this.tempLeave.y = this.transferBtn.y;
if (this.objInfo.pause == 1) {
this.tempLeave.getChildByName("tip").getComponent(cc.Label).string = "回歸隊伍"
} else {
this.tempLeave.getChildByName("tip").getComponent(cc.Label).string = "暫離隊伍"
}
}
} else if (GameModel.player.teamid > 0 && GameModel.player.isleader) {
this.kickBtn.active = true;
this.transferBtn.active = true;
if (this.objInfo.pause == 1) {
this.tempLeave.active = true;
this.tempLeave.getChildByName("tip").getComponent(cc.Label).string = "召回隊伍"
}
} else if (this.objInfo.isleader) {
this.beLeader.active = true;
}
// else{
// this.node.destroy();
// return;
// }
this.headIcon.spriteFrame = GameModel.getRoleHead(info.resid);
this.nameLab.node.color = GameUtil.getReliveColor(info.relive);
this.nameLab.string = info.name;
this.idLabel.string = `編號:${info.roleid}`;
},
leaveTeam(e, d) {
GameModel.send('c2s_leave_team', {
roleid: this.objInfo.roleid,
teamid: this.objInfo.teamid
});
this.closeSelf();
},
transferTeamLeaderRequst(e, d) {
GameModel.send('c2s_transfer_team_requst', {
toid: this.objInfo.roleid,
type: 1
});
this.closeSelf();
},
beLeaderRequst() {
GameModel.send('c2s_transfer_team_requst', {
toid: this.objInfo.roleid,
type: 0
});
this.closeSelf();
},
closeSelf(e, d) {
this.node.destroy();
},
tempLeaveFunc() {
if (this.objInfo.pause == 0) {
if (GameModel.player.isleader) {
MsgAlert.addMsg("隊長不可暫離隊伍");
return;
}
GameModel.send('c2s_pause_team', {
roleid: this.objInfo.roleid
});
GameModel.player.tempLeave = true
}
else {
if (this.objInfo.roleid == GameModel.player.roleid) {
GameModel.send('c2s_recall_confirm', {
roleid: this.objInfo.roleid
});
} else {
GameModel.send('c2s_recall_team', {
roleid: this.objInfo.roleid
});
}
GameModel.player.tempLeave = false
}
this.closeSelf();
}
});

614
assets/Script/game/Npc.js Normal file
View File

@ -0,0 +1,614 @@
import LiveEntity from "../ts/core/LiveEntity";
import GameModel from "../ts/core/GameModel";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import { EDir } from "../ts/core/EEnum";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
import GameUtil from "../ts/core/GameUtil";
import MsgAlert from "../ts/game/msg/MsgAlert";
import WeaponUtil from "../ts/weapon/WeaponUtil";
let CPubFunction = require('./PubFunction');
let CSpeak = require('./Speak');
let CMainPlayerInfo = require('./MainPlayerInfo');
let pTaskConfigMgr = require('./task_config').g_pTaskConfigMgr;
let EState = require('./task_config').EState;
let EEventType = require('./task_config').EEventType;
let pNpcMgr = require('./NpcMgr');
let ENpcKind = {
ERole: 1,
EThing: 2,
EBomb: 3,
EPao: 4,
ETower: 5,
};
cc.Class({
extends: LiveEntity,
properties: {
NpcFunUI: cc.Prefab,
},
onLoad() {
this._super();
this.nConfigID = 0;
this.obj_type = 0;
this.resid = 0;
this.run_type = 0;
this.move_speed = 280;
this.move_tiems = 0;
this.animationNode = this.node.getChildByName("role");
this.weaponNode = this.animationNode.getChildByName('weapon');
this.nameNode = this.node.getChildByName('name');
this.starTypeNameNode = this.node.getChildByName('starTypeName');
this.moveAngle = 0;
this.weaponname = '';
this.resUrl = '';
this.towerGangid = 0;
this.hp = 450
},
start() {
this.schedule(this.objUpdate, 1, cc.macro.REPEAT_FOREVER, 0.1);
},
onDestroy() {
},
clear() {
let weaponNode = this.weaponNode;
if (weaponNode) {
let clips = weaponNode.getComponent(cc.Animation).getClips();
for (const clip of clips) {
weaponNode.getComponent(cc.Animation).stop(clip.name);
weaponNode.getComponent(cc.Animation).removeClip(clip, true);
}
}
let animationNode = this.animationNode;
if (animationNode) {
let clips = animationNode.getComponent(cc.Animation).getClips();
for (const clip of clips) {
animationNode.getComponent(cc.Animation).stop(clip.name);
animationNode.getComponent(cc.Animation).removeClip(clip, true);
}
}
},
setInfo(objinfo) {
this.netInfo = objinfo;
if (this.netInfo.x < 0 || this.netInfo.y < 0) {
this.netInfo.x = 0;
this.netInfo.y = 0;
}
this.x = objinfo.x;
this.y = objinfo.y;
this.onlyid = objinfo.onlyid;
this.resid = objinfo.resid;
this.name = objinfo.name;
this.nConfigID = objinfo.npcconfig;
this.nameNode.getComponent(cc.Label).string = objinfo.name;
if (objinfo.type == 1) {
this.starTypeNameNode.getComponent(cc.Label).string = "地煞" + objinfo.level + "星";
this.nameNode.y = -37;
this.starTypeNameNode.active = true
}
else if (objinfo.type == 2) {
this.starTypeNameNode.getComponent(cc.Label).string = "星君下凡" + objinfo.level + "星";
this.nameNode.y = -37;
this.starTypeNameNode.active = true
} else if (objinfo.type == 3) {
this.starTypeNameNode.getComponent(cc.Label).string = objinfo.name + "星君";
this.nameNode.y = -37;
this.starTypeNameNode.active = true
} else if (objinfo.type == 8) {
this.starTypeNameNode.getComponent(cc.Label).string = "金蟾送福";
this.nameNode.y = -37;
this.starTypeNameNode.active = true;
} else if (objinfo.type == 9) {
this.starTypeNameNode.getComponent(cc.Label).string = "金蟾送寶";
this.nameNode.y = -37;
this.starTypeNameNode.active = true;
}
if (this.nConfigID >= 47205 && this.nConfigID <= 47208) {
this.initAnimation("die");
} else
this.initAnimation();
let nID = GameModel.conf_map[objinfo.mapid].mapid;
let mapinfo = GameModel.conf_map_list[nID];
this.gridInfoArr = mapinfo.mapInfo;
if (mapinfo.baseInfo.rows <= this.netInfo.y || mapinfo.baseInfo.lines <= this.netInfo.x) {
this.netInfo.x = mapinfo.startPos.x;
this.netInfo.y = mapinfo.startPos.y;
}
this.setObjPos(this.netInfo.x, this.netInfo.y);
if (GameModel.conf_res_anchor[this.resid]) {
this.animationNode.anchorX = CPubFunction.GetDefault(GameModel.conf_res_anchor[this.resid].anchorX, 0.5);
this.animationNode.anchorY = CPubFunction.GetDefault(GameModel.conf_res_anchor[this.resid].anchorY, 0.3);
}
if (this.gridInfoArr[this.netInfo.y][this.netInfo.x] == 2) {
this.node.opacity = 150;
}
if (this.nConfigID == 10050) {
var btn = this.node.getChildByName("Button");
btn.anchorX = 0.4
btn.anchorY = 0.72
btn.width = 370
btn.height = 300
this.nameNode.x = 35;
this.nameNode.y = -140;
}
if (this.nConfigID >= 7205 && this.nConfigID <= 7208) {
GameModel.towerNpcList[`${this.nConfigID}`] = this
GameModel.send("c2s_gang_tower", {
roleId: GameModel.player.roleid,
towerId: this.nConfigID
})
}
},
initAnimation(act = "stand", dir = 1, loop = true) {
if (!this.animationNode) return
this.animationNode.active = false;
this.resUrl = `shap/${this.resid}/${act}_${dir}`;
let self = this;
cc.loader.loadRes(this.resUrl, cc.SpriteAtlas, function (error, atlas) {
if (error) {
cc.warn(`$警告:加載NPC資源錯誤:${self.resUrl}`);
return;
}
if (!SKUIUtil.isValid(self.node)) {
return;
}
if (!atlas) {
return;
}
let curFrames = atlas.getSpriteFrames();
let fn = 10;
if (self.resid <= 4038) {
fn = 15;
}
let curClip = cc.AnimationClip.createWithSpriteFrames(curFrames, fn);
curClip.name = `${act}_${dir}`;
if (loop)
curClip.wrapMode = cc.WrapMode.Loop;
let nodeAni = self.animationNode.getComponent(cc.Animation);
nodeAni.stop()
nodeAni.addClip(curClip);
nodeAni.play(`${act}_${dir}`);
if (self.resid == 6142) {
} else {
self.scheduleOnce(() => {
let xDir = 1;
if (self.netInfo.dir == EDir.LEFT || self.netInfo.dir == EDir.RIGHT) {
xDir = -1;
}
if (self.resid != 7209) {
self.animationNode.scaleY = 450 / self.animationNode.height;
self.animationNode.scaleX = 450 / self.animationNode.width * xDir;
} else {
self.animationNode.scaleY = 1.28;
self.animationNode.scaleX = 1.28 * xDir;
if (GameModel.conf_res_anchor[self.resid] && act != "run") {
if (act == "attack" && dir == 1) {
self.animationNode.anchorX = 0.46;
self.animationNode.anchorY = 0.62;
} else {
self.animationNode.anchorX = CPubFunction.GetDefault(GameModel.conf_res_anchor[self.resid].anchorX, 0.5);
self.animationNode.anchorY = CPubFunction.GetDefault(GameModel.conf_res_anchor[self.resid].anchorY, 0.3);
}
}
}
}, 0);
}
self.animationNode.active = true;
//CPubFunction.addWeaponAnimation('', self.weaponNode, self.animationNode, self, self.resid, act, 1);
WeaponUtil.addWeaponAnimation('', self.weaponNode, self.animationNode, self, self.resid, act, 1, 1);
});
if (this.nConfigID >= 7205 && this.nConfigID <= 7208 && this.hp > 0) {
this.loadEff(`shap/${this.resid}/stand_1_ef`, true, -5, 75, null)
var hp = this.node.getChildByName("hp").getComponent(cc.ProgressBar);
hp.node.active = true
}
},
changeHp(value) {
if (!this.node) return
var hp = this.node.getChildByName("hp").getComponent(cc.ProgressBar);
this.hp = value
if (value > 0) {
hp.node.active = true
hp.progress = value / 450
} else {
hp.node.active = false
this.deleteEffNode()
this.initAnimation("die", 1, true)
}
},
loadEff(url, loop, x, y, cb) {
var self = this
self.deleteEffNode()
cc.loader.loadRes(url, cc.SpriteAtlas, function (error, atlas) {
if (error) {
cc.warn(`$警告:加載資源錯誤:${url}`);
return;
}
if (!atlas) {
return;
}
let curFrames = atlas.getSpriteFrames();
let curClip = cc.AnimationClip.createWithSpriteFrames(curFrames, 10);
curClip.name = `eff`;
if (loop)
curClip.wrapMode = cc.WrapMode.Loop;
else
curClip.wrapMode = cc.WrapMode.Normal;
cc.loader.loadRes("Prefabs/EffectFrame", cc.Prefab, (err, prefab) => {
if (err) {
console.log(err)
return;
}
let effNode = cc.instantiate(prefab);
effNode.name = "effNode"
effNode.x = x
effNode.y = y
effNode.parent = self.node
effNode.getComponent("Effect").CreateAndPlayAnimation(curClip, cb)
})
})
},
deleteEffNode() {
if (!this.node) return
for (let i = this.node.children.length - 1; i > 0; i--) {
if (this.node.children[i].name == "effNode")
this.node.children[i].destroy()
}
},
Npc_Init(strDefaultTalk, mapButton) {
this.strDefaultTalk = strDefaultTalk;
this.mapButton = mapButton;
this.mapTaskBtn = {};
},
ReconTaskBtnList() {
this.mapTaskBtn = {};
for (let key in CMainPlayerInfo.vecTaskState) {
let stTaskState = CMainPlayerInfo.vecTaskState[key];
let stTaskConfig = pTaskConfigMgr.GetTaskInfo(stTaskState.nTaskID);
for (let itStep in stTaskState.vecStepState) {
if (stTaskState.vecStepState[itStep].nState != EState.EDoing)
continue;
let stStep = stTaskConfig.vecEvent[itStep];
if (stStep.nEventType == EEventType.PlayerTalkNpc) {
if (stStep.vecNpc[0] != this.nConfigID)
continue;
let vecTmp = CPubFunction.GetTaskTalkList(stTaskConfig.nTaskID, itStep);
this.mapTaskBtn[stTaskConfig.strTaskName] = { vecTmp: vecTmp, nTaskID: stTaskState.nTaskID, nStep: itStep };
}
if (stStep.nEventType == EEventType.PlayerGiveNpcItem) {
if (stStep.nNpcConfigID != this.nConfigID)
continue;
let vecTmp = [];
this.mapTaskBtn[stTaskConfig.strTaskName] = { vecTmp: vecTmp, nTaskID: stTaskState.nTaskID, nStep: itStep };
}
if (stStep.nEventType == EEventType.PlayerKillNpc) {
for (let it2 in stStep.vecNpc) {
if (stStep.vecNpc[it2] != this.nConfigID)
continue;
this.mapTaskBtn[stTaskConfig.strTaskName] = { vecTmp: [], nTaskID: stTaskState.nTaskID, nStep: itStep };
break;
}
}
}
}
},
checklevelLimit() {
},
CloseCurUI() {
CPubFunction.FindAndDeleteNode(cc.find('Canvas/MainUI'), "NpcFunUI");
CPubFunction.FindAndHidenNode(cc.find('Canvas/MainUI'), { nX: 0, nY: -1000 });
},
OpenFunctionUI() {
let npcName = cc.find('name', this.node).getComponent(cc.Label).string;
let goNpcFunUI = SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(300, 0), this.NpcFunUI, 'NpcFunUI');
let npcFunUI = goNpcFunUI.getComponent('NpcFunUI');
if (npcFunUI) {
npcFunUI.NpcFunUI_Init(this.GetOnlyID(), this.nConfigID, npcName, this.strDefaultTalk, this.GetFunctionMapBtn(), this.mapTaskBtn);
}
},
OpenTowerFunctionUI(data) {
GameModel.towerNpc = null
let npcName = cc.find('name', this.node).getComponent(cc.Label).string;
let goNpcFunUI = SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(300, 0), this.NpcFunUI, 'NpcFunUI');
let npcFunUI = goNpcFunUI.getComponent('NpcFunUI');
var talk = "";
if (this.towerGangid == GameModel.player.bangid) {
talk = `這是我方的能量塔,補充能量可以開砲哦`
} else {
talk = `這是敵方能量塔,耐久剩餘${data.durable}`
}
if (npcFunUI) {
npcFunUI.NpcFunUI_Init(this.GetOnlyID(), this.nConfigID, npcName, talk, this.GetFunctionMapBtn(), this.mapTaskBtn);
}
},
GetOnlyID() {
let valid = SKUIUtil.isValid(this.node);
if (!valid) {
return 0;
}
let npc = this.node.getComponent('Npc');
if (npc) {
let result = npc.onlyid;
return result;
}
return 0;
},
IsGrass() {
let resid = this.node.getComponent('Npc').resid;
if (resid == 2003)
return true;
return false;
},
GetKind() {
let stConfig = pNpcMgr.GetNpcConfigInfo(this.nConfigID);
return stConfig.nKind;
},
OnGrassClick() {
GameUtil.createWaitTip('採集', 1, () => {
GameModel.send('c2s_act_npc', { nOnlyID: this.GetOnlyID(), nNpcConfigID: this.nConfigID, });
});
},
OnBombClick() {
GameModel.send('c2s_trigle_npc_bomb', { nNpcConfigID: this.nConfigID, nNpcOnlyID: this.GetOnlyID() });
},
OnPaoClick() {
if (GameModel.needKeep) return
if (GameModel.player.isleader && GameModel.player.teamInfo) {
var roleNum = 0;
for (let i in GameModel.player.teamInfo.objlist) {
if (SKDataUtil.hasProperty(GameModel.player.teamInfo.objlist[i], "accountid"))
roleNum++
}
if (roleNum < 1) {
MsgAlert.addMsg("需要組隊且三人及以上才行哦")
return
}
} else {
MsgAlert.addMsg("需要組隊且三人及以上才行哦")
return
}
GameModel.paoNpc = this;
GameModel.send("c2s_ask_fortifications", {
roleId: GameModel.player.roleid,
type: 1,
serial: 1,
is: 0
})
GameModel.needKeepType = 1
GameModel.serial = 1
},
// 大砲蓄力
OnPaoClickCB() {
if (GameModel.needKeep) return
this.initAnimation("run")
this.animationNode.anchorX = 0.4;
this.animationNode.anchorY = 0.495;
GameUtil.createWaitTip2('蓄力中', 20, () => {
GameModel.needKeep = false
});
GameModel.needKeep = true
},
paoBoom(data) {
GameUtil.breakWaitTip2(false);
GameUtil.waitNode.stopAllActions()
GameUtil.waitNode.destroy()
var dir = data.direction == "L" ? 1 : 3
this.initAnimation("attack", dir, false)
GameModel.needKeep = false
this.scheduleOnce(() => {
this.initAnimation()
}, 1.2)
if (dir == 3)
this.scheduleOnce(() => {
this.loadEff(`shap/7209/attack_${dir}_ef`, false, 440, 290)
}, 0.4)
else
this.scheduleOnce(() => {
this.loadEff(`shap/7209/attack_${dir}_ef`, false, 50, -20)
}, 0.5)
},
OnTowerClick() {
GameModel.towerNpc = this;
GameModel.send("c2s_gang_tower", {
roleId: GameModel.player.roleid,
towerId: this.nConfigID
})
},
// 砲塔蓄力
OnTowerKeepCB() {
GameModel.towerNpc = null;
GameModel.needKeep = true
GameUtil.createWaitTip3('蓄力中', 20, () => {
GameModel.needKeep = false
});
},
GetFunctionMapBtn() {
let mapTmp = Object.assign({}, this.mapButton);
for (let key in mapTmp) {
if (key.indexOf('daily') == -1)
continue;
if (this.nConfigID == 10067) { // 牛百色變色功能屏掉
delete mapTmp(key);
continue;
}
if (this.nConfigID == 30062 && GameModel.player.race != 1) // 菩提祖師-人族
{
delete mapTmp[key];
continue;
}
if (this.nConfigID == 10118 && GameModel.player.race != 2) // 太上老君-仙族
{
delete mapTmp[key];
continue;
}
if (this.nConfigID == 30063 && GameModel.player.race != 3) // 牛魔王-魔族
{
delete mapTmp[key];
continue;
}
if (this.nConfigID == 30065 && GameModel.player.race != 4) // 聶小倩-鬼族
{
delete mapTmp[key];
continue;
}
if (this.nConfigID == 70006 && GameModel.player.race != 5) // 龍首木-龍族
{
delete mapTmp[key];
continue;
}
if (this.nConfigID == 10240 && GameModel.player.level < 28) // 程咬金
{
delete mapTmp[key];
continue;
}
let vecTmp = key.split(":");
if (CMainPlayerInfo.IsAlreadyHasThisGropTask(vecTmp[1])) {
delete mapTmp[key];
continue;
}
}
// 自定義去掉按鈕
for (let key in mapTmp) {
if (this.nConfigID == 10240 && GameModel.player.level < 28) // 程咬金
{
delete mapTmp[key];
// 自定義對話
this.strDefaultTalk = "聽聞孫悟空的金箍棒也是厲害的很,你說和我的三板斧比怎樣?"
continue;
}
}
for (let key in mapTmp) {
if (this.nConfigID >= 7205 && this.nConfigID <= 7208) // 幫戰塔
{
if (this.towerGangid == GameModel.player.bangid && mapTmp[key] == "果斷開打")
delete mapTmp[key];
if (this.towerGangid != GameModel.player.bangid && mapTmp[key] == "開始補充")
delete mapTmp[key];
continue;
}
}
return mapTmp;
},
OnHumanClick() {
if (this.nConfigID == 10055) {
// 判斷是否再幫戰比武場
var inBox = GameUtil.pnpoly(4, [167, 194, 169, 141], [39, 24, 12, 26], GameModel.player.x, GameModel.player.y)
if (!inBox) {
let stSpeak = new CSpeak(this.node.getComponent('Npc').resid, this.strDefaultTalk, cc.find('name', this.node).getComponent(cc.Label).string, 2); // Npc 默認的自言自語黑框
CPubFunction.CreateNpcTalk([stSpeak], null);
return
}
}
this.ReconTaskBtnList();
if (CPubFunction.GetMapLen(this.GetFunctionMapBtn()) > 0) {
this.OpenFunctionUI();
return;
}
if (CPubFunction.GetMapLen(this.mapTaskBtn) > 1) {
this.OpenFunctionUI();
}
else if (CPubFunction.GetMapLen(this.mapTaskBtn) == 1) {
let pSelf = this;
let stData = CPubFunction.GetMapDataByIndex(this.mapTaskBtn, 0);
CPubFunction.CreateNpcTalk(stData.vecTmp, (data) => {
GameModel.send('c2s_task_talk_npc', { nTaskID: stData.nTaskID, nStep: stData.nStep, nNpcConfigID: pSelf.nConfigID, nNpcOnlyID: pSelf.GetOnlyID() });
});
}
else //沒有功能 沒有任務
{
if (this.strDefaultTalk && this.strDefaultTalk != '') {
let stSpeak = new CSpeak(this.node.getComponent('Npc').resid, this.strDefaultTalk, cc.find('name', this.node).getComponent(cc.Label).string, 2); // Npc 默認的自言自語黑框
CPubFunction.CreateNpcTalk([stSpeak], null);
}
}
},
OnNpcClick() {
if (GameModel.player.getLogic().isBing) {
MsgAlert.addMsg("冰凍中,不可進行操作")
return
}
let comRole = this.node.getComponent('Npc');
let nDistance = SKDataUtil.distance({ x: GameModel.player.x, y: GameModel.player.y }, { x: comRole.x, y: comRole.y });
if (nDistance >= 20)
return;
this.CloseCurUI();
let nKind = this.GetKind();
if (nKind == ENpcKind.ERole) {
this.OnHumanClick();
}
if (nKind == ENpcKind.EThing) {
this.OnGrassClick();
}
if (nKind == ENpcKind.EBomb) {
this.OnBombClick();
}
if (nKind == ENpcKind.EPao) {
this.OnPaoClick();
}
if (nKind == ENpcKind.ETower) {
this.OnTowerClick();
}
},
});

View File

@ -0,0 +1,482 @@
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import GameModel from "../ts/core/GameModel";
import MsgAlert from "../ts/game/msg/MsgAlert";
import Arena from "../ts/arena/Arena";
import DebateDao from "../ts/debateDao/DebateDao";
import FGAlert from "../ts/gear_2.3.4/fgui/FGAlert";
import visitingPrison from "../ts/visitingPrison";
import GameUtil from "../ts/core/GameUtil";
import GuoShop from "../ts/GuoShop";
import DrawMoney from "../ts/drawMoney";
import AudioUtil from "../ts/core/AudioUtil";
let CPubFunction = require('./PubFunction');
let pNpcMgr = require('./NpcMgr');
let CMainPlayerInfo = require('./MainPlayerInfo');
cc.Class({
extends: cc.Component,
properties: {
btnNpcFunction: cc.Prefab,
XianQiUpPanel: cc.Prefab,
ShenBingUpPanel: cc.Prefab,
ShenBingCombinePanel: cc.Prefab,
RelationInputUI: cc.Prefab,
RelationListUI: cc.Prefab,
NpcShopUI: cc.Prefab,
PKPanel: cc.Prefab,
ColoringRolePanel: cc.Prefab,
PetFlyPanel: cc.Prefab,
fontRes: cc.Font
},
onLoad() {
this.nOnlyID = 0;
this.nResID = 0;
},
NpcFunUI_Init(nOnlyID, nConfigID, strName, strDefaultTalk, mapBtnFunction, mapTaskBtn) {
this.nOnlyID = nOnlyID;
this.nConfigID = nConfigID;
AudioUtil.playNpcAudio(this.nConfigID);
let stConfigInfo = pNpcMgr.GetNpcConfigInfo(nConfigID);
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcFunUI", "Close", 0));
//形象
let resid = stConfigInfo.nResID;
if (resid <= 4038 || resid == 6024 || resid == 6006 || resid == 6026 || resid == 6027 || resid == 6025 || resid == 6029 || resid == 6034 || resid == 6080 || resid == 5054 || resid == 6089 || resid == 6030 || resid == 6081 || resid == 6035 || resid == 6061 || resid == 6078 || resid == 6011 || resid == 6140 || resid == 6141 || resid == 6142) {
CPubFunction.SetSpineAvatars(cc.find('nodNpc/goSpeaker1', this.node), cc.find('nodNpc/picAvatar', this.node), stConfigInfo.nResID);
} else {
CPubFunction.SetDragonBoneAvatars(cc.find('nodNpc/goSpeaker', this.node), cc.find('nodNpc/picAvatar', this.node), stConfigInfo.nResID);
}
//CPubFunction.SetDragonBoneAvatar(cc.find('nodNpc/goSpeaker', this.node), cc.find('nodNpc/picAvatar', this.node), stConfigInfo.nResID);
cc.find('nodNpc/picName/label', this.node).getComponent(cc.Label).string = strName;
//語言框
let nodContentTalk = cc.find('nodCustomRichText/view/content', this.node);
let comCusRichText = nodContentTalk.getComponent('CustomRichText');
comCusRichText.maxWidth = nodContentTalk.width - 6;
comCusRichText.fontRes = this.fontRes;
comCusRichText.emojiAtlas = GameModel.chatEmojiAtlas;
comCusRichText.string = CPubFunction.GetDefault(strDefaultTalk, '');
//按鈕框
let preButton = this.btnNpcFunction;
let nodContent2 = cc.find('ScrollView/view/content', this.node);
let nBtnHight = preButton.data.height;
let nDis = 2;
let nIndex = -1;
let stStart = { nX: 145, nY: -30 };
for (let key in mapTaskBtn) {
nIndex++;
let goBtn = SKUIUtil.createSubNode(nodContent2, cc.v2(stStart.nX, stStart.nY - nIndex * (nBtnHight + nDis)), preButton, 'Task');
goBtn.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcFunUI", 'OnNpcFunction', { strTaskName: key, stData: mapTaskBtn[key] }));
cc.find('Label', goBtn).getComponent(cc.Label).string = key;
let goTaskTip = cc.find('TaskTip', cc.find('Canvas/MainUI/right'));
let comTaskTip = goTaskTip.getComponent('TaskTip');
if (comTaskTip.stAuto.nTaskID == mapTaskBtn[key].nTaskID) {
this.OnNpcFunction(goBtn.getComponent(cc.Button), { strTaskName: key, stData: mapTaskBtn[key] });
}
}
for (let key in mapBtnFunction) {
if (key.indexOf('daily') != -1) {
let vecTmp = key.split(":");
if (CMainPlayerInfo.IsAlreadyHasThisGropTask(vecTmp[1]))
continue;
}
nIndex++;
let goBtn = SKUIUtil.createSubNode(nodContent2, cc.v2(stStart.nX, stStart.nY - nIndex * (nBtnHight + nDis)), preButton, key);
goBtn.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcFunUI", 'OnNpcFunction', key));
cc.find('Label', goBtn).getComponent(cc.Label).string = mapBtnFunction[key];
}
nodContent2.height = Math.max(nodContent2.height, (nIndex + 1) * (nBtnHight + nDis) + 40);
},
Close() {
this.node.destroy();
},
OnNpcFunction(stEvent, stParam) {
let strTmp = stEvent.target.name;
if (strTmp == 'Task') {
let nTaskID = stParam.stData.nTaskID;
let nStep = stParam.stData.nStep;
let pSelf = this;
let vecSpeak = stParam.stData.vecTmp;
CPubFunction.CreateNpcTalk(vecSpeak, () => {
GameModel.send('c2s_task_talk_npc', { nTaskID: nTaskID, nStep: nStep, nNpcConfigID: pSelf.nConfigID, nNpcOnlyID: pSelf.nOnlyID });
});
}
else if (strTmp == 'Box') {
strTmp;
}
else if (strTmp == 'Teacher') {
strTmp;
}
else if (strTmp == 'Team') {
strTmp;
}
else if (strTmp == 'bpjyr_bang') { //回到幫派
let comMapLogic = cc.find('Canvas/MapUI').getComponent('GameMapLogic');
comMapLogic.changeMap(3002);
}
else if (strTmp.indexOf('daily') != -1) {
let vecTmp = strTmp.split(":");
if (vecTmp.length != 2)
return;
let nTaskGrop = vecTmp[1];
GameModel.send('c2s_start_grop_task', { nNpcOnlyID: this.nOnlyID, nTaskGrop: nTaskGrop });
}
else if (strTmp.indexOf('fuben') != -1) {
let vecTmp = strTmp.split(":");
if (vecTmp.length != 2)
return;
GameModel.send('c2s_incept_fuben_task', { nNpcOnlyID: this.nOnlyID, nTaskID: vecTmp[1] });
}
// 挑戰
else if (strTmp == 'tiaozhan') {
GameModel.send('c2s_challenge_npc', { nOnlyID: this.nOnlyID, nConfigID: this.nConfigID });
}
else if (strTmp == 'hdl_xqhc') {
let xqhc = cc.instantiate(this.XianQiUpPanel);
xqhc.parent = cc.find('Canvas');
}
else if (strTmp == 'hdl_xqsj') {
let xqsj = cc.instantiate(this.XianQiUpPanel);
xqsj.parent = cc.find('Canvas');
}
else if (strTmp == 'hdl_sbsj') {
let sbsj = cc.instantiate(this.ShenBingUpPanel);
sbsj.parent = cc.find('Canvas');
}
else if (strTmp == 'hdl_sbhc') {
let sbhc = cc.instantiate(this.ShenBingCombinePanel);
sbhc.parent = cc.find('Canvas');
}
else if (strTmp == 'shop') {
let goUI = SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(0, 0), this.NpcShopUI, 'NpcShopUI');
let comUI = goUI.getComponent('NpcShopUI');
comUI.nNpcConfigID = this.nConfigID;
}
else if (strTmp == 'taskreset') {
GameModel.send('c2s_task_reset', {});
}
else if (strTmp == 'changerace') { //換種族
cc.loader.loadRes("Prefabs/LoginCreateRole", function (err, prefab) {
let mainui = cc.find('Canvas');
let relive = cc.instantiate(prefab);
relive.parent = mainui;
relive.name = 'changeracelayer';
let logic = relive.getComponent('LoginCreateLogic');
logic.setOpenType(2);
});
}
// 轉生
else if (strTmp == 'zhuansheng') {
let strErr = '';
let vecNeed = [100, 120, 140];
let level = GameModel.player.level;
let relive = GameModel.player.relive;
if (relive >= 3) {
strErr = `無法再轉生了`;
}
else if (level < vecNeed[relive]) {
strErr = `你的等級不夠,需達到${vecNeed[relive]}級才能轉生`;
}
if (strErr.length < 1) {
cc.loader.loadRes("Prefabs/LoginCreateRole", function (err, prefab) {
let mainui = cc.find('Canvas');
let relive = cc.instantiate(prefab);
relive.parent = mainui;
relive.name = 'relivelayer';
let logic = relive.getComponent('LoginCreateLogic');
logic.setOpenType(1);
});
}
}
// 飛升
else if (strTmp == 'fly_up') {
let strErr = '';
let level = GameModel.player.level;
let relive = GameModel.player.relive;
if (relive > 3) {
strErr = `您已經飛升成功!`;
}
if (relive != 3) {
strErr = `您需要三轉才能飛升`;
}
else if (level < 180) {
strErr = `您的等級不夠需達到180級才能飛升`;
}
if (strErr.length < 1) {
GameModel.send('c2s_fly_up', {});
}
else {
CPubFunction.CreateNpcNotice(10094, strErr);
}
}
// 傳送到指定地圖
else if (strTmp.indexOf('goto') != -1) {
let vecTmp = strTmp.split(":");
if (vecTmp.length != 2) {
return;
}
let mapId = parseInt(vecTmp[1]);
let comMapLogic = cc.find('Canvas/MapUI').getComponent('GameMapLogic');
comMapLogic.changeMap(mapId);
}
// 探監
else if (strTmp == 'tanjian') {
let comMapLogic = cc.find('Canvas/MapUI').getComponent('GameMapLogic');
comMapLogic.changeMap(1201);
}
// 傳送至長安
else if (strTmp == 'join_leave') {
let comMapLogic = cc.find('Canvas/MapUI').getComponent('GameMapLogic');
comMapLogic.changeMap(1011);
}
// 水陸大會報名
else if (strTmp == 'sldh') {
GameModel.send('c2s_shuilu_sign');
}
else if (strTmp == 'linghou') {
GameModel.send('c2s_linghou_fight', {
mid: this.nOnlyID,
});
}
// "mapButton": "{ \"planwar\":\"幫我寫戰書\", \"receivewar\":\"我要接受對方的挑戰\", \"warrank\":\"決鬥榜\", \"close\":\"打架是不好的行為\" }",
else if (strTmp == 'planwar') {
SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(0, 0), this.PKPanel, 'PKPanel');
}
else if (strTmp == 'receivewar') {
let palaceFightIcon = cc.find('Canvas/MainUI/PalaceFightIcon');
let logic = palaceFightIcon.getComponent('PalaceFightIcon');
if (logic.hasPalaceFight()) {
GameModel.send('c2s_palace_rolelist', {
roleid: GameModel.player.roleid,
});
}
else {
MsgAlert.addMsg('你沒有被其他人邀請皇城決鬥!');
}
/* if (!palaceFightIcon.active) {
MsgAlert.addMsg('你沒有要進行的決鬥!');
}
else {
palaceFightIcon.getComponent('PalaceFightIcon').showPalaceFightPanel();
} */
}
else if (strTmp == 'warrank') {
MsgAlert.addMsg('暫未開放!');
}
else if (strTmp == "arena") {
//GameModel.send("c2s_start_grop_task", { nNpcOnlyID: 10240, nTaskGrop: "16" })
Arena.Instance.openArenaPanel();
}
else if (strTmp == "visitingPrison") {
visitingPrison.Instance.openVisitingPrisonPanel();
}
//我要結拜
else if (strTmp == 'newBrother') {
if (!GameModel.player.teamInfo.objlist || !Array.isArray(GameModel.player.teamInfo.objlist)) {
MsgAlert.addMsg("必須先組隊才能結拜");
return false;
}
SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(0, 0), this.RelationInputUI, 'RelationInputUI');
}
//新人加入結拜
else if (strTmp == 'addBrother') {
CPubFunction.CreateSubNodeByType(cc.find('Canvas/MainUI'), { nX: 0, nY: 0 }, this.RelationListUI, 'RelationListUI', 1);
}
//退出結拜
else if (strTmp == 'leaveBrother') {
CPubFunction.CreateSubNodeByType(cc.find('Canvas/MainUI'), { nX: 0, nY: 0 }, this.RelationListUI, 'RelationListUI', 2);
}
else if (strTmp == 'rolecolor') { // 染色
let panel = cc.instantiate(this.ColoringRolePanel);
panel.parent = cc.find('Canvas/MainUI');
panel.setPosition(0, 0);
}
else if (strTmp == 'flyingup') { // 寵物飛升
let panel = cc.instantiate(this.PetFlyPanel);
panel.parent = cc.find('Canvas/MainUI');
}
// 證道大會
else if (strTmp == 'join_say') {
if (!GameModel.player.teamInfo.objlist || !Array.isArray(GameModel.player.teamInfo.objlist)) {
MsgAlert.addMsg("必須先組隊才可以參加哦!");
return false;
}
GameModel.send('c2s_join_say', {
roleId: GameModel.player.roleid,
});
}
// 離開證道大會
else if (strTmp == "leave_sat") {
// 判斷是否在隊伍(不在隊伍直接離開)
if (GameModel.player.teamInfo.objlist || Array.isArray(GameModel.player.teamInfo.objlist)) {
if (GameModel.player.isleader) {
FGAlert.show(`確定離開證道大會嗎?離開您的隊伍將失去當前[color=#ed0803]比賽成績[/color]`, () => {
FGAlert.hide();
}, () => {
FGAlert.hide();
let params = {
teamId: GameModel.player.teamid,
}
GameModel.send("c2s_leave_sat", params);
});
} else {
MsgAlert.addMsg("只有隊長才開進行此操作!");
return false;
}
} else {
let params = {
teamId: 0,
}
GameModel.send("c2s_leave_sat", params);
}
}
// 離開水路大會
else if (strTmp == "leave_sldh") {
// 判斷是否在隊伍(不在隊伍直接離開)
if (GameModel.player.teamInfo.objlist || Array.isArray(GameModel.player.teamInfo.objlist)) {
if (GameModel.player.isleader) {
FGAlert.show(`確定離開水路大會嗎?離開您的隊伍將失去當前[color=#ed0803]比賽資格[/color]`, () => {
FGAlert.hide();
}, () => {
FGAlert.hide();
let params = {
teamId: GameModel.player.teamid,
}
GameModel.send("c2s_leave_sldh", params);
});
} else {
MsgAlert.addMsg("只有隊長才開進行此操作!");
return false;
}
} else {
let params = {
teamId: 0,
}
GameModel.send("c2s_leave_sldh", params);
}
}
// 請求幫戰
else if (strTmp == "gang_wars") {
GameModel.send('c2s_gang_wars', {
roleId: GameModel.player.roleid,
});
}
// 上陣迎敵
else if (strTmp == "to_meet_them") {
GameModel.send('c2s_to_meet_them', {
roleId: GameModel.player.roleid,
});
}
// 前往比武場
else if (strTmp == "go_contest") {
GameModel.send('c2s_go_contest', {
roleId: GameModel.player.roleid,
});
}
// 返回長安
else if (strTmp.indexOf('to_map_chang_an') != -1) {
let vecTmp = strTmp.split(":");
if (vecTmp.length != 2)
return;
GameModel.send('c2s_to_map_chang_an', {
roleId: GameModel.player.roleid,
type: parseInt(vecTmp[1])
});
}
// 返回基地
else if (strTmp.indexOf('go_home') != -1) {
let vecTmp = strTmp.split(":");
if (vecTmp.length != 2)
return;
GameModel.send('c2s_go_home', {
roleId: GameModel.player.roleid,
type: parseInt(vecTmp[1])
});
}
// 比武
else if (strTmp == "contest") {
GameModel.send('c2s_contest', {
roleId: GameModel.player.roleid,
});
}
// 玩法說明
else if (strTmp.indexOf('explain') != -1) {
let vecTmp = strTmp.split(":");
if (vecTmp.length != 2)
return;
DebateDao.Instance.openPlayInfo(vecTmp[1]);
}
// 開打幫戰塔
else if (strTmp.indexOf('break') != -1) {
let vecTmp = strTmp.split(":");
if (vecTmp.length != 2)
return;
var typeId = (vecTmp[1] == 7206 || vecTmp[1] == 7208) ? 3 : 2
GameModel.send('c2s_ask_fortifications', {
roleId: GameModel.player.roleid,
type: typeId,
serial: parseInt(vecTmp[1]),
is: 1
});
}
// 蓄力幫戰塔
else if (strTmp.indexOf('recharge') != -1) {
if (GameModel.needKeep) return
let vecTmp = strTmp.split(":");
if (vecTmp.length != 2)
return;
var typeId = (vecTmp[1] == 7206 || vecTmp[1] == 7208) ? 3 : 2
GameModel.send('c2s_ask_fortifications', {
roleId: GameModel.player.roleid,
type: typeId,
serial: parseInt(vecTmp[1]),
is: 0
});
GameModel.towerNpc = GameModel.towerNpcList[vecTmp[1]]
GameModel.needKeepType = typeId
GameModel.serial = parseInt(vecTmp[1])
}
// 郭老闆兌換
else if (strTmp.indexOf('guoShopBuy') != -1) {
GuoShop.Instance.openShopMainPanel()
}
// 郭老闆回收
else if (strTmp.indexOf('guoShopSale') != -1) {
GuoShop.Instance.openShopMainPanel(1)
}
// 提現
else if (strTmp.indexOf('drawMoney') != -1) {
DrawMoney.Instance.openDrawPanel();
}
// 天梯報名
else if (strTmp == 'TianTi') {
if (!GameModel.player.teamInfo.objlist || !Array.isArray(GameModel.player.teamInfo.objlist)) {
MsgAlert.addMsg("必須先組隊才可以參加天梯巔峰戰!");
return false;
}
GameModel.send('c2s_join_Tianti', {
roleid: GameModel.player.roleid,
});
}
this.node.destroy();
},
});

View File

@ -0,0 +1,166 @@
import GameModel from "../ts/core/GameModel";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import { ELivingType } from "../ts/core/EEnum";
let CPubFunction = require('./PubFunction');
class CNpcMgr {
constructor() {
this.mapNpcConfig = {};
this.mapNpcObj = {};
}
LoadNpcJson() {
let conf = GameModel.conf_npc;
for (let key in conf) {
if (key == 'datatype') {
continue;
}
let stData = GameModel.conf_npc[key];
this.mapNpcConfig[key] = { nConfigID: key, nResID: stData.resid, strName: stData.name, stTalk: stData.talk, mapButton: this.GetMapButton(stData.mapButton), nKind: stData.kind, stAutoCreate: this.GetCreate(stData.auto_create) };
}
}
AddNpcObj(nOnlyID, goObj) {
if (SKDataUtil.hasProperty(this.mapNpcObj, nOnlyID)) {
let temp = this.mapNpcObj[nOnlyID];
if (temp) {
let valid = SKUIUtil.isValid(temp);
if (valid) {
temp.destroy();
}
}
}
this.mapNpcObj[nOnlyID] = goObj;
}
CheckNpcRes(onlyid, resid) {
for (let ponlyid in this.mapNpcObj) {
if (ponlyid == onlyid) {
continue;
}
let npcnode = this.mapNpcObj[ponlyid];
if (npcnode.resid == resid) {
return true;
}
}
return false;
}
GetNpcDefaultDir(nConfigID) {
if (!SKDataUtil.hasProperty(this.mapNpcConfig, nConfigID)) {
return 0;
}
let pAutoCreate = this.mapNpcConfig[nConfigID].stAutoCreate;
if (null == pAutoCreate) {
return 0;
}
return pAutoCreate.dir;
}
GetMapButton(strJson) {
if (strJson == "") {
return JSON.parse('{}');
}
let mapButton = SKDataUtil.jsonBy(strJson);
return mapButton;
}
GetCreate(strData) {
if (typeof strData == "undefined") {
return null;
}
let vecTmp = strData.split(";");
if (vecTmp.length != 4) {
return null;
}
return { map: parseInt(vecTmp[0]), x: parseInt(vecTmp[1]), y: parseInt(vecTmp[2]), dir: parseInt(vecTmp[3]) };
}
GetCurSceneNode() {
let nodMap = cc.find('Canvas/MapUI');
return nodMap;
}
GetCurGameMapID() {
let goScene = this.GetCurSceneNode();
if (!goScene) {
return null;
}
return goScene.getComponent('GameMapLogic').mapId;
}
ReloadNpcJson() {
if (CPubFunction.GetMapLen(this.mapNpcConfig) == 0) {
this.LoadNpcJson();
}
SKUIUtil.destroyDict(this.mapNpcObj);
}
GetNpcConfigInfo(nConfigID) {
if (!SKDataUtil.hasProperty(this.mapNpcConfig, nConfigID)) {
return null;
}
return this.mapNpcConfig[nConfigID];
}
FindNpcByConfigID(nConfigID) {
let mapPlayer = this.mapNpcObj;
for (let key in mapPlayer) {
let node = mapPlayer[key];
if (!node) {
continue;
}
let valid = SKUIUtil.isValid(node);
if (!valid) {
continue;
}
if (node.livingtype != ELivingType.NPC) {
continue;
}
let npc = node.getComponent('Npc');
if (npc.nConfigID != nConfigID) {
continue;
}
return node;
}
return null;
}
GetNpcPos(nConfigID) {
for (let key in this.mapNpcConfig) {
if (this.mapNpcConfig[key].nConfigID == nConfigID) {
let stCreate = this.mapNpcConfig[key].stAutoCreate;
if (!stCreate) {
continue;
}
return { nNpc: nConfigID, nMap: stCreate.map, nX: stCreate.x, nY: stCreate.y, nDir: stCreate.dir };
}
}
return null;
}
DestroyNpc(onlyid) {
let node = this.mapNpcObj[onlyid];
if (node) {
let valid = SKUIUtil.isValid(node);
if (valid) {
let npc = node.getComponent('Npc');
if (npc) {
npc.clear();
}
node.destroy();
}
}
delete this.mapNpcObj[onlyid];
}
}
let g_NpcMgr = null;
module.exports = (() => {
if (g_NpcMgr == null) {
g_NpcMgr = new CNpcMgr();
}
return g_NpcMgr;
})();

View File

@ -0,0 +1,232 @@
import GameModel from "../ts/core/GameModel";
import GameUtil from "../ts/core/GameUtil";
import ItemUtil from "../ts/core/ItemUtil";
import Report from "../ts/gear_2.3.4/net/Report";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties:{
btnMallInfo:cc.Prefab,
NumPad:cc.Prefab,
},
onLoad() {
this.nNpcConfigID = 0;
this.vecTmpGoods = [];
this.vecGoodsInfo = [];
this.pGoodsInfo = null;
this.nBuyCnt = 0;
this.selectedGoodsQuantity = 10000;
this.selectedGoods = 0;
},
start() {
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcShopUI", "Close", 0));
cc.find('picFrame/nodDetail/nodNum/btnPad', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcShopUI", "OpenNumPad", 0));
cc.find('picFrame/nodDetail/nodNum/btnAdd', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcShopUI", "ChangeBuyCnt", 1));
cc.find('picFrame/nodDetail/nodNum/btnCut', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcShopUI", "ChangeBuyCnt", -1));
cc.find('picFrame/nodDetail/btnOK', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcShopUI", "OnBuy", 0));
this.vecMutexNode = [cc.find('picFrame/picTip', this.node), cc.find('picFrame/nodDetail', this.node)];
CPubFunction.ChangeTeamNodeState(this.vecMutexNode, 0);
GameModel.send('c2s_ask_npc_shop_item', { nNpcConfigID: this.nNpcConfigID });
},
Close() {
this.node.destroy();
},
GetMoneyIconFile(nKind) {
let strMoneyIcon = 'ui_common_icon_yinliang';
switch(nKind){
case 0:{strMoneyIcon = 'ui_common_icon_yinliang';break;}
case 1:{strMoneyIcon = 'ui_common_icon_xianyu';break;}
case 3:{strMoneyIcon = 'ui_common_score_shuilu';break;}
default:
strMoneyIcon = 'ui_common_icon_yinliang';
}
return strMoneyIcon;
},
updateGoodsInfo(updateItem){
let goContent = cc.find('scvGoods/view/content', this.node);
let childrens = goContent.getChildren();
for (const child of childrens) {
var showId = cc.find('lblItemID', child).getComponent(cc.Label).string;
if(showId == updateItem.nItemID){
cc.find('labQuantity', child).getComponent(cc.Label).string = updateItem.quantity;
break;
}
}
},
SetGoodsInfo(goItem, pInfo) {
let stConfigInfo = {};
if (pInfo.type && pInfo.type == 'weapon') {
let equipdata = GameModel.conf_equip[pInfo.itemid];
if(equipdata){
stConfigInfo.name = equipdata.Name;
stConfigInfo.icon = equipdata.Shape;
}else{
let info=`$警告:裝備定義不存在[${pInfo.itemid}]`;
Report.report(info);
}
}
else {
stConfigInfo = ItemUtil.getItemData(pInfo.itemid);
}
cc.find('nodItemInfo/Icon', goItem).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIconBy(stConfigInfo);
cc.find('labName', goItem).getComponent(cc.Label).string = stConfigInfo.name;
cc.find('picText/Label', goItem).getComponent(cc.Label).string = pInfo.price;
cc.find('lblItemID', goItem).getComponent(cc.Label).string = pInfo.itemid;
if(pInfo.quantity != null){
var lblQuantity = cc.find('labQuantity', goItem);
lblQuantity.getComponent(cc.Label).string = pInfo.quantity ;
lblQuantity.active = true;
}
SKUIUtil.setSpriteFrame(cc.find('picText/picYinLiang', goItem), 'Common/ui_common', this.GetMoneyIconFile(pInfo.moneykind));
},
InitNpcShopGoodsList(data) {
let tmpData = JSON.parse(data.info);
this.vecGoodsInfo = tmpData.goods;
let goContent = cc.find('scvGoods/view/content', this.node);
goContent.destroyAllChildren();
SKUIUtil.destroyList(this.vecTmpGoods);
let stStart = { nX: 125, nY: -48 };
for (var nIndex in this.vecGoodsInfo) {
let stPos = cc.v2(stStart.nX + (nIndex % 2) * 245, stStart.nY - Math.floor(nIndex / 2) * 82);
let goItem = SKUIUtil.createSubNode(goContent, stPos, this.btnMallInfo, '');
goItem.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NpcShopUI", 'OnClickGoods', nIndex));
this.SetGoodsInfo(goItem, this.vecGoodsInfo[nIndex]);
this.vecTmpGoods.push(goItem);
}
this.OnClickGoods(0,this.selectedGoods);
goContent.height = Math.max(goContent.height, Math.ceil((this.vecGoodsInfo.length + 1) / 2) * 80 + 60);
},
OnClickGoods(e, nIndex) {
CPubFunction.ChangeTeamNodeState(this.vecMutexNode, 1);
CPubFunction.ChangeTeamButtonState(this.vecTmpGoods, 'Common/ui_common', 'ui_common_public_list0', 'ui_common_public_list2', nIndex);
this.pGoodsInfo = this.vecGoodsInfo[nIndex];
let pItemInfo = {};
this.selectedGoods = nIndex;
if (this.pGoodsInfo.type && this.pGoodsInfo.type == 'weapon') {
let equipdata = GameModel.conf_equip[this.pGoodsInfo.itemid];
if(!equipdata){
cc.warn(`$警告:NPC商店,武器${this.pGoodsInfo.itemid}找不到定義`);
return;
}
pItemInfo.name = equipdata.Name;
pItemInfo.icon = equipdata.Shape;
pItemInfo.description = equipdata.Detail;
let indexarr = ['武器','項鍊','衣服','頭盔','鞋子','翅膀'];
let sexarr = ['男', '女'];
let racearr = ['人', '仙', '魔', '鬼', '龍'];
pItemInfo.description += '\n' + `【裝備部位】${indexarr[equipdata.Index - 1]}`;
if (equipdata.Sex == 9 || equipdata.Race == 9) {
pItemInfo.description += '\n' + '【裝備適用】通用';
}
else if (equipdata.OwnerRoleId && equipdata.OwnerRoleId > 0) {
pItemInfo.description += '\n' + `【裝備適用】${GameUtil.roleName[equipdata.OwnerRoleId]}`;
} else {
pItemInfo.description += '\n' + `【裝備適用】${sexarr[equipdata.Sex - 1]}${racearr[equipdata.Race - 1]}`;
}
pItemInfo.description += '\n' + `【等級要求】${equipdata.NeedGrade}`;
if (equipdata.BaseAttr) {
let basearr = equipdata.BaseAttr.split(';');
for (const item of basearr) {
let itemarr = item.split(':');
if (itemarr.length == 2 && GameUtil.attrEquipType[itemarr[0]] != null) {
let key = GameUtil.attrEquipType[itemarr[0]];
let value = Number(itemarr[1]);
let valuestr = '';
if (GameUtil.equipTypeNumerical.indexOf(Number(key)) == -1){
valuestr = (value > 0 ? '+' : '') + (value / 10).toFixed(1) + '%';
}
else {
valuestr = (value > 0 ? '+' : '') + value;
}
pItemInfo.description += '\n' + GameUtil.getAttrTypeL1Name(key) + ' ' + valuestr;
}
}
}
}
else {
pItemInfo = ItemUtil.getItemData(this.pGoodsInfo.itemid);
}
cc.find('picFrame/nodDetail/picText/Label', this.node).getComponent(cc.Label).string = pItemInfo.name;
cc.find('picFrame/nodDetail/txDiscrib', this.node).getComponent(cc.Label).string = pItemInfo.description;
cc.find('picFrame/nodDetail/nodNum/numLabel', this.node).getComponent(cc.Label).string = 1;
this.SetBuyCnt(1);
if(this.pGoodsInfo.quantity != null){
this.selectedGoodsQuantity = this.pGoodsInfo.quantity;
if(this.pGoodsInfo.quantity == 0)
this.SetBuyCnt(0);
}
},
OpenNumPad(e, d) {
let goNumPad = CPubFunction.CreateSubNode(cc.find('Canvas/MainUI'), { nX: 60, nY: 195 }, this.NumPad, 'NumPad');
goNumPad.getComponent('NumPad').NumPad_Init((nNum) => {
let nCnt = CPubFunction.ChangeNumToRange(nNum, 1, 10000);
this.SetBuyCnt(nCnt);
});
},
SetBuyCnt(nBuyCnt) {
if (this.pGoodsInfo == null)
return;
this.nBuyCnt = nBuyCnt;
let nMoney = this.pGoodsInfo.price;
cc.find('picFrame/nodDetail/nodNum/numLabel', this.node).getComponent(cc.Label).string = nBuyCnt;
cc.find('picFrame/nodDetail/btnOK/money', this.node).getComponent(cc.Label).string = nBuyCnt * nMoney;
SKUIUtil.setSpriteFrame(cc.find('picFrame/nodDetail/btnOK/icon', this.node), 'Common/ui_common', this.GetMoneyIconFile(this.pGoodsInfo.moneykind));
},
ChangeBuyCnt(stEvent, nAdd) {
if (this.pGoodsInfo == null)
return;
let nNewNum = CPubFunction.ChangeNumToRange(this.nBuyCnt + nAdd, 1, this.selectedGoodsQuantity);
this.SetBuyCnt(nNewNum);
},
OnBuy() {
if (null == this.pGoodsInfo)
return;
GameModel.send('c2s_buy_from_npc', { nConfigID: this.nNpcConfigID, nItemID: this.pGoodsInfo.itemid, nCnt: this.nBuyCnt });
},
SetMoneyInfo() {
let topnode = cc.find('topInfo', this.node);
let toplogic = topnode.getComponent('TopInfo');
toplogic.updateGameMoney();
},
});

View File

@ -0,0 +1,68 @@
let GameRes = require('./GameRes');
let CPubFunction = require('./PubFunction');
let CSpeak = require('./Speak');
let pNpcMgr = require('./NpcMgr');
cc.Class({
extends: cc.Component,
properties:
{
},
onLoad()
{
this.pCallBack = null;
let goOld = cc.find('NumPad');
if (goOld != null )
{
goOld.destroy();
}
},
NumPad_Init( pCallBack )
{
this.pCallBack = pCallBack;
},
start()
{
let vecChild = this.node.getChildren();
for (let it in vecChild)
{
let strName = vecChild[it].name;
cc.find(strName, this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "NumPad", "OnButton", strName));
}
this.nNum = 0;
},
OnButton(e, strBtn)
{
if (null == this.pCallBack)
return;
if (CPubFunction.IsDataInVecter(strBtn, ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']))
{
this.nNum = this.nNum *10 + parseInt(strBtn);
}
if (CPubFunction.IsDataInVecter(strBtn, ['delete']))
{
this.nNum = 0;
}
if (CPubFunction.IsDataInVecter(strBtn, ['ok', 'btnClose']))
{
this.node.destroy();
}
this.pCallBack(this.nNum);
},
});

View File

@ -0,0 +1,339 @@
import GameModel from "../ts/core/GameModel";
import ItemUtil from "../ts/core/ItemUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import Report from "../ts/gear_2.3.4/net/Report";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
import SkillUtil from "../ts/game/skill/core/SkillUtil";
import GameUtil from "../ts/core/GameUtil";
import ExpUtil from "../ts/core/ExpUtil";
import MsgAlert from "../ts/game/msg/MsgAlert";
let CPubFunction = require('./PubFunction');
let CMainPlayerInfo = require('./MainPlayerInfo');
cc.Class({
extends: cc.Component,
properties: {
itemUI: cc.Prefab,
rowPartnerAttrib: cc.Prefab,
goAtribLine: cc.Prefab,
rowPartnerZiZhi: cc.Prefab,
ChuanGongUI: cc.Prefab,
btnPartner: cc.Prefab,
},
onLoad() {
let avatar = cc.find('nodRole/avater', this.node);
if (avatar) {
avatar.active = false;
}
},
start() {
this.svPartnerAttribute = cc.find('svPartnerAttribute', this.node);
this.cvZiZhi = cc.find('cvZiZhi', this.node);
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "Close", 0));
cc.find('btnChangeState', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "ChangePartnerState", 0));
cc.find('btnChuanGong', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "OpenChunGongUI", 0));
cc.find('btnRelive', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "DoRelive", 0));
cc.find('nodRole/btnKangXing', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "ShowAttribute", 0));
cc.find('svPartnerAttribute/btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "CloseAtrib", 0));
cc.find('nodRole/btnZiZhi', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "ShowZiZhi", 0));
cc.find('cvZiZhi/btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "CloseZiZhi", 0));
cc.find('nodRole/btnAddExp', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "ShowBook", 0));
this.nCurSelect = -1;
this.vecPartnerBtn = [];
this.vecAtrib = [];
this.ShowPartnerList();
GameModel.send('c2s_get_bagitem', { roleid: Report.roleId });
GameModel.send('c2s_ask_partner_list', { nRoleID: Report.roleId });
},
CloseAtrib() {
this.svPartnerAttribute.active = false;
},
CloseZiZhi() {
this.cvZiZhi.active = false;
},
ReplaceAtriPos(contentRow, mapAll) {
let nCurY = 0;
contentRow.height = 480;
for (var itAll in mapAll) {
nCurY -= 50;
let goTitle = SKUIUtil.createSubNode(contentRow, cc.v2(300, nCurY), this.rowPartnerAttrib, 'rowPartnerAttrib');
goTitle.getComponent(cc.Label).string = itAll;
cc.find('Value', goTitle).getComponent(cc.Label).string = '';
this.vecAtrib.push(goTitle);
nCurY -= 20;
let goLine = SKUIUtil.createSubNode(contentRow, cc.v2(330, nCurY), this.goAtribLine, 'goAtribLine');
this.vecAtrib.push(goLine);
let mapAtrib = mapAll[itAll];
let nIndex = -1;
for (var it in mapAtrib) {
nIndex++;
let bNewLine = (nIndex % 2) == 0 ? true : false;
nCurY -= bNewLine ? 50 : 0;
let goAtrib = CPubFunction.CreateSubNode(contentRow, { nX: (bNewLine ? 72 : 372), nY: nCurY }, this.rowPartnerAttrib, 'rowPartnerAttrib');
goAtrib.getComponent(cc.Label).string = CPubFunction.GetAttributeName(it);
let nValue = mapAtrib[it];
let bIn = false;
if (CPubFunction.IsDataInVecter(it, ['Atk', 'Speed', 'AdDefEhan', 'HitCombo', 'HpMax', 'MpMax', 'Basecon', 'Wakan', 'Power', 'Agility'])) {
bIn = true;
}
nValue = bIn ? nValue : nValue / 10;
let strValue = bIn ? `${nValue}` : `${nValue}%`;
cc.find('Value', goAtrib).getComponent(cc.Label).string = strValue;
this.vecAtrib.push(goAtrib);
}
}
contentRow.height = Math.max(contentRow.height, Math.abs(nCurY) + 50);
},
//zzzErr
ShowAttribute() {
this.svPartnerAttribute.active = true;
let contentRow = cc.find('view/content', this.svPartnerAttribute);
SKUIUtil.destroyList(this.vecAtrib);
let mapInfo = this.GetCurSelectPartnerInfo();
let mapFenLei = {};
for (var it in mapInfo) {
let strTypeName = CPubFunction.GetAttributeType(it);
if ('' == strTypeName)
continue;
if (SKDataUtil.hasProperty(mapFenLei, strTypeName) == false)
mapFenLei[strTypeName] = {};
mapFenLei[strTypeName][it] = mapInfo[it];
}
this.ReplaceAtriPos(contentRow, mapFenLei);
},
ShowZiZhi() {
this.cvZiZhi.active = true;
SKUIUtil.destroyList(this.vecAtrib);
let mapCurInfo = this.GetCurSelectPartnerInfo();
if (!mapCurInfo) {
return;
}
cc.find('DingWei/Label', this.cvZiZhi).getComponent(cc.Label).string = mapCurInfo['dingwei'];
let mapZiZhi = SKDataUtil.jsonBy(mapCurInfo['mapZiZhi']);
let nCurY = 84;
let nIndex = -1;
for (var it in mapZiZhi) {
nIndex++;
let bNewLine = (nIndex % 2) == 0 ? true : false;
nCurY -= bNewLine ? 40 : 0;
let rowPartnerZiZhi = CPubFunction.CreateSubNode(this.cvZiZhi, { nX: (bNewLine ? -230 : 17), nY: nCurY }, this.rowPartnerZiZhi, 'rowPartnerZiZhi');
rowPartnerZiZhi.getComponent(cc.Label).string = CPubFunction.GetAttributeName(it);
let nValue = mapZiZhi[it];
cc.find('picPecent/Label', rowPartnerZiZhi).getComponent(cc.Label).string = `${nValue}%`;
cc.find('picPecent/picBar', rowPartnerZiZhi).width = nValue;
this.vecAtrib.push(rowPartnerZiZhi);
}
},
loadInfo(info) {
let data = ItemUtil.getItemData(info.itemid);
if (data) {
this.itemInfo = data;
this.itemInfo.count = info.count;
this.itemBg.active = true;
this.itemCount.string = info.count;
this.itemIcon.spriteFrame = ItemUtil.getItemIconBy(this.itemInfo);
}
},
ShowBook(e, d) {
if (this.itemui) {
let valid = SKUIUtil.isValid(this.itemui);
if (valid) {
this.itemui.destroy();
}
this.itemui = null;
}
let stPartnerInfo = this.GetCurSelectPartnerInfo();
this.itemui = cc.instantiate(this.itemUI);
this.itemui.parent = this.node;
this.itemui.getComponent('UseItemUI').setUIPos(220, -150);
this.itemui.getComponent('UseItemUI').loadList('點擊/長按可使用修煉冊', [10202, 10204], stPartnerInfo.id, true);
},
OnReceiveBagItem() {
if (this.itemui != null && this.itemui.parent != null) {
this.itemui.getComponent('UseItemUI').refreshInfoNum();
// this.ShowBook();
}
},
GetPartnerInfoByPartnerID(nID) {
for (var it in CMainPlayerInfo.vecPartnerInfo) {
if (CMainPlayerInfo.vecPartnerInfo[it].id == nID)
return CMainPlayerInfo.vecPartnerInfo[it];
}
return null;
},
GetCurSelectPartnerInfo() {
if (this.nCurSelect >= CMainPlayerInfo.vecPartnerInfo)
return null;
return CMainPlayerInfo.vecPartnerInfo[this.nCurSelect];
},
DoRelive() {
let pPartnerInfo = this.GetCurSelectPartnerInfo();
if (null == pPartnerInfo)
return;
GameModel.send('c2s_partner_relive', { nPartnerID: pPartnerInfo.id });
},
OpenChunGongUI() {
let goUI = CPubFunction.CreateSubNode(cc.find('Canvas/MainUI'), { nX: 0, nY: 0 }, this.ChuanGongUI, 'ChuanGongUI');
if (CMainPlayerInfo.vecPartnerInfo.length < 2)
return;
goUI.getComponent('ChuanGongUI').Init(CMainPlayerInfo.vecPartnerInfo, this.nCurSelect);
},
GetFreePos() {
for (var it in CMainPlayerInfo.vecChuZhan) {
if (CMainPlayerInfo.vecChuZhan[it] == 0)
return it;
}
return -1;
},
ChangePartnerState() {
if (CMainPlayerInfo.vecPartnerInfo.length <= this.nCurSelect || this.vecPartnerBtn.length <= this.nCurSelect)
return;
let stInfo = CMainPlayerInfo.vecPartnerInfo[this.nCurSelect];
let nChuZhanPos = CMainPlayerInfo.GetParterChuZhanPos(stInfo.id);
if (nChuZhanPos == -1) {
let nToPos = this.GetFreePos();
if (nToPos == -1) {
MsgAlert.addMsg("最多只能4個夥伴參戰!");
return;
}
cc.find('picState', this.vecPartnerBtn[this.nCurSelect]).active = true;
CMainPlayerInfo.ChangeChuZhan(nToPos, stInfo.id);
GameModel.send('c2s_change_partner_state', { nPartnerID: stInfo.id, nPos: nToPos });
}
else {
cc.find('picState', this.vecPartnerBtn[this.nCurSelect]).active = false;
CMainPlayerInfo.ChangeChuZhan(nChuZhanPos, 0);
GameModel.send('c2s_change_partner_state', { nPartnerID: 0, nPos: nChuZhanPos });
}
this.SetButtonText(stInfo.id);
},
ShowPartnerList() {
SKUIUtil.destroyList(this.vecPartnerBtn);
let goContent = cc.find('svPartnerList/view/content', this.node);
let stStart = { nX: 120, nY: -45 };
for (let i = 0; i < CMainPlayerInfo.vecPartnerInfo.length; i++) {
let stInfo = CMainPlayerInfo.vecPartnerInfo[i];
let goPartner = CPubFunction.CreateSubNode(goContent, { nX: stStart.nX, nY: stStart.nY - i * 90 }, this.btnPartner, 'btnPartner');
goPartner.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PartnerUI", "ShowPartnerInfo", i));
SKUIUtil.setSpriteFrame(cc.find('HeadPic/Icon', goPartner), 'Common/huoban', 'huoban_' + stInfo.resid);
cc.find('Name', goPartner).getComponent(cc.Label).string = stInfo.name;
let level_lb = cc.find('Level', goPartner).getComponent(cc.Label);
GameUtil.setReliveLabel(level_lb, 0, stInfo.relive, stInfo.level);
cc.find('picState', goPartner).active = CMainPlayerInfo.GetParterChuZhanPos(stInfo.id) >= 0;
if (this.vecPartnerBtn) {
this.vecPartnerBtn.push(goPartner);
}
}
goContent.height = Math.max(goContent.height, CMainPlayerInfo.vecPartnerInfo.length * 90);
this.ShowPartnerInfo(0, 0);
},
ChangePartnerExp(nResID, nExp) {
for (var it in CMainPlayerInfo.vecPartnerInfo) {
if (CMainPlayerInfo.vecPartnerInfo[it].resid == nResID) {
CMainPlayerInfo.vecPartnerInfo[it].exp = nExp;
break;
}
}
},
ShowPartnerInfo(stEvent, nIndex) {
let stInfo = CMainPlayerInfo.vecPartnerInfo[nIndex];
if (!stInfo) {
return;
}
cc.find('nodRole/Name', this.node).getComponent(cc.Label).string = stInfo.name;
let level_lb = cc.find('nodRole/Level', this.node).getComponent(cc.Label);
GameUtil.setReliveLabel(level_lb, 0, stInfo.relive, stInfo.level);
// cc.log(`${stInfo.name},${stInfo.relive},${stInfo.level}`);
cc.find('nodRole/DingWei/Label', this.node).getComponent(cc.Label).string = stInfo.dingwei;
SKUIUtil.setSpriteFrame(cc.find('nodRole/Race', this.node), 'Common/ui_common', CPubFunction.GetRaceFileName(stInfo.race));
for (var itSkill in stInfo.skill_list) {
SKUIUtil.setSpriteFrameFgui(cc.find('nodRole/nodSkill', this.node), itSkill);
// SKUIUtil.setSpriteFrame(cc.find('nodRole/nodSkill', this.node), 'icon/skill', itSkill);
cc.find('nodRole/nodSkill/Name', this.node).getComponent(cc.Label).string = SkillUtil.getSkill(itSkill).name;
cc.find('nodRole/nodSkill/SkillExp/Label', this.node).getComponent(cc.Label).string = stInfo.skill_list[itSkill];
break;
}
cc.find('nodRole/Blood/Title/Label', this.node).getComponent(cc.Label).string = stInfo.HpMax;
cc.find('nodRole/Atk/Title/Label', this.node).getComponent(cc.Label).string = stInfo.Atk;
cc.find('nodRole/Speed/Title/Label', this.node).getComponent(cc.Label).string = stInfo.Speed;
let nMax = ExpUtil.getPartnerUpgradeExp(stInfo.relive, stInfo.level);
let strTmp = `${stInfo.exp}/${nMax}`;
cc.find('nodRole/nodExp/picText/Label', this.node).getComponent(cc.Label).string = strTmp;
let fPercent = Math.min(stInfo.exp / nMax, 1);
cc.find('nodRole/nodExp/picText/picBar', this.node).width = cc.find('nodRole/nodExp/picText', this.node).width * fPercent;
this.SetButtonText(stInfo.id);
level_lb = cc.find('Level', this.vecPartnerBtn[nIndex]).getComponent(cc.Label);
GameUtil.setReliveLabel(level_lb, 0, stInfo.relive, stInfo.level);
if (this.nCurSelect != nIndex) {
this.nCurSelect = nIndex;
let target = cc.find('nodRole/goAvater', this.node);
let avatar = cc.find('nodRole/avater', this.node);
SKUIUtil.showDragonBone(target, `dragonbone/${stInfo.resid}`, "idle", avatar, `ui/photo/${stInfo.resid}`);
}
},
SetButtonText(nPartnerID) {
let nPos = CMainPlayerInfo.GetParterChuZhanPos(nPartnerID);
cc.find('btnChangeState/Label', this.node).getComponent(cc.Label).string = nPos == -1 ? '參戰' : '休息';
},
Close() {
this.node.destroy();
let goTeamUI = cc.find('Canvas/MainUI/TeamUI');
if (goTeamUI) {
goTeamUI.getComponent('TeamUI').CreateCardList();
}
},
});

View File

@ -0,0 +1,273 @@
import ExpUtil from "../ts/core/ExpUtil";
import GameModel from "../ts/core/GameModel";
import {EAttrTypeL1,EAttrTypeL2} from "../ts/core/EEnum";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
var PracticeMgr = require('./PetPracticeMgr');
class PetLogic {
constructor() {}
init() {
this.petid = 0; //數據庫中的寵物id
this.resid = 0; //資源id
this.dataid = 0;
this.aptitude=0;
this.intro = ''; //介紹
this.name = '';
this.relive = 0;
this.level = 0;
this.grade = 0;
this.skill = [];
this.shenSkill = 0;
this.rate = 0;
this.hp = 0;
this.mp = 0;
this.atk = 0;
this.spd = 0;
this.cur_aptitude = 0;
this.cur_hp = 0;
this.cur_mp = 0;
this.cur_atk = 0;
this.cur_spd = 0;
this.exp = 0;
this.maxexp = 0;
this.ppoint = {};
this.dpoint = {};
this.wuxing = {};
this.xexp = 0;
this.xlevel = 0;
this.longgu = 0;
this.qianneng = 0;
this.ppointT = {};
this.dpointT = {};
this.xiulianfree = 0;
this.xiulianleft = 0;
this.xmaxexp = 0;
this.maxskillcnt = 4;
this.petcolor = -1;
this.qinmi = 0;
this.maxRate = 0;
}
createPet(petid) {
// this.setInfo(info);
GameModel.send('c2s_create_pet', {
petid: petid,
});
}
setInfo(info) {
this.init();
this.petinfo = info;
if (this.petinfo == null) {
return;
}
let skilllist = {};
if(info.petid){
this.petid=info.petid;
}
if(info.dataid){
this.dataid = info.dataid;
}
if(info.resid){
this.resid = info.resid;
}
if(info.intro){
this.intro = info.intro;
}
if(info.name){
this.name = info.name;
}
if(info.relive){
this.relive = info.relive;
}
if(info.level){
this.level = info.level;
}
if(info.grade){
this.grade = info.grade;
}
if(info.skill){
skilllist = SKDataUtil.jsonBy(info.skill);
}
if(info.shenskill){
this.shenSkill = info.shenskill;
}
if(info.rate){
this.rate=info.rate / 10000;
}
if(info.aptitude){
this.aptitude=info.aptitude;
}
if(info.hp){
this.hp = info.hp;
}
if(info.mp){
this.mp = info.mp;
}
if(info.atk){
this.atk = info.atk;
}
if(info.spd){
this.spd = info.spd;
}
if(info.exp){
this.exp = info.exp;
}
if(info.ppoint){
this.ppoint = SKDataUtil.jsonBy(info.ppoint);
}
if(info.dpoint){
this.dpoint = SKDataUtil.jsonBy(info.dpoint);
}
info.wuxing && (this.wuxing = SKDataUtil.jsonBy(info.wuxing));
info.xexp && (this.xexp = SKDataUtil.jsonBy(info.xexp));
info.xlevel && (this.xlevel = SKDataUtil.jsonBy(info.xlevel));
info.longgu && (this.longgu = info.longgu);
info.maxskillcnt && (this.maxskillcnt = info.maxskillcnt);
info.color && (this.petcolor = info.color);
info.qinmi && (this.qinmi = info.qinmi);
info.maxrate && (this.maxRate = info.maxrate / 10000);
if (info.attr1) {
this.attr1 = SKDataUtil.jsonBy(info.attr1);
this.cur_aptitude = this.attr1[EAttrTypeL1.Aptitude];
this.cur_hp = this.attr1[EAttrTypeL1.HP];
this.cur_mp = this.attr1[EAttrTypeL1.MP];
this.cur_atk = this.attr1[EAttrTypeL1.ATK];
this.cur_spd = this.attr1[EAttrTypeL1.SPD];
}
this.petinfo.skill = skilllist;
for (let key in skilllist) {
if (SKDataUtil.hasProperty(skilllist,key)){
this.skill.push(key);
}
}
this.maxexp = ExpUtil.getSummonUpGradeExp(this.relive, this.level);
this.xmaxexp = PracticeMgr.GetUpdateHunPo(info.xlevel);
this.initPoint();
this.calculateAttribute();
}
initPoint() {
for(let key in EAttrTypeL2){
let value=SKDataUtil.toNumber(key);
if(isNaN(value)){
continue;
}
let element=this.ppoint[value];
if(element==null){
this.ppoint[value]=0;
}
this.ppoint[value]+=this.petinfo.level;
this.ppointT[value]=0;
}
(this.dpoint[EAttrTypeL1.K_SEAL] == null) && (this.dpoint[EAttrTypeL1.K_SEAL] = 0);
(this.dpoint[EAttrTypeL1.K_CONFUSION] == null) && (this.dpoint[EAttrTypeL1.K_CONFUSION] = 0);
(this.dpoint[EAttrTypeL1.K_SLEEP] == null) && (this.dpoint[EAttrTypeL1.K_SLEEP] = 0);
(this.dpoint[EAttrTypeL1.K_FORGET] == null) && (this.dpoint[EAttrTypeL1.K_FORGET] = 0);
this.dpointT[EAttrTypeL1.K_SEAL] = 0;
this.dpointT[EAttrTypeL1.K_CONFUSION] = 0;
this.dpointT[EAttrTypeL1.K_SLEEP] = 0;
this.dpointT[EAttrTypeL1.K_FORGET] = 0;
(this.dpoint[EAttrTypeL1.K_WIND] == null) && (this.dpoint[EAttrTypeL1.K_WIND] = 0);
(this.dpoint[EAttrTypeL1.K_WATER] == null) && (this.dpoint[EAttrTypeL1.K_WATER] = 0);
(this.dpoint[EAttrTypeL1.K_FIRE] == null) && (this.dpoint[EAttrTypeL1.K_FIRE] = 0);
(this.dpoint[EAttrTypeL1.K_POISON] == null) && (this.dpoint[EAttrTypeL1.K_POISON] = 0);
(this.dpoint[EAttrTypeL1.K_THUNDER] == null) && (this.dpoint[EAttrTypeL1.K_THUNDER] = 0);
(this.dpoint[EAttrTypeL1.K_WILDFIRE] == null) && (this.dpoint[EAttrTypeL1.K_WILDFIRE] = 0);
(this.dpoint[EAttrTypeL1.K_BLOODRETURN] == null) && (this.dpoint[EAttrTypeL1.K_BLOODRETURN] = 0);
(this.dpoint[EAttrTypeL1.K_DETER] == null) && (this.dpoint[EAttrTypeL1.K_DETER] = 0);
this.dpointT[EAttrTypeL1.K_WIND] = 0;
this.dpointT[EAttrTypeL1.K_WATER] = 0;
this.dpointT[EAttrTypeL1.K_FIRE] = 0;
this.dpointT[EAttrTypeL1.K_POISON] = 0;
this.dpointT[EAttrTypeL1.K_THUNDER] = 0;
this.dpointT[EAttrTypeL1.K_WILDFIRE] = 0;
this.dpointT[EAttrTypeL1.K_BLOODRETURN] = 0;
this.dpointT[EAttrTypeL1.K_DETER] = 0;
(this.dpoint[EAttrTypeL1.PHY_GET] == null) && (this.dpoint[EAttrTypeL1.PHY_GET] = 0);
(this.dpoint[EAttrTypeL1.PHY_HIT] == null) && (this.dpoint[EAttrTypeL1.PHY_HIT] = 0);
(this.dpoint[EAttrTypeL1.PHY_DODGE] == null) && (this.dpoint[EAttrTypeL1.PHY_DODGE] = 0);
(this.dpoint[EAttrTypeL1.PHY_COMBO] == null) && (this.dpoint[EAttrTypeL1.PHY_COMBO] = 0);
(this.dpoint[EAttrTypeL1.PHY_COMBO_PROB] == null) && (this.dpoint[EAttrTypeL1.PHY_COMBO_PROB] = 0);
(this.dpoint[EAttrTypeL1.PHY_DEADLY] == null) && (this.dpoint[EAttrTypeL1.PHY_DEADLY] = 0);
(this.dpoint[EAttrTypeL1.PHY_BREAK] == null) && (this.dpoint[EAttrTypeL1.PHY_BREAK] = 0);
(this.dpoint[EAttrTypeL1.PHY_BREAK_PROB] == null) && (this.dpoint[EAttrTypeL1.PHY_BREAK_PROB] = 0);
(this.dpoint[EAttrTypeL1.PHY_REBOUND_PROB] == null) && (this.dpoint[EAttrTypeL1.PHY_REBOUND_PROB] = 0);
(this.dpoint[EAttrTypeL1.PHY_REBOUND] == null) && (this.dpoint[EAttrTypeL1.PHY_REBOUND] = 0);
this.dpointT[EAttrTypeL1.PHY_GET] = 0;
this.dpointT[EAttrTypeL1.PHY_HIT] = 0;
this.dpointT[EAttrTypeL1.PHY_DODGE] = 0;
this.dpointT[EAttrTypeL1.PHY_COMBO] = 0;
this.dpointT[EAttrTypeL1.PHY_COMBO_PROB] = 0;
this.dpointT[EAttrTypeL1.PHY_DEADLY] = 0;
this.dpointT[EAttrTypeL1.PHY_BREAK] = 0;
this.dpointT[EAttrTypeL1.PHY_BREAK_PROB] = 0;
this.dpointT[EAttrTypeL1.PHY_REBOUND_PROB] = 0;
this.dpointT[EAttrTypeL1.PHY_REBOUND] = 0;
}
calculateAttribute() {
this.calculateProperty();
this.calculateKang();
// this.calPassiveSkillAttr();
}
calculateProperty() {
let qianneng=this.level * 8 - this.ppoint[EAttrTypeL1.BONE] - this.ppoint[EAttrTypeL1.SPIRIT] - this.ppoint[EAttrTypeL1.STRENGTH] - this.ppoint[EAttrTypeL1.DEXTERITY];
this.qianneng = Math.max(0,qianneng);
}
calculateKang() {
this.dfengyin = this.attr1[EAttrTypeL1.K_SEAL]; // this.dpoint[EAttrTypeL1.K_SEAL] * 4;
this.dhunlun = this.attr1[EAttrTypeL1.K_CONFUSION]; // this.dpoint[EAttrTypeL1.K_CONFUSION] * 4;
this.dhunshui = this.attr1[EAttrTypeL1.K_SLEEP]; // this.dpoint[EAttrTypeL1.K_SLEEP] * 4;
this.dyiwang = this.attr1[EAttrTypeL1.K_FORGET]; // this.dpoint[EAttrTypeL1.K_FORGET] * 4;
this.dfeng = this.attr1[EAttrTypeL1.K_WIND]; // this.dpoint[EAttrTypeL1.K_WIND] * 4;
this.dshui = this.attr1[EAttrTypeL1.K_WATER]; // this.dpoint[EAttrTypeL1.K_WATER] * 4;
this.dhuo = this.attr1[EAttrTypeL1.K_FIRE]; // this.dpoint[EAttrTypeL1.K_FIRE] * 4;
this.ddu = this.attr1[EAttrTypeL1.K_POISON]; // this.dpoint[EAttrTypeL1.K_POISON] * 4;
this.dlei = this.attr1[EAttrTypeL1.K_THUNDER]; // this.dpoint[EAttrTypeL1.K_THUNDER] * 4;
this.dguihuo = this.attr1[EAttrTypeL1.K_WILDFIRE]; // this.dpoint[EAttrTypeL1.K_WILDFIRE] * 4;
this.dsanshi = this.attr1[EAttrTypeL1.K_BLOODRETURN]; // this.dpoint[EAttrTypeL1.K_BLOODRETURN] * 4;
this.dzhenshe = this.attr1[EAttrTypeL1.K_DETER];
this.pxishou = this.attr1[EAttrTypeL1.K_PHY_GET]; // this.dpoint[EAttrTypeL1.PHY_GET] * 3;
this.pmingzhong = this.attr1[EAttrTypeL1.PHY_HIT]; // this.dpoint[EAttrTypeL1.PHY_HIT] * 1.5;
this.pshanbi = this.attr1[EAttrTypeL1.PHY_DODGE]; // this.dpoint[EAttrTypeL1.PHY_DODGE] * 1.5;
this.plianji = 3 + this.attr1[EAttrTypeL1.PHY_COMBO]; // this.dpoint[EAttrTypeL1.PHY_COMBO] * 1;
this.plianjilv = this.attr1[EAttrTypeL1.PHY_COMBO_PROB]; // this.dpoint[EAttrTypeL1.PHY_COMBO_PROB] * 1.5;
this.pkuangbao = this.attr1[EAttrTypeL1.PHY_DEADLY]; // this.dpoint[EAttrTypeL1.PHY_DEADLY] * 1.5;
this.ppofang = this.attr1[EAttrTypeL1.PHY_BREAK]; // this.dpoint[EAttrTypeL1.PHY_BREAK] * 3;
this.ppofanglv = this.attr1[EAttrTypeL1.PHY_BREAK_PROB]; // this.dpoint[EAttrTypeL1.PHY_BREAK_PROB] * 3;
this.pfanzhenlv = this.attr1[EAttrTypeL1.PHY_REBOUND_PROB]; // this.dpoint[EAttrTypeL1.PHY_REBOUND_PROB] * 4;
this.pfanzhen = this.attr1[EAttrTypeL1.PHY_REBOUND]; // this.dpoint[EAttrTypeL1.PHY_REBOUND] * 4;
this.xiulianfree = PracticeMgr.GetLevelPoint(this.petinfo.relive, this.petinfo.xlevel);
this.xiulianleft = this.xiulianfree;
for (let key in this.dpoint) {
this.xiulianleft -= this.dpoint[key];
}
}
getMaxAddPoint(type) {
return PracticeMgr.GetMaxAddPoint(this.relive, type);
}
getMaxLongGu() {
if (this.relive == 0) return 2;
if (this.relive == 1) return 4;
if (this.relive == 2) return 7;
if (this.relive == 3) return 12;
if (this.relive == 4) return 12;
}
}
module.exports = {
PetLogic
};

View File

@ -0,0 +1,212 @@
import { EAttrTypeL1 } from "../ts/core/EEnum";
let MaxPointKang = {
[EAttrTypeL1.K_SEAL]: [16, 20, 24, 26, 26],
[EAttrTypeL1.K_CONFUSION]: [16, 20, 24, 26, 26],
[EAttrTypeL1.K_SLEEP]: [16, 20, 24, 26, 26],
[EAttrTypeL1.K_FORGET]: [16, 20, 24, 26, 26],
[EAttrTypeL1.K_WIND]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_WATER]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_FIRE]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_POISON]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_THUNDER]: [10, 12, 14, 16, 15],
[EAttrTypeL1.K_WILDFIRE]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_BLOODRETURN]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_DETER]: [10, 12, 14, 16, 16],
[EAttrTypeL1.PHY_GET]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_HIT]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_DODGE]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_COMBO]: [3, 3, 3, 3, 3],
[EAttrTypeL1.PHY_COMBO_PROB]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_DEADLY]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_BREAK]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_BREAK_PROB]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_REBOUND_PROB]: [10, 13, 16, 16, 16],
[EAttrTypeL1.PHY_REBOUND]: [10, 13, 16, 19, 19]
};
let HunPo = {
[0]: 825,
[1]: 2112,
[2]: 3717,
[3]: 7416,
[4]: 10188,
[5]: 16600,
[6]: 25062,
[7]: 30738,
[8]: 36482,
[9]: 43517,
[10]: 48900,
[11]: 53966,
[12]: 54851,
[13]: 55801,
[14]: 56815,
[15]: 57893,
[16]: 59033,
[17]: 60236,
[18]: 61501,
[19]: 62826,
[20]: 64212,
[21]: 65659,
[22]: 67165,
[23]: 68731,
[24]: 70355,
[25]: 76079,
[26]: 78181,
[27]: 80358,
[28]: 82609,
[29]: 84933,
[30]: 87330,
[31]: 89801,
[32]: 92344,
[33]: 94960,
[34]: 97648,
[35]: 100408,
[36]: 103240,
[37]: 107595,
[38]: 114602,
[39]: 121909,
[40]: 129524,
[41]: 137452,
[42]: 145700,
[43]: 154274,
[44]: 163181,
[45]: 172426,
[46]: 182015,
[47]: 191956,
[48]: 202254,
[49]: 212915,
[50]: 286043,
[51]: 301089,
[52]: 326641,
[53]: 342707,
[54]: 359295,
[55]: 376411,
[56]: 394314,
[57]: 418064,
[58]: 447245,
[59]: 466989,
[60]: 487304,
[61]: 508197,
[62]: 529676,
[63]: 551748,
[64]: 574421,
[65]: 594158,
[66]: 621514,
[67]: 646266,
[68]: 671650,
[69]: 697673,
[70]: 754342,
[71]: 781665,
[72]: 829648,
[73]: 838300,
[74]: 907627,
[75]: 1082194,
[76]: 1283276,
[77]: 1317827,
[78]: 1334797,
[79]: 1351800,
[80]: 1368836,
[81]: 1385907,
[82]: 1403010,
[83]: 1420148,
[84]: 1437320,
[85]: 1454526,
[86]: 1471766,
[87]: 1489040,
[88]: 1506348,
[89]: 1523691,
[90]: 1541069,
[91]: 1558481,
[92]: 1575928,
[93]: 1593410,
[94]: 1610926,
[95]: 1628478,
[96]: 1646065,
[97]: 1663687,
[98]: 1681345,
[99]: 1699037,
[100]: 1719180,
[101]: 1734290,
[102]: 1749386,
[103]: 1764470,
[104]: 1779542,
[105]: 1794601,
[106]: 1809649,
[107]: 1824685,
[108]: 1839709,
[109]: 1854722,
[110]: 1869725,
[111]: 1884716,
[112]: 1899697,
[113]: 1914667,
[114]: 1929627,
[115]: 1944577,
[116]: 1959517,
[117]: 1974447,
[118]: 1989368,
[119]: 2004279,
[120]: 2019181,
[121]: 2034074,
[122]: 2048959,
[123]: 2063834,
[124]: 2078701,
[125]: 0,
};
let MaxPracticeLevel = {
[0]: 25,
[1]: 50,
[2]: 75,
[3]: 100,
[4]: 125
};
let MaxPracticePoint = {
[0]: 25,
[1]: 50,
[2]: 75,
[3]: 100,
[4]: 125
};
class PetPracticeMgr {
constructor() {
}
Init() {
}
GetMaxAddPoint(relive, type) {
return MaxPointKang[type][relive];
}
GetUpdateHunPo(level) {
return HunPo[level];
}
GetMaxPriactiveLevel(relive) {
return MaxPracticeLevel[relive];
}
GetMaxPoint(relive) {
return MaxPracticePoint[relive];
}
GetLevelPoint(relive, level) {
if (level > MaxPracticePoint[relive]) {
return MaxPracticePoint[relive];
}
return level;
}
}
let practicemgr = null;
module.exports = (() => {
if (practicemgr == null) {
practicemgr = new PetPracticeMgr();
}
return practicemgr;
})();

View File

@ -0,0 +1,43 @@
import GameModel from "../ts/core/GameModel";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import RoleMenuAlert from "../ts/RoleMenuAlert"
let GameRes = require('./GameRes');
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties: {
PlayerFunUI: cc.Prefab,
},
onLoad() {
},
PlayerAvatar_Init(info) {
this.pInfo = info;
},
start() {
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, 'PlayerAvatar', 'Close', 0));
cc.find('btnHeadPic', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerAvatar", 'OpenPlayerFunUI', 0));
cc.find('btnHeadPic', this.node).getComponent(cc.Sprite).spriteFrame = GameModel.getRoleHead(this.pInfo.resid);
cc.find('btnHeadPic/level', this.node).getComponent(cc.Label).string = this.pInfo.level;
},
OpenPlayerFunUI() {
RoleMenuAlert.show(this.pInfo);
return
let goFunUI = SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(0, 0), this.PlayerFunUI, 'PlayerFunUI');
goFunUI.getComponent('PlayerFunUI').PlayerFunUI_Init(this.pInfo);
this.node.destroy();
},
Close() {
this.node.destroy();
},
});

View File

@ -0,0 +1,144 @@
import GameModel from "../ts/core/GameModel";
import GameUtil from "../ts/core/GameUtil";
import DebateDao from "../ts/debateDao/DebateDao";
import { BattleType } from "../ts/game/battle/Battle";
import FGAlert from "../ts/gear_2.3.4/fgui/FGAlert";
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties: {},
onLoad() { },
start() { },
Close() {
this.node.destroy();
},
PlayerFunUI_Init(info) {
this.pInfo = info;
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'Close', 0));
cc.find('nodPlayerInfo/picPlayerAvater', this.node).getComponent(cc.Sprite).spriteFrame = GameModel.getRoleHead(info.resid);
cc.find('nodPlayerInfo/picPlayerAvater/level', this.node).getComponent(cc.Label).string = info.level;
cc.find('nodPlayerInfo/nodBianHao/labText', this.node).getComponent(cc.Label).string = info.roleid;
cc.find('nodPlayerInfo/nodName/labText', this.node).color = GameUtil.getReliveColor(info.relive);
cc.find('nodPlayerInfo/nodName/labText', this.node).getComponent(cc.Label).string = info.name;
// cc.find('nodPlayerInfo/nodBangPai/labText', this.node).getComponent(cc.Label).string = strBangName;
cc.find('btnChat', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnChat'));
cc.find('btnAddFriend', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnAddFriend'));
cc.find('btnFight', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnFight'));
cc.find('btnTeam', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnTeam'));
cc.find('btnInviteTeam', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnInviteTeam'));
if (GameModel.player.teamid > 0 && GameModel.player.teamid == info.teamid) {
cc.find('btnFight', this.node).active = false;
}
cc.find('btnTeam', this.node).active = false;
if (GameModel.player.teamid == 0 && info.teamid > 0) {
cc.find('btnTeam', this.node).active = true;
}
cc.find('btnInviteTeam', this.node).active = false;
if (GameModel.player.teamid > 0 && info.teamid == 0&&GameModel.player.isleader) {
cc.find('btnInviteTeam', this.node).active = true;
}
if (GameModel.player.mapid == 4004) {
cc.find('btnFight', this.node).active = false;
cc.find('btnTeam', this.node).active = false;
cc.find('btnInviteTeam', this.node).active = false;
cc.find('btnChat', this.node).active = false;
cc.find('btnAddFriend', this.node).active = false;
if (DebateDao.Instance.stageType > 3) {
var battleBtn = cc.find('btnBattle', this.node)
battleBtn.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnBattle'));
battleBtn.active = true;
}
}
},
PlayerFunUI_Init2(nResID, nLevel, nRoleID, nRelive, strName, strBangName) {
this.pInfo = {
resid: nResID,
level: nLevel,
relive: nLevel,
name: strName
};
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'Close', 0));
cc.find('nodPlayerInfo/picPlayerAvater', this.node).getComponent(cc.Sprite).spriteFrame = GameModel.getRoleHead(nResID);
cc.find('nodPlayerInfo/picPlayerAvater/level', this.node).getComponent(cc.Label).string = nLevel;
cc.find('nodPlayerInfo/nodBianHao/labText', this.node).getComponent(cc.Label).string = nRoleID;
cc.find('nodPlayerInfo/nodName/labText', this.node).color = GameUtil.getReliveColor(nRelive);
cc.find('nodPlayerInfo/nodName/labText', this.node).getComponent(cc.Label).string = strName;
// cc.find('nodPlayerInfo/nodBangPai/labText', this.node).getComponent(cc.Label).string = strBangName;
cc.find('btnChat', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnChat'));
cc.find('btnAddFriend', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnAddFriend'));
cc.find('btnFight', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnFight'));
cc.find('btnExchange', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnExchange'));
cc.find('btnTeam', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerFunUI", 'OnPlayerFunction', 'btnTeam'));
if (GameModel.player.teamid > 0 && GameModel.player.teamid == info.teamid) {
cc.find('btnFight', this.node).active = false;
cc.find('btnExchange', this.node).active = false;
}
cc.find('btnTeam', this.node).active = false;
if (GameModel.player.teamid == 0 && info.teamid > 0) {
cc.find('btnTeam', this.node).active = true;
}
},
OnPlayerFunction(stEvent, stParam) {
if (stParam == 'btnChat') {
} else if (stParam == 'btnAddFriend') {
GameModel.send('c2s_add_friend', {
roleid: this.pInfo.roleid
});
} else if (stParam == 'btnFight') {
let roleId = this.pInfo.roleid;
FGAlert.show(`一定要和他拼個你死我活嗎?\n[color=#ff0000]野外決鬥每擊敗一個玩家被抓捕後將失去30分鐘自由遊戲時間決鬥死亡將會扣除2億經驗是否繼續[/color]`, () => {
FGAlert.hide();
}, () => {
FGAlert.hide();
GameModel.send('c2s_pk', {
troleid: roleId,
type: BattleType.Force
});
});
} else if (stParam == 'btnExchange') {
cc.ll.net.send('c2s_exchange_views', {
troleid: this.pInfo.roleid
});
} else if (stParam == 'btnTeam') {
GameModel.send('c2s_requst_team', {
roleid: GameModel.player.roleid,
teamid: this.pInfo.teamid
});
}
else if (stParam == 'btnInviteTeam') {
GameModel.send('c2s_team_invite', {
toroleid: this.pInfo.roleid,
});
}
else if (stParam == 'btnBattle') {
let teamId = this.pInfo.teamid;
GameModel.notice.addMsg(1, '是否發起決殺? ', () => {
GameModel.send('c2s_sat_challenge', {
rivalTeamId: teamId
});
}, () => { });
}
this.node.destroy();
},
});

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
cc.Class({
extends: cc.Component,
properties: {
},
initCallFunc(target,checkCallFunc){
this.checkCallFunc = checkCallFunc;
this.target = target;
},
onRadioBtnClick (toggle, customEventData) {
if(this.checkCallFunc != null && this.target != null && typeof(this.checkCallFunc) == 'function'){
this.checkCallFunc&this.checkCallFunc.apply(this.target,customEventData);
}
},
});

View File

@ -0,0 +1,167 @@
import GameModel from "../ts/core/GameModel";
import GameUtil from "../ts/core/GameUtil";
import MsgAlert from "../ts/game/msg/MsgAlert";
import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties:
{
},
onLoad() {
this.nSeleLive = 0;
this.vecOldInfo = [];
this.vecLiveInfo = [];
this.vecBtnLive = [];
this.vecBtnRace = [];
this.vecBtnSex = [];
},
start() {
for (let nLive = 0; nLive <= 3; nLive++) {
let goBtnLive = cc.find(`btnLive_${nLive}`, this.node);
goBtnLive.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "RestoryUI", "OnClickLive", nLive));
this.vecBtnLive.push(goBtnLive);
}
for (let nRace = 1; nRace <= 5; nRace++) {
let goBtnRace = cc.find(`btnRace_${nRace}`, this.node);
goBtnRace.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "RestoryUI", "OnSelecetRace", nRace));
this.vecBtnRace.push(goBtnRace);
}
for (let nSex = 1; nSex <= 2; nSex++) {
let btnSex = cc.find(`nodRole/btnSex${nSex}`, this.node);
btnSex.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "RestoryUI", "OnSelecetSex", nSex));
this.vecBtnSex.push(btnSex);
}
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "RestoryUI", "Close", 0));
cc.find('btnOK', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "RestoryUI", "OnOK", 0));
this.UpdateAvatar(GameModel.player.race, GameModel.player.sex, GameModel.player.relive);
GameModel.send('c2s_ask_relive_list', {});
},
Init(strJson) {
console.log(strJson)
let vecTmp = SKDataUtil.jsonBy(strJson);
for (let i = 0; i < 4; i++) {
this.vecLiveInfo.push({ nRace: vecTmp[i][0], nSex: vecTmp[i][1], nLive: i });
this.vecOldInfo.push({ nRace: vecTmp[i][0], nSex: vecTmp[i][1], nLive: i });
}
this.OnClickLive(0, 0);
},
UpdateAvatar(nRace, nSex, nLive) {
let nResID = GameUtil.getRaceResId(nRace, nSex, nLive);
CPubFunction.SetAnimation(cc.find('nodRole/anmRole', this.node), nResID, 'stand_1'); //zzzErr 需整理資源
let picName = GameModel.conf_role.data[nResID].name;
SKUIUtil.setSpriteFrame(cc.find('nodRole/picRaceName/roleName', this.node), 'Login/ui_login_roletxt', picName);
this.SetAtribInfo(cc.find('nodCur', this.node), this.vecOldInfo[this.nSeleLive]);
this.SetAtribInfo(cc.find('nodNew', this.node), this.vecLiveInfo[this.nSeleLive]);
},
SetAtribInfo(goNod, stLiveInfo) {
if (null == goNod || null == stLiveInfo)
return;
let vecSex = ['男', '女'];
let vecRace = ['人', '仙', '魔', '鬼', '龍'];
let strName = `${vecSex[stLiveInfo.nSex - 1]}${vecRace[stLiveInfo.nRace - 1]}`;
cc.find('picTitle/Label', goNod).getComponent(cc.Label).string = strName;
let stReliveAttr = {};
if (stLiveInfo.nLive == 0)
stReliveAttr = GameUtil.reliveFixAttr1;
if (stLiveInfo.nLive == 1)
stReliveAttr = GameUtil.reliveFixAttr2;
if (stLiveInfo.nLive == 2)
stReliveAttr = GameUtil.reliveFixAttr3;
if (stLiveInfo.nLive == 3)
stReliveAttr = GameUtil.reliveFixAttr4;
let mapAttr = stReliveAttr[stLiveInfo.nRace][stLiveInfo.nSex];
let strText = '';
let nCnt = 0;
for (var it in mapAttr) {
nCnt++;
let strKey = GameUtil.getAttrTypeL1Name(it);
let nValue = mapAttr[it];
strText += `+${strKey} ${nValue}%`;
if (nCnt % 2 == 0)
strText += '\n';
else
strText += ' ';
}
cc.find('picDetil/Label', goNod).getComponent(cc.Label).string = strText;
},
GetLiveInfo(nIndex) {
if (nIndex < 0 || nIndex > 3) {
return null;
}
let data = SKDataUtil.valueForKey(this.vecLiveInfo, nIndex);
console.log(data)
if (data && data.nRace == 0) {
return null;
}
return data;
},
OnClickLive(e, nLive) {
let pInfo = this.GetLiveInfo(nLive);
console.log(pInfo)
if (null == pInfo)
return;
this.nSeleLive = nLive;
CPubFunction.ChangeTeamButtonState(this.vecBtnLive, 'Common/ui_common', 'ui_common_btn_tab_subheading0', 'ui_common_btn_tab_subheading1', nLive);
this.OnSelecetRace(0, this.vecLiveInfo[nLive].nRace);
},
OnSelecetRace(e, nRace) {
let pInfo = this.GetLiveInfo(this.nSeleLive);
if (null == pInfo)
return;
if (GameModel.player.relive <= this.nSeleLive) {
MsgAlert.addMsg("回夢丹只能修改前世屬性");
return;
}
pInfo.nRace = nRace;
CPubFunction.ChangeTeamButtonState(this.vecBtnRace, 'Common/ui_common', 'ui_common_partner_roll1', 'ui_common_exp_guangquan_back', nRace - 1);
this.OnSelecetSex(0, pInfo.nSex);
},
OnSelecetSex(e, nSex) {
let pInfo = this.GetLiveInfo(this.nSeleLive);
if (null == pInfo)
return;
if (GameModel.player.relive <= this.nSeleLive) {
MsgAlert.addMsg("回夢丹只能修改前世屬性");
return;
}
pInfo.nSex = nSex;
this.UpdateAvatar(pInfo.nRace, pInfo.nSex, pInfo.nLive);
for (var it in this.vecBtnSex) {
if (it == nSex - 1) {
cc.find('light', this.vecBtnSex[it]).active = true;
}
else {
cc.find('light', this.vecBtnSex[it]).active = false;
}
}
},
Close() {
this.node.destroy();
},
OnOK(e, d) {
let strJson = SKDataUtil.toJson(this.vecLiveInfo);
GameModel.send('c2s_change_relive_list', { strJson: strJson });
}
});

View File

@ -0,0 +1,211 @@
import { EAttrTypeL1 } from "../ts/core/EEnum";
let MaxPointKang = {
[EAttrTypeL1.K_SEAL]: [16, 20, 24, 26, 26],
[EAttrTypeL1.K_CONFUSION]: [16, 20, 24, 26, 26],
[EAttrTypeL1.K_SLEEP]: [16, 20, 24, 26, 26],
[EAttrTypeL1.K_FORGET]: [16, 20, 24, 26, 26],
[EAttrTypeL1.K_WIND]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_WATER]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_FIRE]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_POISON]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_THUNDER]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_WILDFIRE]: [10, 12, 14, 16, 16],
[EAttrTypeL1.K_BLOODRETURN]: [10, 12, 14, 16, 16],
[EAttrTypeL1.PHY_GET]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_HIT]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_DODGE]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_COMBO]: [3, 3, 3, 3, 3],
[EAttrTypeL1.PHY_COMBO_PROB]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_DEADLY]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_BREAK]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_BREAK_PROB]: [10, 15, 20, 25, 25],
[EAttrTypeL1.PHY_REBOUND_PROB]: [10, 13, 16, 16, 16],
[EAttrTypeL1.PHY_REBOUND]: [10, 13, 16, 19, 19]
};
let YinLiang = {
[0]: 825,
[1]: 2112,
[2]: 3717,
[3]: 7416,
[4]: 10188,
[5]: 16600,
[6]: 25062,
[7]: 30738,
[8]: 36482,
[9]: 43517,
[10]: 48900,
[11]: 53966,
[12]: 54851,
[13]: 55801,
[14]: 56815,
[15]: 57893,
[16]: 59033,
[17]: 60236,
[18]: 61501,
[19]: 62826,
[20]: 64212,
[21]: 65659,
[22]: 67165,
[23]: 68731,
[24]: 70355,
[25]: 76079,
[26]: 78181,
[27]: 80358,
[28]: 82609,
[29]: 84933,
[30]: 87330,
[31]: 89801,
[32]: 92344,
[33]: 94960,
[34]: 97648,
[35]: 100408,
[36]: 103240,
[37]: 107595,
[38]: 114602,
[39]: 121909,
[40]: 129524,
[41]: 137452,
[42]: 145700,
[43]: 154274,
[44]: 163181,
[45]: 172426,
[46]: 182015,
[47]: 191956,
[48]: 202254,
[49]: 212915,
[50]: 286043,
[51]: 301089,
[52]: 326641,
[53]: 342707,
[54]: 359295,
[55]: 376411,
[56]: 394314,
[57]: 418064,
[58]: 447245,
[59]: 466989,
[60]: 487304,
[61]: 508197,
[62]: 529676,
[63]: 551748,
[64]: 574421,
[65]: 594158,
[66]: 621514,
[67]: 646266,
[68]: 671650,
[69]: 697673,
[70]: 754342,
[71]: 781665,
[72]: 829648,
[73]: 838300,
[74]: 907627,
[75]: 1082194,
[76]: 1283276,
[77]: 1317827,
[78]: 1334797,
[79]: 1351800,
[80]: 1368836,
[81]: 1385907,
[82]: 1403010,
[83]: 1420148,
[84]: 1437320,
[85]: 1454526,
[86]: 1471766,
[87]: 1489040,
[88]: 1506348,
[89]: 1523691,
[90]: 1541069,
[91]: 1558481,
[92]: 1575928,
[93]: 1593410,
[94]: 1610926,
[95]: 1628478,
[96]: 1646065,
[97]: 1663687,
[98]: 1681345,
[99]: 1699037,
[100]: 1719180,
[101]: 1734290,
[102]: 1749386,
[103]: 1764470,
[104]: 1779542,
[105]: 1794601,
[106]: 1809649,
[107]: 1824685,
[108]: 1839709,
[109]: 1854722,
[110]: 1869725,
[111]: 1884716,
[112]: 1899697,
[113]: 1914667,
[114]: 1929627,
[115]: 1944577,
[116]: 1959517,
[117]: 1974447,
[118]: 1989368,
[119]: 2004279,
[120]: 2019181,
[121]: 2034074,
[122]: 2048959,
[123]: 2063834,
[124]: 2078701,
[125]: 0,
};
let MaxPracticeLevel = {
[0]: 25,
[1]: 50,
[2]: 75,
[3]: 125,
[4]: 125,
};
let MaxPracticePoint = {
[0]: 25,
[1]: 50,
[2]: 75,
[3]: 125,
[4]: 125
};
class RolePracticeMgr {
constructor() {
}
Init() {
}
GetMaxAddPoint(relive, type) {
return MaxPointKang[type][relive];
}
GetUpdateYinLiang(level) {
return YinLiang[level];
}
GetMaxPriactiveLevel(relive) {
return MaxPracticeLevel[relive];
}
GetMaxPoint(relive) {
return MaxPracticePoint[relive];
}
GetLevelPoint(relive, level) {
if (level > MaxPracticePoint[relive]) {
return MaxPracticePoint[relive];
}
return level;
}
}
let practicemgr = null;
module.exports = (() => {
if (practicemgr == null) {
practicemgr = new RolePracticeMgr();
}
return practicemgr;
})();

View File

@ -0,0 +1,4 @@

let Task = require('./GameRes');

View File

@ -0,0 +1,116 @@
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
class CScreenNoticeMgr {
constructor() {
this.vecMsg = [];
this.goScreenNotice = null;
this.goRichText = null;
this.goRichTextBg = null;
this.bInUsing = false;
}
Reset() {
this.vecMsg = [];
this.goScreenNotice = null;
this.goRichText = null;
this.goRichTextBg = null;
this.bInUsing = false;
}
AddNotice(strRichText, bFront) {
if (bFront == 1) {
this.ShowOrHiden(false);
if (this.vecMsg.length > 0) {
this.vecMsg.splice(0, 0, strRichText);
}
}
else {
this.vecMsg.push(strRichText);
}
this.CheckAndShowNotice();
}
OnUpdate(nIndex) {
}
ShowOrHiden(bShow) {
this.bInUsing = bShow;
if (!SKUIUtil.isValid(this.goScreenNotice)) {
cc.warn(`$警告:屏幕通知節點無效!`);
return;
}
this.goScreenNotice.active = true;
this.goScreenNotice.y = this.bInUsing ? 156 : 2000;
}
CheckAndShowNotice() {
if (this.goScreenNotice == null) {
this.goScreenNotice = cc.find('Canvas/MainUI/Notice');
if (null == this.goScreenNotice)
return;
}
if (this.goRichText == null) {
this.goRichText = cc.find('Canvas/MainUI/Notice/Mask/bg/notice_label');
if (null == this.goRichText)
return;
}
if (this.goRichTextBg == null) {
this.goRichTextBg = cc.find('Canvas/MainUI/Notice/Mask/bg');
if (null == this.goRichTextBg)
return;
}
if (this.bInUsing == true)
return;
if (this.vecMsg.length <= 0)
return;
this.ShowOrHiden(true);
if (!SKUIUtil.isValid(this.goRichText)) {
cc.warn(`$警告:屏幕無效的富文本節點`);
this.bInUsing = false;
return;
}
if (!SKUIUtil.isValid(this.goRichTextBg)) {
cc.warn(`$警告:屏幕無效的富文本節點`);
this.bInUsing = false;
return;
}
var sss = this.vecMsg[0]
var hasColor = /\<color=#(?:[0-9]|[a-f]|[A-F]){6} \>/g;
var newStr = sss.replace(hasColor, "<color=#000000>")
var str = this.vecMsg.shift()
this.goRichTextBg.getComponent(cc.RichText).string = newStr
this.goRichText.getComponent(cc.RichText).string = str
this.goRichTextBg.stopAllActions();
this.goRichTextBg.x = 102;
let self = this;
this.goRichTextBg.runAction(cc.sequence(cc.moveTo(8, cc.v2(-1000, this.goRichText.y)), cc.callFunc(() => {
self.bInUsing = false;
if (self.vecMsg.length > 0) {
self.CheckAndShowNotice();
} else {
self.ShowOrHiden(false);
}
})));
}
}
//---------------------------
let pScreenNoticeMgr = null;
module.exports = (() => {
if (pScreenNoticeMgr == null) {
pScreenNoticeMgr = new CScreenNoticeMgr();
}
return pScreenNoticeMgr;
})();

View File

@ -0,0 +1,64 @@
import GameModel from "../ts/core/GameModel";
import MsgAlert from "../ts/game/msg/MsgAlert";
let CPubFunction = require('./PubFunction');
cc.Class({
extends: cc.Component,
properties: {
editbox_xianyu: cc.EditBox,
editbox_num: cc.EditBox,
curNum: cc.Label,
},
// onLoad () {},
start() {
this.curNum.string = GameModel.player.gameData.jade;
},
// update (dt) {},
onSendBtnClick() {
let nodeCan = cc.find('Canvas');
let yuNumStr = this.editbox_xianyu.string;
let numStr = this.editbox_num.string;
//提示玩家的操作信息
if (yuNumStr < 1000) {
MsgAlert.addMsg('紅包要低於1000仙玉');
return;
}
if (numStr < 50 || numStr > 200) {
MsgAlert.addMsg('紅包數量請在50~200之間');
return;
}
GameModel.send('c2s_world_reward', {
roleid: GameModel.player.roleid,
yuNum: yuNumStr,
num: numStr
});
// let msgStr = '我發了一個大大滴紅包,快來搶。 '
// //聊天框提示
// GameModel.send('c2s_game_chat', {
// roleid: GameModel.player.roleid,
// onlyid: GameModel.player.onlyid,
// scale: 0,
// msg: msgStr,
// name: GameModel.player.name,
// resid: GameModel.player.resid,
// });
this.node.destroy();
},
});

View File

@ -0,0 +1,181 @@
import AudioUtil from "../ts/core/AudioUtil";
import GameModel from "../ts/core/GameModel";
import MsgAlert from "../ts/game/msg/MsgAlert";
let roleTitleUtil = require('../utils/RoleTitlesUtil');
let GameDefine = require('./GameDefine');
var SetRoleTitleUIMgr = require('./SetRoleTitleUIMgr');
cc.Class({
extends: cc.Component,
properties:
{
scrollViewContent: cc.Node,
roleTitleItem: cc.Prefab,
titleName: cc.Label,
titleDesc: cc.Label,
btnUnload: cc.Node,
btnLoad: cc.Node,
},
onLoad() {
SetRoleTitleUIMgr.showTitleList();
this.selectRoleTitleId = -1;
this.selectRoleTitleType = -1;
this.selectRoleTitleName = '';
this.titles = [];
},
//初始化用戶稱謂列表數據
initScrollViewTitle(data) {
let roleTitleIdList = data;
this.titles = JSON.parse(roleTitleIdList.titles);
this.titles.forEach((titleItem, index) => {
let pkgTitltItem = roleTitleUtil.pkgRoleTitle(titleItem, GameModel.player.bangname);
if (pkgTitltItem != null) {
let pre_roleTitle = cc.instantiate(this.roleTitleItem);
var toggle = pre_roleTitle.getComponent(cc.Toggle);
let toggleName = pre_roleTitle.getChildByName('LblTitleName').getComponent(cc.Label);
toggleName.string = pkgTitltItem.name;
toggleName = pre_roleTitle.getChildByName('LblTitleType').getComponent(cc.Label);
toggleName.string = pkgTitltItem.type;
var checkEventHandler = new cc.Component.EventHandler();
checkEventHandler.target = this;
checkEventHandler.component = "SetRoleTitleUI";
checkEventHandler.handler = "onSelectRoleTitle";
checkEventHandler.customEventData = pkgTitltItem.id;
if (index == 0) {
toggle.isChecked = true;
this.titleName.string = pkgTitltItem.name;
this.titleDesc.string = pkgTitltItem.desc;
this.selectRoleTitleId = pkgTitltItem.id;
this.selectRoleTitleName = pkgTitltItem.name;
this.selectRoleTitleType = pkgTitltItem.type;
if (!pkgTitltItem.onLoad) {
this.btnLoad.active = true;
this.btnUnload.active = false;
} else {
this.btnLoad.active = false;
this.btnUnload.active = true;
}
} else {
toggle.isChecked = false;
}
toggle.checkEvents.push(checkEventHandler);
pre_roleTitle.parent = this.scrollViewContent;
}
});
},
onClickedBtnLoad() {
if (this.selectRoleTitleId != -1) {
if (this.selectRoleTitleId == GameModel.player.titleid && this.selectRoleTitleType == GameModel.player.titletype) {
//特殊稱謂
if (this.selectRoleTitleType == GameDefine.TitleType.BroTitle || this.selectRoleTitleType == GameDefine.TitleType.CoupleTitle) {
if (this.selectRoleTitleName == GameModel.player.titleval) {
GameModel.send('c2s_title_change', { type: -1, titleid: 0, value: '', operatetype: 1 }); //卸下當前稱謂
} else {
GameModel.send('c2s_title_change', { type: this.selectRoleTitleType, titleid: this.selectRoleTitleId, value: this.selectRoleTitleName, operatetype: 2 }); //裝備新稱謂
}
} else {
GameModel.send('c2s_title_change', { type: -1, titleid: 0, value: '', operatetype: 1 }); //卸下當前稱謂
}
} else {
//圖片或者普通稱謂
GameModel.send('c2s_title_change', { type: this.selectRoleTitleType, titleid: this.selectRoleTitleId, value: this.selectRoleTitleName, operatetype: 2 }); //裝備新稱謂
}
} else {
MsgAlert.addMsg('請先選擇一個稱謂');
}
},
//接收服務端傳來的操作稱謂結果
changeBtnLoadStatus(data) {
if (data.ecode == 0) {
if (data.operatetype == 2) {
this.btnUnload.active = true;
this.btnLoad.active = false;
} else {
let childrens = this.scrollViewContent.getChildren();
for (const child of childrens) {
var toggle = child.getComponent(cc.Toggle);
toggle.isChecked = false;
}
this.btnUnload.active = false;
this.btnLoad.active = true;
}
GameModel.player.titleid = data.titleid;
GameModel.player.titletype = data.type;
GameModel.player.titleval = data.value;
let logic = cc.find('Canvas').getComponent('GameLogic');
if (logic) {
logic.resetSelfPlayerTitle();
}
} else {
cc.log('稱謂操作失敗');
}
},
onSelectRoleTitle(toggle, roleTitleId) {
roleTitleId = Number(roleTitleId);
let titleName = toggle.node.getChildByName('LblTitleName').getComponent(cc.Label).string;
var roleTitle = roleTitleUtil.getRoleTitle(roleTitleId, titleName, GameModel.player.bangname);
this.titleName.string = roleTitle.name;
this.titleDesc.string = roleTitle.desc;
this.selectRoleTitleId = roleTitleId;
this.selectRoleTitleName = roleTitle.name;
this.selectRoleTitleType = roleTitle.type;
/*
let titleList = this.titles.filter(e => {
if(e.titleid == roleTitleId)
return true;
});
if(titleList.length > 0){
let titleItem = titleList[0];
this.selectRoleTitleType = titleItem.type;
}
*/
if (this.selectRoleTitleId != GameModel.player.titleid) {
this.btnUnload.active = false;
this.btnLoad.active = true;
} else {
this.btnUnload.active = true;
this.btnLoad.active = false;
}
},
onCloseBtnClicked(e, d) {
//zfy --關閉音效
AudioUtil.playAudio('ui/ui_guanbi');
this.node.destroy();
},
});

View File

@ -0,0 +1,69 @@
let PanelName = 'SetRoleTitlePanel';
let GameDefine = require('./GameDefine');
const { default: SKDataUtil } = require('../ts/gear_2.3.4/util/SKDataUtil');
class SetRoleTitleUIMgr{
initTitles(data) {
this.roleData = data;
let roleTitles = JSON.parse(data.titles);
let tempList = SKDataUtil.clone(GameDefine.RoleTitleList);
this.roleTitles = [];
for(let i=0; i<roleTitles.length; i++) {
for(let j=0; j<tempList.length; j++){
if(roleTitles[i].titleid == tempList[j].id){
this.roleTitles.push(tempList[j]);
break;
}
}
}
}
showTitleList(){
let data = this.roleData;
this.mainUI = cc.find('Canvas');
let setRoleTitlePanel = this.mainUI.getChildByName(PanelName);
if(setRoleTitlePanel){
let panellogic = setRoleTitlePanel.getComponent('SetRoleTitleUI');
panellogic.initScrollViewTitle(data);
}else{
cc.loader.loadRes("Prefabs/SetRoleTitleUI", (err, prefab) => {
let setRoleTitlePanel = cc.instantiate(prefab);
if (setRoleTitlePanel) {
setRoleTitlePanel.name = PanelName;
setRoleTitlePanel.parent = this.mainUI;
let panellogic = setRoleTitlePanel.getComponent('SetRoleTitleUI');
panellogic.initScrollViewTitle(data);
}
});
}
}
onRoleTitleChanged(data){
this.mainUI = cc.find('Canvas');
let setRoleTitlePanel = this.mainUI.getChildByName(PanelName);
if(setRoleTitlePanel){
let panellogic = setRoleTitlePanel.getComponent('SetRoleTitleUI');
panellogic.changeBtnLoadStatus(data);
}else{
cc.loader.loadRes("Prefabs/SetRoleTitleUI", (err, prefab) => {
let setRoleTitlePanel = cc.instantiate(prefab);
if (setRoleTitlePanel) {
setRoleTitlePanel.name = PanelName;
setRoleTitlePanel.parent = this.mainUI;
let panellogic = setRoleTitlePanel.getComponent('SetRoleTitleUI');
panellogic.changeBtnLoadStatus(data);
}
});
}
}
}
let instance = null;
module.exports = (()=>{
if(instance==null){
instance = new SetRoleTitleUIMgr();
}
return instance;
})();

View File

@ -0,0 +1,208 @@
import GameModel from "../ts/core/GameModel";
import ItemUtil from "../ts/core/ItemUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
let CPubFunction = require('./PubFunction');
let CMainPlayerInfo = require('./MainPlayerInfo');
let EShopAction =
{
EAdd: 1,
EDelete: 0
};
cc.Class({
extends: cc.Component,
properties: {
BagItem: cc.Prefab,
NumPad: cc.Prefab,
},
onLoad() {
this.nSelect = 0;
this.vecBtnItm = [];
},
start() {
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "Close", 0));
cc.find('bntSell', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "OnSell", 0));
cc.find('btnTakeBack', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "OnTakeBack", 0));
cc.find('nodSellNum/btnAdd', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "ChangeSellCnt", 1));
cc.find('nodSellNum/btnCut', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "ChangeSellCnt", -1));
cc.find('nodSellPrice/btnAdd', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "ChangePrice", 1));
cc.find('nodSellPrice/btnCut', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "ChangePrice", -1));
cc.find('nodSellNum/btnPad', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "OpenNumPadForCnt", 0));
cc.find('nodSellPrice/btnPad', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "OpenNumPadForPrice", 0));
},
Init() {
},
Close() {
this.node.destroy();
},
InitCtrState(nAct) {
this.nAddOrDelete = nAct;
cc.find('nodSellNum/btnAdd', this.node).active = (nAct == EShopAction.EAdd ? true : false);
cc.find('nodSellNum/btnCut', this.node).active = (nAct == EShopAction.EAdd ? true : false);
cc.find('nodSellPrice/btnAdd', this.node).active = (nAct == EShopAction.EAdd ? true : false);
cc.find('nodSellPrice/btnCut', this.node).active = (nAct == EShopAction.EAdd ? true : false);
},
ShowBagItem() {
this.InitCtrState(EShopAction.EAdd);
SKUIUtil.destroyList(this.vecBtnItm);
let goContentBagItem = cc.find('scvGoods/view/content', this.node);
let stStart = { nX: 40, nY: -40 };
for (var it in CMainPlayerInfo.vecBagItem) {
let stData = CMainPlayerInfo.vecBagItem[it];
let btnBagItem = CPubFunction.CreateSubNode(goContentBagItem, { nX: stStart.nX + (it % 3) * 80, nY: stStart.nY - Math.floor(it / 3) * 80 }, this.BagItem, '');
btnBagItem.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "OnClickBagItm", it));
btnBagItem.getComponent('BagItem').loadInfo(stData);
this.vecBtnItm.push(btnBagItem);
}
goContentBagItem.height = Math.max(goContentBagItem.height, (CMainPlayerInfo.vecBagItem.length / 3 + 1) * 80);
this.OnClickBagItm(null, 0);
},
OnClickBagItm(stEvent, nIndex) {
this.nSelect = nIndex;
let stBagItem = CMainPlayerInfo.vecBagItem[this.nSelect];
if(!stBagItem){
cc.warn(`$警告:找不到道具${this.nSelect}`);
return;
}
let stInfo = ItemUtil.getItemData(stBagItem.itemid);
let goIcon = cc.find('svItemDetail/view/content/ItemIcon/icon', this.node);
goIcon.getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIconBy(stInfo);
cc.find('svItemDetail/view/content/txTitle', this.node).getComponent(cc.Label).string = stInfo.name;
let strText = stInfo.description;
strText += '\n\n' + '【用途】' + stInfo.usedetail;
cc.find('svItemDetail/view/content/txDetal', this.node).getComponent(cc.Label).string = strText;
},
ShowSellingItem() {
this.InitCtrState(EShopAction.EDelete);
SKUIUtil.destroyList(this.vecBtnItm);
let goContentBagItem = cc.find('scvGoods/view/content', this.node);
let stStart = { nX: 40, nY: -40 };
for (var it in CMainPlayerInfo.vecMyGoods) {
let stGoods = CMainPlayerInfo.vecMyGoods[it];
let btnGoods = CPubFunction.CreateSubNode(goContentBagItem, { nX: stStart.nX + (it % 3) * 80, nY: stStart.nY - Math.floor(it / 3) * 80 }, this.BagItem, '');
btnGoods.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShangJiaUI", "OnClickGoods", it));
btnGoods.getComponent('BagItem').loadInfo({ itemid: stGoods.nConfigID, count: stGoods.nCnt });
this.vecBtnItm.push(btnGoods);
}
this.OnClickGoods(null, 0);
},
OnClickGoods(stEvent, nIndex) {
this.nSelect = nIndex;
let stGoods = CMainPlayerInfo.vecMyGoods[this.nSelect];
let stInfo = ItemUtil.getItemData(stGoods.nConfigID);
let goIcon = cc.find('svItemDetail/view/content/ItemIcon/icon', this.node);
goIcon.getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIconBy(stInfo);
cc.find('svItemDetail/view/content/txTitle', this.node).getComponent(cc.Label).string = stInfo.name;
let strText = stInfo.description;
strText += '\n\n' + '【用途】' + stInfo.usedetail;
cc.find('svItemDetail/view/content/txDetal', this.node).getComponent(cc.Label).string = strText;
cc.find('nodSellNum/Label', this.node).getComponent(cc.Label).string = stGoods.nCnt;
cc.find('nodSellPrice/Label', this.node).getComponent(cc.Label).string = stGoods.nPrice;
},
OpenNumPadForCnt(e, d) {
if (this.nAddOrDelete == EShopAction.EDelete)
return;
let goNumPad = CPubFunction.CreateSubNode(cc.find('Canvas/MainUI'), { nX: 20, nY: 245 }, this.NumPad, 'NumPad');
goNumPad.getComponent('NumPad').NumPad_Init((nNum) => {
cc.find('nodSellNum/Label', this.node).getComponent(cc.Label).string = CPubFunction.ChangeNumToRange(nNum, 1, CMainPlayerInfo.vecBagItem[this.nSelect].count);
});
},
OpenNumPadForPrice(e, d) {
if (this.nAddOrDelete == EShopAction.EDelete)
return;
let goNumPad = CPubFunction.CreateSubNode(cc.find('Canvas/MainUI'), { nX: 20, nY: 245 }, this.NumPad, 'NumPad');
goNumPad.getComponent('NumPad').NumPad_Init((nNum) => {
cc.find('nodSellPrice/Label', this.node).getComponent(cc.Label).string = CPubFunction.ChangeNumToRange(nNum, 1, 9999999999);;
});
},
ChangeSellCnt(stEvent, nAdd) {
let nCur = parseInt(cc.find('nodSellNum/Label', this.node).getComponent(cc.Label).string);
let nNewNum = CPubFunction.ChangeNumToRange(nCur + nAdd, 1, CMainPlayerInfo.vecBagItem[this.nSelect].count);
cc.find('nodSellNum/Label', this.node).getComponent(cc.Label).string = nNewNum;
},
ChangePrice(stEvent, nAdd) {
let nPrice = parseInt(cc.find('nodSellPrice/Label', this.node).getComponent(cc.Label).string);
let nNewPrice = nPrice + 1;
cc.find('nodSellPrice/Label', this.node).getComponent(cc.Label).string = nNewPrice;
},
OnSell() {
if (this.nAddOrDelete != EShopAction.EAdd)
return;
let nCnt = parseInt(cc.find('nodSellNum/Label', this.node).getComponent(cc.Label).string);
let nPrice = parseInt(cc.find('nodSellPrice/Label', this.node).getComponent(cc.Label).string);
let stBagItem = CMainPlayerInfo.vecBagItem[this.nSelect];
GameModel.send('c2s_add_goods',
{
nSeller: GameModel.player.roleid,
nConfigID: stBagItem.itemid,
nPrice: nPrice,
nCnt: nCnt
});
this.Close();
},
OnTakeBack() {
if (this.nAddOrDelete != EShopAction.EDelete)
return;
let stGoods = CMainPlayerInfo.vecMyGoods[this.nSelect];
GameModel.send('c2s_take_back_goods', { nID: stGoods.nID });
},
});

View File

@ -0,0 +1,122 @@
import GameModel from "../ts/core/GameModel";
import GameUtil from "../ts/core/GameUtil";
import MsgAlert from "../ts/game/msg/MsgAlert";
import FGAlert from "../ts/gear_2.3.4/fgui/FGAlert";
cc.Class({
extends: cc.Component,
properties: {
ex_xianyu_label: cc.Label,
xianyu_label: cc.Label,
money_label: cc.Label,
web_view_prefab: cc.Prefab,
editbox: cc.EditBox,
xnode: cc.Node,
},
init (data) {
if (data) {
this.goodsid = data.goodsid;
this.ex_xianyu_label.string = data.ex_jade;
this.xianyu_label.string = data.jade;
this.money_label.string = '¥'+data.money;
}
},
onButtonClick (event, param) {
if(!GameUtil.hasCharge){
FGAlert.show(`暫未開通線上充值,請聯繫管理!`, () => {
FGAlert.hide();
}, () => {
FGAlert.hide();
});
return;
}
if (this.goodsid) {
let send_data = {
roleid: GameModel.player.roleid,
goodsid: this.goodsid,
goodscount: 1,
money: this.checkNum(this.money_label.string),
};
let node = cc.instantiate(this.web_view_prefab);
node.name="ChargeWebUI";
node.parent = cc.find('Canvas');
let webUI= node.getComponent('ChargeWebUI');
if(webUI){
webUI.setData(send_data);
}
}
else if(this.checkNum(this.editbox.string) > 1996) {
let send_data = {
roleid: GameModel.player.roleid,
goodsid: 0,
goodscount: 1,
money: this.checkNum(this.editbox.string),
};
let node = cc.instantiate(this.web_view_prefab);
node.parent = cc.find('Canvas');
node.getComponent('ChargeWebUI').setData(send_data);
}
else {
MsgAlert.addMsg('請輸入正確的充值金額!');
}
},
showEditbox () {
this.editbox.node.active = true;
this.ex_xianyu_label.string = '0';
this.xianyu_label.string = '0';
this.money_label.string = '0';
this.money_label.node.active = false;
this.editbox.node.on('editing-did-ended', this.editEnd.bind(this));
},
checkNum (num) {
num = num.replace(/¥/, '');
if (isNaN(parseInt(num))) {
num = 0;
}
else {
num = Math.abs(parseInt(num));
}
return num;
},
editEnd () {
let money = this.checkNum(this.editbox.string);
if (money <= 1996) {
if (money == 0) {
MsgAlert.addMsg('格式錯誤!');
} else {
MsgAlert.addMsg('充值不能少於1996');
money = 0;
}
this.ex_xianyu_label.string = '0';
this.xianyu_label.string = '0';
this.editbox.string = '';
}
else if (money > 1996) {
this.ex_xianyu_label.string = this.calculateExJade(money);
this.xianyu_label.string = money*100;
this.editbox.string = '¥' + money;
}
this.xnode.x = -this.xianyu_label.node.width-this.xnode.width/2;
},
/*
* 自定義充值金額計算獎勵仙玉
*/
calculateExJade (money) {
let exjade = 0;
for (let i = 6; i >= 1; --i) {
let item = GameModel.conf_charge[i];
if (item && money >= item.money) {
let count = Math.floor(money/item.money);
exjade += count*item.ex_jade;
money -= count*item.money;
}
}
return exjade;
},
});

View File

@ -0,0 +1,677 @@
import GameModel from "../ts/core/GameModel";
import ItemUtil from "../ts/core/ItemUtil";
import AudioUtil from "../ts/core/AudioUtil";
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
import MsgAlert from "../ts/game/msg/MsgAlert";
import FGHUD from "../ts/gear_2.3.4/fgui/FGHUD";
import RechargeReward from "../ts/rechargeReward/RechargeReward";
let CPubFunction = require('./PubFunction');
let CItemMgr = require('./ItemMgr').g_ctCItemMgr;
let EItemType = require('./ItemMgr').EItemType;
let CItemType = require('./ItemMgr').CItemType;
let CMainPlayerInfo = require('./MainPlayerInfo');
cc.Class({
extends: cc.Component,
properties: {
WXcontent: cc.Node,
OneWxAccount: cc.Prefab,
//多寶閣
malltip: cc.Node,
mallmessge: cc.Node,
mallname: cc.Label,
mallmessgeuse: cc.Label,
mallnum: cc.Label,
mallsprices: cc.Label,
shop_charge_item: cc.Prefab,
btnGoodsInfo: cc.Prefab,
btnShangJia: cc.Prefab,
btnItemType: cc.Prefab,
btnEquipGoodsInfo: cc.Prefab,
btnMallInfo: cc.Prefab,
BuyUI: cc.Prefab,
NumPad: cc.Prefab,
ShangJiaUI: cc.Prefab,
btnItemName: cc.Prefab,
selectedIndex: cc.Integer = 0,
current: cc.Integer = 0
},
onLoad() {
this.m_nMaxGoodsCnt = 8;
this.vecItemName = [];
this.vecTmpGoods = [];
this.vecItemType = [];
this.type = 0;
this.freshList = {};
this.mallList = {};
this.dayList = {};
var cz1 = cc.find("tabChongZhi/RewardButton", this.node)
var cz2 = cc.find("tabChongZhi/RewardButton2", this.node)
cz1.active = false;
cz2.active = false;
return;
if (GameModel.player.hideIconList.hasOwnProperty("au")) {
if (GameModel.player.hideIconList["au"] == 1) {
cz1.x = -240
cz1.active = true
cz2.active = false
}
if (GameModel.player.hideIconList["au"] == 2) {
cz2.x = -240
cz2.active = true
cz1.active = false
}
if (GameModel.player.hideIconList["au"] == 0) {
cz2.x = -160
cz1.x = -320
cz2.active = true
cz1.active = true
}
} else {
cz2.x = -160
cz1.x = -320
cz2.active = true
cz1.active = true
}
},
start() {
this.vecTagTeamBtn = [cc.find('btnBaiTan', this.node), cc.find('btnDuoBaoGe', this.node), cc.find('btnChongZhi', this.node)];
this.vecShopTeamBtn = [cc.find('tabBaiTan/btnBuy', this.node), cc.find('tabBaiTan/btnSell', this.node), cc.find('tabBaiTan/btnGongShiQi', this.node)];
this.vecDuoBaoGeTeamBtn = [cc.find('tabDuoBaoGe/btnFhesh', this.node), cc.find('tabDuoBaoGe/btnMerial', this.node), cc.find('tabDuoBaoGe/btnWeekLimit', this.node), cc.find('tabDuoBaoGe/btnFashion', this.node)];
this.vecTabNode = [cc.find('tabBaiTan', this.node), cc.find('tabDuoBaoGe', this.node), cc.find('tabChongZhi', this.node)];
GameModel.send('c2s_ask_roles_goods', { nRoleID: GameModel.player.roleid });
GameModel.send('c2s_get_bagitem', { roleid: GameModel.player.roleid });
cc.find('tabDuoBaoGe/nodSell/picFrame/MallMessage/MallNum/btnPad', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "OpenNumPad", 0));
this.ShopUI_Init();
this.SetMoneyInfo();
if (this.selectedIndex == 0) {
this.OnTabBaiTan();
}
else if (this.selectedIndex == 1) {
this.OnTabDuoBaoGe();
}
else if (this.selectedIndex == 2) {
this.OnTabChongZhi();
}
},
Close() {
AudioUtil.playCloseAudio();
this.node.destroy();
},
SetMoneyInfo() {
// cc.find('layMoney/yinliang/ui_common_icon_yinliang/yinliangLabel', this.node).getComponent(cc.Label).string = GameModel.player.gameData.money;
// cc.find('layMoney/xianyu/ui_common_icon_xianyu/xianyuLabel', this.node).getComponent(cc.Label).string = GameModel.player.gameData.jade;
let topnode = cc.find('topInfo', this.node);
let toplogic = topnode.getComponent('TopInfo');
toplogic.updateGameMoney();
},
ShopUI_Init() {
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "Close", 0));
cc.find('btnBaiTan', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "OnTabBaiTan", 0));
cc.find('btnDuoBaoGe', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "OnTabDuoBaoGe", 0));
cc.find('btnChongZhi', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "OnTabChongZhi", 0));
cc.find('tabBaiTan/btnBuy', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "InitBuyUI", 0));
cc.find('tabBaiTan/btnSell', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "InitSellUI", 0));
cc.find('tabBaiTan/btnGongShiQi', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "InitBuyUI", 2));
cc.find('tabDuoBaoGe/btnFhesh', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "DbgSelect", 0));
cc.find('tabDuoBaoGe/btnMerial', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "DbgSelect", 1));
cc.find('tabDuoBaoGe/btnWeekLimit', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "DbgSelect", 2));
cc.find('tabDuoBaoGe/btnFashion', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", "DbgSelect", 3));
this.InitBuyUI(0, 0);
},
SetUITitle(strName) {
cc.find('picBg/Name/Lable', this.node).getComponent(cc.Label).string = strName;
},
OnTabBaiTan() {
AudioUtil.playFenyeAudio();
CPubFunction.ChangeTeamNodeState(this.vecTabNode, 0);
CPubFunction.ChangeTeamButtonState(this.vecTagTeamBtn, 'Common/ui_common', 'ui_common_btn_tab1', 'ui_common_btn_tab2', 0);
this.SetUITitle('擺 攤');
},
// 點擊多寶閣
OnTabDuoBaoGe() {
cc.find("tabDuoBaoGe", this.node).active = true;
for (let button of this.vecDuoBaoGeTeamBtn) {
button.active = true;
}
AudioUtil.playFenyeAudio();
CPubFunction.ChangeTeamNodeState(this.vecTabNode, 1);
CPubFunction.ChangeTeamButtonState(this.vecTagTeamBtn, 'Common/ui_common', 'ui_common_btn_tab1', 'ui_common_btn_tab2', 1);
GameModel.send('c2s_get_mall', { roleid: GameModel.player.roleid });
this.malltip.active = true;
this.mallmessge.active = false;
this.SetUITitle('多寶閣');
CPubFunction.ChangeTeamButtonState(this.vecDuoBaoGeTeamBtn, 'Common/ui_common', 'ui_common_btn_tab_subheading0', 'ui_common_btn_tab_subheading1', this.type);
this.refreshMall();
},
OnTabChongZhi() {
AudioUtil.playFenyeAudio();
this._record_num = 0;
this.xnum = 0;
this.ynum = 0;
this.WXcontent.destroyAllChildren();
CPubFunction.ChangeTeamNodeState(this.vecTabNode, 2);
CPubFunction.ChangeTeamButtonState(this.vecTagTeamBtn, 'Common/ui_common', 'ui_common_btn_tab1', 'ui_common_btn_tab2', 2);
let charge_list = GameModel.conf_charge;
for (let i = 1; charge_list[i]; ++i) {
this.addChargeGoodsItem(charge_list[i]);
}
this.SetUITitle('充 值');
},
/*
* 添加充值購買物品
*/
addChargeGoodsItem(data) {
let node = cc.instantiate(this.shop_charge_item);
node.parent = this.WXcontent;
if (data) {
node.getComponent('ShopChargeItem').init(data);
}
else {
node.getComponent('ShopChargeItem').showEditbox();
}
},
//添加每個客服的微信號信息
addWXInfo(element) {
let infonode = cc.instantiate(this.OneWxAccount);
let infologic = infonode.getComponent('WXInfo');
infologic.setInfo(element.account);
infonode.parent = this.WXcontent;
//infonode.setScale(cc.v2(0.8, 0.8));
infonode.x = 0;
infonode.y = 0;
let tx = 620 - this.ynum * (infonode.width + 50);
let ty = -100 - this.xnum * (infonode.height + 30);
let t = 0.1 * (1 + this._record_num);
let act1 = cc.moveTo(t, cc.v2(tx, ty));
this._record_num++;
var act2 = cc.fadeIn(t);
infonode.runAction(act1);
infonode.runAction(act2);
},
SetGoodsInfo(goGoods, stGoodsInfo) {
let stConfigInfo = ItemUtil.getItemData(stGoodsInfo.nConfigID);
cc.find('nodItemInfo/Icon', goGoods).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIcon(stConfigInfo.icon);
cc.find('nodItemInfo/txLap', goGoods).getComponent(cc.Label).string = stGoodsInfo.nCnt;
cc.find('labName', goGoods).getComponent(cc.Label).string = stConfigInfo.name; //zzzErr time(null)-nTime
cc.find('picText/Label', goGoods).getComponent(cc.Label).string = stGoodsInfo.nPrice;
cc.find('labTime', goGoods).getComponent(cc.Label).string = Math.max(Math.floor((stGoodsInfo.nTime + 86400 - CPubFunction.GetTime()) / 3600), 0) + 'H';
},
// 設置物品單元格顯示
SetMallInfo(goGoods, stGoodsInfo) {
console.log("stConfigInfo = ", stConfigInfo)
let stConfigInfo = ItemUtil.getItemData(stGoodsInfo.itemid);
cc.find('nodItemInfo/Icon', goGoods).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIcon(stConfigInfo.icon);
// cc.find('nodItemInfo/txLap', goGoods).getComponent(cc.Label).string = stGoodsInfo.nCnt;
cc.find('labName', goGoods).getComponent(cc.Label).string = stConfigInfo.name; //zzzErr time(null)-nTime
cc.find('picText/Label', goGoods).getComponent(cc.Label).string = stGoodsInfo.price;
let limitNode = cc.find("limitTip", goGoods);
if (limitNode) {
let limitTip = limitNode.getComponent(cc.Label);
if (this.type == 2) {
limitTip.string = `${stGoodsInfo.count}/${stGoodsInfo.time}`;
limitNode.active = true;
} else {
limitNode.active = false;
}
}
// cc.find('itemid', goGoods).getComponent(cc.Label).string = stConfigInfo.itemid;
// cc.find('labTime', goGoods).getComponent(cc.Label).string = Math.max(Math.floor((stGoodsInfo.nTime + 86400 - CPubFunction.GetTime()) / 3600), 0) + 'H';
},
HideAll() {
cc.find('tabBaiTan/nodBuy', this.node).active = false;
cc.find('tabBaiTan/nodSell', this.node).active = false;
SKUIUtil.destroyList(this.vecTmpGoods);
SKUIUtil.destroyList(this.vecItemType);
},
OnReceiveMyGoods() {
if (cc.find('tabBaiTan/nodSell', this.node).active == false)
return;
this.InitSellUI();
},
InitSellUI() {
CPubFunction.ChangeTeamButtonState(this.vecShopTeamBtn, 'Common/ui_common', 'ui_common_btn_tab_subheading0', 'ui_common_btn_tab_subheading1', 1);
this.HideAll();
cc.find('tabBaiTan/nodSell', this.node).active = true;
cc.find('tabBaiTan/nodSell/picText/Label', this.node).getComponent(cc.Label).string = `我的攤位(${CMainPlayerInfo.vecMyGoods.length}/${this.m_nMaxGoodsCnt})`;
let contentGoods = cc.find('tabBaiTan/nodSell/scvGoods/view/content', this.node);
let stStart = { nX: 127, nY: -48 };
let i = 0;
for (; i < this.m_nMaxGoodsCnt; i++) {
let stPos = { nX: stStart.nX + (i % 2) * 245, nY: stStart.nY - Math.floor(i / 2) * 82 };
if (i < CMainPlayerInfo.vecMyGoods.length) {
let goGoods = CPubFunction.CreateSubNode(contentGoods, stPos, this.btnGoodsInfo, '');
this.SetGoodsInfo(goGoods, CMainPlayerInfo.vecMyGoods[i]);
if (CMainPlayerInfo.vecMyGoods[i].nCnt > 0) {
goGoods.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'OpenShangJiaUI', { nIndex: i, nFlag: 1 }));
}
else {
cc.find('nodItemInfo/picTiXian', goGoods).active = true;
goGoods.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'OnTakeMoney', CMainPlayerInfo.vecMyGoods[i].nID));
}
this.vecTmpGoods.push(goGoods);
}
if (i >= CMainPlayerInfo.vecMyGoods.length && i < this.m_nMaxGoodsCnt) {
let goShangJia = CPubFunction.CreateSubNode(contentGoods, stPos, this.btnShangJia, '');
goShangJia.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'OpenShangJiaUI', { nIndex: i, nFlag: 0 }));
cc.find('Label', goShangJia).getComponent(cc.Label).string = '點擊上架物品';
this.vecTmpGoods.push(goShangJia);
}
}
let stPos = { nX: stStart.nX + (i % 2) * 245, nY: stStart.nY - Math.floor(i / 2) * 82 };
let goLock = CPubFunction.CreateSubNode(contentGoods, stPos, this.btnShangJia, '');
goLock.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'OpenShangJiaUI', { nIndex: i, nFlag: 0 }));
SKUIUtil.setSpriteFrame(cc.find('nodBtnAdd/Icon', goLock), 'Common/ui_common', 'ui_common_package_lock');
cc.find('Label', goLock).getComponent(cc.Label).string = '增加攤位';
this.vecTmpGoods.push(goLock);
contentGoods.height = Math.max(contentGoods.height, Math.ceil((this.m_nMaxGoodsCnt + 1) / 2) * 80 + 0);
},
InitBuyUI(event, param) {
cc.find("tabDuoBaoGe", this.node).active = false;
CPubFunction.ChangeTeamButtonState(this.vecShopTeamBtn, 'Common/ui_common', 'ui_common_btn_tab_subheading0', 'ui_common_btn_tab_subheading1', param);
this.HideAll();
cc.find('tabBaiTan/nodBuy', this.node).active = true;
let preButton = this.btnItemType;
let contentItemType = cc.find('tabBaiTan/nodBuy/scrItemType/view/content', this.node);
let nBtnHight = preButton.data.height;
let nDis = 0;
let nIndex = -1;
let stStart = { nX: 117, nY: -36 };
for (const it in CItemMgr.mapItemKind) {
nIndex++;
let goItemType = CPubFunction.CreateSubNode(contentItemType, { nX: stStart.nX, nY: stStart.nY - nIndex * (nBtnHight + nDis) }, preButton, it);
goItemType.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'OnClickMainKind', it));
cc.find('Label', goItemType).getComponent(cc.Label).string = CItemMgr.mapItemKind[it];
this.vecItemType.push(goItemType);
}
contentItemType.height = Math.max(contentItemType.height, nIndex * (nBtnHight + nDis) + 80);
this.OnClickMainKind(0, EItemType.Equip);
this.malltip.active = false;
},
InitEquipGoodsList(vecEquips) {
vecEquips = [{
Shape: 100105,
EName: '武器(一級神兵)',
EIndex: 1,
EquipType: 2
},
{
Shape: 102605,
EName: '項鍊(一級神兵)',
EIndex: 2,
EquipType: 2
},
{
Shape: 102305,
EName: '衣服(一級神兵)',
EIndex: 3,
EquipType: 2
},
{
Shape: 102105,
EName: '頭盔(一級神兵)',
EIndex: 4,
EquipType: 2
},
{
Shape: 102505,
EName: '鞋子(一級神兵)',
EIndex: 5,
EquipType: 2
},
{
Shape: 100604,
EName: '武器(一階仙器)',
EIndex: 1,
EquipType: 3
},
{
Shape: 102604,
EName: '項鍊(一階仙器)',
EIndex: 2,
EquipType: 3
},
{
Shape: 102304,
EName: '衣服(一階仙器)',
EIndex: 3,
EquipType: 3
},
{
Shape: 102204,
EName: '頭盔(一階仙器)',
EIndex: 4,
EquipType: 3
},
{
Shape: 102504,
EName: '鞋子(一階仙器)',
EIndex: 5,
EquipType: 3
},
];
cc.find('tabBaiTan/nodBuy', this.node).active = true;
let contentGoods = cc.find('tabBaiTan/nodBuy/scvGoods/view/content', this.node);
SKUIUtil.destroyList(this.vecTmpGoods);
let stStart = {
nX: 125,
nY: -48
};
for (let i = 0; i < vecEquips.length; i++) {
let stPos = {
nX: stStart.nX + (i % 2) * 245,
nY: stStart.nY - Math.floor(i / 2) * 82
};
let goGoods = CPubFunction.CreateSubNode(contentGoods, stPos, this.btnEquipGoodsInfo, '');
goGoods.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'BuyEquip', vecEquips[i]));
cc.find('nodItemInfo/Icon', goGoods).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIcon(vecEquips[i].icon);
cc.find('labName', goGoods).getComponent(cc.Label).string = vecEquips[i].EName; //zzzErr time(null)-nTime
this.vecTmpGoods.push(goGoods);
}
contentGoods.height = Math.max(contentGoods.height, Math.ceil((vecEquips.length + 1) / 2) * 80 + 0);
},
BuyEquip(e, equipInfo) {
GameModel.send('c2s_creat_equip', {
type: equipInfo.EquipType,
roleid: GameModel.player.roleid,
index: equipInfo.EIndex,
is: 1
});
},
InitGoodList(vecGoods) {
CPubFunction.ChangeTeamButtonState(this.vecShopTeamBtn, 'Common/ui_common', 'ui_common_btn_tab_subheading0', 'ui_common_btn_tab_subheading1', 0);
cc.find('tabBaiTan/nodBuy', this.node).active = true;
let contentGoods = cc.find('tabBaiTan/nodBuy/scvGoods/view/content', this.node);
SKUIUtil.destroyList(this.vecTmpGoods);
let stStart = { nX: 125, nY: -48 };
for (let i = 0; i < vecGoods.length; i++) {
let stPos = { nX: stStart.nX + (i % 2) * 245, nY: stStart.nY - Math.floor(i / 2) * 82 };
let goGoods = CPubFunction.CreateSubNode(contentGoods, stPos, this.btnGoodsInfo, '');
goGoods.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'OpenBuyUI', vecGoods[i]));
this.SetGoodsInfo(goGoods, vecGoods[i]);
this.vecTmpGoods.push(goGoods);
}
contentGoods.height = Math.max(contentGoods.height, Math.ceil((vecGoods.length + 1) / 2) * 84 + 0);
},
//加載出售商品展示
InitMallList(data) {
let list = JSON.parse(data.info);
this.freshList = list[0];
this.mallList = list[1];
this.dayList = list[2];
this.refreshMall();
},
refreshMall() {
SKUIUtil.destroyList(this.vecTmpGoods);
let contentGoods = cc.find('tabDuoBaoGe/nodSell/scvGoods/view/content', this.node);
contentGoods.destroyAllChildren();
let stStart = { nX: 125, nY: -48 };
let list = null;
if (this.type == 0) {
list = this.freshList;
} else if (this.type == 1) {
list = this.mallList;
} else if (this.type == 2) {
list = this.dayList;
}
if (!list) {
return;
}
let length = CPubFunction.GetMapLen(list);
for (let i = 1; i <= length; i++) {
let stPos = { nX: stStart.nX + ((i - 1) % 2) * 245, nY: stStart.nY - Math.floor((i - 1) / 2) * 82 };
let goMall = CPubFunction.CreateSubNode(contentGoods, stPos, this.btnMallInfo, '');
goMall.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'OpenBuyMall', i - 1));
this.SetMallInfo(goMall, list[i]);
this.vecTmpGoods.push(goMall);
}
let height = Math.max(contentGoods.height, Math.ceil((length + 1) / 2) * 80 + 60);
contentGoods.height = height;
this.refreshCurrent();
},
OpenBuyUI(stEvent, stGoodsInfo) {
CPubFunction.FindAndDeleteNode(cc.find('Canvas/MainUI'), 'BuyUI');
let goBuyUI = CPubFunction.CreateSubNode(cc.find('Canvas/MainUI'), { nX: 0, nY: 0 }, this.BuyUI, 'BuyUI');
let comBuyUI = goBuyUI.getComponent('BuyUI');
comBuyUI.nID = stGoodsInfo.nID;
comBuyUI.nConfigID = stGoodsInfo.nConfigID;
comBuyUI.nPrice = stGoodsInfo.nPrice;
comBuyUI.nMax = stGoodsInfo.nCnt;
comBuyUI.nBuyCnt = 1;
},
// 點擊道具
OpenBuyMall(event, nIndex) {
console.log("點擊道具")
CPubFunction.ChangeTeamButtonState(this.vecTmpGoods, 'Common/ui_common', 'ui_common_public_list0', 'ui_common_public_list2', nIndex);
this.current = nIndex + 1;
this.refreshCurrent();
},
refreshCurrent() {
let list;
if (this.type == 0) {
list = this.freshList;
} else if (this.type == 1) {
list = this.mallList;
} else if (this.type == 2) {
list = this.dayList;
}
if (!list) {
return;
}
if (this.current == 0) {
this.malltip.active = true;
this.mallmessge.active = false;
return;
}
let data = list[this.current];
let mall = ItemUtil.getItemData(data.itemid);
this.malltip.active = false;
this.mallmessge.active = true;
this.mallname.string = mall.name;
let desc = mall.description;
if (this.type == 2) {
desc += `\n還可以購買: ${Math.max(0, data.time - data.count)}`;
}
this.mallmessgeuse.string = desc;
this.mallnum.string = 1;
this.price = Number(data.price);
this.mallsprices.string = this.price;
this.price = Number(data.price);
this.itemid = data.itemid;
this.mallId = data.id;
this.mallCount = data.count ? data.count : 0;
this.mallLimit = data.time ? data.time : 0;
},
Onaddmall() {
if (parseInt(this.mallnum.string) >= 10000) {
return;
}
this.mallnum.string = parseInt(this.mallnum.string) + 1;
this.mallsprices.string = parseInt(this.mallsprices.string) + Number(this.price);
},
onminmall() {
if (parseInt(this.mallnum.string) <= 1) {
return;
}
this.mallnum.string = parseInt(this.mallnum.string) - 1;
this.mallsprices.string = parseInt(this.mallsprices.string) - Number(this.price);
},
OpenNumPad(e, d) {
this.mallnum.string = 0;
let goNumPad = CPubFunction.CreateSubNode(cc.find('Canvas/MainUI'), { nX: 60, nY: 195 }, this.NumPad, 'NumPad');
goNumPad.getComponent('NumPad').NumPad_Init((nNum) => {
this.mallnum.string = CPubFunction.ChangeNumToRange(nNum, 1, 10000);
this.mallsprices.string = Number(this.price) * Number(this.mallnum.string);
});
},
// 點擊購買
OnBuyMall() {
let price = parseInt(this.mallsprices.string);
let jade = GameModel.player.gameData.jade;
if (jade < price) {
FGHUD.hideLoading();
MsgAlert.addMsg(`您的仙玉不足!`);
return;
}
if (this.type == 2) {
if (this.mallCount >= this.mallLimit) {
return;
}
this.dayList[this.mallId].count++;
}
console.log(`請求購買${this.type},${this.mallId},${this.mallnum},${this.mallsprices}`);
GameModel.send('c2s_buymall_items', {
type: this.type,
mallid: this.mallId,
mallnum: this.mallnum.string,
mallprices: this.mallsprices.string,
});
},
BuyPreview(nItemID, nPrice) {
this.stCurItem = ItemUtil.getItemData(nItemID);
let goIcon = cc.find('svItemDetail/view/content/ItemIcon/icon', this.node);
goIcon.getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIcon(this.stCurItem.icon);
cc.find('svItemDetail/view/content/txTitle', this.node).getComponent(cc.Label).string = this.stCurItem.name;
let strText = this.stCurItem.description;
strText += '\n\n' + '【用途】' + this.stCurItem.usedetail;
cc.find('svItemDetail/view/content/txDetal', this.node).getComponent(cc.Label).string = strText;
},
OpenShangJiaUI(stEvent, stParam) {
CPubFunction.FindAndDeleteNode(cc.find('Canvas/MainUI'), 'ShangJiaUI');
let goShangJiaUI = CPubFunction.CreateSubNode(cc.find('Canvas/MainUI'), { nX: 0, nY: 0 }, this.ShangJiaUI, 'ShangJiaUI');
let comShangJiaUI = goShangJiaUI.getComponent('ShangJiaUI');
if (stParam.nFlag == 0) {
comShangJiaUI.ShowBagItem();
}
if (stParam.nFlag == 1) {
comShangJiaUI.ShowSellingItem();
}
},
// 切換多寶閣
DbgSelect(event, param) {
CPubFunction.ChangeTeamButtonState(this.vecDuoBaoGeTeamBtn, 'Common/ui_common', 'ui_common_btn_tab_subheading0', 'ui_common_btn_tab_subheading1', param);
this.type = param;
this.current = 0;
this.refreshMall();
},
// 點擊多寶閣
OnClickMainKind(event, nKind) {
cc.find('tabBaiTan/nodBuy/scvGoods', this.node).active = false;
cc.find('tabBaiTan/nodBuy/scrItemName', this.node).active = true;
if (nKind == EItemType.Equip) {
this.ShowEquipNameList(CItemMgr.mapEquipType);
}
else {
let mapTmp = {};
mapTmp[0] = new CItemType(nKind, 0, '全部', 0);
for (let it in GameModel.game_conf.item) {
let stConfig = GameModel.game_conf.item[it];
if (stConfig.type == nKind) {
mapTmp[stConfig.id] = new CItemType(nKind, stConfig.id, stConfig.name, stConfig.icon);
}
}
this.ShowEquipNameList(mapTmp);
}
},
ShowEquipNameList(mapEquipType) //顯示物品
{
SKUIUtil.destroyList(this.vecItemName);
//按鈕框
let preButton = this.btnItemName;
let contItemName = cc.find('tabBaiTan/nodBuy/scrItemName/view/content', this.node);
let nBtnHight = preButton.data.height;
let nBtnWidth = preButton.data.width;
let nDis = 4;
let nIndex = -1;
let stStart = { nX: 117, nY: -60 };
for (const it in mapEquipType) {
nIndex++;
let goBtn = CPubFunction.CreateSubNode(contItemName, { nX: stStart.nX + (nIndex % 2) * nBtnWidth, nY: stStart.nY - Math.floor(nIndex / 2) * (nBtnHight + nDis) }, preButton, it);
goBtn.getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "ShopUI", 'OnClickEquipName', mapEquipType[it]));
cc.find('Label', goBtn).getComponent(cc.Label).string = mapEquipType[it].strTypeName;
cc.find('nodIcon/Icon', goBtn).getComponent(cc.Sprite).spriteFrame = ItemUtil.getItemIcon(mapEquipType[it].icon);
this.vecItemName.push(goBtn);
}
contItemName.height = Math.max(contItemName.height, Math.ceil(nIndex / 2) * (nBtnHight + nDis) + 80);
},
OnClickEquipName(stEvent, stItemType) {
if (stItemType.nItemKind == 1)
return;
cc.find('tabBaiTan/nodBuy/scrItemName', this.node).active = false;
cc.find('tabBaiTan/nodBuy/scvGoods', this.node).active = true;
if (stItemType.nItemKind == 1) {
this.InitEquipGoodsList([]);
}
else {
GameModel.send('c2s_get_shop_items', { nKind: stItemType.nItemKind, nItem: stItemType.nParam });
}
},
OnTakeMoney(e, nID) {
GameModel.send('c2s_take_back_goods',
{
nID: nID,
});
// this.Close();
},
/*
* 打開充值獎勵界面
*/
onOpenChargeReward() {
RechargeReward.Instance.openRewardPanel3();
},
onOpenChargeReward2() {
RechargeReward.Instance.openRewardPanel2();
},
});

View File

@ -0,0 +1,55 @@
import SkillUtil from "../ts/game/skill/core/SkillUtil";
cc.Class({
extends: cc.Component,
properties: {
sprite: cc.Sprite,
frame: cc.Node,
_w: 28,
_h: 28,
width: {
get() {
return this._w;
},
set(n) {
this._w = n;
this.node.width = n;
this.sprite.node.width = n;
this.frame.width = n;
}
},
height: {
get() {
return this._h;
},
set(n) {
this._h = n;
this.node.height = n;
this.sprite.node.height = n;
this.frame.height = n;
}
},
_icon_id: 0,
icon: {
get() {
return this._icon_id;
},
set(n) {
this._icon_id = n;
this.setSprite(n);
},
}
},
start() {
},
setSprite(iconid) {
let frame = SkillUtil.getSkillIcon(iconid);
this.sprite.spriteFrame = frame;
},
});

View File

@ -0,0 +1,16 @@

class CSpeak
{
constructor(nSpeakerID, strText, strName, emPos)
{
this.nSpeakerID = nSpeakerID;
this.strText = strText;
this.strName = strName;
this.emPos = emPos;
}
};
module.exports = CSpeak;

Some files were not shown because too many files have changed in this diff Show More