Compare commits
886 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c31ee9b2e6 | ||
|
|
1db0ebb9e3 | ||
|
|
03cb55a053 | ||
|
|
9b92dfe59c | ||
|
|
6824f0a4ad | ||
|
|
1de3560cbe | ||
|
|
b30f3c7f8e | ||
|
|
0e69e79e7c | ||
|
|
fbb3b526ba | ||
|
|
28dc4d0547 | ||
|
|
f8cd5af72d | ||
|
|
c0d9bde0e3 | ||
|
|
cbce1e763f | ||
|
|
989528fb19 | ||
|
|
bfb73d847f | ||
|
|
9d793b77d8 | ||
|
|
e16ec04399 | ||
|
|
e47b25c768 | ||
|
|
ed24e15ec9 | ||
|
|
451fd0ce81 | ||
|
|
ed413b1ec4 | ||
|
|
8d091709e0 | ||
|
|
71f7222f0a | ||
|
|
dee9d7cc12 | ||
|
|
cfbf191f67 | ||
|
|
590c1e7488 | ||
|
|
f07dc748bc | ||
|
|
ba50a1f1e0 | ||
|
|
0a117db90e | ||
|
|
735742b767 | ||
|
|
5123b7984e | ||
|
|
f235f33dea | ||
|
|
c6877c6828 | ||
|
|
70c510cbbf | ||
|
|
2c04d8d58f | ||
|
|
54d434e7f5 | ||
|
|
4718cc678c | ||
|
|
90cfba07ec | ||
|
|
ea9e7bed20 | ||
|
|
8e10a42a76 | ||
|
|
89759c494f | ||
|
|
76f1bc51ad | ||
|
|
7346cfbd67 | ||
|
|
5cfff8f347 | ||
|
|
6761b1ba0a | ||
|
|
aef5a9a65e | ||
|
|
4be4b62167 | ||
|
|
4394a1e3e2 | ||
|
|
fe53bb012b | ||
|
|
9686b4b97d | ||
|
|
486b5100ac | ||
|
|
208febb5b3 | ||
|
|
651c281c2f | ||
|
|
940340cef8 | ||
|
|
b74e4e435b | ||
|
|
eb4b1152a0 | ||
|
|
3fb0e3c90a | ||
|
|
4cebc4b154 | ||
|
|
ac12bc45c4 | ||
|
|
7150d872cf | ||
|
|
49cf038bdb | ||
|
|
c1ca37bda5 | ||
|
|
4944275cff | ||
|
|
8511e51c00 | ||
|
|
0d26fd250e | ||
|
|
fa630edd73 | ||
|
|
602c93913c | ||
|
|
bad9f48449 | ||
|
|
35dc7f578d | ||
|
|
14d5d42d08 | ||
|
|
7179ed8418 | ||
|
|
67efcf901b | ||
|
|
48d81e5ba5 | ||
|
|
7787a00ee1 | ||
|
|
699e392036 | ||
|
|
c932ccaba6 | ||
|
|
8109001683 | ||
|
|
5d44b88212 | ||
|
|
993d54f500 | ||
|
|
6493b5c699 | ||
|
|
3dc8c37011 | ||
|
|
db8e86b49d | ||
|
|
d8fb97368a | ||
|
|
2ef607f0ab | ||
|
|
ce6f7a090b | ||
|
|
a2d36fb396 | ||
|
|
aa4f2bba5f | ||
|
|
1e8e9cc8f0 | ||
|
|
f2a2650f38 | ||
|
|
f0d7cabc29 | ||
|
|
cdae7019c7 | ||
|
|
e685c77351 | ||
|
|
95851df2af | ||
|
|
639ceeb387 | ||
|
|
275bca1375 | ||
|
|
9886fc088c | ||
|
|
7d62cb408e | ||
|
|
97b91ec0d9 | ||
|
|
513ee323df | ||
|
|
6f3d42635e | ||
|
|
265b5474e1 | ||
|
|
b727316a77 | ||
|
|
598f288902 | ||
|
|
31be75d787 | ||
|
|
a6d99ba19b | ||
|
|
5f867a9a84 | ||
|
|
a572fe571d | ||
|
|
d51954e25f | ||
|
|
1e99c284b0 | ||
|
|
46b11ccf9e | ||
|
|
c40bb80cca | ||
|
|
2dc4bdae98 | ||
|
|
418dd48412 | ||
|
|
0e44ceaff7 | ||
|
|
f27864d87e | ||
|
|
7dfed34849 | ||
|
|
5d5fd03238 | ||
|
|
9d1e561916 | ||
|
|
c26a8289be | ||
|
|
fc2bc97405 | ||
|
|
ab66a2dd52 | ||
|
|
6448443c0f | ||
|
|
049a754327 | ||
|
|
5d8bf297e8 | ||
|
|
6b062362f2 | ||
|
|
965b98f0a8 | ||
|
|
2ed2daabf2 | ||
|
|
79d68e8caf | ||
|
|
7ecf780dab | ||
|
|
7116c6a74a | ||
|
|
79c7a15552 | ||
|
|
a91941b139 | ||
|
|
11a4631d28 | ||
|
|
7d761de229 | ||
|
|
c9f22e7671 | ||
|
|
8570d9dd2d | ||
|
|
53bd3da968 | ||
|
|
8f20ac7cb0 | ||
|
|
7a4e927513 | ||
|
|
24901b3966 | ||
|
|
3943be89c5 | ||
|
|
ccd96db341 | ||
|
|
9b7fe04959 | ||
|
|
add4dcaa57 | ||
|
|
17510ca30c | ||
|
|
284aed53e3 | ||
|
|
b18bb603cc | ||
|
|
44531ae9f9 | ||
|
|
66157b5c7d | ||
|
|
c09deb3f35 | ||
|
|
9dae3eb965 | ||
|
|
55449888a4 | ||
|
|
3d534e7523 | ||
|
|
56bbcacc2b | ||
|
|
f4387fca51 | ||
|
|
fe31d8da1b | ||
|
|
4142eabe88 | ||
|
|
bc524cbb10 | ||
|
|
7eb00e61fa | ||
|
|
1aa646ca37 | ||
|
|
6100bcc988 | ||
|
|
d5c3de2bcb | ||
|
|
a3a918ec95 | ||
|
|
8803fe5ee4 | ||
|
|
fc43266090 | ||
|
|
caf7e428b7 | ||
|
|
230d4e21a6 | ||
|
|
bc16ece6d7 | ||
|
|
974db01487 | ||
|
|
6c75f30ffe | ||
|
|
29ded94b59 | ||
|
|
b8b1b86fbb | ||
|
|
455e71bf7a | ||
|
|
ac16f8d0d2 | ||
|
|
120d0079ec | ||
|
|
e5f914814d | ||
|
|
2065c73a5c | ||
|
|
c450235ffd | ||
|
|
a500c79107 | ||
|
|
41af84e469 | ||
|
|
7710ffac6b | ||
|
|
70083216c3 | ||
|
|
fb15192cb0 | ||
|
|
b845ca91b3 | ||
|
|
3427faf4bb | ||
|
|
3ea8d17837 | ||
|
|
0e41adbf6d | ||
|
|
b4d109fbc7 | ||
|
|
bc9bfbac0c | ||
|
|
440c601b7b | ||
|
|
1cda0abb3f | ||
|
|
2c4fe56d6c | ||
|
|
e630c77bb0 | ||
|
|
9f533f4da1 | ||
|
|
328dd55733 | ||
|
|
401b940473 | ||
|
|
2c9685502c | ||
|
|
194e1cb608 | ||
|
|
55296e95da | ||
|
|
1c96c3a82f | ||
|
|
6f4a85dd25 | ||
|
|
2ee6438cfc | ||
|
|
6da425e8c2 | ||
|
|
21b74b519c | ||
|
|
b01520ead7 | ||
|
|
9202d9c83b | ||
|
|
9a25a6dd90 | ||
|
|
10b5e282f7 | ||
|
|
24c73e4b5f | ||
|
|
ec76fd9ad9 | ||
|
|
f841ca153f | ||
|
|
dacb122526 | ||
|
|
454bdf3755 | ||
|
|
85fa456381 | ||
|
|
53d965aebc | ||
|
|
29eddc6688 | ||
|
|
7817465e42 | ||
|
|
a6a7f6b75a | ||
|
|
1387150aa7 | ||
|
|
bce3ff4452 | ||
|
|
ab5b4ce521 | ||
|
|
802e756db3 | ||
|
|
6d5a74b44c | ||
|
|
1f90462c46 | ||
|
|
f75e0fccf6 | ||
|
|
21b55ec9b6 | ||
|
|
e7a00cd1e4 | ||
|
|
1b10f1854f | ||
|
|
3a0e919426 | ||
|
|
c623b9f038 | ||
|
|
d527822974 | ||
|
|
3a3ab128ab | ||
|
|
dfd5a42748 | ||
|
|
077a4d0f14 | ||
|
|
e32c238a90 | ||
|
|
40bb3b0c0f | ||
|
|
5935f650b8 | ||
|
|
80db106cd1 | ||
|
|
c1e793fbe3 | ||
|
|
39878f292c | ||
|
|
7b5d3c5836 | ||
|
|
f8e5991c68 | ||
|
|
190d53f430 | ||
|
|
9708208fd5 | ||
|
|
58bc0cc529 | ||
|
|
961fbf6146 | ||
|
|
2659d9950c | ||
|
|
5bd296efe4 | ||
|
|
35e2a37420 | ||
|
|
f78071e910 | ||
|
|
a3771c610b | ||
|
|
ddb9b12654 | ||
|
|
49e7708675 | ||
|
|
2ac928f6a2 | ||
|
|
8dfc52ced1 | ||
|
|
93065c8a00 | ||
|
|
d9cbbb3337 | ||
|
|
271308d569 | ||
|
|
572ea3e46e | ||
|
|
c01bb6dd49 | ||
|
|
46b4b73cda | ||
|
|
92ff9e6393 | ||
|
|
1a89a7e49a | ||
|
|
743d0f097b | ||
|
|
033bdbf11f | ||
|
|
e0d20294fe | ||
|
|
d6ea584023 | ||
|
|
d161fac759 | ||
|
|
b95a8b1378 | ||
|
|
f04c3f44e9 | ||
|
|
007dbf7d4f | ||
|
|
ddcb2c72f0 | ||
|
|
4fc4b6b23e | ||
|
|
4aa2e6f2a7 | ||
|
|
7b6ede56cc | ||
|
|
614909a19f | ||
|
|
8060568ced | ||
|
|
cd4622580a | ||
|
|
9c290fa178 | ||
|
|
5f4f6087d2 | ||
|
|
9858563402 | ||
|
|
479c5976ec | ||
|
|
603a25ed57 | ||
|
|
6fc419c7ce | ||
|
|
c819d7ce8a | ||
|
|
7b4916851e | ||
|
|
2a6bdfd66e | ||
|
|
23ac799d02 | ||
|
|
e911269404 | ||
|
|
e57618f534 | ||
|
|
d8249cc3ac | ||
|
|
bb804e059a | ||
|
|
778505742a | ||
|
|
c3ce4f0615 | ||
|
|
c1e72278f0 | ||
|
|
a1b4dbb1b4 | ||
|
|
b5981bae15 | ||
|
|
f93e31fb95 | ||
|
|
20d555500d | ||
|
|
58b59379d9 | ||
|
|
dc4c1fc49e | ||
|
|
e10aa91ae9 | ||
|
|
6a5c903e48 | ||
|
|
4369ed4075 | ||
|
|
d906155c9c | ||
|
|
0ac2b10096 | ||
|
|
d2005a212d | ||
|
|
e91c3d797d | ||
|
|
eddc613d25 | ||
|
|
fd05b716a9 | ||
|
|
cdce72b7a2 | ||
|
|
9e5acb67ed | ||
|
|
425ea3ec56 | ||
|
|
e3fc446960 | ||
|
|
38345d5909 | ||
|
|
776b6ae29f | ||
|
|
1c5b577038 | ||
|
|
18296991a2 | ||
|
|
955d7cca3f | ||
|
|
4c7e7aaf78 | ||
|
|
d3e870351b | ||
|
|
cfed0a625f | ||
|
|
6f7a26f595 | ||
|
|
365ae2a618 | ||
|
|
d2ac016e74 | ||
|
|
08d3ed2d7e | ||
|
|
8ae9b1c288 | ||
|
|
87b4c11a9c | ||
|
|
aa3cd49667 | ||
|
|
060dcda776 | ||
|
|
72123ff72e | ||
|
|
ad6cc54cfa | ||
|
|
a7d661556a | ||
|
|
6423f40b58 | ||
|
|
6d5086d5e6 | ||
|
|
be9a8be241 | ||
|
|
aa2648ce08 | ||
|
|
dee92b0594 | ||
|
|
65574eecaa | ||
|
|
db1f0229db | ||
|
|
b527d23e44 | ||
|
|
25d14cf9c2 | ||
|
|
689e1a7ef3 | ||
|
|
7edaf6ccc0 | ||
|
|
9cef0fd55f | ||
|
|
fb6c741cc1 | ||
|
|
a831629459 | ||
|
|
5200466331 | ||
|
|
34518800c4 | ||
|
|
c4b592025d | ||
|
|
2278d90172 | ||
|
|
5ef5298243 | ||
|
|
989d1601eb | ||
|
|
0c1b99ad82 | ||
|
|
026fbcc5c4 | ||
|
|
ac5b0c44fa | ||
|
|
545a879fa3 | ||
|
|
5f1b5b34bd | ||
|
|
e7e0bde881 | ||
|
|
e36dd5e583 | ||
|
|
21b5b2b20a | ||
|
|
2647f6925d | ||
|
|
aa340aae4f | ||
|
|
83f941496d | ||
|
|
3598a27b56 | ||
|
|
691bd7cccb | ||
|
|
e0e35ed993 | ||
|
|
0301b00a7d | ||
|
|
a8fc5ea363 | ||
|
|
08cc62b173 | ||
|
|
1c080a08b2 | ||
|
|
73230eef02 | ||
|
|
00845e9738 | ||
|
|
c06f88f8dc | ||
|
|
fb20918bc6 | ||
|
|
50a42a6219 | ||
|
|
4af4b48bca | ||
|
|
603f289cb9 | ||
|
|
85906420c5 | ||
|
|
447a5364dc | ||
|
|
b65a6adc2d | ||
|
|
5f9e2bf603 | ||
|
|
4a8cd3fb1c | ||
|
|
35e73dfc1a | ||
|
|
3d26181207 | ||
|
|
c8d0e2b3c5 | ||
|
|
5873842dae | ||
|
|
7a4cbe79d8 | ||
|
|
31ae34260e | ||
|
|
63ad8832a9 | ||
|
|
2751a48575 | ||
|
|
f03d3de706 | ||
|
|
18096ad14d | ||
|
|
88cee05344 | ||
|
|
6d52fa22c1 | ||
|
|
6f0d6c4eba | ||
|
|
4de0784535 | ||
|
|
f981f0b664 | ||
|
|
44326ddfa0 | ||
|
|
8d621fabe4 | ||
|
|
ec09ae2a0f | ||
|
|
5f766555a7 | ||
|
|
303fb3fef2 | ||
|
|
f250b2c03f | ||
|
|
ab71cd250c | ||
|
|
06261d6465 | ||
|
|
b492e287e4 | ||
|
|
b1b42d5258 | ||
|
|
dbd220fcfc | ||
|
|
04ecb7b08c | ||
|
|
1fc0cbe7b1 | ||
|
|
974e8d2337 | ||
|
|
03cf4e1843 | ||
|
|
d65af7f268 | ||
|
|
dbdaff5f3c | ||
|
|
2483e8bdd4 | ||
|
|
049d79f8dc | ||
|
|
dcc9d416c5 | ||
|
|
b9b7cc1c74 | ||
|
|
ceb9317d64 | ||
|
|
2089171f80 | ||
|
|
7adbf9e3c4 | ||
|
|
f4f0111fa9 | ||
|
|
72ba48e7d1 | ||
|
|
562be8071c | ||
|
|
15f7e7eaf0 | ||
|
|
f11022dc96 | ||
|
|
9627e10463 | ||
|
|
13e846a688 | ||
|
|
af88eb3db9 | ||
|
|
8fb94acaa6 | ||
|
|
797d32155c | ||
|
|
51a75c0906 | ||
|
|
eaee735bff | ||
|
|
5ab0b5f1ab | ||
|
|
991d7f52bb | ||
|
|
defa53883f | ||
|
|
ee14aded6a | ||
|
|
558cfdf2d8 | ||
|
|
9ae7ab2790 | ||
|
|
78af86e37e | ||
|
|
986d295fbe | ||
|
|
bb92d5a24e | ||
|
|
42a58102c4 | ||
|
|
7bec44980b | ||
|
|
64351e1f6b | ||
|
|
9ebcf06b5a | ||
|
|
6262219db6 | ||
|
|
40a48df785 | ||
|
|
c10d5817a0 | ||
|
|
a6dbfc3fa9 | ||
|
|
9ddc8a6c1b | ||
|
|
646cb07192 | ||
|
|
beb9547565 | ||
|
|
f2717b72e9 | ||
|
|
e8842259b6 | ||
|
|
311c587ddd | ||
|
|
6b828c55c0 | ||
|
|
ca872ddab7 | ||
|
|
80edb5a22f | ||
|
|
8f06da008b | ||
|
|
b146f13e91 | ||
|
|
7db1817bf3 | ||
|
|
6bf327ccb7 | ||
|
|
71f4564255 | ||
|
|
3a6e7f9a7c | ||
|
|
fcb5091001 | ||
|
|
aac1a5d5ad | ||
|
|
d3c630ec8e | ||
|
|
fb70f96ed3 | ||
|
|
7a4a8b8f8c | ||
|
|
be828e96cf | ||
|
|
77fc58e672 | ||
|
|
104a6d1bf5 | ||
|
|
748d55bab5 | ||
|
|
dd09e4228b | ||
|
|
8515c13f92 | ||
|
|
efc5900332 | ||
|
|
9a880a3cce | ||
|
|
22d3603f19 | ||
|
|
448becfe4b | ||
|
|
c01ed07ef7 | ||
|
|
3d3d774273 | ||
|
|
5c7be3141e | ||
|
|
8a50d3a5a1 | ||
|
|
a525866905 | ||
|
|
b2a21397d8 | ||
|
|
d05efd7327 | ||
|
|
45835b8706 | ||
|
|
2ccda92192 | ||
|
|
110bc8ba88 | ||
|
|
e9244a90d1 | ||
|
|
a25afdb9dd | ||
|
|
4bfc954ae4 | ||
|
|
953112ed88 | ||
|
|
43a4a54ea6 | ||
|
|
4fd0f4a6d0 | ||
|
|
418d5780bf | ||
|
|
2df5ba26fd | ||
|
|
98cc05b3cc | ||
|
|
65e9cee902 | ||
|
|
008fc9eddf | ||
|
|
49f697de6e | ||
|
|
ef470b60db | ||
|
|
079c1b21f6 | ||
|
|
6488cf581a | ||
|
|
10e8dbb255 | ||
|
|
cd70a96e95 | ||
|
|
7a4275a1c9 | ||
|
|
f154548f34 | ||
|
|
4cf4604a70 | ||
|
|
fc9122f77f | ||
|
|
d193c93fd0 | ||
|
|
0e339930f0 | ||
|
|
4fbafb72c8 | ||
|
|
8cb98ac1c9 | ||
|
|
07e5f3b31f | ||
|
|
d46cea8ec3 | ||
|
|
287f858230 | ||
|
|
fa1198dd00 | ||
|
|
e9244b18c4 | ||
|
|
bbcb866671 | ||
|
|
7998dee76a | ||
|
|
028fc1d88a | ||
|
|
2301851088 | ||
|
|
513dd9b5fc | ||
|
|
db721dbb53 | ||
|
|
d99175f807 | ||
|
|
ab5df0906d | ||
|
|
dbe73675a8 | ||
|
|
4b6d350215 | ||
|
|
67ffcb9c1b | ||
|
|
3fb8fa1c0e | ||
|
|
458e466262 | ||
|
|
3522b65858 | ||
|
|
5ed50c0ede | ||
|
|
1f1356d913 | ||
|
|
5087a05afa | ||
|
|
a01bf53f0a | ||
|
|
c36dec1a7b | ||
|
|
84dca0cd71 | ||
|
|
12211838ce | ||
|
|
eadaf188dd | ||
|
|
7989086ebe | ||
|
|
515bd7e066 | ||
|
|
862a3f0177 | ||
|
|
db6852ca01 | ||
|
|
a0dfd94a24 | ||
|
|
65ae28e715 | ||
|
|
e64cabe516 | ||
|
|
caee46ed04 | ||
|
|
c367168605 | ||
|
|
d76f57d2ec | ||
|
|
0edf4d4b74 | ||
|
|
be2057beb3 | ||
|
|
dca5ec2391 | ||
|
|
8abaf2d846 | ||
|
|
74caaa5a88 | ||
|
|
f9d0b87676 | ||
|
|
12c52903aa | ||
|
|
8fdadba962 | ||
|
|
d392473c6e | ||
|
|
c9bb11ed29 | ||
|
|
b70249c249 | ||
|
|
504e40eb38 | ||
|
|
945a1ce922 | ||
|
|
e4fe7b0726 | ||
|
|
a9c7c04316 | ||
|
|
29317b4ea4 | ||
|
|
e07da910b5 | ||
|
|
06addac953 | ||
|
|
d70dec2f19 | ||
|
|
310e5f4c79 | ||
|
|
9185bd21ce | ||
|
|
adaca35ac5 | ||
|
|
fe9c082c38 | ||
|
|
4477a52fab | ||
|
|
403001b3ab | ||
|
|
41be97bb08 | ||
|
|
1de8644056 | ||
|
|
5d9f65f6d0 | ||
|
|
1a31862d94 | ||
|
|
a4fdfb1dde | ||
|
|
3c915c8d73 | ||
|
|
e041781019 | ||
|
|
6c1aa4263b | ||
|
|
d9e7c928f6 | ||
|
|
b59fd66886 | ||
|
|
6ad37f7cc0 | ||
|
|
1dfc90943f | ||
|
|
d30e9e502f | ||
|
|
1b06feed2c | ||
|
|
d57ef8ace6 | ||
|
|
c737e2cd89 | ||
|
|
a5d135a78a | ||
|
|
f764b389d5 | ||
|
|
e360bb7662 | ||
|
|
2daa1d6006 | ||
|
|
6f86255585 | ||
|
|
3d7c916058 | ||
|
|
f5a3400308 | ||
|
|
2242ca17dd | ||
|
|
df8aef2f45 | ||
|
|
5684447b6a | ||
|
|
aba89f58fc | ||
|
|
fabe2a6b3d | ||
|
|
b7e9c5c3d7 | ||
|
|
584489c613 | ||
|
|
b506620e47 | ||
|
|
b9bd81f802 | ||
|
|
ecd5958b55 | ||
|
|
5fbf156762 | ||
|
|
07adc9afd3 | ||
|
|
52e9a63ab3 | ||
|
|
8c228bfc90 | ||
|
|
d8386149e7 | ||
|
|
925a6cb8eb | ||
|
|
9bfbada234 | ||
|
|
457b3b23a8 | ||
|
|
c301840cb2 | ||
|
|
edfbd9ec35 | ||
|
|
679ae0de42 | ||
|
|
1f414ccc84 | ||
|
|
9dd813c593 | ||
|
|
c79625c019 | ||
|
|
25ca47f63b | ||
|
|
14c28c83bf | ||
|
|
9a4dd35b5b | ||
|
|
6794741f34 | ||
|
|
67d82fdb65 | ||
|
|
ac6a61b6af | ||
|
|
4a7df9f57f | ||
|
|
42d074f1cb | ||
|
|
c74953aabc | ||
|
|
5654eb7445 | ||
|
|
f1f3c2ba6b | ||
|
|
d601930533 | ||
|
|
673739b538 | ||
|
|
f3708369a7 | ||
|
|
40ae361190 | ||
|
|
b2a31dc888 | ||
|
|
e2df1b56e0 | ||
|
|
be813055c8 | ||
|
|
cf8b1aa7a8 | ||
|
|
cb9acdb86b | ||
|
|
46044a175b | ||
|
|
7d0ea33c71 | ||
|
|
8d852e11c3 | ||
|
|
6194090eb3 | ||
|
|
c838e603e6 | ||
|
|
03e7a5368e | ||
|
|
a666ac3417 | ||
|
|
3a26dc2dd2 | ||
|
|
294bf0121b | ||
|
|
ce94619813 | ||
|
|
e61171acc8 | ||
|
|
698cf0922f | ||
|
|
840672e242 | ||
|
|
8f629e1ac0 | ||
|
|
f1cc76dc42 | ||
|
|
d63306b9a4 | ||
|
|
83de30c45e | ||
|
|
f0019edefb | ||
|
|
f0a3b22724 | ||
|
|
b863a8e3f4 | ||
|
|
f57f7e5225 | ||
|
|
3ed6ac716d | ||
|
|
0d574dfec7 | ||
|
|
a83f98212b | ||
|
|
f910e5898d | ||
|
|
19fdca577f | ||
|
|
fe750e0645 | ||
|
|
30e75cf876 | ||
|
|
a234e231e7 | ||
|
|
e88575790b | ||
|
|
4a945ae37d | ||
|
|
01a7063020 | ||
|
|
1468aebe4d | ||
|
|
22a6577076 | ||
|
|
9621200f95 | ||
|
|
1aff7876ec | ||
|
|
a4ea1fabaa | ||
|
|
27b796556c | ||
|
|
05efb66d3b | ||
|
|
881c683953 | ||
|
|
54cdfc3e47 | ||
|
|
1b23618a5d | ||
|
|
48b6c358ef | ||
|
|
d9ddc699c9 | ||
|
|
a0cf7ed49d | ||
|
|
8913c7fc88 | ||
|
|
13126cb4b2 | ||
|
|
2c8a5f70e5 | ||
|
|
d385b8c795 | ||
|
|
7cd4088ecd | ||
|
|
313e3f6bdf | ||
|
|
4acd0f9bcb | ||
|
|
6fa1b63954 | ||
|
|
5b3a108204 | ||
|
|
56a472e971 | ||
|
|
7080ca79f7 | ||
|
|
dd1063d61e | ||
|
|
d8ca62d0c8 | ||
|
|
46488baee7 | ||
|
|
f011b093d6 | ||
|
|
eb10c29940 | ||
|
|
6ef7de12af | ||
|
|
67da3359ac | ||
|
|
c79e3498bc | ||
|
|
b507498f30 | ||
|
|
e763a97390 | ||
|
|
5682c2aace | ||
|
|
26b7f4d109 | ||
|
|
d351d4549f | ||
|
|
4ce72abeb5 | ||
|
|
a351869a40 | ||
|
|
568915467c | ||
|
|
c2d8f2f894 | ||
|
|
e1593159f8 | ||
|
|
fcfcbfd9ae | ||
|
|
d398da007f | ||
|
|
284cdfbe53 | ||
|
|
a509b5b119 | ||
|
|
7456741201 | ||
|
|
62e22bc2e8 | ||
|
|
cdc40c57ad | ||
|
|
f8a2738052 | ||
|
|
79e55d3646 | ||
|
|
e1b1bafd78 | ||
|
|
5810bba3d8 | ||
|
|
7bb1df9f35 | ||
|
|
f0bb21c710 | ||
|
|
f7b00effe8 | ||
|
|
a0c49f6a6e | ||
|
|
e4aadf984d | ||
|
|
a335e07912 | ||
|
|
2080d5d643 | ||
|
|
b50725a99c | ||
|
|
6d7ddf4a25 | ||
|
|
f12dad8c7f | ||
|
|
3c60d66567 | ||
|
|
2b95659045 | ||
|
|
2018520302 | ||
|
|
d0fa3731bb | ||
|
|
7db28b8e49 | ||
|
|
bec8324c7b | ||
|
|
cdb2e850fb | ||
|
|
3f12d50201 | ||
|
|
4fb30c128d | ||
|
|
b2cd80a254 | ||
|
|
f3b8eec0cd | ||
|
|
3510a6bef5 | ||
|
|
94227802b4 | ||
|
|
c17c28f4fe | ||
|
|
97ba55700d | ||
|
|
080cb76743 | ||
|
|
b921faab86 | ||
|
|
7515a0ef1b | ||
|
|
61e7e50afd | ||
|
|
86f8891173 | ||
|
|
4429fb0e24 | ||
|
|
776d33f119 | ||
|
|
a8e400309d | ||
|
|
6cfa99a2fd | ||
|
|
ff7526810b | ||
|
|
bff03d9595 | ||
|
|
e1abcbf979 | ||
|
|
d7db1af006 | ||
|
|
ccf4d4cf3e | ||
|
|
ac48012ed0 | ||
|
|
c47f373913 | ||
|
|
6fbcf645cb | ||
|
|
b4c27e47f0 | ||
|
|
a4c4632f98 | ||
|
|
fd3cac4e2e | ||
|
|
424c407aba | ||
|
|
604b634b80 | ||
|
|
c7b30dcf87 | ||
|
|
0845703721 | ||
|
|
10693e85b3 | ||
|
|
d06e38ae36 | ||
|
|
bbcbdabe27 | ||
|
|
194eef9612 | ||
|
|
d92df2510a | ||
|
|
d66db62d4b | ||
|
|
d128fb5203 | ||
|
|
d5bdd59e65 | ||
|
|
3a47091fa5 | ||
|
|
d988308e79 | ||
|
|
4bd8a963ce | ||
|
|
d8fe750a63 | ||
|
|
8611677a5d | ||
|
|
f199aa4642 | ||
|
|
bab3c5b294 | ||
|
|
1d826dca2d | ||
|
|
5d042832ad | ||
|
|
c8ef9aa7e7 | ||
|
|
3e707f40a6 | ||
|
|
d1c1de9e75 | ||
|
|
f526f0fcfb | ||
|
|
e6eca956a3 | ||
|
|
0970248aaa | ||
|
|
5291201c37 | ||
|
|
27296bd4ed | ||
|
|
75da39d626 | ||
|
|
7106d1b991 | ||
|
|
69701634df | ||
|
|
b457d91a2d | ||
|
|
0223007bc4 | ||
|
|
4bf6afa963 | ||
|
|
01569a9965 | ||
|
|
5ee0c9c5f1 | ||
|
|
9cedb170d6 | ||
|
|
08434ef5b5 | ||
|
|
513acf7dc9 | ||
|
|
9034e6a452 | ||
|
|
5b143a061f | ||
|
|
dd355826d3 | ||
|
|
c530cf25b9 | ||
|
|
99cccbbb75 | ||
|
|
0510e5c71b | ||
|
|
71edfe09ca | ||
|
|
35e3a95e79 | ||
| 1dde46fb3a | |||
| 47d3a203d8 | |||
|
|
7f796f480c | ||
|
|
c3d9830278 | ||
|
|
1b031303fc | ||
| d5ec878c3f | |||
|
|
68da2a7313 | ||
|
|
674e9c8679 | ||
|
|
0b45dbebb8 | ||
| 94377eed13 | |||
|
|
37dc0e4dad | ||
|
|
7a0501f3ce | ||
| 95533b39a2 | |||
|
|
3aeae3c273 | ||
| 6e6fc18cd8 | |||
| e90fdc5796 | |||
|
|
b9e1915f98 | ||
|
|
d080d9b23e | ||
|
|
d82329610d | ||
|
|
2b15221013 | ||
|
|
dc0eee51b9 | ||
|
|
a77df017d7 | ||
|
|
472cefe2ca | ||
|
|
4cb91d9c95 | ||
| 8c70edf172 | |||
| 57119c41da | |||
| b7014b03ee | |||
|
|
14a895bfc0 | ||
|
|
e346e7146e | ||
|
|
7718bc4ab0 | ||
|
|
4106b91afd | ||
|
|
5f87e1e817 | ||
| 000e3803dc | |||
|
|
25f8d5badb | ||
| 0ec8c05429 | |||
| 9472a28e5c | |||
|
|
1a2510264e | ||
|
|
c145034f84 | ||
| da58ff6466 | |||
| 71467e216d | |||
|
|
97fd207faf | ||
|
|
9916b78bb6 | ||
| f7ba919c6a | |||
| 2393149460 | |||
|
|
1e5d69bed5 | ||
|
|
2639862d95 | ||
| 5328524eed | |||
| c1c8ae1a91 | |||
|
|
00b2a50ddb | ||
| 1ade69bebe | |||
| 6f4a9e0238 | |||
| ff733e9981 | |||
| 1d30bb96a2 | |||
|
|
aa81a18d2c | ||
|
|
5f101e936a | ||
|
|
21d6651d1b | ||
|
|
b1ea12e70d | ||
|
|
a447c7470a | ||
|
|
43222b0299 | ||
|
|
54843c5417 | ||
|
|
d33daf1652 | ||
|
|
2dd336e3bc | ||
|
|
986b121df4 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -54,3 +54,4 @@ Assets/Editor/FYUtils
|
|||||||
|
|
||||||
Assets/Editor/FYUtils.meta
|
Assets/Editor/FYUtils.meta
|
||||||
fbg.log
|
fbg.log
|
||||||
|
.vsconfig
|
||||||
@ -20,61 +20,32 @@ namespace BFEditor.Build
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class BuildMode
|
||||||
|
{
|
||||||
|
public const string DEV = "dev";
|
||||||
|
public const string TEST = "test";
|
||||||
|
public const string PUBLISH = "publish";
|
||||||
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class BuildInfo
|
public class BuildInfo
|
||||||
{
|
{
|
||||||
public string bundleName; // 包名
|
public string bundleName; // 包名
|
||||||
public string version; // 版本号
|
public string version; // 版本号
|
||||||
public string mode; // 渠道名_debug 或 渠道名_release
|
public string mode; // 内网测试包,外网测试包,外网正式包
|
||||||
public int version_code = 1; // 各自渠道的version_code
|
public int versionCode = 1; // 各自渠道的version code
|
||||||
public List<BulidGitInfo> git_info; // 打包的git信息
|
public List<BulidGitInfo> git_info; // 打包的git信息
|
||||||
|
public bool exportProject = false; // 是否只导出工程
|
||||||
|
public bool onlyAssetBundle = false; // 是否只打ab包
|
||||||
|
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
public bool skipVersion = false; // 是否跳过版本校验
|
public bool skipVersion = false; // 是否跳过版本校验
|
||||||
|
|
||||||
public bool IsGPChannel()
|
|
||||||
{
|
|
||||||
return bundleName == "com.combo.heroes.puzzle.rpg";
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsGPOfficial()
|
|
||||||
{
|
|
||||||
return bundleName == "com.combo.heroes.puzzle.rpg";
|
|
||||||
}
|
|
||||||
|
|
||||||
// dev包使用mono编译,不会导出as工程
|
|
||||||
public bool IsDevChannel()
|
|
||||||
{
|
|
||||||
return bundleName == "com.juzu.b6.dev" || bundleName == "com.juzu.b6.dev.android" ||
|
|
||||||
bundleName == "com.juzu.b6.dev.ios";
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsReleaseChannel()
|
|
||||||
{
|
|
||||||
return !IsDevChannel();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 是否是内网release
|
|
||||||
public bool IsLanRelease()
|
|
||||||
{
|
|
||||||
return bundleName == "com.juzu.b6.release.android" || bundleName == "com.juzu.b6.release.ios";
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsPublish()
|
public bool IsPublish()
|
||||||
{
|
{
|
||||||
return !IsDevChannel() && !IsLanRelease();
|
return mode == BuildMode.PUBLISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsIOSPlatform()
|
|
||||||
{
|
|
||||||
return bundleName.Contains("ios");
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsAndroidPlatform()
|
|
||||||
{
|
|
||||||
return !IsIOSPlatform();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetBundleName()
|
public string GetBundleName()
|
||||||
{
|
{
|
||||||
return bundleName;
|
return bundleName;
|
||||||
|
|||||||
@ -48,6 +48,12 @@ namespace BFEditor.Build
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 只打ab包
|
||||||
|
if (buildInfo.onlyAssetBundle)
|
||||||
|
{
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// 删除不进包的多语言
|
// 删除不进包的多语言
|
||||||
// if (!DeleteOverLanguageAb(buildInfo))
|
// if (!DeleteOverLanguageAb(buildInfo))
|
||||||
// {
|
// {
|
||||||
@ -73,19 +79,10 @@ namespace BFEditor.Build
|
|||||||
watch.Start();
|
watch.Start();
|
||||||
|
|
||||||
var result = false;
|
var result = false;
|
||||||
|
if (BuildAndroidUtils.BuildAndroidPlayer(buildInfo))
|
||||||
if (buildInfo.IsAndroidPlatform() && BuildAndroidUtils.BuildAndroidPlayer(buildInfo))
|
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR_OSX
|
|
||||||
if (buildInfo.IsIOSPlatform() && BuildIOSUtils.BuildIOSPlayer(buildInfo))
|
|
||||||
{
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@ -140,8 +137,7 @@ namespace BFEditor.Build
|
|||||||
var watch = new System.Diagnostics.Stopwatch();
|
var watch = new System.Diagnostics.Stopwatch();
|
||||||
watch.Start();
|
watch.Start();
|
||||||
|
|
||||||
// var buildTarget = buildInfo.IsIOSPlatform() ? BuildTarget.iOS : BuildTarget.Android;
|
var isRelease = true;
|
||||||
var isRelease = buildInfo.IsReleaseChannel();
|
|
||||||
Debug.Log("[bfinfo]开始打包资源, bundleName : " + buildInfo.bundleName + " version : " + buildInfo.version + " mode : " + buildInfo.mode);
|
Debug.Log("[bfinfo]开始打包资源, bundleName : " + buildInfo.bundleName + " version : " + buildInfo.version + " mode : " + buildInfo.mode);
|
||||||
|
|
||||||
// // 检查平台
|
// // 检查平台
|
||||||
@ -197,7 +193,7 @@ namespace BFEditor.Build
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 本地缓存ab
|
// 本地缓存ab
|
||||||
if (buildInfo.IsReleaseChannel())
|
if (buildInfo.IsPublish())
|
||||||
{
|
{
|
||||||
Debug.Log("[bfinfo]正在缓存assetbundles...");
|
Debug.Log("[bfinfo]正在缓存assetbundles...");
|
||||||
BFEditorUtils.CopyDirWithIgnore(outputPath, Path.Combine(AssetBundleCachePath, buildInfo.version), new List<string> { ".meta" });
|
BFEditorUtils.CopyDirWithIgnore(outputPath, Path.Combine(AssetBundleCachePath, buildInfo.version), new List<string> { ".meta" });
|
||||||
|
|||||||
@ -6,77 +6,116 @@ namespace BFEditor.Build
|
|||||||
public enum BFPlatformOptions
|
public enum BFPlatformOptions
|
||||||
{
|
{
|
||||||
AndroidDev = 1,
|
AndroidDev = 1,
|
||||||
IOSDev,
|
AndroidTest,
|
||||||
AndroidRelease,
|
|
||||||
AndroidGP,
|
AndroidGP,
|
||||||
|
AndroidGPRU
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BuildProjectWindow : EditorWindow
|
public class BuildProjectWindow : EditorWindow
|
||||||
{
|
{
|
||||||
private static int versionCode = 18;
|
private static int VersionCode = 4;
|
||||||
private static string versionName = "1.6.5";
|
private static string VersionName = "1.2.10";
|
||||||
|
private static int VersionCodeRU = 12;
|
||||||
|
private static string VersionNameRU = "0.4.9";
|
||||||
BFPlatformOptions platform = BFPlatformOptions.AndroidDev;
|
BFPlatformOptions platform = BFPlatformOptions.AndroidDev;
|
||||||
const string ANDROID_DEV_PACKAGE_NAME = "com.juzu.b6.dev.android";
|
const string ANDROID_GP_PACKAGE_NAME = "com.juzu.b6.dev.android";
|
||||||
const string ANDROID_RELEASE_PACKAGE_NAME = "com.juzu.b6.release.android";
|
|
||||||
const string ANDROID_GP_PACKAGE_NAME = "com.combo.heroes.puzzle.rpg";
|
|
||||||
const string IOS_PACKAGE_NAME = "com.juzu.b6.dev.ios";
|
|
||||||
|
|
||||||
public BuildProjectWindow()
|
public BuildProjectWindow()
|
||||||
{
|
{
|
||||||
titleContent = new GUIContent("打包");
|
titleContent = new GUIContent("打包");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable() { }
|
private void OnEnable() { }
|
||||||
|
|
||||||
void OnGUI()
|
void OnGUI()
|
||||||
{
|
{
|
||||||
GUILayout.BeginVertical("box");
|
|
||||||
|
|
||||||
EditorGUILayout.LabelField("选择渠道");
|
|
||||||
platform = (BFPlatformOptions)EditorGUILayout.EnumPopup("", platform);
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
|
|
||||||
EditorGUILayout.LabelField("版本: " + versionName);
|
|
||||||
EditorGUILayout.Space();
|
|
||||||
|
|
||||||
string packageName;
|
string packageName;
|
||||||
string mode;
|
string mode;
|
||||||
|
string versionName = VersionName;
|
||||||
|
int versionCode = VersionCode;
|
||||||
bool skipVersion = false;
|
bool skipVersion = false;
|
||||||
|
string appType;
|
||||||
if (platform == BFPlatformOptions.AndroidDev)
|
if (platform == BFPlatformOptions.AndroidDev)
|
||||||
{
|
{
|
||||||
packageName = ANDROID_DEV_PACKAGE_NAME;
|
packageName = ANDROID_GP_PACKAGE_NAME;
|
||||||
skipVersion = true;
|
skipVersion = true;
|
||||||
mode = "dev_debug";
|
mode = BuildMode.DEV;
|
||||||
|
versionName = "0.1.0";
|
||||||
|
versionCode = 1;
|
||||||
|
appType = "内网测试包";
|
||||||
}
|
}
|
||||||
else if(platform == BFPlatformOptions.AndroidRelease)
|
else if(platform == BFPlatformOptions.AndroidTest)
|
||||||
{
|
{
|
||||||
packageName = ANDROID_RELEASE_PACKAGE_NAME;
|
packageName = ANDROID_GP_PACKAGE_NAME;
|
||||||
mode = "release_release";
|
mode = BuildMode.TEST;
|
||||||
|
versionName = "0.1.0";
|
||||||
|
versionCode = 1;
|
||||||
|
appType = "外网测试包";
|
||||||
}
|
}
|
||||||
else if(platform == BFPlatformOptions.AndroidGP)
|
else if(platform == BFPlatformOptions.AndroidGP)
|
||||||
{
|
{
|
||||||
packageName = ANDROID_GP_PACKAGE_NAME;
|
packageName = ANDROID_GP_PACKAGE_NAME;
|
||||||
mode = "publish_release";
|
mode = BuildMode.PUBLISH;
|
||||||
|
appType = "外网正式包";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packageName = IOS_PACKAGE_NAME;
|
packageName = ANDROID_GP_PACKAGE_NAME;
|
||||||
mode = "dev_debug";
|
skipVersion = true;
|
||||||
|
mode = BuildMode.DEV;
|
||||||
|
versionName = "0.1.0";
|
||||||
|
versionCode = 1;
|
||||||
|
appType = "内网测试包";
|
||||||
}
|
}
|
||||||
|
GUILayout.BeginVertical("box");
|
||||||
|
EditorGUILayout.LabelField("选择");
|
||||||
|
platform = (BFPlatformOptions)EditorGUILayout.EnumPopup("", platform);
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.LabelField("版本: " + versionName);
|
||||||
|
EditorGUILayout.Space();
|
||||||
EditorGUILayout.LabelField("包名: " + packageName);
|
EditorGUILayout.LabelField("包名: " + packageName);
|
||||||
EditorGUILayout.LabelField("mode: " + mode);
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.LabelField(appType);
|
||||||
|
EditorGUILayout.Space();
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
var buildInfo = new BuildInfo();
|
||||||
|
buildInfo.version = versionName;
|
||||||
|
buildInfo.versionCode = versionCode;
|
||||||
|
buildInfo.mode = mode;
|
||||||
|
buildInfo.bundleName = packageName;
|
||||||
|
buildInfo.skipVersion = skipVersion;
|
||||||
|
|
||||||
if (GUILayout.Button("一键打包"))
|
if (GUILayout.Button("一键APK"))
|
||||||
{
|
{
|
||||||
var buildInfo = new BuildInfo();
|
buildInfo.exportProject = false;
|
||||||
buildInfo.version = versionName;
|
buildInfo.onlyAssetBundle = false;
|
||||||
buildInfo.version_code = versionCode;
|
BuildProjectTools.BuildBFPlayer(buildInfo);
|
||||||
buildInfo.mode = mode;
|
}
|
||||||
buildInfo.bundleName = packageName;
|
|
||||||
buildInfo.skipVersion = skipVersion;
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
|
if (GUILayout.Button("仅导出工程"))
|
||||||
|
{
|
||||||
|
buildInfo.exportProject = true;
|
||||||
|
buildInfo.onlyAssetBundle = false;
|
||||||
|
BuildProjectTools.BuildBFPlayer(buildInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
|
||||||
|
if (GUILayout.Button("仅打ab包"))
|
||||||
|
{
|
||||||
|
buildInfo.exportProject = true;
|
||||||
|
buildInfo.onlyAssetBundle = true;
|
||||||
BuildProjectTools.BuildBFPlayer(buildInfo);
|
BuildProjectTools.BuildBFPlayer(buildInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,25 +77,12 @@ namespace BFEditor.Build
|
|||||||
Directory.CreateDirectory(outputPath);
|
Directory.CreateDirectory(outputPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetBundleManifest manifest;
|
AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(outputPath, options |
|
||||||
if (release)
|
BuildAssetBundleOptions.StrictMode |
|
||||||
{
|
BuildAssetBundleOptions.DisableLoadAssetByFileName |
|
||||||
manifest = BuildPipeline.BuildAssetBundles(outputPath, options |
|
BuildAssetBundleOptions.DisableLoadAssetByFileNameWithExtension |
|
||||||
BuildAssetBundleOptions.StrictMode |
|
BuildAssetBundleOptions.DeterministicAssetBundle,
|
||||||
BuildAssetBundleOptions.DisableLoadAssetByFileName |
|
target);
|
||||||
BuildAssetBundleOptions.DisableLoadAssetByFileNameWithExtension |
|
|
||||||
BuildAssetBundleOptions.DeterministicAssetBundle,
|
|
||||||
target);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
manifest = BuildPipeline.BuildAssetBundles(outputPath, options |
|
|
||||||
BuildAssetBundleOptions.StrictMode |
|
|
||||||
BuildAssetBundleOptions.DisableLoadAssetByFileName |
|
|
||||||
BuildAssetBundleOptions.DisableLoadAssetByFileNameWithExtension |
|
|
||||||
BuildAssetBundleOptions.DeterministicAssetBundle,
|
|
||||||
target);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (manifest == null)
|
if (manifest == null)
|
||||||
{
|
{
|
||||||
@ -365,12 +352,12 @@ namespace BFEditor.Build
|
|||||||
SetProtoABName(Path.Combine(Application.dataPath, "proto"), index++ / total);
|
SetProtoABName(Path.Combine(Application.dataPath, "proto"), index++ / total);
|
||||||
SetSpineABName(Path.Combine(Application.dataPath, "arts", "spines"), index++ / total);
|
SetSpineABName(Path.Combine(Application.dataPath, "arts", "spines"), index++ / total);
|
||||||
SetFirstABName(Path.Combine(Application.dataPath, "first"), index++ / total);
|
SetFirstABName(Path.Combine(Application.dataPath, "first"), index++ / total);
|
||||||
// SetTimelineABName(Path.Combine(Application.dataPath, "arts", "timeline"), 16f / total);
|
// SetTimelineABName(Path.Combine(Application.dataPath, "arts", "timeline"), index++ / total);
|
||||||
SetVideoABName(Path.Combine(Application.dataPath, "arts", "video"), index++ / total);
|
SetVideoABName(Path.Combine(Application.dataPath, "arts", "video"), index++ / total);
|
||||||
// SetLanguageResABName(Resource.ResourceProcessConfig.LANGUAGE_PATH, 19f / total);
|
// SetLanguageResABName(Resource.ResourceProcessConfig.LANGUAGE_PATH, index++ / total);
|
||||||
// SetBakedatasABName(Path.Combine(Application.dataPath, "arts", "bakedatas"), 21f / total);
|
// SetBakedatasABName(Path.Combine(Application.dataPath, "arts", "bakedatas"), index++ / total);
|
||||||
// SetLightProbesABName(Path.Combine(Application.dataPath, "arts", "lightprobes"), 22f / total);
|
// SetLightProbesABName(Path.Combine(Application.dataPath, "arts", "lightprobes"), index++ / total);
|
||||||
// SetReflectionsABName(Path.Combine(Application.dataPath, "arts", "reflections"), 23f / total);
|
// SetReflectionsABName(Path.Combine(Application.dataPath, "arts", "reflections"), index++ / total);
|
||||||
|
|
||||||
EditorUtility.ClearProgressBar();
|
EditorUtility.ClearProgressBar();
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
@ -572,11 +559,11 @@ namespace BFEditor.Build
|
|||||||
{
|
{
|
||||||
EditorUtility.DisplayProgressBar("提示", "正在设置spine ABName", progress);
|
EditorUtility.DisplayProgressBar("提示", "正在设置spine ABName", progress);
|
||||||
|
|
||||||
var dirInfo = new DirectoryInfo(dirPath);
|
string[] dirList = { "ui" , "characters" };
|
||||||
var dirs = dirInfo.GetDirectories();
|
for (var i = 0; i < dirList.Length; ++i)
|
||||||
for (var i = 0; i < dirs.Length; i++)
|
|
||||||
{
|
{
|
||||||
SetABNameBySubDir(dirs[i]);
|
var dirInfo = new DirectoryInfo(Path.Combine(dirPath, dirList[i]));
|
||||||
|
SetABNameBySubDir(dirInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,6 +583,11 @@ namespace BFEditor.Build
|
|||||||
var dirInfo = new DirectoryInfo(Path.Combine(dirPath, dirList[i]));
|
var dirInfo = new DirectoryInfo(Path.Combine(dirPath, dirList[i]));
|
||||||
SetABNameBySubDir(dirInfo);
|
SetABNameBySubDir(dirInfo);
|
||||||
}
|
}
|
||||||
|
var dirInfo2 = new DirectoryInfo(Path.Combine(dirPath, "ui", "activity"));
|
||||||
|
if (dirInfo2.Exists)
|
||||||
|
{
|
||||||
|
SetABNameBySubDir(dirInfo2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetBackgroundABName(string dirPath)
|
static void SetBackgroundABName(string dirPath)
|
||||||
|
|||||||
@ -3,12 +3,12 @@ using UnityEditor;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEditor.Build.Reporting;
|
using UnityEditor.Build.Reporting;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace BFEditor.Build
|
namespace BFEditor.Build
|
||||||
{
|
{
|
||||||
public static class BuildAndroidUtils
|
public static class BuildAndroidUtils
|
||||||
{
|
{
|
||||||
const string JAVA_HOME_ENVIRONMENT = "JAVA_HOME";
|
const string JAVA_HOME_ENVIRONMENT = "JAVA_HOME";
|
||||||
@ -18,19 +18,19 @@ namespace BFEditor.Build
|
|||||||
const string GRADLE_PATH = "/Users/aoddabao/.gradle/wrapper/dists/gradle-5.6.4-all/ankdp27end7byghfw1q2sw75f/gradle-5.6.4/bin/gradle";
|
const string GRADLE_PATH = "/Users/aoddabao/.gradle/wrapper/dists/gradle-5.6.4-all/ankdp27end7byghfw1q2sw75f/gradle-5.6.4/bin/gradle";
|
||||||
const string BUGLY_APP_ID = "1eb4e5e560";
|
const string BUGLY_APP_ID = "1eb4e5e560";
|
||||||
const string BUGLY_APP_KEY = "99e249db-4eeb-440e-83e7-c2bd80e8b5e4";
|
const string BUGLY_APP_KEY = "99e249db-4eeb-440e-83e7-c2bd80e8b5e4";
|
||||||
|
|
||||||
static Thread buglyUploadThread;
|
static Thread buglyUploadThread;
|
||||||
static string ReleaseSOPath = Application.dataPath + "/../BFVersions/android/ub-release/src/main/jniLibs";
|
static string ReleaseSOPath = Application.dataPath + "/../BFVersions/android/ub-release/src/main/jniLibs";
|
||||||
static string BuglyPath = Application.dataPath + "/../Bugly";
|
static string BuglyPath = Application.dataPath + "/../Bugly";
|
||||||
static string BuglySOPath = Application.dataPath + "/../Bugly/so";
|
static string BuglySOPath = Application.dataPath + "/../Bugly/so";
|
||||||
static string GradleExcuteProjectPath = Application.dataPath + "/../BFVersions/android/ub-release";
|
static string GradleExcuteProjectPath = Application.dataPath + "/../BFVersions/android/ub-release";
|
||||||
static string DevAsProjectPath = Application.dataPath + "/../BFVersions/android/dz_dev";
|
|
||||||
static string LanReleaseAsProjectPath = Application.dataPath + "/../BFVersions/android/dz_release";
|
|
||||||
static string GoogleAsProjectPath = Application.dataPath + "/../BFVersions/android/dz_google_apk";
|
static string GoogleAsProjectPath = Application.dataPath + "/../BFVersions/android/dz_google_apk";
|
||||||
static string GoogleCommonProjectPath = Application.dataPath + "/../BFVersions/android/google_common";
|
static string GoogleCommonProjectPath = Application.dataPath + "/../BFVersions/android/google_common";
|
||||||
static string GPAsProjectPath = Application.dataPath + "/../BFVersions/android/ub-gp"; // gp删档测试渠道
|
static string RuStoreProjectPath = Application.dataPath + "/../BFVersions/android/ru_store";
|
||||||
static string GPOfficialAsProjectPath = Application.dataPath + "/../BFVersions/android/ub-google"; // gp正式渠道
|
static string RuProjectPath = Application.dataPath + "/../BFVersions/android/ru";
|
||||||
|
static string GoogleServicesProjectPath = Application.dataPath + "/../BFVersions/android/google-services";
|
||||||
static string PublishAsProjectPath = Application.dataPath + "/../BFVersions/android/publish_release";
|
static string PublishAsProjectPath = Application.dataPath + "/../BFVersions/android/publish_release";
|
||||||
|
static string KeystoreFilePath = Application.dataPath + "/../BFVersions/android/keystore/dz_keystore.txt";
|
||||||
static string SignShellPath = Application.dataPath + "/../BFFiles/androidkey";
|
static string SignShellPath = Application.dataPath + "/../BFFiles/androidkey";
|
||||||
static string GpAlginShellPath = Application.dataPath + "/../BFFiles/androidkey";
|
static string GpAlginShellPath = Application.dataPath + "/../BFFiles/androidkey";
|
||||||
static HashSet<string> AABInPackageFileHashSet = new HashSet<string>()
|
static HashSet<string> AABInPackageFileHashSet = new HashSet<string>()
|
||||||
@ -38,12 +38,12 @@ namespace BFEditor.Build
|
|||||||
"bin",
|
"bin",
|
||||||
"UnityServicesProjectConfiguration.json"
|
"UnityServicesProjectConfiguration.json"
|
||||||
};
|
};
|
||||||
|
|
||||||
static BuildAndroidUtils()
|
static BuildAndroidUtils()
|
||||||
{
|
{
|
||||||
EnsureJavaHome();
|
EnsureJavaHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnsureJavaHome()
|
public static void EnsureJavaHome()
|
||||||
{
|
{
|
||||||
// var javaHomeEnvironment = Environment.GetEnvironmentVariable(JAVA_HOME_ENVIRONMENT);
|
// var javaHomeEnvironment = Environment.GetEnvironmentVariable(JAVA_HOME_ENVIRONMENT);
|
||||||
@ -52,35 +52,44 @@ namespace BFEditor.Build
|
|||||||
// Environment.SetEnvironmentVariable(JAVA_HOME_ENVIRONMENT, JAVA_HOME_ENVIRONMENT_PATH);
|
// Environment.SetEnvironmentVariable(JAVA_HOME_ENVIRONMENT, JAVA_HOME_ENVIRONMENT_PATH);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 打包android
|
/// 打包android
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool BuildAndroidPlayer(BuildInfo buildInfo)
|
public static bool BuildAndroidPlayer(BuildInfo buildInfo)
|
||||||
{
|
{
|
||||||
var buildTarget = BuildTarget.Android;
|
var buildTarget = BuildTarget.Android;
|
||||||
|
|
||||||
// 检查平台
|
// 检查平台
|
||||||
if (EditorUserBuildSettings.activeBuildTarget != buildTarget)
|
if (EditorUserBuildSettings.activeBuildTarget != buildTarget)
|
||||||
{
|
{
|
||||||
Debug.LogError("[bferror]当前没有在对应平台");
|
Debug.LogError("[bferror]当前没有在对应平台");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新生成XLua
|
// 重新生成XLua
|
||||||
CompileScriptsUtils.RegenerateXLuaCode(true);
|
CompileScriptsUtils.RegenerateXLuaCode(true);
|
||||||
|
|
||||||
// 打包设置
|
// 打包设置
|
||||||
BuildSettings(buildInfo);
|
BuildSettings(buildInfo);
|
||||||
|
|
||||||
// 开始打包
|
// 开始打包
|
||||||
var bpOptions = GetBuildOptions(buildInfo);
|
var bpOptions = GetBuildOptions(buildInfo);
|
||||||
var report = BuildPipeline.BuildPlayer(bpOptions);
|
var report = BuildPipeline.BuildPlayer(bpOptions);
|
||||||
|
|
||||||
// 打包成功
|
// 导出工程成功
|
||||||
if (report.summary.result == BuildResult.Succeeded)
|
if (report.summary.result == BuildResult.Succeeded)
|
||||||
{
|
{
|
||||||
return BuildAndroidAPK(buildInfo);
|
MergeProject(buildInfo, GoogleAsProjectPath);
|
||||||
|
FixGradleVersion(buildInfo.versionCode, buildInfo.version);
|
||||||
|
if (buildInfo.exportProject)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return BuildAPK(buildInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -88,7 +97,7 @@ namespace BFEditor.Build
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 打包设置
|
/// 打包设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -96,66 +105,58 @@ namespace BFEditor.Build
|
|||||||
{
|
{
|
||||||
// 设置bundleVersion
|
// 设置bundleVersion
|
||||||
PlayerSettings.bundleVersion = buildInfo.version;
|
PlayerSettings.bundleVersion = buildInfo.version;
|
||||||
|
|
||||||
// 设置VersionCode
|
// 设置VersionCode
|
||||||
PlayerSettings.Android.bundleVersionCode = buildInfo.version_code;
|
PlayerSettings.Android.bundleVersionCode = buildInfo.versionCode;
|
||||||
|
|
||||||
// 设置竖屏
|
// 设置竖屏
|
||||||
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
||||||
PlayerSettings.allowedAutorotateToPortrait = false;
|
PlayerSettings.allowedAutorotateToPortrait = false;
|
||||||
PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
|
PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
|
||||||
PlayerSettings.allowedAutorotateToLandscapeLeft = false;
|
PlayerSettings.allowedAutorotateToLandscapeLeft = false;
|
||||||
PlayerSettings.allowedAutorotateToLandscapeRight = false;
|
PlayerSettings.allowedAutorotateToLandscapeRight = false;
|
||||||
|
|
||||||
// 安卓构建目标CPU架构
|
// 安卓构建目标CPU架构
|
||||||
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;
|
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;
|
||||||
|
|
||||||
// 强加Internet权限
|
// 强加Internet权限
|
||||||
PlayerSettings.Android.forceInternetPermission = true;
|
PlayerSettings.Android.forceInternetPermission = true;
|
||||||
|
|
||||||
// 关闭启动动画
|
// 关闭启动动画
|
||||||
PlayerSettings.SplashScreen.show = false;
|
PlayerSettings.SplashScreen.show = false;
|
||||||
|
|
||||||
// 设置包名
|
// 设置包名
|
||||||
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, buildInfo.bundleName);
|
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, buildInfo.bundleName);
|
||||||
Debug.Log("[bfinfo]设置包名:" + buildInfo.bundleName);
|
|
||||||
|
|
||||||
// 跳过版本控制
|
// 跳过版本控制
|
||||||
var symbols = ANDROID_DEFINE_SYMBOLS;
|
var symbols = ANDROID_DEFINE_SYMBOLS;
|
||||||
if (buildInfo.skipVersion)
|
if (buildInfo.skipVersion)
|
||||||
{
|
{
|
||||||
symbols = symbols + ";SKIP_VERSION;";
|
symbols = symbols + ";SKIP_VERSION";
|
||||||
|
}
|
||||||
|
if (buildInfo.mode == BuildMode.DEV)
|
||||||
|
{
|
||||||
|
symbols = symbols + ";BF_APP_DEV";
|
||||||
|
}
|
||||||
|
else if (buildInfo.mode == BuildMode.TEST)
|
||||||
|
{
|
||||||
|
symbols = symbols + ";BF_APP_TEST";
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, symbols);
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, symbols);
|
||||||
Debug.Log("[bfinfo]设置defineSymbols: " + symbols);
|
Debug.Log("[bfinfo]设置defineSymbols: " + symbols);
|
||||||
|
|
||||||
// 是否是dev
|
PlayerSettings.productName = "C1";
|
||||||
var development = buildInfo.IsDevChannel() ? true : false;
|
EditorUserBuildSettings.development = false;
|
||||||
EditorUserBuildSettings.development = development;
|
EditorUserBuildSettings.androidBuildType = AndroidBuildType.Release;
|
||||||
|
|
||||||
// 商品名称
|
|
||||||
// 应用名
|
|
||||||
if (buildInfo.IsPublish())
|
|
||||||
{
|
|
||||||
PlayerSettings.productName = "Knights Combo";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlayerSettings.productName = development ? "b6-dev" : "b6-release";
|
|
||||||
}
|
|
||||||
// BuildType设置dev/release
|
|
||||||
EditorUserBuildSettings.androidBuildType = development ? AndroidBuildType.Debug : AndroidBuildType.Release;
|
|
||||||
|
|
||||||
// 是否导出as工程
|
// 是否导出as工程
|
||||||
// EditorUserBuildSettings.exportAsGoogleAndroidProject = development ? false : true;
|
|
||||||
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
|
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
|
||||||
|
|
||||||
// dev使用Mono release使用IL2CPP
|
var scriptImp = ScriptingImplementation.IL2CPP;
|
||||||
var scriptImp = development ? ScriptingImplementation.Mono2x : ScriptingImplementation.IL2CPP;
|
|
||||||
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, scriptImp);
|
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, scriptImp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取打包参数
|
/// 获取打包参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -164,43 +165,23 @@ namespace BFEditor.Build
|
|||||||
var bpOptions = new BuildPlayerOptions();
|
var bpOptions = new BuildPlayerOptions();
|
||||||
bpOptions.scenes = AssetBundleUtils.GetBuildScenes();
|
bpOptions.scenes = AssetBundleUtils.GetBuildScenes();
|
||||||
bpOptions.target = BuildTarget.Android;
|
bpOptions.target = BuildTarget.Android;
|
||||||
|
|
||||||
// if (buildInfo.IsDevChannel())
|
|
||||||
// {
|
|
||||||
// bpOptions.locationPathName = GetDevApkPathName(buildInfo);
|
|
||||||
// Debug.Log("[bfinfo]apk path : " + bpOptions.locationPathName);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// bpOptions.locationPathName = GetASProjectPathName();
|
|
||||||
// Debug.Log("[bfinfo]asProject path : " + bpOptions.locationPathName);
|
|
||||||
// }
|
|
||||||
bpOptions.locationPathName = GetASProjectPathName(buildInfo);
|
bpOptions.locationPathName = GetASProjectPathName(buildInfo);
|
||||||
|
|
||||||
BuildOptions options;
|
BuildOptions options = BuildOptions.None;
|
||||||
if (buildInfo.IsReleaseChannel())
|
|
||||||
{
|
|
||||||
options = BuildOptions.None;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
options = BuildOptions.Development;
|
|
||||||
}
|
|
||||||
|
|
||||||
bpOptions.options = options;
|
bpOptions.options = options;
|
||||||
return bpOptions;
|
return bpOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetDevApkPathName(BuildInfo buildInfo)
|
static string GetDevApkPathName(BuildInfo buildInfo)
|
||||||
{
|
{
|
||||||
var apkName = buildInfo.skipVersion ? "dz_dev_skip_version.apk" : "dz_dev_debug.apk";
|
var apkName = buildInfo.skipVersion ? "dz_dev_skip_version.apk" : "dz_dev_debug.apk";
|
||||||
var path = Path.Combine(AS_PROJECT_PATH, apkName);
|
var path = Path.Combine(AS_PROJECT_PATH, apkName);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetASProjectPathName(BuildInfo buildInfo)
|
static string GetASProjectPathName(BuildInfo buildInfo)
|
||||||
{
|
{
|
||||||
var dir = Path.Combine(AS_PROJECT_PATH, buildInfo.mode);
|
var dir = Path.Combine(AS_PROJECT_PATH, "publish_release");
|
||||||
if (Directory.Exists(dir))
|
if (Directory.Exists(dir))
|
||||||
{
|
{
|
||||||
Directory.Delete(dir, true);
|
Directory.Delete(dir, true);
|
||||||
@ -208,32 +189,53 @@ namespace BFEditor.Build
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool BuildAPK(BuildInfo buildInfo)
|
static bool BuildAPK(BuildInfo buildInfo, bool isAAB = false)
|
||||||
{
|
{
|
||||||
if (buildInfo.IsGPChannel())
|
// 设置jdk环境变量
|
||||||
{
|
string javaHomePath = System.Environment.GetEnvironmentVariable("JAVE_HOME");
|
||||||
MergeGPToReleaseProject(buildInfo);
|
if (string.IsNullOrEmpty(javaHomePath))
|
||||||
FixGradleVersion(buildInfo.version_code, buildInfo.version);
|
{
|
||||||
}
|
Debug.LogError("[bferror] 找不到环境变量JAVE_HOME");
|
||||||
|
return false;
|
||||||
if (buildInfo.IsLanRelease())
|
}
|
||||||
{
|
var gradleFilePath = Path.Combine(PublishAsProjectPath, "gradle.properties");
|
||||||
AddBuglyParamsToReleaseProject();
|
var gradleFileText = File.ReadAllText(gradleFilePath);
|
||||||
}
|
if (!gradleFileText.Contains("org.gradle.java.home"))
|
||||||
|
{
|
||||||
|
gradleFileText = gradleFileText + "\norg.gradle.java.home=" + javaHomePath.Replace("\\", "/");
|
||||||
|
}
|
||||||
|
File.WriteAllText(gradleFilePath, gradleFileText);
|
||||||
|
|
||||||
|
// 设置密钥密码
|
||||||
|
if (File.Exists(KeystoreFilePath))
|
||||||
|
{
|
||||||
|
var password = File.ReadAllText(KeystoreFilePath).Replace("\n", "").Replace("\r", "");
|
||||||
|
var buildGradlePath = Path.Combine(PublishAsProjectPath, "launcher/build.gradle");
|
||||||
|
var text = File.ReadAllText(buildGradlePath);
|
||||||
|
var regex = new Regex("REPLACE_PASSWORD");
|
||||||
|
text = regex.Replace(text, password);
|
||||||
|
File.WriteAllText(buildGradlePath, text);
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Log("[bfinfo]正在buildApk...");
|
Debug.Log("[bfinfo]正在buildApk...");
|
||||||
var success = true;
|
var success = true;
|
||||||
var args = "";
|
var args = "assembleRelease";
|
||||||
if (buildInfo.IsReleaseChannel())
|
if (isAAB)
|
||||||
{
|
{
|
||||||
args += " assembleRelease";
|
args = "bundleRelease";
|
||||||
}
|
}
|
||||||
else
|
string gradleHomePath = System.Environment.GetEnvironmentVariable("GRADLE_HOME");
|
||||||
{
|
if (string.IsNullOrEmpty(gradleHomePath))
|
||||||
args += " assembleDebug";
|
{
|
||||||
}
|
Debug.LogError("[bferror] 找不到环境变量GRADLE_HOME");
|
||||||
|
return false;
|
||||||
BFEditorUtils.RunCommond(GRADLE_PATH, args, GradleExcuteProjectPath,
|
}
|
||||||
|
#if UNITY_EDITOR_OSX
|
||||||
|
var gradleCommondPath = Path.Combine(gradleHomePath, "gradle");
|
||||||
|
#else
|
||||||
|
var gradleCommondPath = Path.Combine(gradleHomePath, "gradle.bat");
|
||||||
|
#endif
|
||||||
|
BFEditorUtils.RunCommond(gradleCommondPath, args, PublishAsProjectPath,
|
||||||
(msg) =>
|
(msg) =>
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
@ -245,80 +247,35 @@ namespace BFEditor.Build
|
|||||||
Debug.LogError("[bferror] " + errorMsg);
|
Debug.LogError("[bferror] " + errorMsg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (buildInfo.IsGPChannel())
|
|
||||||
{
|
|
||||||
// 尝试制作并上传bugly符号表 开新Thread不影响打包流程
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
CopySOAndUploadBuglySymbol(buildInfo.bundleName, buildInfo.version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool BuildAAB(BuildInfo buildInfo)
|
|
||||||
{
|
|
||||||
var result = true;
|
|
||||||
if(buildInfo.IsGPChannel())
|
|
||||||
{
|
|
||||||
// MergeGPToReleaseProject(buildInfo);
|
|
||||||
// FixGradleVersion(buildInfo.version_code, buildInfo.version);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool BuildAndroidAPK(BuildInfo buildInfo)
|
|
||||||
{
|
|
||||||
var result = true;
|
|
||||||
if(buildInfo.IsDevChannel())
|
|
||||||
{
|
|
||||||
MergeProject(buildInfo, DevAsProjectPath);
|
|
||||||
var dir = Path.Combine(Application.dataPath, "../", AS_PROJECT_PATH, buildInfo.mode);
|
|
||||||
BFEditorUtils.RunCommond("gradle", " assembleDebug", dir, (msg) => {
|
|
||||||
}, (errorMsg) => {
|
|
||||||
Debug.LogError("[bferror] " + errorMsg);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if(buildInfo.IsLanRelease())
|
|
||||||
{
|
|
||||||
MergeProject(buildInfo, LanReleaseAsProjectPath);
|
|
||||||
}
|
|
||||||
else if(buildInfo.IsGPChannel())
|
|
||||||
{
|
|
||||||
MergeProject(buildInfo, GoogleAsProjectPath);
|
|
||||||
FixGradleVersion(buildInfo.version_code, buildInfo.version);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 合并dev工程
|
/// 合并工程
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static void MergeProject(BuildInfo buildInfo, String asProjectPath)
|
static void MergeProject(BuildInfo buildInfo, String asProjectPath)
|
||||||
{
|
{
|
||||||
Debug.Log("[bfinfo]正在整合dev project...");
|
Debug.Log("[bfinfo]正在整合 project...");
|
||||||
|
|
||||||
var dir = Path.Combine(Application.dataPath, "../", AS_PROJECT_PATH, buildInfo.mode);
|
var dir = Path.Combine(Application.dataPath, "../", AS_PROJECT_PATH, "publish_release");
|
||||||
|
|
||||||
var javaPath = Path.Combine(dir, "unityLibrary/src/main/java");
|
var javaPath = Path.Combine(dir, "unityLibrary/src/main/java");
|
||||||
var manifestPath = Path.Combine(dir, "unityLibrary/src/main/AndroidManifest.xml");
|
var manifestPath = Path.Combine(dir, "unityLibrary/src/main/AndroidManifest.xml");
|
||||||
|
|
||||||
|
// 老版本unity需要替换这个,2021之后的新版本不需要
|
||||||
// 获取到unity打出的build-id
|
// 获取到unity打出的build-id
|
||||||
var reader = new StreamReader(new FileStream(manifestPath, FileMode.Open));
|
// var reader = new StreamReader(new FileStream(manifestPath, FileMode.Open));
|
||||||
string buildIdLine;
|
// string buildIdLine;
|
||||||
while ((buildIdLine = reader.ReadLine()) != null)
|
// while ((buildIdLine = reader.ReadLine()) != null)
|
||||||
{
|
// {
|
||||||
if (buildIdLine.Contains("unity.build-id"))
|
// if (buildIdLine.Contains("unity.build-id"))
|
||||||
{
|
// {
|
||||||
Debug.Log("[bfinfo]修正build-id: " + buildIdLine);
|
// Debug.Log("[bfinfo]修正build-id: " + buildIdLine);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
reader.Close();
|
// reader.Close();
|
||||||
reader.Dispose();
|
// reader.Dispose();
|
||||||
|
|
||||||
if (Directory.Exists(javaPath))
|
if (Directory.Exists(javaPath))
|
||||||
{
|
{
|
||||||
@ -326,71 +283,62 @@ namespace BFEditor.Build
|
|||||||
di.Delete(true);
|
di.Delete(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
BFEditorUtils.CopyDir(GoogleCommonProjectPath, dir);
|
// 如果是俄罗斯支付 则需要覆盖为俄罗斯相关文件
|
||||||
// 获取到google_common复制过去的build.gradle和AndroidManifest
|
// if (buildInfo.bundleName == BF.BFPlatform.ANDROID_GP_PACKAGE_NAME_RU)
|
||||||
var buildGradlePath = Path.Combine(dir, "launcher/build.gradle");
|
// {
|
||||||
var text = File.ReadAllText(buildGradlePath);
|
// BFEditorUtils.CopyDir(RuProjectPath, dir);
|
||||||
var regex = new Regex("REPLACE_APPLICATION_ID");
|
// // 获取到build.gradle和AndroidManifest
|
||||||
text = regex.Replace(text, buildInfo.bundleName);
|
// var buildGradlePath = Path.Combine(dir, "launcher/build.gradle");
|
||||||
File.WriteAllText(buildGradlePath, text);
|
// var text = File.ReadAllText(buildGradlePath);
|
||||||
|
// var regex = new Regex("REPLACE_APPLICATION_ID");
|
||||||
|
// text = regex.Replace(text, buildInfo.bundleName);
|
||||||
|
// File.WriteAllText(buildGradlePath, text);
|
||||||
|
|
||||||
var androidManifestPath = Path.Combine(dir, "launcher/src/main/AndroidManifest.xml");
|
// var androidManifestPath = Path.Combine(dir, "launcher/src/main/AndroidManifest.xml");
|
||||||
text = File.ReadAllText(androidManifestPath);
|
// text = File.ReadAllText(androidManifestPath);
|
||||||
regex = new Regex("REPLACE_APPLICATION_ID");
|
// regex = new Regex("REPLACE_APPLICATION_ID");
|
||||||
text = regex.Replace(text, buildInfo.bundleName);
|
// text = regex.Replace(text, buildInfo.bundleName);
|
||||||
File.WriteAllText(androidManifestPath, text);
|
// File.WriteAllText(androidManifestPath, text);
|
||||||
|
|
||||||
BFEditorUtils.CopyDir(asProjectPath, dir);
|
// // 还有另一个AndroidManifest
|
||||||
|
// androidManifestPath = Path.Combine(dir, "unityLibrary/src/main/AndroidManifest.xml");
|
||||||
|
// text = File.ReadAllText(androidManifestPath);
|
||||||
|
// regex = new Regex("REPLACE_APPLICATION_ID");
|
||||||
|
// text = regex.Replace(text, buildInfo.bundleName);
|
||||||
|
// File.WriteAllText(androidManifestPath, text);
|
||||||
|
// }
|
||||||
|
// // 否则使用通用谷歌
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
BFEditorUtils.CopyDir(GoogleCommonProjectPath, dir);
|
||||||
|
// 获取到google_common复制过去的build.gradle和AndroidManifest
|
||||||
|
var buildGradlePath = Path.Combine(dir, "launcher/build.gradle");
|
||||||
|
var text = File.ReadAllText(buildGradlePath);
|
||||||
|
var regex = new Regex("REPLACE_APPLICATION_ID");
|
||||||
|
text = regex.Replace(text, buildInfo.bundleName);
|
||||||
|
File.WriteAllText(buildGradlePath, text);
|
||||||
|
|
||||||
text = File.ReadAllText(manifestPath);
|
var androidManifestPath = Path.Combine(dir, "launcher/src/main/AndroidManifest.xml");
|
||||||
regex = new Regex("REPLACE_BUILD_ID");
|
text = File.ReadAllText(androidManifestPath);
|
||||||
text = regex.Replace(text, buildIdLine);
|
regex = new Regex("REPLACE_APPLICATION_ID");
|
||||||
File.WriteAllText(manifestPath, text);
|
text = regex.Replace(text, buildInfo.bundleName);
|
||||||
}
|
File.WriteAllText(androidManifestPath, text);
|
||||||
|
|
||||||
/// <summary>
|
BFEditorUtils.CopyDir(asProjectPath, dir);
|
||||||
/// 合并gp工程
|
// 还有dz_google_apk下的AndroidManifest
|
||||||
/// </summary>
|
androidManifestPath = Path.Combine(dir, "unityLibrary/src/main/AndroidManifest.xml");
|
||||||
static void MergeGPToReleaseProject(BuildInfo buildInfo)
|
text = File.ReadAllText(androidManifestPath);
|
||||||
{
|
regex = new Regex("REPLACE_APPLICATION_ID");
|
||||||
Debug.Log("[bfinfo]正在整合gp渠道sdk...");
|
text = regex.Replace(text, buildInfo.bundleName);
|
||||||
|
File.WriteAllText(androidManifestPath, text);
|
||||||
var javaPath = GradleExcuteProjectPath + "/src/main/java";
|
// }
|
||||||
var manifestPath = GradleExcuteProjectPath + "/src/main/AndroidManifest.xml";
|
// 统一替换google-services文件
|
||||||
|
var gsPath = Path.Combine(GoogleServicesProjectPath, Path.Combine(buildInfo.bundleName, "google-services.json"));
|
||||||
// 获取到unity打出的build-id
|
if (File.Exists(gsPath))
|
||||||
var reader = new StreamReader(new FileStream(manifestPath, FileMode.Open));
|
|
||||||
string buildIdLine;
|
|
||||||
while ((buildIdLine = reader.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
if (buildIdLine.Contains("unity.build-id"))
|
|
||||||
{
|
|
||||||
Debug.Log("[bfinfo]修正build-id: " + buildIdLine);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reader.Close();
|
|
||||||
reader.Dispose();
|
|
||||||
|
|
||||||
if (Directory.Exists(javaPath))
|
|
||||||
{
|
|
||||||
var di = new DirectoryInfo(javaPath);
|
|
||||||
di.Delete(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buildInfo.IsGPOfficial())
|
|
||||||
{
|
{
|
||||||
BFEditorUtils.CopyDir(GPOfficialAsProjectPath, GradleExcuteProjectPath);
|
var destFilePath = Path.Combine(dir, "launcher/google-services.json");
|
||||||
|
File.Copy(gsPath, destFilePath, true);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
BFEditorUtils.CopyDir(GPAsProjectPath, GradleExcuteProjectPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
var text = File.ReadAllText(manifestPath);
|
|
||||||
var regex = new Regex("REPLACE_BUILD_ID");
|
|
||||||
text = regex.Replace(text, buildIdLine);
|
|
||||||
File.WriteAllText(manifestPath, text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -413,7 +361,7 @@ namespace BFEditor.Build
|
|||||||
text2 = regex2.Replace(text2, string.Format("versionName '{0}'", versionName));
|
text2 = regex2.Replace(text2, string.Format("versionName '{0}'", versionName));
|
||||||
File.WriteAllText(gradleFilePath2, text2);
|
File.WriteAllText(gradleFilePath2, text2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 内网Release包接入Bugly
|
/// 内网Release包接入Bugly
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -429,7 +377,7 @@ namespace BFEditor.Build
|
|||||||
"implementation 'com.tencent.bugly:crashreport:latest.release'\n" +
|
"implementation 'com.tencent.bugly:crashreport:latest.release'\n" +
|
||||||
"implementation 'com.tencent.bugly:nativecrashreport:latest.release'\n");
|
"implementation 'com.tencent.bugly:nativecrashreport:latest.release'\n");
|
||||||
File.WriteAllText(gradleFilePath, text);
|
File.WriteAllText(gradleFilePath, text);
|
||||||
|
|
||||||
// 修改AndroidManifest.xml
|
// 修改AndroidManifest.xml
|
||||||
var manifestPath = GradleExcuteProjectPath + "/src/main/AndroidManifest.xml";
|
var manifestPath = GradleExcuteProjectPath + "/src/main/AndroidManifest.xml";
|
||||||
text = File.ReadAllText(manifestPath);
|
text = File.ReadAllText(manifestPath);
|
||||||
@ -442,7 +390,7 @@ namespace BFEditor.Build
|
|||||||
"<uses-permission android:name='android.permission.READ_LOGS' />\n" +
|
"<uses-permission android:name='android.permission.READ_LOGS' />\n" +
|
||||||
"<uses-permission android:name='android.permission.POST_NOTIFICATIONS'/>\n");
|
"<uses-permission android:name='android.permission.POST_NOTIFICATIONS'/>\n");
|
||||||
File.WriteAllText(manifestPath, text);
|
File.WriteAllText(manifestPath, text);
|
||||||
|
|
||||||
// 修改UnityPlayerActivity.java
|
// 修改UnityPlayerActivity.java
|
||||||
var javaPath = GradleExcuteProjectPath + "/src/main/java/com/juzu/ub/release/android/UnityPlayerActivity.java";
|
var javaPath = GradleExcuteProjectPath + "/src/main/java/com/juzu/ub/release/android/UnityPlayerActivity.java";
|
||||||
text = File.ReadAllText(javaPath);
|
text = File.ReadAllText(javaPath);
|
||||||
@ -458,7 +406,7 @@ namespace BFEditor.Build
|
|||||||
text = text.Insert(index + length, formatInsertString);
|
text = text.Insert(index + length, formatInsertString);
|
||||||
File.WriteAllText(javaPath, text);
|
File.WriteAllText(javaPath, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// release包加密后签名
|
/// release包加密后签名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -477,7 +425,7 @@ namespace BFEditor.Build
|
|||||||
});
|
});
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// gp包对齐
|
/// gp包对齐
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -524,7 +472,7 @@ namespace BFEditor.Build
|
|||||||
{
|
{
|
||||||
// 将release的so复制到bugly文件下
|
// 将release的so复制到bugly文件下
|
||||||
BFEditorUtils.CopyDir(ReleaseSOPath, BuglySOPath);
|
BFEditorUtils.CopyDir(ReleaseSOPath, BuglySOPath);
|
||||||
|
|
||||||
// 开启Thread处理打包so和上传
|
// 开启Thread处理打包so和上传
|
||||||
TryCloseUploadThread();
|
TryCloseUploadThread();
|
||||||
var args = "bugly.sh" + " " + BUGLY_APP_ID + " " + BUGLY_APP_KEY + " " + bundleName + " " + version;
|
var args = "bugly.sh" + " " + BUGLY_APP_ID + " " + BUGLY_APP_KEY + " " + bundleName + " " + version;
|
||||||
@ -532,7 +480,7 @@ namespace BFEditor.Build
|
|||||||
buglyUploadThread.IsBackground = true;
|
buglyUploadThread.IsBackground = true;
|
||||||
buglyUploadThread.Start();
|
buglyUploadThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UploadBuglySymbol(string args)
|
static void UploadBuglySymbol(string args)
|
||||||
{
|
{
|
||||||
BFEditorUtils.RunCommond("sh", args, BuglyPath,
|
BFEditorUtils.RunCommond("sh", args, BuglyPath,
|
||||||
@ -544,10 +492,10 @@ namespace BFEditor.Build
|
|||||||
{
|
{
|
||||||
Debug.LogError("[bferror] UploadBuglySymbol: " + errorMsg);
|
Debug.LogError("[bferror] UploadBuglySymbol: " + errorMsg);
|
||||||
});
|
});
|
||||||
|
|
||||||
TryCloseUploadThread();
|
TryCloseUploadThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TryCloseUploadThread()
|
static void TryCloseUploadThread()
|
||||||
{
|
{
|
||||||
if (buglyUploadThread != null)
|
if (buglyUploadThread != null)
|
||||||
|
|||||||
@ -1,348 +1,348 @@
|
|||||||
#if UNITY_EDITOR_OSX
|
// #if UNITY_EDITOR_OSX
|
||||||
using UnityEngine;
|
// using UnityEngine;
|
||||||
using UnityEditor;
|
// using UnityEditor;
|
||||||
using UnityEditor.Build.Reporting;
|
// using UnityEditor.Build.Reporting;
|
||||||
using UnityEditor.iOS.Xcode;
|
// using UnityEditor.iOS.Xcode;
|
||||||
using System.IO;
|
// using System.IO;
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
namespace BFEditor.Build
|
// namespace BFEditor.Build
|
||||||
{
|
// {
|
||||||
public static class BuildIOSUtils
|
// public static class BuildIOSUtils
|
||||||
{
|
// {
|
||||||
#if UNITY_EDITOR_OSX
|
// #if UNITY_EDITOR_OSX
|
||||||
const string IOS_DEFINE_SYMBOLS = "THREAD_SAFE;USE_AB";
|
// const string IOS_DEFINE_SYMBOLS = "THREAD_SAFE;USE_AB";
|
||||||
const string DEV_XCODE_LOCAL_PATH = "BFVersions/ios/dev";
|
// const string DEV_XCODE_LOCAL_PATH = "BFVersions/ios/dev";
|
||||||
const string RELEASE_XCODE_LOCAL_PATH = "BFVersions/ios/release";
|
// const string RELEASE_XCODE_LOCAL_PATH = "BFVersions/ios/release";
|
||||||
|
|
||||||
static string devXCodePath = Application.dataPath + "/../" + DEV_XCODE_LOCAL_PATH;
|
// static string devXCodePath = Application.dataPath + "/../" + DEV_XCODE_LOCAL_PATH;
|
||||||
static string releaseXCodePath = Application.dataPath + "/../" + RELEASE_XCODE_LOCAL_PATH;
|
// static string releaseXCodePath = Application.dataPath + "/../" + RELEASE_XCODE_LOCAL_PATH;
|
||||||
static string devOptionsPListPath = Application.dataPath + "/../" + "BFVersions/ios/exports/dev/ExportOptions.plist";
|
// static string devOptionsPListPath = Application.dataPath + "/../" + "BFVersions/ios/exports/dev/ExportOptions.plist";
|
||||||
static string releaseOptionsPListPath = Application.dataPath + "/../" + "BFVersions/ios/exports/release/ExportOptions.plist";
|
// static string releaseOptionsPListPath = Application.dataPath + "/../" + "BFVersions/ios/exports/release/ExportOptions.plist";
|
||||||
static string publishOptionsPListPath = Application.dataPath + "/../" + "BFVersions/ios/exports/dis/ExportOptions.plist";
|
// static string publishOptionsPListPath = Application.dataPath + "/../" + "BFVersions/ios/exports/dis/ExportOptions.plist";
|
||||||
|
|
||||||
public static bool BuildIOSPlayer(BuildInfo buildInfo)
|
// public static bool BuildIOSPlayer(BuildInfo buildInfo)
|
||||||
{
|
// {
|
||||||
var buildTarget = BuildTarget.iOS;
|
// var buildTarget = BuildTarget.iOS;
|
||||||
|
|
||||||
// 检查平台
|
// // 检查平台
|
||||||
if (EditorUserBuildSettings.activeBuildTarget != buildTarget)
|
// if (EditorUserBuildSettings.activeBuildTarget != buildTarget)
|
||||||
{
|
// {
|
||||||
Debug.LogError("[bferror]当前没有在对应平台");
|
// Debug.LogError("[bferror]当前没有在对应平台");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 重新生成XLua
|
// // 重新生成XLua
|
||||||
CompileScriptsUtils.RegenerateXLuaCode(true);
|
// CompileScriptsUtils.RegenerateXLuaCode(true);
|
||||||
|
|
||||||
// 打包设置
|
// // 打包设置
|
||||||
BuildSettings(buildInfo);
|
// BuildSettings(buildInfo);
|
||||||
|
|
||||||
// 开始打包
|
// // 开始打包
|
||||||
var bpOptions = GetBuildOptions(buildInfo);
|
// var bpOptions = GetBuildOptions(buildInfo);
|
||||||
var report = BuildPipeline.BuildPlayer(bpOptions);
|
// var report = BuildPipeline.BuildPlayer(bpOptions);
|
||||||
if (report.summary.result == BuildResult.Succeeded)
|
// if (report.summary.result == BuildResult.Succeeded)
|
||||||
{
|
// {
|
||||||
return BuildIpaFromXCode(buildInfo);
|
// return BuildIpaFromXCode(buildInfo);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Debug.LogError("[bferror]unity打包xcode失败");
|
// Debug.LogError("[bferror]unity打包xcode失败");
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 打包设置
|
// /// 打包设置
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
static void BuildSettings(BuildInfo buildInfo)
|
// static void BuildSettings(BuildInfo buildInfo)
|
||||||
{
|
// {
|
||||||
// 设置bundleVersion
|
// // 设置bundleVersion
|
||||||
PlayerSettings.bundleVersion = buildInfo.version;
|
// PlayerSettings.bundleVersion = buildInfo.version;
|
||||||
|
|
||||||
// 设置buildNumber
|
// // 设置buildNumber
|
||||||
PlayerSettings.iOS.buildNumber = buildInfo.version_code.ToString();
|
// PlayerSettings.iOS.buildNumber = buildInfo.versionCode.ToString();
|
||||||
|
|
||||||
// 设置竖屏
|
// // 设置竖屏
|
||||||
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
// PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
||||||
PlayerSettings.allowedAutorotateToPortrait = false;
|
// PlayerSettings.allowedAutorotateToPortrait = false;
|
||||||
PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
|
// PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
|
||||||
PlayerSettings.allowedAutorotateToLandscapeLeft = false;
|
// PlayerSettings.allowedAutorotateToLandscapeLeft = false;
|
||||||
PlayerSettings.allowedAutorotateToLandscapeRight = false;
|
// PlayerSettings.allowedAutorotateToLandscapeRight = false;
|
||||||
|
|
||||||
// 允许Xcode根据appleDeveloperTeamID自动签署应用程序
|
// // 允许Xcode根据appleDeveloperTeamID自动签署应用程序
|
||||||
PlayerSettings.iOS.appleEnableAutomaticSigning = !buildInfo.IsPublish();
|
// PlayerSettings.iOS.appleEnableAutomaticSigning = !buildInfo.IsPublish();
|
||||||
|
|
||||||
// 使用手动签名时iOS资源调配配置文件的类型,自动
|
// // 使用手动签名时iOS资源调配配置文件的类型,自动
|
||||||
PlayerSettings.iOS.iOSManualProvisioningProfileType = buildInfo.IsPublish() ? ProvisioningProfileType.Distribution : ProvisioningProfileType.Automatic;
|
// PlayerSettings.iOS.iOSManualProvisioningProfileType = buildInfo.IsPublish() ? ProvisioningProfileType.Distribution : ProvisioningProfileType.Automatic;
|
||||||
|
|
||||||
// 关闭启动动画
|
// // 关闭启动动画
|
||||||
PlayerSettings.SplashScreen.show = false;
|
// PlayerSettings.SplashScreen.show = false;
|
||||||
|
|
||||||
// 设置包名
|
// // 设置包名
|
||||||
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, buildInfo.bundleName);
|
// PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, buildInfo.bundleName);
|
||||||
Debug.Log("[bfinfo]设置包名:" + buildInfo.bundleName);
|
// Debug.Log("[bfinfo]设置包名:" + buildInfo.bundleName);
|
||||||
|
|
||||||
// 是否跳过版本控制
|
// // 是否跳过版本控制
|
||||||
var symbols = IOS_DEFINE_SYMBOLS;
|
// var symbols = IOS_DEFINE_SYMBOLS;
|
||||||
if (buildInfo.skipVersion)
|
// if (buildInfo.skipVersion)
|
||||||
{
|
// {
|
||||||
symbols = symbols + ";SKIP_VERSION;";
|
// symbols = symbols + ";SKIP_VERSION;";
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, symbols);
|
// PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, symbols);
|
||||||
Debug.Log("[bfinfo]设置defineSymbols: " + symbols);
|
// Debug.Log("[bfinfo]设置defineSymbols: " + symbols);
|
||||||
|
|
||||||
// 是否是dev
|
// // 是否是dev
|
||||||
var development = buildInfo.IsDevChannel();
|
// var development = buildInfo.IsDevChannel();
|
||||||
EditorUserBuildSettings.development = development;
|
// EditorUserBuildSettings.development = development;
|
||||||
|
|
||||||
// 商品名称
|
// // 商品名称
|
||||||
if (buildInfo.IsPublish())
|
// if (buildInfo.IsPublish())
|
||||||
{
|
// {
|
||||||
PlayerSettings.productName = "Heroic Expedition";
|
// PlayerSettings.productName = "Heroic Expedition";
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
PlayerSettings.productName = development ? "b6-dev" : "b6-release";
|
// PlayerSettings.productName = development ? "b6-dev" : "b6-release";
|
||||||
}
|
// }
|
||||||
|
|
||||||
// BuildType设置dev/release
|
// // BuildType设置dev/release
|
||||||
EditorUserBuildSettings.iOSBuildConfigType = development ? iOSBuildType.Debug : iOSBuildType.Release;
|
// EditorUserBuildSettings.iOSXcodeBuildConfig = development ? XcodeBuildConfig.Debug : XcodeBuildConfig.Release;
|
||||||
|
|
||||||
// 使用IL2CPP
|
// // 使用IL2CPP
|
||||||
var scriptImp = ScriptingImplementation.IL2CPP;
|
// var scriptImp = ScriptingImplementation.IL2CPP;
|
||||||
PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, scriptImp);
|
// PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, scriptImp);
|
||||||
|
|
||||||
// 目标平台架构,目前支持ARM64
|
// // 目标平台架构,目前支持ARM64
|
||||||
PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, 1);
|
// PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, 1);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 获取打包参数
|
// /// 获取打包参数
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
static BuildPlayerOptions GetBuildOptions(BuildInfo buildInfo)
|
// static BuildPlayerOptions GetBuildOptions(BuildInfo buildInfo)
|
||||||
{
|
// {
|
||||||
var bpOptions = new BuildPlayerOptions();
|
// var bpOptions = new BuildPlayerOptions();
|
||||||
bpOptions.scenes = AssetBundleUtils.GetBuildScenes();
|
// bpOptions.scenes = AssetBundleUtils.GetBuildScenes();
|
||||||
bpOptions.target = BuildTarget.iOS;
|
// bpOptions.target = BuildTarget.iOS;
|
||||||
|
|
||||||
var path = buildInfo.IsReleaseChannel() ? RELEASE_XCODE_LOCAL_PATH : DEV_XCODE_LOCAL_PATH;
|
// var path = buildInfo.IsReleaseChannel() ? RELEASE_XCODE_LOCAL_PATH : DEV_XCODE_LOCAL_PATH;
|
||||||
bpOptions.locationPathName = path;
|
// bpOptions.locationPathName = path;
|
||||||
Debug.Log("[bfinfo]xcode path : " + path);
|
// Debug.Log("[bfinfo]xcode path : " + path);
|
||||||
var absolutePath = buildInfo.IsReleaseChannel() ? releaseXCodePath : devXCodePath;
|
// var absolutePath = buildInfo.IsReleaseChannel() ? releaseXCodePath : devXCodePath;
|
||||||
if (Directory.Exists(absolutePath))
|
// if (Directory.Exists(absolutePath))
|
||||||
{
|
// {
|
||||||
Directory.Delete(absolutePath, true);
|
// Directory.Delete(absolutePath, true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!buildInfo.IsPublish())
|
// if (!buildInfo.IsPublish())
|
||||||
{
|
// {
|
||||||
var options = BuildOptions.Development | BuildOptions.ConnectWithProfiler | BuildOptions.AllowDebugging;
|
// var options = BuildOptions.Development | BuildOptions.ConnectWithProfiler | BuildOptions.AllowDebugging;
|
||||||
bpOptions.options = options;
|
// bpOptions.options = options;
|
||||||
}
|
// }
|
||||||
return bpOptions;
|
// return bpOptions;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 打包ipa
|
// /// 打包ipa
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
static bool BuildIpaFromXCode(BuildInfo buildInfo)
|
// static bool BuildIpaFromXCode(BuildInfo buildInfo)
|
||||||
{
|
// {
|
||||||
// 修改XCode设置
|
// // 修改XCode设置
|
||||||
FixXCodeProject(buildInfo);
|
// FixXCodeProject(buildInfo);
|
||||||
|
|
||||||
// 权限
|
// // 权限
|
||||||
UnlockKeyChain();
|
// UnlockKeyChain();
|
||||||
|
|
||||||
// archive
|
// // archive
|
||||||
if (!Archive(buildInfo))
|
// if (!Archive(buildInfo))
|
||||||
{
|
// {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 导出ipa
|
// // 导出ipa
|
||||||
if (!ExportIpa(buildInfo))
|
// if (!ExportIpa(buildInfo))
|
||||||
{
|
// {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// xCode工程设置
|
// /// xCode工程设置
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
static void FixXCodeProject(BuildInfo buildInfo)
|
// static void FixXCodeProject(BuildInfo buildInfo)
|
||||||
{
|
// {
|
||||||
var isDev = buildInfo.IsDevChannel();
|
// var isDev = buildInfo.IsDevChannel();
|
||||||
var xCodeProjectPath = isDev ? devXCodePath : releaseXCodePath;
|
// var xCodeProjectPath = isDev ? devXCodePath : releaseXCodePath;
|
||||||
|
|
||||||
var path = xCodeProjectPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
|
// var path = xCodeProjectPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
|
||||||
var pbxProject = new PBXProject();
|
// var pbxProject = new PBXProject();
|
||||||
pbxProject.ReadFromFile(path);
|
// pbxProject.ReadFromFile(path);
|
||||||
var targetGuid = pbxProject.TargetGuidByName("Unity-iPhone");
|
// var targetGuid = pbxProject.TargetGuidByName("Unity-iPhone");
|
||||||
pbxProject.AddBuildProperty(targetGuid, "OTHER_LDFLAGS", "-ObjC");
|
// pbxProject.AddBuildProperty(targetGuid, "OTHER_LDFLAGS", "-ObjC");
|
||||||
pbxProject.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");
|
// pbxProject.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");
|
||||||
pbxProject.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");
|
// pbxProject.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");
|
||||||
pbxProject.SetBuildProperty(targetGuid, "DEVELOPMENT_TEAM", "49QQW8856Q");
|
// pbxProject.SetBuildProperty(targetGuid, "DEVELOPMENT_TEAM", "49QQW8856Q");
|
||||||
if (buildInfo.IsPublish())
|
// if (buildInfo.IsPublish())
|
||||||
{
|
// {
|
||||||
pbxProject.SetBuildProperty(targetGuid, "PROVISIONING_PROFILE_SPECIFIER", "ub_appstore_dis");
|
// pbxProject.SetBuildProperty(targetGuid, "PROVISIONING_PROFILE_SPECIFIER", "ub_appstore_dis");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 添加系统库
|
// // 添加系统库
|
||||||
AddSystemLibReferenceToProject(pbxProject, targetGuid, "libsqlite3.tbd");
|
// AddSystemLibReferenceToProject(pbxProject, targetGuid, "libsqlite3.tbd");
|
||||||
AddSystemLibReferenceToProject(pbxProject, targetGuid, "libz.1.tbd");
|
// AddSystemLibReferenceToProject(pbxProject, targetGuid, "libz.1.tbd");
|
||||||
AddSystemLibReferenceToProject(pbxProject, targetGuid, "libiconv.2.tbd");
|
// AddSystemLibReferenceToProject(pbxProject, targetGuid, "libiconv.2.tbd");
|
||||||
AddSystemLibReferenceToProject(pbxProject, targetGuid, "libresolv.9.tbd");
|
// AddSystemLibReferenceToProject(pbxProject, targetGuid, "libresolv.9.tbd");
|
||||||
|
|
||||||
var pListPath = Path.Combine(xCodeProjectPath, "Info.plist");
|
// var pListPath = Path.Combine(xCodeProjectPath, "Info.plist");
|
||||||
var pList = new PlistDocument();
|
// var pList = new PlistDocument();
|
||||||
pList.ReadFromFile(pListPath);
|
// pList.ReadFromFile(pListPath);
|
||||||
|
|
||||||
// 版本号
|
// // 版本号
|
||||||
var vKey = "CFBundleShortVersionString";
|
// var vKey = "CFBundleShortVersionString";
|
||||||
var vValue = new PlistElementString(buildInfo.version);
|
// var vValue = new PlistElementString(buildInfo.version);
|
||||||
var pListRoot = pList.root;
|
// var pListRoot = pList.root;
|
||||||
var rootDict = pListRoot.values;
|
// var rootDict = pListRoot.values;
|
||||||
if (!rootDict.ContainsKey(vKey))
|
// if (!rootDict.ContainsKey(vKey))
|
||||||
{
|
// {
|
||||||
rootDict.Add(vKey, vValue);
|
// rootDict.Add(vKey, vValue);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
rootDict[vKey] = vValue;
|
// rootDict[vKey] = vValue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// VersionCode
|
// // VersionCode
|
||||||
var vCodeKey = "CFBundleVersion";
|
// var vCodeKey = "CFBundleVersion";
|
||||||
var vCodeValue = new PlistElementString(buildInfo.version_code.ToString());
|
// var vCodeValue = new PlistElementString(buildInfo.versionCode.ToString());
|
||||||
if (!rootDict.ContainsKey(vCodeKey))
|
// if (!rootDict.ContainsKey(vCodeKey))
|
||||||
{
|
// {
|
||||||
rootDict.Add(vCodeKey, vCodeValue);
|
// rootDict.Add(vCodeKey, vCodeValue);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
rootDict[vCodeKey] = vCodeValue;
|
// rootDict[vCodeKey] = vCodeValue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 数美SDK会使用位置,必须加入这个说明
|
// // 数美SDK会使用位置,必须加入这个说明
|
||||||
var localtionKey = "NSLocationWhenInUseUsageDescription";
|
// var localtionKey = "NSLocationWhenInUseUsageDescription";
|
||||||
var localtionValue = new PlistElementString("We use your location to give you a better localization.");
|
// var localtionValue = new PlistElementString("We use your location to give you a better localization.");
|
||||||
if (!rootDict.ContainsKey(localtionKey))
|
// if (!rootDict.ContainsKey(localtionKey))
|
||||||
{
|
// {
|
||||||
rootDict.Add(localtionKey, localtionValue);
|
// rootDict.Add(localtionKey, localtionValue);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
rootDict[localtionKey] = localtionValue;
|
// rootDict[localtionKey] = localtionValue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 提审提示缺少出口合规证明,这里直接设置为false即可
|
// // 提审提示缺少出口合规证明,这里直接设置为false即可
|
||||||
var encryptionKey = "ITSAppUsesNonExemptEncryption";
|
// var encryptionKey = "ITSAppUsesNonExemptEncryption";
|
||||||
var encryptionValue = new PlistElementBoolean(false);
|
// var encryptionValue = new PlistElementBoolean(false);
|
||||||
if (!rootDict.ContainsKey(encryptionKey))
|
// if (!rootDict.ContainsKey(encryptionKey))
|
||||||
{
|
// {
|
||||||
rootDict.Add(encryptionKey, encryptionValue);
|
// rootDict.Add(encryptionKey, encryptionValue);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
rootDict[encryptionKey] = encryptionValue;
|
// rootDict[encryptionKey] = encryptionValue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
pList.WriteToFile(pListPath);
|
// pList.WriteToFile(pListPath);
|
||||||
pbxProject.WriteToFile(path);
|
// pbxProject.WriteToFile(path);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//添加系统lib方法
|
// //添加系统lib方法
|
||||||
static void AddSystemLibReferenceToProject(PBXProject pbxProject, string targetGuid, string lib)
|
// static void AddSystemLibReferenceToProject(PBXProject pbxProject, string targetGuid, string lib)
|
||||||
{
|
// {
|
||||||
var fileGuid = pbxProject.AddFile("usr/lib/" + lib, "Frameworks/" + lib, PBXSourceTree.Sdk);
|
// var fileGuid = pbxProject.AddFile("usr/lib/" + lib, "Frameworks/" + lib, PBXSourceTree.Sdk);
|
||||||
pbxProject.AddFileToBuild(targetGuid, fileGuid);
|
// pbxProject.AddFileToBuild(targetGuid, fileGuid);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Archive
|
// /// Archive
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
static bool Archive(BuildInfo buildInfo)
|
// static bool Archive(BuildInfo buildInfo)
|
||||||
{
|
// {
|
||||||
Debug.Log("[bfinfo]正在archive...");
|
// Debug.Log("[bfinfo]正在archive...");
|
||||||
var result = true;
|
// var result = true;
|
||||||
var xCodeProjectPath = buildInfo.IsDevChannel() ? devXCodePath : releaseXCodePath;
|
// var xCodeProjectPath = buildInfo.IsDevChannel() ? devXCodePath : releaseXCodePath;
|
||||||
var archivePath = xCodeProjectPath + "/build/archive/Unity-iPhone.xcarchive";
|
// var archivePath = xCodeProjectPath + "/build/archive/Unity-iPhone.xcarchive";
|
||||||
var args = string.Format("archive -scheme Unity-iPhone -configuration Release -archivePath {0}", archivePath);
|
// var args = string.Format("archive -scheme Unity-iPhone -configuration Release -archivePath {0}", archivePath);
|
||||||
BFEditorUtils.RunCommond("xcodebuild", args, xCodeProjectPath,
|
// BFEditorUtils.RunCommond("xcodebuild", args, xCodeProjectPath,
|
||||||
(info) =>
|
// (info) =>
|
||||||
{
|
// {
|
||||||
Debug.Log(info);
|
// Debug.Log(info);
|
||||||
},
|
// },
|
||||||
(error) =>
|
// (error) =>
|
||||||
{
|
// {
|
||||||
if (error.Contains("ARCHIVE FAILED")) // 失败标志
|
// if (error.Contains("ARCHIVE FAILED")) // 失败标志
|
||||||
{
|
// {
|
||||||
result = false;
|
// result = false;
|
||||||
}
|
// }
|
||||||
Debug.LogError("[bferror] " + error);
|
// Debug.LogError("[bferror] " + error);
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 导出ipa
|
// /// 导出ipa
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
static bool ExportIpa(BuildInfo buildInfo)
|
// static bool ExportIpa(BuildInfo buildInfo)
|
||||||
{
|
// {
|
||||||
Debug.Log("[bfinfo]正在导出ipa...");
|
// Debug.Log("[bfinfo]正在导出ipa...");
|
||||||
var result = false;
|
// var result = false;
|
||||||
var xCodeProjectPath = buildInfo.IsDevChannel() ? devXCodePath : releaseXCodePath;
|
// var xCodeProjectPath = buildInfo.IsDevChannel() ? devXCodePath : releaseXCodePath;
|
||||||
string exportPListPath;
|
// string exportPListPath;
|
||||||
if (buildInfo.IsPublish())
|
// if (buildInfo.IsPublish())
|
||||||
{
|
// {
|
||||||
exportPListPath = publishOptionsPListPath;
|
// exportPListPath = publishOptionsPListPath;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
exportPListPath = buildInfo.IsDevChannel() ? devOptionsPListPath : releaseOptionsPListPath;
|
// exportPListPath = buildInfo.IsDevChannel() ? devOptionsPListPath : releaseOptionsPListPath;
|
||||||
}
|
// }
|
||||||
var ipaPath = xCodeProjectPath + "/build/ipa";
|
// var ipaPath = xCodeProjectPath + "/build/ipa";
|
||||||
var archivePath = xCodeProjectPath + "/build/archive/Unity-iPhone.xcarchive";
|
// var archivePath = xCodeProjectPath + "/build/archive/Unity-iPhone.xcarchive";
|
||||||
var args = string.Format("-exportArchive -archivePath {0} -exportPath {1} -exportOptionsPlist {2} -allowProvisioningUpdates", archivePath, ipaPath, exportPListPath);
|
// var args = string.Format("-exportArchive -archivePath {0} -exportPath {1} -exportOptionsPlist {2} -allowProvisioningUpdates", archivePath, ipaPath, exportPListPath);
|
||||||
BFEditorUtils.RunCommond("xcodebuild", args, null,
|
// BFEditorUtils.RunCommond("xcodebuild", args, null,
|
||||||
(info) =>
|
// (info) =>
|
||||||
{
|
// {
|
||||||
if(info.Contains("EXPORT SUCCEEDED"))
|
// if(info.Contains("EXPORT SUCCEEDED"))
|
||||||
{
|
// {
|
||||||
result = true;
|
// result = true;
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
(error) =>
|
// (error) =>
|
||||||
{
|
// {
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
|
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 远程打包签名ipa时需要钥匙串权限
|
// /// 远程打包签名ipa时需要钥匙串权限
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
static void UnlockKeyChain()
|
// static void UnlockKeyChain()
|
||||||
{
|
// {
|
||||||
BFEditorUtils.RunCommond("security", "-v unlock-keychain -p '123456' /Users/aoddabao/Library/Keychains/login.keychain-db", null,
|
// BFEditorUtils.RunCommond("security", "-v unlock-keychain -p '123456' /Users/aoddabao/Library/Keychains/login.keychain-db", null,
|
||||||
(msg) =>
|
// (msg) =>
|
||||||
{
|
// {
|
||||||
Debug.Log(msg);
|
// Debug.Log(msg);
|
||||||
},
|
// },
|
||||||
(msg) =>
|
// (msg) =>
|
||||||
{
|
// {
|
||||||
Debug.LogError(msg);
|
// Debug.LogError(msg);
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
#endif
|
// #endif
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
@ -85,6 +85,9 @@ namespace BFEditor
|
|||||||
{
|
{
|
||||||
//加载lua配置测试
|
//加载lua配置测试
|
||||||
LuaEnv env = new LuaEnv();
|
LuaEnv env = new LuaEnv();
|
||||||
|
env.DoString(@"
|
||||||
|
print('当前 Lua 版本: ' .. _VERSION) -- 输出 Lua 5.1
|
||||||
|
");
|
||||||
env.AddLoader((ref string scriptPath) =>
|
env.AddLoader((ref string scriptPath) =>
|
||||||
{
|
{
|
||||||
var text = LoadGameLuaScriptText(scriptPath, isDeveloper);
|
var text = LoadGameLuaScriptText(scriptPath, isDeveloper);
|
||||||
@ -136,58 +139,58 @@ namespace BFEditor
|
|||||||
var configFileInfos = configDirInfo.GetFiles(suffix, SearchOption.TopDirectoryOnly);
|
var configFileInfos = configDirInfo.GetFiles(suffix, SearchOption.TopDirectoryOnly);
|
||||||
|
|
||||||
// 检查棋盘文件格式
|
// 检查棋盘文件格式
|
||||||
checkBoard("chapter_board", env, sb);
|
// checkBoard("chapter_board", env, sb);
|
||||||
checkBoard("chapter_board_bossrush", env, sb);
|
// checkBoard("chapter_board_bossrush", env, sb);
|
||||||
checkBoard("chapter_board_daily_challenge", env, sb);
|
// checkBoard("chapter_board_daily_challenge", env, sb);
|
||||||
checkBoard("chapter_board_dungeon_armor", env, sb);
|
// checkBoard("chapter_board_dungeon_armor", env, sb);
|
||||||
checkBoard("chapter_board_dungeon_equip", env, sb);
|
// checkBoard("chapter_board_dungeon_equip", env, sb);
|
||||||
checkBoard("chapter_board_dungeon_gold", env, sb);
|
// checkBoard("chapter_board_dungeon_gold", env, sb);
|
||||||
checkBoard("chapter_board_dungeon_shards", env, sb);
|
// checkBoard("chapter_board_dungeon_shards", env, sb);
|
||||||
checkBoard("chapter_board_rune", env, sb);
|
// checkBoard("chapter_board_rune", env, sb);
|
||||||
checkBoard("activity_pvp_board", env, sb);
|
// checkBoard("activity_pvp_board", env, sb);
|
||||||
checkBoard("arena_board", env, sb);
|
// checkBoard("arena_board", env, sb);
|
||||||
|
|
||||||
|
|
||||||
// 检查monster
|
// 检查monster
|
||||||
string monsterConfigListLua = "{";
|
// string monsterConfigListLua = "{";
|
||||||
foreach (var file in configFileInfos)
|
// foreach (var file in configFileInfos)
|
||||||
{
|
// {
|
||||||
var fileName = file.Name.ToLower();
|
// var fileName = file.Name.ToLower();
|
||||||
if(fileName.Contains("monster_"))
|
// if(fileName.Contains("monster_"))
|
||||||
{
|
// {
|
||||||
monsterConfigListLua += "'" + fileName.Replace(".lua", "").Replace(".bytes", "") + "',";
|
// monsterConfigListLua += "'" + fileName.Replace(".lua", "").Replace(".bytes", "") + "',";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
monsterConfigListLua += "}";
|
// monsterConfigListLua += "}";
|
||||||
var luaScriptString = "local ids = {}\n local MONSTER_LIST = " + monsterConfigListLua + "\n";
|
// var luaScriptString = "local ids = {}\n local MONSTER_LIST = " + monsterConfigListLua + "\n";
|
||||||
luaScriptString += @"local str = {}
|
// luaScriptString += @"local str = {}
|
||||||
for i, name in ipairs(MONSTER_LIST) do
|
// for i, name in ipairs(MONSTER_LIST) do
|
||||||
if name ~= 'monster_base' and name ~= 'monster_position' and name ~= 'monster_position_base' then
|
// if name ~= 'monster_base' and name ~= 'monster_position' and name ~= 'monster_position_base' then
|
||||||
local data = require('app/config/' .. name).data
|
// local data = require('app/config/' .. name).data
|
||||||
for k, v in pairs(data) do
|
// for k, v in pairs(data) do
|
||||||
if ids[k] then
|
// if ids[k] then
|
||||||
table.insert(str, name .. '和' .. ids[k] .. '存在相同的mosnter id:' .. k)
|
// table.insert(str, name .. '和' .. ids[k] .. '存在相同的mosnter id:' .. k)
|
||||||
end
|
// end
|
||||||
ids[k] = name
|
// ids[k] = name
|
||||||
end
|
// end
|
||||||
end
|
// end
|
||||||
end
|
// end
|
||||||
if #str > 0 then
|
// if #str > 0 then
|
||||||
return table.concat(str, '\n');
|
// return table.concat(str, '\n');
|
||||||
end
|
// end
|
||||||
return ''";
|
// return ''";
|
||||||
var resultStr = env.DoString(luaScriptString);
|
// var resultStr = env.DoString(luaScriptString);
|
||||||
if (resultStr.Length > 0)
|
// if (resultStr.Length > 0)
|
||||||
{
|
// {
|
||||||
foreach(var strObj in resultStr)
|
// foreach(var strObj in resultStr)
|
||||||
{
|
// {
|
||||||
var str = Convert.ToString(strObj);
|
// var str = Convert.ToString(strObj);
|
||||||
if(!String.IsNullOrEmpty(str))
|
// if(!String.IsNullOrEmpty(str))
|
||||||
{
|
// {
|
||||||
sb.Append(str + "\n");
|
// sb.Append(str + "\n");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 检查怪物的坐标信息
|
// 检查怪物的坐标信息
|
||||||
// var luaScriptString2 = @"local MONSTER_POSITION_KEY = { 'monster_1','monster_2','monster_3','monster_4','monster_5','monster_6','monster_7','monster_8','monster_9','monster_10','monster_11','monster_12'}
|
// var luaScriptString2 = @"local MONSTER_POSITION_KEY = { 'monster_1','monster_2','monster_3','monster_4','monster_5','monster_6','monster_7','monster_8','monster_9','monster_10','monster_11','monster_12'}
|
||||||
// local list = {'enemy_id_1', 'enemy_id_2', 'enemy_id_3'}
|
// local list = {'enemy_id_1', 'enemy_id_2', 'enemy_id_3'}
|
||||||
|
|||||||
@ -1,117 +1,117 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Experimental.SceneManagement;
|
|
||||||
|
|
||||||
namespace BFEditor.Resource
|
namespace BFEditor.Resource
|
||||||
{
|
{
|
||||||
public class CheckRaycastTargetWindow : EditorWindow
|
public class CheckRaycastTargetWindow : EditorWindow
|
||||||
{
|
{
|
||||||
ShowRaycast raycastHelper;
|
ShowRaycast raycastHelper;
|
||||||
RectTransform rt;
|
RectTransform rt;
|
||||||
Vector2 scrollPos;
|
Vector2 scrollPos;
|
||||||
|
|
||||||
CheckRaycastTargetWindow()
|
CheckRaycastTargetWindow()
|
||||||
{
|
{
|
||||||
this.titleContent = new GUIContent("检查RaycastTarget");
|
this.titleContent = new GUIContent("检查RaycastTarget");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
{
|
{
|
||||||
PrefabStage currentPrefabStage = PrefabStageUtility.GetCurrentPrefabStage();
|
UnityEditor.SceneManagement.PrefabStage currentPrefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
|
||||||
Transform tran;
|
Transform tran;
|
||||||
if (currentPrefabStage == null)
|
if (currentPrefabStage == null)
|
||||||
tran = Selection.activeTransform;
|
tran = Selection.activeTransform;
|
||||||
else
|
else
|
||||||
tran = currentPrefabStage.prefabContentsRoot.transform;
|
tran = currentPrefabStage.prefabContentsRoot.transform;
|
||||||
if (tran != null)
|
if (tran != null)
|
||||||
rt = tran.GetComponent<RectTransform>();
|
rt = tran.GetComponent<RectTransform>();
|
||||||
if (rt != null)
|
if (rt != null)
|
||||||
{
|
{
|
||||||
raycastHelper = rt.GetComponent<ShowRaycast>();
|
raycastHelper = rt.GetComponent<ShowRaycast>();
|
||||||
if (raycastHelper == null)
|
if (raycastHelper == null)
|
||||||
raycastHelper = rt.gameObject.AddComponent<ShowRaycast>();
|
raycastHelper = rt.gameObject.AddComponent<ShowRaycast>();
|
||||||
raycastHelper.SetEditorWindowMode(true);
|
raycastHelper.SetEditorWindowMode(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnGUI()
|
void OnGUI()
|
||||||
{
|
{
|
||||||
GUILayout.BeginVertical();
|
GUILayout.BeginVertical();
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
rt = (RectTransform)EditorGUILayout.ObjectField("", rt, typeof(RectTransform), true, GUILayout.Width(200));
|
rt = (RectTransform)EditorGUILayout.ObjectField("", rt, typeof(RectTransform), true, GUILayout.Width(200));
|
||||||
GUILayout.Space(6);
|
GUILayout.Space(6);
|
||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
{
|
{
|
||||||
if (raycastHelper != null)
|
if (raycastHelper != null)
|
||||||
DestroyImmediate(raycastHelper);
|
DestroyImmediate(raycastHelper);
|
||||||
if (rt != null)
|
if (rt != null)
|
||||||
{
|
{
|
||||||
raycastHelper = rt.GetComponent<ShowRaycast>();
|
raycastHelper = rt.GetComponent<ShowRaycast>();
|
||||||
if (raycastHelper == null)
|
if (raycastHelper == null)
|
||||||
raycastHelper = rt.gameObject.AddComponent<ShowRaycast>();
|
raycastHelper = rt.gameObject.AddComponent<ShowRaycast>();
|
||||||
raycastHelper.SetEditorWindowMode(true);
|
raycastHelper.SetEditorWindowMode(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (raycastHelper != null)
|
if (raycastHelper != null)
|
||||||
{
|
{
|
||||||
GUILayout.Label(string.Format("raycastTarget组件一共有 {0} 个", raycastHelper.GetTotalCount()));
|
GUILayout.Label(string.Format("raycastTarget组件一共有 {0} 个", raycastHelper.GetTotalCount()));
|
||||||
GUILayout.Label("(红色)image " + raycastHelper.GetImageCount() +
|
GUILayout.Label("(红色)image " + raycastHelper.GetImageCount() +
|
||||||
" (绿色)text " + raycastHelper.GetTextCount());
|
" (绿色)text " + raycastHelper.GetTextCount());
|
||||||
GUILayout.Label("(黄色)emptyRaycast " + raycastHelper.GetEmptyCount() +
|
GUILayout.Label("(黄色)emptyRaycast " + raycastHelper.GetEmptyCount() +
|
||||||
" (蓝色)rawImage " + raycastHelper.GetRawImageCount());
|
" (蓝色)rawImage " + raycastHelper.GetRawImageCount());
|
||||||
GUILayout.Space(6);
|
GUILayout.Space(6);
|
||||||
scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Width(400), GUILayout.Height(270));
|
scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Width(400), GUILayout.Height(270));
|
||||||
List<string> pathList = raycastHelper.GetImagePathList();
|
List<string> pathList = raycastHelper.GetImagePathList();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (pathList.Count > 0)
|
if (pathList.Count > 0)
|
||||||
{
|
{
|
||||||
GUILayout.Label("image路径:");
|
GUILayout.Label("image路径:");
|
||||||
for (; i < pathList.Count; i++)
|
for (; i < pathList.Count; i++)
|
||||||
GUILayout.Label(pathList[i]);
|
GUILayout.Label(pathList[i]);
|
||||||
}
|
}
|
||||||
pathList = raycastHelper.GetTextPathList();
|
pathList = raycastHelper.GetTextPathList();
|
||||||
i = 0;
|
i = 0;
|
||||||
if (pathList.Count > 0)
|
if (pathList.Count > 0)
|
||||||
{
|
{
|
||||||
GUILayout.Label("text路径:");
|
GUILayout.Label("text路径:");
|
||||||
for (; i < pathList.Count; i++)
|
for (; i < pathList.Count; i++)
|
||||||
GUILayout.Label(pathList[i]);
|
GUILayout.Label(pathList[i]);
|
||||||
}
|
}
|
||||||
pathList = raycastHelper.GetEmptyPathList();
|
pathList = raycastHelper.GetEmptyPathList();
|
||||||
i = 0;
|
i = 0;
|
||||||
if (pathList.Count > 0)
|
if (pathList.Count > 0)
|
||||||
{
|
{
|
||||||
GUILayout.Label("emptyRaycast路径:");
|
GUILayout.Label("emptyRaycast路径:");
|
||||||
for (; i < pathList.Count; i++)
|
for (; i < pathList.Count; i++)
|
||||||
GUILayout.Label(pathList[i]);
|
GUILayout.Label(pathList[i]);
|
||||||
}
|
}
|
||||||
pathList = raycastHelper.GetRawImagePathList();
|
pathList = raycastHelper.GetRawImagePathList();
|
||||||
i = 0;
|
i = 0;
|
||||||
if (pathList.Count > 0)
|
if (pathList.Count > 0)
|
||||||
{
|
{
|
||||||
GUILayout.Label("rawImage路径:");
|
GUILayout.Label("rawImage路径:");
|
||||||
for (; i < pathList.Count; i++)
|
for (; i < pathList.Count; i++)
|
||||||
GUILayout.Label(pathList[i]);
|
GUILayout.Label(pathList[i]);
|
||||||
}
|
}
|
||||||
GUILayout.EndScrollView();
|
GUILayout.EndScrollView();
|
||||||
}
|
}
|
||||||
GUILayout.EndVertical();
|
GUILayout.EndVertical();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
if (raycastHelper != null)
|
if (raycastHelper != null)
|
||||||
DestroyImmediate(raycastHelper);
|
DestroyImmediate(raycastHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
//[MenuItem("资源工具/资源检查/检查RaycastTarget", false, 401)]
|
//[MenuItem("资源工具/资源检查/检查RaycastTarget", false, 401)]
|
||||||
public static void OpenWindow()
|
public static void OpenWindow()
|
||||||
{
|
{
|
||||||
CheckRaycastTargetWindow window = (CheckRaycastTargetWindow)GetWindowWithRect(typeof(CheckRaycastTargetWindow),
|
CheckRaycastTargetWindow window = (CheckRaycastTargetWindow)GetWindowWithRect(typeof(CheckRaycastTargetWindow),
|
||||||
new Rect(Screen.width / 2, Screen.height / 2, 400, 400), true);
|
new Rect(Screen.width / 2, Screen.height / 2, 400, 400), true);
|
||||||
window.Show();
|
window.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,206 +1,206 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using BFEditor.Resource;
|
using BFEditor.Resource;
|
||||||
using BF;
|
using BF;
|
||||||
|
|
||||||
namespace BFEditor
|
namespace BFEditor
|
||||||
{
|
{
|
||||||
public class GameObjectEditer : Editor
|
public class GameObjectEditer : Editor
|
||||||
{
|
{
|
||||||
static Material CustomUIDefault;
|
static Material CustomUIDefault;
|
||||||
|
|
||||||
// 重写Text菜单,默认取消raycastTarget
|
// 重写Text菜单,默认取消raycastTarget
|
||||||
[MenuItem("GameObject/UI/Text", true)]
|
[MenuItem("GameObject/UI/Text", true)]
|
||||||
static bool ValidateUITextMenu()
|
static bool ValidateUITextMenu()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Text", false)]
|
[MenuItem("GameObject/UI/Text", false)]
|
||||||
static void CreateUIText()
|
static void CreateUIText()
|
||||||
{
|
{
|
||||||
GameObject go = new GameObject("Text", typeof(UnityEngine.UI.Text));
|
GameObject go = new GameObject("Text", typeof(UnityEngine.UI.Text));
|
||||||
UnityEngine.UI.Text text = go.GetComponent<UnityEngine.UI.Text>();
|
UnityEngine.UI.Text text = go.GetComponent<UnityEngine.UI.Text>();
|
||||||
text.raycastTarget = false;
|
text.raycastTarget = false;
|
||||||
text.material = GetCustomDefaultUIMat();
|
text.material = GetCustomDefaultUIMat();
|
||||||
CheckAndSetUIParent(go.transform);
|
CheckAndSetUIParent(go.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/TextMeshPro - Text", true)]
|
[MenuItem("GameObject/UI/TextMeshPro - Text", true)]
|
||||||
static bool ValidateUITextMeshProMenu()
|
static bool ValidateUITextMeshProMenu()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/TextMeshPro - Text", false)]
|
[MenuItem("GameObject/UI/TextMeshPro - Text", false)]
|
||||||
static void CreateUITextMeshPro()
|
static void CreateUITextMeshPro()
|
||||||
{
|
{
|
||||||
Debug.LogError("请在UI/BF通用控件里创建Text");
|
Debug.LogError("请在UI/BF通用控件里创建Text");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重写Image菜单,默认取消raycastTarget
|
// 重写Image菜单,默认取消raycastTarget
|
||||||
[MenuItem("GameObject/UI/Image", true)]
|
[MenuItem("GameObject/UI/Image", true)]
|
||||||
static bool ValidateUIImageMenu()
|
static bool ValidateUIImageMenu()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Image", false)]
|
[MenuItem("GameObject/UI/Image", false)]
|
||||||
static void CreateUIImage()
|
static void CreateUIImage()
|
||||||
{
|
{
|
||||||
GameObject go = new GameObject("Image", typeof(UnityEngine.UI.Image));
|
GameObject go = new GameObject("Image", typeof(UnityEngine.UI.Image));
|
||||||
UnityEngine.UI.Image image = go.GetComponent<UnityEngine.UI.Image>();
|
UnityEngine.UI.Image image = go.GetComponent<UnityEngine.UI.Image>();
|
||||||
image.raycastTarget = false;
|
image.raycastTarget = false;
|
||||||
image.material = GetCustomDefaultUIMat();
|
image.material = GetCustomDefaultUIMat();
|
||||||
CheckAndSetUIParent(go.transform);
|
CheckAndSetUIParent(go.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/BFSlider", false)]
|
[MenuItem("GameObject/UI/BFSlider", false)]
|
||||||
static void CreateBFSlider()
|
static void CreateBFSlider()
|
||||||
{
|
{
|
||||||
GameObject go = new GameObject("BFSlider", typeof(BFSlider));
|
GameObject go = new GameObject("BFSlider", typeof(BFSlider));
|
||||||
BFSlider slider = go.GetComponent<BFSlider>();
|
BFSlider slider = go.GetComponent<BFSlider>();
|
||||||
slider.raycastTarget = false;
|
slider.raycastTarget = false;
|
||||||
slider.material = GetCustomDefaultUIMat();
|
slider.material = GetCustomDefaultUIMat();
|
||||||
CheckAndSetUIParent(go.transform);
|
CheckAndSetUIParent(go.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Raw Image", true)]
|
[MenuItem("GameObject/UI/Raw Image", true)]
|
||||||
static bool ValidateUIRawImageMenu()
|
static bool ValidateUIRawImageMenu()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Raw Image", false)]
|
[MenuItem("GameObject/UI/Raw Image", false)]
|
||||||
static void CreateUIRawImage()
|
static void CreateUIRawImage()
|
||||||
{
|
{
|
||||||
GameObject go = new GameObject("RawImage", typeof(UnityEngine.UI.RawImage));
|
GameObject go = new GameObject("RawImage", typeof(UnityEngine.UI.RawImage));
|
||||||
UnityEngine.UI.RawImage image = go.GetComponent<UnityEngine.UI.RawImage>();
|
UnityEngine.UI.RawImage image = go.GetComponent<UnityEngine.UI.RawImage>();
|
||||||
image.raycastTarget = false;
|
image.raycastTarget = false;
|
||||||
image.material = GetCustomDefaultUIMat();
|
image.material = GetCustomDefaultUIMat();
|
||||||
CheckAndSetUIParent(go.transform);
|
CheckAndSetUIParent(go.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckAndSetUIParent(Transform uiTransform)
|
static void CheckAndSetUIParent(Transform uiTransform)
|
||||||
{
|
{
|
||||||
if (Selection.activeTransform) // 当前有选择一个父节点
|
if (Selection.activeTransform) // 当前有选择一个父节点
|
||||||
{
|
{
|
||||||
uiTransform.SetParent(Selection.activeTransform, false);
|
uiTransform.SetParent(Selection.activeTransform, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var currentPrefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
|
var currentPrefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
|
||||||
if (currentPrefabStage != null) //当前处于prefab编辑模式
|
if (currentPrefabStage != null) //当前处于prefab编辑模式
|
||||||
{
|
{
|
||||||
var prefabRoot = currentPrefabStage.prefabContentsRoot;
|
var prefabRoot = currentPrefabStage.prefabContentsRoot;
|
||||||
uiTransform.SetParent(prefabRoot.transform, false);
|
uiTransform.SetParent(prefabRoot.transform, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Selection.activeTransform = uiTransform;
|
Selection.activeTransform = uiTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Material GetCustomDefaultUIMat()
|
static Material GetCustomDefaultUIMat()
|
||||||
{
|
{
|
||||||
if (CustomUIDefault == null)
|
if (CustomUIDefault == null)
|
||||||
CustomUIDefault = AssetDatabase.LoadAssetAtPath<Material>(ResourceProcessConfig.CUSTOM_DEFAULT_UI_MAT_PATH);
|
CustomUIDefault = AssetDatabase.LoadAssetAtPath<Material>(ResourceProcessConfig.CUSTOM_DEFAULT_UI_MAT_PATH);
|
||||||
return CustomUIDefault;
|
return CustomUIDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Button", true)]
|
[MenuItem("GameObject/UI/Button", true)]
|
||||||
static bool ValidateUIButtonMenu()
|
static bool ValidateUIButtonMenu()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Button", false)]
|
[MenuItem("GameObject/UI/Button", false)]
|
||||||
static void CreateUIButton()
|
static void CreateUIButton()
|
||||||
{
|
{
|
||||||
Debug.LogError("请在UI/BF通用控件里创建Button");
|
Debug.LogError("请在UI/BF通用控件里创建Button");
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Button - TextMeshPro", true)]
|
[MenuItem("GameObject/UI/Button - TextMeshPro", true)]
|
||||||
static bool ValidateUIButtonTMPMenu()
|
static bool ValidateUIButtonTMPMenu()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Button - TextMeshPro", false)]
|
[MenuItem("GameObject/UI/Button - TextMeshPro", false)]
|
||||||
static void CreateUIButtonTMP()
|
static void CreateUIButtonTMP()
|
||||||
{
|
{
|
||||||
Debug.LogError("请在UI/BF通用控件里创建Button");
|
Debug.LogError("请在UI/BF通用控件里创建Button");
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Text - TextMeshPro", true)]
|
[MenuItem("GameObject/UI/Text - TextMeshPro", true)]
|
||||||
static bool ValidateUITextTMPMenu()
|
static bool ValidateUITextTMPMenu()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/Text - TextMeshPro", false)]
|
[MenuItem("GameObject/UI/Text - TextMeshPro", false)]
|
||||||
static void CreateUITextTMP()
|
static void CreateUITextTMP()
|
||||||
{
|
{
|
||||||
Debug.LogError("请在UI/BF通用控件里创建Text");
|
Debug.LogError("请在UI/BF通用控件里创建Text");
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/BF通用控件/Button")]
|
[MenuItem("GameObject/UI/BF通用控件/Button")]
|
||||||
static void CreateBFCommonButton()
|
static void CreateBFCommonButton()
|
||||||
{
|
{
|
||||||
GameObject go = new GameObject("Button", typeof(UnityEngine.UI.Image));
|
GameObject go = new GameObject("Button", typeof(UnityEngine.UI.Image));
|
||||||
UnityEngine.UI.Image image = go.GetComponent<UnityEngine.UI.Image>();
|
UnityEngine.UI.Image image = go.GetComponent<UnityEngine.UI.Image>();
|
||||||
image.material = GetCustomDefaultUIMat();
|
image.material = GetCustomDefaultUIMat();
|
||||||
go.AddComponent<BF.UITouchEvent>();
|
go.AddComponent<BF.UITouchEvent>();
|
||||||
CheckAndSetUIParent(go.transform);
|
CheckAndSetUIParent(go.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/BF通用控件/Text")]
|
[MenuItem("GameObject/UI/BF通用控件/Text")]
|
||||||
static void CreateBFCommonText()
|
static void CreateBFCommonText()
|
||||||
{
|
{
|
||||||
if (TMP_Settings.defaultFontAsset == null)
|
if (TMP_Settings.defaultFontAsset == null)
|
||||||
{
|
{
|
||||||
var tmpSettings = TMP_Settings.instance;
|
var tmpSettings = TMP_Settings.instance;
|
||||||
var type = tmpSettings.GetType();
|
var type = tmpSettings.GetType();
|
||||||
var fontAssetField = type.GetField("m_defaultFontAsset", System.Reflection.BindingFlags.Instance |
|
var fontAssetField = type.GetField("m_defaultFontAsset", System.Reflection.BindingFlags.Instance |
|
||||||
System.Reflection.BindingFlags.NonPublic);
|
System.Reflection.BindingFlags.NonPublic);
|
||||||
var fontAssets = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>(ResourceProcessConfig.DEFAULT_TMP_FONTASSET_PATH);
|
var fontAssets = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>(ResourceProcessConfig.DEFAULT_TMP_FONTASSET_PATH);
|
||||||
fontAssetField.SetValue(tmpSettings, fontAssets);
|
fontAssetField.SetValue(tmpSettings, fontAssets);
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject go = new GameObject("TextMeshPro", typeof(TMPro.TextMeshProUGUI));
|
GameObject go = new GameObject("TextMeshPro", typeof(TMPro.TextMeshProUGUI));
|
||||||
TMPro.TextMeshProUGUI textMeshPro = go.GetComponent<TMPro.TextMeshProUGUI>();
|
TMPro.TextMeshProUGUI textMeshPro = go.GetComponent<TMPro.TextMeshProUGUI>();
|
||||||
textMeshPro.raycastTarget = false;
|
textMeshPro.raycastTarget = false;
|
||||||
var font = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>(
|
var font = AssetDatabase.LoadAssetAtPath<TMP_FontAsset>(
|
||||||
"Assets/arts/fonts/tmpfonts/default/tmpfont/font_sdf.asset");
|
"Assets/arts/fonts/tmpfonts/default/tmpfont/font_sdf.asset");
|
||||||
textMeshPro.font = font;
|
textMeshPro.font = font;
|
||||||
textMeshPro.material = GetCustomDefaultUIMat();
|
textMeshPro.material = GetCustomDefaultUIMat();
|
||||||
textMeshPro.enableWordWrapping = false;
|
textMeshPro.enableWordWrapping = false;
|
||||||
CheckAndSetUIParent(go.transform);
|
CheckAndSetUIParent(go.transform);
|
||||||
|
|
||||||
if (TMP_Settings.defaultFontAsset != null)
|
if (TMP_Settings.defaultFontAsset != null)
|
||||||
{
|
{
|
||||||
var tmpSettings = TMP_Settings.instance;
|
var tmpSettings = TMP_Settings.instance;
|
||||||
var type = tmpSettings.GetType();
|
var type = tmpSettings.GetType();
|
||||||
var fontAssetField = type.GetField("m_defaultFontAsset", System.Reflection.BindingFlags.Instance |
|
var fontAssetField = type.GetField("m_defaultFontAsset", System.Reflection.BindingFlags.Instance |
|
||||||
System.Reflection.BindingFlags.NonPublic);
|
System.Reflection.BindingFlags.NonPublic);
|
||||||
fontAssetField.SetValue(tmpSettings, null);
|
fontAssetField.SetValue(tmpSettings, null);
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/创建序列帧")]
|
[MenuItem("GameObject/UI/创建序列帧")]
|
||||||
static void CreateFrameAnimation()
|
static void CreateFrameAnimation()
|
||||||
{
|
{
|
||||||
FrameAnimationTools.CreateFrameAnimation();
|
FrameAnimationTools.CreateFrameAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("GameObject/UI/创建序列帧(父节点)")]
|
[MenuItem("GameObject/UI/创建序列帧(父节点)")]
|
||||||
static void CreateFrameAnimationInParent()
|
static void CreateFrameAnimationInParent()
|
||||||
{
|
{
|
||||||
FrameAnimationTools.CreateFrameAnimation(true);
|
FrameAnimationTools.CreateFrameAnimation(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,93 +1,93 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using BFEditor.Build;
|
using BFEditor.Build;
|
||||||
|
|
||||||
public class JenkinsAdapter {
|
public class JenkinsAdapter {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建版本号
|
/// 构建版本号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string BuildVersion = (int.Parse(DateTime.Now.ToString("yyMMddHH"))).ToString();
|
private static string BuildVersion = (int.Parse(DateTime.Now.ToString("yyMMddHH"))).ToString();
|
||||||
private static int versionCode = 10;
|
private static int versionCode = 10;
|
||||||
private static string versionName = "1.4.0";
|
private static string versionName = "1.4.0";
|
||||||
|
|
||||||
[MenuItem("Jenkins/JenkinsBuildIos")]
|
[MenuItem("Jenkins/JenkinsBuildIos")]
|
||||||
public static void CommandLineBuildIos() {
|
public static void CommandLineBuildIos() {
|
||||||
var buildInfo = new BuildInfo();
|
var buildInfo = new BuildInfo();
|
||||||
buildInfo.version = versionName;
|
buildInfo.version = versionName;
|
||||||
buildInfo.mode = "publish_release";
|
buildInfo.mode = "publish_release";
|
||||||
buildInfo.bundleName = "com.combo.heroes.puzzle.rpg";
|
buildInfo.bundleName = "com.combo.heroes.puzzle.rpg";
|
||||||
buildInfo.skipVersion = false;
|
buildInfo.skipVersion = false;
|
||||||
BuildProjectTools.BuildResources(buildInfo, Application.streamingAssetsPath, true);
|
BuildProjectTools.BuildResources(buildInfo, Application.streamingAssetsPath, true);
|
||||||
// 重新生成XLua
|
// 重新生成XLua
|
||||||
CompileScriptsUtils.RegenerateXLuaCode(true);
|
CompileScriptsUtils.RegenerateXLuaCode(true);
|
||||||
|
|
||||||
// 设置版本号
|
// 设置版本号
|
||||||
PlayerSettings.bundleVersion = buildInfo.version;
|
PlayerSettings.bundleVersion = buildInfo.version;
|
||||||
//SDK要求
|
//SDK要求
|
||||||
PlayerSettings.iOS.targetOSVersionString = "12.0";
|
PlayerSettings.iOS.targetOSVersionString = "12.0";
|
||||||
//设置Build,每次需要增加
|
//设置Build,每次需要增加
|
||||||
PlayerSettings.iOS.buildNumber = versionCode.ToString();
|
PlayerSettings.iOS.buildNumber = versionCode.ToString();
|
||||||
// 隐藏ios的横条
|
// 隐藏ios的横条
|
||||||
PlayerSettings.iOS.hideHomeButton = false;
|
PlayerSettings.iOS.hideHomeButton = false;
|
||||||
// 禁止在所有边缘上延迟手势
|
// 禁止在所有边缘上延迟手势
|
||||||
PlayerSettings.iOS.deferSystemGesturesMode = UnityEngine.iOS.SystemGestureDeferMode.All;
|
PlayerSettings.iOS.deferSystemGesturesMode = UnityEngine.iOS.SystemGestureDeferMode.All;
|
||||||
// 设置竖屏
|
// 设置竖屏
|
||||||
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
||||||
PlayerSettings.allowedAutorotateToPortrait = false;
|
PlayerSettings.allowedAutorotateToPortrait = false;
|
||||||
PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
|
PlayerSettings.allowedAutorotateToPortraitUpsideDown = false;
|
||||||
PlayerSettings.allowedAutorotateToLandscapeLeft = false;
|
PlayerSettings.allowedAutorotateToLandscapeLeft = false;
|
||||||
PlayerSettings.allowedAutorotateToLandscapeRight = false;
|
PlayerSettings.allowedAutorotateToLandscapeRight = false;
|
||||||
// 关闭启动动画
|
// 关闭启动动画
|
||||||
PlayerSettings.SplashScreen.show = false;
|
PlayerSettings.SplashScreen.show = false;
|
||||||
// 设置包名
|
// 设置包名
|
||||||
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, buildInfo.bundleName);
|
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, buildInfo.bundleName);
|
||||||
// 是否跳过版本控制
|
// 是否跳过版本控制
|
||||||
var symbols = "THREAD_SAFE;USE_AB";
|
var symbols = "THREAD_SAFE;USE_AB";
|
||||||
if (buildInfo.skipVersion)
|
if (buildInfo.skipVersion)
|
||||||
{
|
{
|
||||||
symbols = symbols + ";SKIP_VERSION;";
|
symbols = symbols + ";SKIP_VERSION;";
|
||||||
}
|
}
|
||||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, symbols);
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, symbols);
|
||||||
// 商品名称
|
// 商品名称
|
||||||
PlayerSettings.productName = "Knights Combo";
|
PlayerSettings.productName = "Knights Combo";
|
||||||
// BuildType设置dev/release
|
// BuildType设置dev/release
|
||||||
EditorUserBuildSettings.iOSBuildConfigType = iOSBuildType.Release;
|
EditorUserBuildSettings.iOSXcodeBuildConfig = XcodeBuildConfig.Release;
|
||||||
EditorUserBuildSettings.development = false;
|
EditorUserBuildSettings.development = false;
|
||||||
// 使用IL2CPP
|
// 使用IL2CPP
|
||||||
var scriptImp = ScriptingImplementation.IL2CPP;
|
var scriptImp = ScriptingImplementation.IL2CPP;
|
||||||
PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, scriptImp);
|
PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, scriptImp);
|
||||||
// 目标平台架构,目前支持ARM64
|
// 目标平台架构,目前支持ARM64
|
||||||
PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, 1);
|
PlayerSettings.SetArchitecture(BuildTargetGroup.iOS, 1);
|
||||||
|
|
||||||
// 开始打包
|
// 开始打包
|
||||||
BuildPipeline.BuildPlayer(GetBuildScenes(), GetIosBuildPath(), BuildTarget.iOS, BuildOptions.None);
|
BuildPipeline.BuildPlayer(GetBuildScenes(), GetIosBuildPath(), BuildTarget.iOS, BuildOptions.None);
|
||||||
Console.WriteLine("Build Complete Path:" + GetIosBuildPath());
|
Console.WriteLine("Build Complete Path:" + GetIosBuildPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取build Setting 列表里的打勾场景
|
/// 获取build Setting 列表里的打勾场景
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static string[] GetBuildScenes() {
|
private static string[] GetBuildScenes() {
|
||||||
List<string> names = new List<string>();
|
List<string> names = new List<string>();
|
||||||
|
|
||||||
foreach (var x in EditorBuildSettings.scenes) {
|
foreach (var x in EditorBuildSettings.scenes) {
|
||||||
if (!x.enabled) continue;
|
if (!x.enabled) continue;
|
||||||
names.Add(x.path);
|
names.Add(x.path);
|
||||||
}
|
}
|
||||||
return names.ToArray();
|
return names.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Get Build Path
|
#region Get Build Path
|
||||||
private static string GetIosBuildPath() {
|
private static string GetIosBuildPath() {
|
||||||
return "build/iOS";
|
return "build/iOS";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -14,19 +14,26 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
defaultScale: 0.01
|
defaultScale: 0.01
|
||||||
defaultMix: 0.2
|
defaultMix: 0.2
|
||||||
defaultShader: BF/Spine/Skeleton
|
defaultShader: Spine/Skeleton
|
||||||
defaultZSpacing: 0
|
defaultZSpacing: 0
|
||||||
defaultInstantiateLoop: 1
|
defaultInstantiateLoop: 1
|
||||||
|
defaultPhysicsPositionInheritance: {x: 1, y: 1}
|
||||||
|
defaultPhysicsRotationInheritance: 1
|
||||||
showHierarchyIcons: 1
|
showHierarchyIcons: 1
|
||||||
|
reloadAfterPlayMode: 1
|
||||||
setTextureImporterSettings: 1
|
setTextureImporterSettings: 1
|
||||||
textureSettingsReference: Assets/ThirdParty/Spine/Editor/spine-unity/Editor/ImporterPresets/PMATexturePreset.preset
|
textureSettingsReference: Assets/ThirdParty/Spine/Editor/spine-unity/Editor/ImporterPresets/PMATexturePreset.preset
|
||||||
|
fixPrefabOverrideViaMeshFilter: 0
|
||||||
|
removePrefabPreviewMeshes: 0
|
||||||
blendModeMaterialMultiply: {fileID: 0}
|
blendModeMaterialMultiply: {fileID: 0}
|
||||||
blendModeMaterialScreen: {fileID: 0}
|
blendModeMaterialScreen: {fileID: 0}
|
||||||
blendModeMaterialAdditive: {fileID: 0}
|
blendModeMaterialAdditive: {fileID: 0}
|
||||||
atlasTxtImportWarning: 1
|
atlasTxtImportWarning: 1
|
||||||
textureImporterWarning: 1
|
textureImporterWarning: 1
|
||||||
componentMaterialWarning: 1
|
componentMaterialWarning: 1
|
||||||
|
skeletonDataAssetNoFileError: 1
|
||||||
autoReloadSceneSkeletons: 1
|
autoReloadSceneSkeletons: 1
|
||||||
handleScale: 1
|
handleScale: 1
|
||||||
mecanimEventIncludeFolderName: 1
|
mecanimEventIncludeFolderName: 1
|
||||||
|
timelineDefaultMixDuration: 0
|
||||||
timelineUseBlendDuration: 1
|
timelineUseBlendDuration: 1
|
||||||
|
|||||||
@ -78,6 +78,7 @@ namespace BFEditor
|
|||||||
psi.RedirectStandardOutput = true; //由调用程序获取输出信息
|
psi.RedirectStandardOutput = true; //由调用程序获取输出信息
|
||||||
psi.RedirectStandardError = true; //重定向标准错误输出
|
psi.RedirectStandardError = true; //重定向标准错误输出
|
||||||
psi.CreateNoWindow = true; //不显示程序窗口
|
psi.CreateNoWindow = true; //不显示程序窗口
|
||||||
|
psi.StandardOutputEncoding = System.Text.Encoding.UTF8; // 核心:指定UTF-8解码
|
||||||
p.StartInfo = psi;
|
p.StartInfo = psi;
|
||||||
p.Start();
|
p.Start();
|
||||||
|
|
||||||
|
|||||||
@ -70,6 +70,10 @@ namespace BF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
public bool GetIsHashCollision()
|
||||||
|
{
|
||||||
|
return spriteNameList.Count != spriteDict.Count;
|
||||||
|
}
|
||||||
|
|
||||||
public Sprite GetSprite(uint spriteName)
|
public Sprite GetSprite(uint spriteName)
|
||||||
{
|
{
|
||||||
@ -86,7 +90,7 @@ namespace BF
|
|||||||
int count = spriteNameList.Count;
|
int count = spriteNameList.Count;
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
spriteDict.Add(spriteNameList[i], spriteList[i]);
|
spriteDict.TryAdd(spriteNameList[i], spriteList[i]);
|
||||||
}
|
}
|
||||||
#if !UNITY_EDITOR
|
#if !UNITY_EDITOR
|
||||||
spriteNameList.Clear();
|
spriteNameList.Clear();
|
||||||
|
|||||||
@ -10,10 +10,8 @@ namespace BF
|
|||||||
public class BFMain : MonoSingleton<BFMain>
|
public class BFMain : MonoSingleton<BFMain>
|
||||||
{
|
{
|
||||||
List<ManagerBase> managerList;
|
List<ManagerBase> managerList;
|
||||||
|
|
||||||
// 客户端c#代码版本号,每次发布新包后加1,lua层存在一套代码兼容多版本c#代码
|
// 客户端c#代码版本号,每次发布新包后加1,lua层存在一套代码兼容多版本c#代码
|
||||||
public const int CLIENT_VERSION = 2;
|
public const int CLIENT_VERSION = 4;
|
||||||
|
|
||||||
// 是否是单机版
|
// 是否是单机版
|
||||||
public static bool IsStandAlone = false;
|
public static bool IsStandAlone = false;
|
||||||
public static bool IsShenhe = false;
|
public static bool IsShenhe = false;
|
||||||
@ -23,6 +21,60 @@ namespace BF
|
|||||||
public const string FILE_HEAD_BASE64 = "Zm9yX2ZpbGVfaGVhZ";
|
public const string FILE_HEAD_BASE64 = "Zm9yX2ZpbGVfaGVhZ";
|
||||||
public static long ServerTime = 0;
|
public static long ServerTime = 0;
|
||||||
public static long DifferenceTime = 0;
|
public static long DifferenceTime = 0;
|
||||||
|
public static string ProjectId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
return "b13";
|
||||||
|
#else
|
||||||
|
if (BFPlatform.Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU)
|
||||||
|
{
|
||||||
|
return "b13-ru";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "b13";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static string ProjectEnv
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// 编辑器
|
||||||
|
return "release";
|
||||||
|
#else
|
||||||
|
// 如果走深度链接启动且有参数,则走深度链接地址
|
||||||
|
if (!string.IsNullOrEmpty(DPEnv))
|
||||||
|
{
|
||||||
|
return DPEnv;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "release";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static bool ForceEnv
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DPForceEnv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 深度链接参数
|
||||||
|
public static string DPEntrance = string.Empty; // 内外网
|
||||||
|
public static bool DPIsLan = false; // 是否为内网
|
||||||
|
public static string DPEnv = string.Empty; // env
|
||||||
|
public static bool DPSupportGM = false; // 正式环境下是否开启GM
|
||||||
|
public static bool DPSupportLog = false; // 正式环境下是否打印日志
|
||||||
|
public static string DPPackageName = string.Empty; // 模拟包名
|
||||||
|
public static bool DPForceEnv = false; // 是否强制设置env
|
||||||
|
|
||||||
protected override void Init()
|
protected override void Init()
|
||||||
{
|
{
|
||||||
@ -320,6 +372,53 @@ namespace BF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BattleManager battleMgr;
|
||||||
|
// public BattleManager BattleMgr
|
||||||
|
// {
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// if (battleMgr == null)
|
||||||
|
// {
|
||||||
|
// battleMgr = BattleManager.Create();
|
||||||
|
// battleMgr.SetMono(this);
|
||||||
|
// battleMgr.Init();
|
||||||
|
// managerList.Add(battleMgr);
|
||||||
|
// }
|
||||||
|
// return battleMgr;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
BFParseClientManager parseClientMgr;
|
||||||
|
public BFParseClientManager ParseClientMgr
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (parseClientMgr == null)
|
||||||
|
{
|
||||||
|
parseClientMgr = BFParseClientManager.Create();
|
||||||
|
parseClientMgr.SetMono(this);
|
||||||
|
parseClientMgr.Init();
|
||||||
|
managerList.Add(parseClientMgr);
|
||||||
|
}
|
||||||
|
return parseClientMgr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
URPManager urpMgr;
|
||||||
|
public URPManager URPMgr
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (urpMgr == null)
|
||||||
|
{
|
||||||
|
urpMgr = URPManager.Create();
|
||||||
|
urpMgr.Init();
|
||||||
|
managerList.Add(urpMgr);
|
||||||
|
}
|
||||||
|
return urpMgr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void SetServerTime(long serverTime)
|
public static void SetServerTime(long serverTime)
|
||||||
{
|
{
|
||||||
ServerTime = serverTime;
|
ServerTime = serverTime;
|
||||||
|
|||||||
@ -105,5 +105,16 @@ namespace BF
|
|||||||
httpRequest.RawData = Encoding.UTF8.GetBytes(data);
|
httpRequest.RawData = Encoding.UTF8.GetBytes(data);
|
||||||
httpRequest.Send();
|
httpRequest.Send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendRequest(string url, string data, Action<HTTPRequest, HTTPResponse> callback)
|
||||||
|
{
|
||||||
|
var httpRequest = new HTTPRequest(new Uri(url), HTTPMethods.Get, (req, httpResponse) =>
|
||||||
|
{
|
||||||
|
callback?.Invoke(req, httpResponse);
|
||||||
|
});
|
||||||
|
httpRequest.SetHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
httpRequest.RawData = Encoding.UTF8.GetBytes(data);
|
||||||
|
httpRequest.Send();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
8
Assets/Scripts/Common/DeepLink.meta
Normal file
8
Assets/Scripts/Common/DeepLink.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 150be05a54bb5274885ce7c5a6bdcedc
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
254
Assets/Scripts/Common/DeepLink/DeepLinkManager.cs
Normal file
254
Assets/Scripts/Common/DeepLink/DeepLinkManager.cs
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class DeepLinkManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
// 深度链接参数
|
||||||
|
public static string ENTRANCE = "entrance"; // Lan/Wan 内外网
|
||||||
|
public const string ENTRANCE_LAN = "lan";
|
||||||
|
public static string ENV = "env"; // 正式环境/白名单等
|
||||||
|
public static string GM = "gm"; // gm
|
||||||
|
public static string LOG = "log"; // 日志
|
||||||
|
public static string PACKAGE = "package"; // 包名
|
||||||
|
public const string TRUE_FLAG = "true";
|
||||||
|
public const string FALSE_FLAG = "false";
|
||||||
|
private const string SIGN_FLAG = "sign"; // 签名
|
||||||
|
|
||||||
|
// 缓存上一次的地址 与 解析后的参数
|
||||||
|
private string DeepLinkURL = string.Empty;
|
||||||
|
private Dictionary<string, string> DeepLinkParams = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
// 因事件触发的callback,冷启动会在login中处理
|
||||||
|
public Action<string, string> luaDeepLinkActiveCallback;
|
||||||
|
private static char[] NOTHING_CHAR_RESULT = new char[32];
|
||||||
|
private static char[] NOTHING_CHAR = new char[32] {
|
||||||
|
(char)('y' ^ (0x37 - 0)),
|
||||||
|
(char)('r' ^ (0x37 - 1)),
|
||||||
|
(char)('u' ^ (0x37 - 2)),
|
||||||
|
(char)('8' ^ (0x37 - 3)),
|
||||||
|
(char)('c' ^ (0x37 - 4)),
|
||||||
|
(char)('z' ^ (0x37 - 5)),
|
||||||
|
(char)('P' ^ (0x37 - 6)),
|
||||||
|
(char)('i' ^ (0x37 - 7)),
|
||||||
|
(char)('s' ^ (0x37 - 8)),
|
||||||
|
(char)('o' ^ (0x37 - 9)),
|
||||||
|
(char)('O' ^ (0x37 - 10)),
|
||||||
|
(char)('0' ^ (0x37 - 11)),
|
||||||
|
(char)('x' ^ (0x37 - 12)),
|
||||||
|
(char)('W' ^ (0x37 - 13)),
|
||||||
|
(char)('L' ^ (0x37 - 14)),
|
||||||
|
(char)('e' ^ (0x37 - 15)),
|
||||||
|
(char)('k' ^ (0x37 - 16)),
|
||||||
|
(char)('B' ^ (0x37 - 17)),
|
||||||
|
(char)('q' ^ (0x37 - 18)),
|
||||||
|
(char)('2' ^ (0x37 - 19)),
|
||||||
|
(char)('H' ^ (0x37 - 20)),
|
||||||
|
(char)('f' ^ (0x37 - 21)),
|
||||||
|
(char)('Y' ^ (0x37 - 22)),
|
||||||
|
(char)('n' ^ (0x37 - 23)),
|
||||||
|
(char)('X' ^ (0x37 - 24)),
|
||||||
|
(char)('4' ^ (0x37 - 25)),
|
||||||
|
(char)('A' ^ (0x37 - 26)),
|
||||||
|
(char)('9' ^ (0x37 - 27)),
|
||||||
|
(char)('N' ^ (0x37 - 28)),
|
||||||
|
(char)('a' ^ (0x37 - 29)),
|
||||||
|
(char)('U' ^ (0x37 - 30)),
|
||||||
|
(char)('G' ^ (0x37 - 31)),
|
||||||
|
};
|
||||||
|
private static bool NothingFlag = false;
|
||||||
|
private static char[] GetNothingChar()
|
||||||
|
{
|
||||||
|
if (!NothingFlag)
|
||||||
|
{
|
||||||
|
NothingFlag = true;
|
||||||
|
for (int i = 0; i < 32; ++i)
|
||||||
|
{
|
||||||
|
NOTHING_CHAR_RESULT[i] = (char)(NOTHING_CHAR[i] ^ (0x37 - i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NOTHING_CHAR_RESULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
// 注册监听
|
||||||
|
Application.deepLinkActivated += OnDeepLinkActivated;
|
||||||
|
if (!string.IsNullOrEmpty(Application.absoluteURL))
|
||||||
|
{
|
||||||
|
// 冷启动而且 Application.absoluteURL 不为 null,因此处理深层链接。
|
||||||
|
OnDeepLinkActivated(Application.absoluteURL);
|
||||||
|
}
|
||||||
|
// 初始化 DeepLink Manager 全局变量。
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DeepLinkURL = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDeepLinkActivated(string url)
|
||||||
|
{
|
||||||
|
DeepLinkURL = url;
|
||||||
|
UpdateMapData(DeepLinkURL);
|
||||||
|
|
||||||
|
// 不考虑中途打开 仅处理冷启动
|
||||||
|
// if (luaDeepLinkActiveCallback != null)
|
||||||
|
// {
|
||||||
|
// // 延迟的回调
|
||||||
|
// luaDeepLinkActiveCallback(DeepLinkURL, GetDeepLinkParamsJson());
|
||||||
|
// }
|
||||||
|
HandleLaunchLinkParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleLaunchLinkParams()
|
||||||
|
{
|
||||||
|
if (!DeepLinkParams.ContainsKey(SIGN_FLAG))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string serverSign = DeepLinkParams[SIGN_FLAG];
|
||||||
|
if (string.IsNullOrEmpty(serverSign))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string signStr = string.Empty;
|
||||||
|
foreach (var kvp in DeepLinkParams.OrderBy(kv => kv.Key, StringComparer.Ordinal))
|
||||||
|
{
|
||||||
|
if (!kvp.Key.Equals(SIGN_FLAG))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(signStr))
|
||||||
|
{
|
||||||
|
signStr += kvp.Key + "=" + kvp.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
signStr += "&" + kvp.Key + "=" + kvp.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signStr += string.Concat(GetNothingChar());
|
||||||
|
if (!Md5Encrypt.VerifyMd5Hash(signStr, serverSign))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 冷启动 更新参数
|
||||||
|
if (DeepLinkParams.ContainsKey(ENTRANCE))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(DeepLinkParams[ENTRANCE]))
|
||||||
|
{
|
||||||
|
BFMain.DPEntrance = DeepLinkParams[ENTRANCE];
|
||||||
|
if (BFMain.DPEntrance == ENTRANCE_LAN)
|
||||||
|
{
|
||||||
|
BFMain.DPIsLan = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log("深度链接 更新 ENTRANCE:" + BFMain.DPEntrance + " 内网:" + BFMain.DPIsLan); // 测试日志 TODOJ
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DeepLinkParams.ContainsKey(ENV))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(DeepLinkParams[ENV]))
|
||||||
|
{
|
||||||
|
BFMain.DPEnv = DeepLinkParams[ENV];
|
||||||
|
BFMain.DPForceEnv = true;
|
||||||
|
Debug.Log("深度链接 更新 ENV:" + BFMain.DPEnv); // 测试日志 TODOJ
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DeepLinkParams.ContainsKey(GM))
|
||||||
|
{
|
||||||
|
var support = DeepLinkParams[GM] == TRUE_FLAG;
|
||||||
|
BFMain.DPSupportGM = support;
|
||||||
|
|
||||||
|
Debug.Log("深度链接 更新 GM:" + BFMain.DPSupportGM); // 测试日志 TODOJ
|
||||||
|
}
|
||||||
|
if (DeepLinkParams.ContainsKey(LOG))
|
||||||
|
{
|
||||||
|
var support = DeepLinkParams[LOG] == TRUE_FLAG;
|
||||||
|
BFMain.DPSupportLog = support;
|
||||||
|
|
||||||
|
Debug.Log("深度链接 更新 LOG:" + BFMain.DPSupportLog); // 测试日志 TODOJ
|
||||||
|
}
|
||||||
|
if (DeepLinkParams.ContainsKey(PACKAGE))
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(DeepLinkParams[PACKAGE]))
|
||||||
|
{
|
||||||
|
BFMain.DPPackageName = DeepLinkParams[PACKAGE];
|
||||||
|
|
||||||
|
Debug.Log("深度链接 更新 ENV:" + BFMain.DPPackageName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateMapData(string url)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(url))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var splitUrl = url.Split('?', 2);
|
||||||
|
if (splitUrl.Length < 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var parsedUrl = splitUrl[1];
|
||||||
|
if (string.IsNullOrWhiteSpace(parsedUrl))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var strs = parsedUrl.Split('&');
|
||||||
|
foreach (var str in strs)
|
||||||
|
{
|
||||||
|
var keyValueStr = str.Split('=', 2);
|
||||||
|
if (keyValueStr.Length == 2)
|
||||||
|
{
|
||||||
|
var key = keyValueStr[0];
|
||||||
|
var value = keyValueStr[1];
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
DeepLinkParams[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取缓存的深度链接
|
||||||
|
public string GetDeepLinkURL()
|
||||||
|
{
|
||||||
|
return DeepLinkURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<string, string> GetDeepLinkParamsDic()
|
||||||
|
{
|
||||||
|
return DeepLinkParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetDeepLinkParamsJson()
|
||||||
|
{
|
||||||
|
return JsonConvert.SerializeObject(DeepLinkParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetDeepLinkValueByKey(string key)
|
||||||
|
{
|
||||||
|
if (DeepLinkParams.ContainsKey(key))
|
||||||
|
{
|
||||||
|
return DeepLinkParams[key];
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置回调
|
||||||
|
public void SetLuaDeepLinkActiveCallback(Action<string, string> callback)
|
||||||
|
{
|
||||||
|
luaDeepLinkActiveCallback = callback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Common/DeepLink/DeepLinkManager.cs.meta
Normal file
11
Assets/Scripts/Common/DeepLink/DeepLinkManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ade1fea119719f145b768283e38c6a43
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -8,13 +8,14 @@ namespace BF
|
|||||||
public class GameLaunchManager : ManagerBase
|
public class GameLaunchManager : ManagerBase
|
||||||
{
|
{
|
||||||
#if UNITY_IOS && !UNITY_EDITOR
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
private static extern void IOS_ATTrack();
|
private static extern void IOS_ATTrack();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public LaunchRequester LaunchRequester { get; private set; }
|
public LaunchRequester LaunchRequester { get; private set; }
|
||||||
public int LaunchTimes { get; private set; }
|
public int LaunchTimes { get; private set; }
|
||||||
public bool LoadedFirstAb = false;
|
public bool LoadedFirstAb = false;
|
||||||
|
private bool isShowAtt = false;
|
||||||
|
|
||||||
GameLaunchProcessorBase currentProcessor;
|
GameLaunchProcessorBase currentProcessor;
|
||||||
|
|
||||||
@ -52,14 +53,23 @@ namespace BF
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowIOSATTrack()
|
||||||
|
{
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
// ATT的回调里面会初始化广告SDK,所以这里处理一下如果多次调用,只会生效一次
|
||||||
|
if (!isShowAtt)
|
||||||
|
{
|
||||||
|
isShowAtt = true;
|
||||||
|
IOS_ATTrack();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏启动入口
|
/// 游戏启动入口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LaunchGame()
|
public void LaunchGame()
|
||||||
{
|
{
|
||||||
#if UNITY_IOS && !UNITY_EDITOR
|
|
||||||
IOS_ATTrack();
|
|
||||||
#endif
|
|
||||||
LaunchTimes++;
|
LaunchTimes++;
|
||||||
#if USE_AB
|
#if USE_AB
|
||||||
GameLaunchProcessorBase processor = new LaunchSuccProcessor();
|
GameLaunchProcessorBase processor = new LaunchSuccProcessor();
|
||||||
|
|||||||
@ -128,13 +128,13 @@ namespace BF
|
|||||||
}
|
}
|
||||||
var clientNums1 = int.Parse(clientNums[0]);
|
var clientNums1 = int.Parse(clientNums[0]);
|
||||||
var latestNums1 = int.Parse(latestNums[0]);
|
var latestNums1 = int.Parse(latestNums[0]);
|
||||||
if(clientNums1 < latestNums1)
|
if (clientNums1 < latestNums1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(clientNums1 == latestNums1)
|
else if (clientNums1 == latestNums1)
|
||||||
{
|
{
|
||||||
if(int.Parse(clientNums[1]) < int.Parse(latestNums[1]))
|
if (int.Parse(clientNums[1]) < int.Parse(latestNums[1]))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,10 @@ namespace BF
|
|||||||
|
|
||||||
public override void Process(LaunchRequester lr)
|
public override void Process(LaunchRequester lr)
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "CalculateDiffProcessorStart");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
base.Process(lr);
|
base.Process(lr);
|
||||||
this.lr = lr;
|
this.lr = lr;
|
||||||
|
|
||||||
@ -48,6 +52,10 @@ namespace BF
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams1 = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams1.TryAdd("opt_type", "CalculateDiffProcessorOverWithoutUpdate");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams1);
|
||||||
|
|
||||||
// 既没有热更新也没有自动修复
|
// 既没有热更新也没有自动修复
|
||||||
lr.deleteList = lr.preCheckOverList;
|
lr.deleteList = lr.preCheckOverList;
|
||||||
lr.curVersionTempDir = Path.Combine(TempUpdateDirPath, lr.persistentAbcc.version);
|
lr.curVersionTempDir = Path.Combine(TempUpdateDirPath, lr.persistentAbcc.version);
|
||||||
@ -62,6 +70,10 @@ namespace BF
|
|||||||
EnsureFilesInUpdate();
|
EnsureFilesInUpdate();
|
||||||
GetDeleteList();
|
GetDeleteList();
|
||||||
|
|
||||||
|
var clientProcessorOptParams2 = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams2.TryAdd("opt_type", "CalculateDiffProcessorOverWithUpdate");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams2);
|
||||||
|
|
||||||
totalCount = abConfigList.Count;
|
totalCount = abConfigList.Count;
|
||||||
alreadyCount = 0;
|
alreadyCount = 0;
|
||||||
frameAlreadyCount = 0;
|
frameAlreadyCount = 0;
|
||||||
|
|||||||
@ -32,6 +32,10 @@ namespace BF
|
|||||||
|
|
||||||
public override void Process(LaunchRequester lr)
|
public override void Process(LaunchRequester lr)
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "DownloadUpdateProcessorStart");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
base.Process(lr);
|
base.Process(lr);
|
||||||
|
|
||||||
this.lr = lr;
|
this.lr = lr;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace BF
|
namespace BF
|
||||||
{
|
{
|
||||||
@ -18,6 +19,10 @@ namespace BF
|
|||||||
|
|
||||||
public override void Process(LaunchRequester lr)
|
public override void Process(LaunchRequester lr)
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "FirstABProcessorStart");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
base.Process(lr);
|
base.Process(lr);
|
||||||
this.lr = lr;
|
this.lr = lr;
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,10 @@ namespace BF
|
|||||||
|
|
||||||
public override void Process(LaunchRequester lr)
|
public override void Process(LaunchRequester lr)
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "FixUpProcessorStart");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
base.Process(lr);
|
base.Process(lr);
|
||||||
|
|
||||||
this.lr = lr;
|
this.lr = lr;
|
||||||
|
|||||||
@ -18,6 +18,10 @@ namespace BF
|
|||||||
|
|
||||||
public override void Process(LaunchRequester lr)
|
public override void Process(LaunchRequester lr)
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "OnGetVersionProcessorStart");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
base.Process(lr);
|
base.Process(lr);
|
||||||
|
|
||||||
this.lr = lr;
|
this.lr = lr;
|
||||||
@ -121,6 +125,11 @@ namespace BF
|
|||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(lr.versionInfo.cdn_url))
|
if(string.IsNullOrEmpty(lr.versionInfo.cdn_url))
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "OnGetVersionProcessorChooseCdnFail");
|
||||||
|
clientProcessorOptParams.TryAdd("err_info", "server return cdn list is empty");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
BFLog.LogError("获取不到cdn列表 服务器返回的cdn列表为空");
|
BFLog.LogError("获取不到cdn列表 服务器返回的cdn列表为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -181,6 +190,10 @@ namespace BF
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void DownloadABConfig()
|
void DownloadABConfig()
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "OnGetVersionProcessorDownloadABConfig");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
var address = Path.Combine(lr.firstChoiceCDN, lr.versionInfo.version, "ab_config.bytes");
|
var address = Path.Combine(lr.firstChoiceCDN, lr.versionInfo.version, "ab_config.bytes");
|
||||||
var timeout = 60;
|
var timeout = 60;
|
||||||
BFMain.Instance.WebRequestMgr.Get(address, OnDownloadABConfig, timeout);
|
BFMain.Instance.WebRequestMgr.Get(address, OnDownloadABConfig, timeout);
|
||||||
|
|||||||
@ -22,6 +22,10 @@ namespace BF
|
|||||||
|
|
||||||
public override void Process(LaunchRequester lr)
|
public override void Process(LaunchRequester lr)
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "PreCheckProcessorStart");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
base.Process(lr);
|
base.Process(lr);
|
||||||
|
|
||||||
this.lr = lr;
|
this.lr = lr;
|
||||||
@ -109,6 +113,10 @@ namespace BF
|
|||||||
|
|
||||||
BFMain.Instance.LoomMgr.QueueOnMainThread(() =>
|
BFMain.Instance.LoomMgr.QueueOnMainThread(() =>
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "PreCheckProcessorCheckMissFile");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
checkMissFileEnd = true;
|
checkMissFileEnd = true;
|
||||||
PreCheckEnd();
|
PreCheckEnd();
|
||||||
});
|
});
|
||||||
@ -129,6 +137,10 @@ namespace BF
|
|||||||
|
|
||||||
BFMain.Instance.LoomMgr.QueueOnMainThread(() =>
|
BFMain.Instance.LoomMgr.QueueOnMainThread(() =>
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "PreCheckProcessorCheckOverFile");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
checkOverFileEnd = true;
|
checkOverFileEnd = true;
|
||||||
PreCheckEnd();
|
PreCheckEnd();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -19,13 +20,25 @@ namespace BF
|
|||||||
base.Process(lr);
|
base.Process(lr);
|
||||||
|
|
||||||
this.lr = lr;
|
this.lr = lr;
|
||||||
PrepareABConfig();
|
|
||||||
|
// 这里延迟一帧处理是因为数数在当前帧未初始化完成会报错,所以这里处理为延迟一帧,等初始化完成
|
||||||
|
BFMain.Instance.OneShotManager.AddOneShot(()=>{
|
||||||
|
PrepareABConfig();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrepareABConfig()
|
void PrepareABConfig()
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "PrepareProcessorStart");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
GetBytesAsync(StreamingAbccPath, (byte[] data) =>
|
GetBytesAsync(StreamingAbccPath, (byte[] data) =>
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "PrepareProcessorOver");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
var json = AssetBundleConfigCollection.Decompress(data);
|
var json = AssetBundleConfigCollection.Decompress(data);
|
||||||
lr.streamingAbcc = AssetBundleConfigCollection.Create(json);
|
lr.streamingAbcc = AssetBundleConfigCollection.Create(json);
|
||||||
var needCopyABConfig = false;
|
var needCopyABConfig = false;
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace BF
|
namespace BF
|
||||||
@ -13,6 +14,10 @@ namespace BF
|
|||||||
|
|
||||||
public override void Process(LaunchRequester lr)
|
public override void Process(LaunchRequester lr)
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "RequestVersionProcessorStart");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
base.Process(lr);
|
base.Process(lr);
|
||||||
|
|
||||||
this.lr = lr;
|
this.lr = lr;
|
||||||
@ -28,6 +33,10 @@ namespace BF
|
|||||||
|
|
||||||
void OnServerRespond(string json)
|
void OnServerRespond(string json)
|
||||||
{
|
{
|
||||||
|
var clientProcessorOptParams = new Dictionary<string, object>();
|
||||||
|
clientProcessorOptParams.TryAdd("opt_type", "RequestVersionProcessorOver");
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr.PostThinkingAnalyticsEventProperties("client_processor_opt", clientProcessorOptParams);
|
||||||
|
|
||||||
BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "green", "版本信息: " + json);
|
BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "green", "版本信息: " + json);
|
||||||
if (!BFMain.IsStandAlone) // 如果是单机就直接下一步
|
if (!BFMain.IsStandAlone) // 如果是单机就直接下一步
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,6 +16,8 @@ namespace BF
|
|||||||
|
|
||||||
public const string MAIN_SOCKET_NAME = "0";
|
public const string MAIN_SOCKET_NAME = "0";
|
||||||
public const string CHAT_SOCKET_NAME = "1";
|
public const string CHAT_SOCKET_NAME = "1";
|
||||||
|
public const int MAIN_SOCKET_NAME_INT = 0;
|
||||||
|
public const int CHAT_SOCKET_NAME_INT = 1;
|
||||||
static NetManager instance;
|
static NetManager instance;
|
||||||
private NetClient netClient;
|
private NetClient netClient;
|
||||||
private List<ClientInfo> clients = new List<ClientInfo>();
|
private List<ClientInfo> clients = new List<ClientInfo>();
|
||||||
@ -31,8 +33,11 @@ namespace BF
|
|||||||
public byte [] authReqData = null;
|
public byte [] authReqData = null;
|
||||||
public byte [] ChatAuthReqData = null;
|
public byte [] ChatAuthReqData = null;
|
||||||
public string decodePbStr = null;
|
public string decodePbStr = null;
|
||||||
|
public string decodeChatPbStr = null;
|
||||||
public uint rspGroup = 0;
|
public uint rspGroup = 0;
|
||||||
|
public uint rspChatGroup = 0;
|
||||||
public bool decodeFinish = false;
|
public bool decodeFinish = false;
|
||||||
|
public bool decodeChatFinish = false;
|
||||||
public static NetManager Create()
|
public static NetManager Create()
|
||||||
{
|
{
|
||||||
BFLog.LogAssert(instance == null, "This method only allows BFMain to call once");
|
BFLog.LogAssert(instance == null, "This method only allows BFMain to call once");
|
||||||
@ -199,7 +204,14 @@ namespace BF
|
|||||||
|
|
||||||
public void HandleDecodePbChange(int clientId, uint group, uint seq, byte[] data)
|
public void HandleDecodePbChange(int clientId, uint group, uint seq, byte[] data)
|
||||||
{
|
{
|
||||||
decodeFinish = false;
|
if (clientId == MAIN_SOCKET_NAME_INT)
|
||||||
|
{
|
||||||
|
decodeFinish = false;
|
||||||
|
}
|
||||||
|
else if (clientId == CHAT_SOCKET_NAME_INT)
|
||||||
|
{
|
||||||
|
decodeChatFinish = false;
|
||||||
|
}
|
||||||
OnDecodePbCallback?.Invoke(clientId, group, seq, data);
|
OnDecodePbCallback?.Invoke(clientId, group, seq, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +329,7 @@ namespace BF
|
|||||||
public void ConnectWithConfiguration(int clientId, NetConnectConfiguration configuration, string domainName, int port)
|
public void ConnectWithConfiguration(int clientId, NetConnectConfiguration configuration, string domainName, int port)
|
||||||
{
|
{
|
||||||
ClientInfo clientInfo = new ClientInfo();
|
ClientInfo clientInfo = new ClientInfo();
|
||||||
clientInfo.Name = configuration.UniqueIdentifier;
|
clientInfo.Name = clientId.ToString();
|
||||||
clientInfo.LastConnectStatus = NetConnectStatus.InvalidConnect;
|
clientInfo.LastConnectStatus = NetConnectStatus.InvalidConnect;
|
||||||
clients[clientId] = clientInfo;
|
clients[clientId] = clientInfo;
|
||||||
netClient.Connect(configuration, domainName, port);
|
netClient.Connect(configuration, domainName, port);
|
||||||
@ -370,16 +382,31 @@ namespace BF
|
|||||||
return decodeFinish;
|
return decodeFinish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool GetDecodeChatStataus()
|
||||||
|
{
|
||||||
|
return decodeChatFinish;
|
||||||
|
}
|
||||||
|
|
||||||
public string GetDecodePbStr()
|
public string GetDecodePbStr()
|
||||||
{
|
{
|
||||||
return decodePbStr;
|
return decodePbStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetDecodeChatPbStr()
|
||||||
|
{
|
||||||
|
return decodeChatPbStr;
|
||||||
|
}
|
||||||
|
|
||||||
public uint GetDecodeGroup()
|
public uint GetDecodeGroup()
|
||||||
{
|
{
|
||||||
return rspGroup;
|
return rspGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint GetDecodeChatGroup()
|
||||||
|
{
|
||||||
|
return rspChatGroup;
|
||||||
|
}
|
||||||
|
|
||||||
public void AddLuaOnReceiveMessage(Action<int, uint, uint, byte[]> luaFunc)
|
public void AddLuaOnReceiveMessage(Action<int, uint, uint, byte[]> luaFunc)
|
||||||
{
|
{
|
||||||
OnReceiveMsgLuaCallback = luaFunc;
|
OnReceiveMsgLuaCallback = luaFunc;
|
||||||
|
|||||||
@ -104,7 +104,15 @@ namespace BF
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private bool DeserializeAuthRsp(out long status)
|
private bool DeserializeAuthRsp(out long status)
|
||||||
{
|
{
|
||||||
string pbData = BF.BFMain.Instance.NetMgr.GetDecodePbStr();
|
string pbData;
|
||||||
|
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||||
|
{
|
||||||
|
pbData = BFMain.Instance.NetMgr.GetDecodePbStr();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pbData = BFMain.Instance.NetMgr.GetDecodeChatPbStr();
|
||||||
|
}
|
||||||
Dictionary<string, object> dict = Json.Deserialize(pbData) as Dictionary<string, object>;
|
Dictionary<string, object> dict = Json.Deserialize(pbData) as Dictionary<string, object>;
|
||||||
|
|
||||||
status = (long)dict["status"];
|
status = (long)dict["status"];
|
||||||
|
|||||||
@ -214,7 +214,14 @@ namespace BF
|
|||||||
// ResetOldSessionRc4Key();
|
// ResetOldSessionRc4Key();
|
||||||
|
|
||||||
ForceSendHeartBeatImmediately();
|
ForceSendHeartBeatImmediately();
|
||||||
BF.BFMain.Instance.NetMgr.decodeFinish = false;
|
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||||
|
{
|
||||||
|
BF.BFMain.Instance.NetMgr.decodeFinish = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BF.BFMain.Instance.NetMgr.decodeChatFinish = false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -310,7 +317,16 @@ namespace BF
|
|||||||
private bool DeserializeReconnectRsp(out long status, out long seqCs)
|
private bool DeserializeReconnectRsp(out long status, out long seqCs)
|
||||||
{
|
{
|
||||||
// BFLog.Log("==================================== DeserializeReconnectRsp");
|
// BFLog.Log("==================================== DeserializeReconnectRsp");
|
||||||
string pbData = BF.BFMain.Instance.NetMgr.GetDecodePbStr();
|
string pbData;
|
||||||
|
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||||
|
|
||||||
|
{
|
||||||
|
pbData = BF.BFMain.Instance.NetMgr.GetDecodePbStr();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pbData = BF.BFMain.Instance.NetMgr.GetDecodeChatPbStr();
|
||||||
|
}
|
||||||
Dictionary<string, object> dict = Json.Deserialize(pbData) as Dictionary<string, object>;
|
Dictionary<string, object> dict = Json.Deserialize(pbData) as Dictionary<string, object>;
|
||||||
// BFLog.Log("==================================== DeserializeReconnectRsp pbData = " + pbData);
|
// BFLog.Log("==================================== DeserializeReconnectRsp pbData = " + pbData);
|
||||||
// BFLog.Log("==================================== DeserializeReconnectRsp status = " + (long)dict["status"]);
|
// BFLog.Log("==================================== DeserializeReconnectRsp status = " + (long)dict["status"]);
|
||||||
|
|||||||
@ -73,30 +73,64 @@ namespace BF
|
|||||||
// BFLog.Log("visibleStatus = " + visibleStatus);
|
// BFLog.Log("visibleStatus = " + visibleStatus);
|
||||||
if (visibleStatus == NetConnectStatus.Decoding && !decoding)
|
if (visibleStatus == NetConnectStatus.Decoding && !decoding)
|
||||||
{
|
{
|
||||||
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeStataus();
|
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||||
if (decodeFinish)
|
|
||||||
{
|
{
|
||||||
uint group = BF.BFMain.Instance.NetMgr.GetDecodeGroup();
|
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeStataus();
|
||||||
if (group == Auth_Rsp_Group || group == Chat_Auth_Rsp_Group)
|
if (decodeFinish)
|
||||||
{
|
{
|
||||||
decoding = true;
|
uint group = BF.BFMain.Instance.NetMgr.GetDecodeGroup();
|
||||||
FilterAuthIncomingMessage2();
|
if (group == Auth_Rsp_Group)
|
||||||
return;
|
{
|
||||||
|
decoding = true;
|
||||||
|
FilterAuthIncomingMessage2();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeChatStataus();
|
||||||
|
if (decodeFinish)
|
||||||
|
{
|
||||||
|
uint group = BF.BFMain.Instance.NetMgr.GetDecodeChatGroup();
|
||||||
|
if (group == Chat_Auth_Rsp_Group)
|
||||||
|
{
|
||||||
|
decoding = true;
|
||||||
|
FilterAuthIncomingMessage2();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// BFLog.Log("visibleStatus = " + visibleStatus + "decoding = " + decoding);
|
// BFLog.Log("visibleStatus = " + visibleStatus + "decoding = " + decoding);
|
||||||
if (visibleStatus == NetConnectStatus.Decoding2 && !decoding)
|
if (visibleStatus == NetConnectStatus.Decoding2 && !decoding)
|
||||||
{
|
{
|
||||||
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeStataus();
|
if(ownerConnection.UniqueIdentifier.CompareTo(BF.NetManager.MAIN_SOCKET_NAME) == 0)
|
||||||
if (decodeFinish)
|
|
||||||
{
|
{
|
||||||
uint group = BF.BFMain.Instance.NetMgr.GetDecodeGroup();
|
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeStataus();
|
||||||
if (group == Reconnect_Rsp_Group)
|
if (decodeFinish)
|
||||||
{
|
{
|
||||||
decoding = true;
|
uint group = BF.BFMain.Instance.NetMgr.GetDecodeGroup();
|
||||||
FilterReconnectIncomingMessage2();
|
if (group == Reconnect_Rsp_Group)
|
||||||
return;
|
{
|
||||||
|
decoding = true;
|
||||||
|
FilterReconnectIncomingMessage2();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool decodeFinish = BF.BFMain.Instance.NetMgr.GetDecodeChatStataus();
|
||||||
|
if (decodeFinish)
|
||||||
|
{
|
||||||
|
uint group = BF.BFMain.Instance.NetMgr.GetDecodeChatGroup();
|
||||||
|
if (group == Reconnect_Rsp_Group)
|
||||||
|
{
|
||||||
|
decoding = true;
|
||||||
|
FilterReconnectIncomingMessage2();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,15 +26,18 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
|||||||
private const string Key = "9uHgeBwag3NXva9MC23ToO3q11Ve59bF1uwg4qGltdGmCQ7OSByFZ_3b1ZF7krMlkHQo5gXzIokVDsvg1rwbr-";
|
private const string Key = "9uHgeBwag3NXva9MC23ToO3q11Ve59bF1uwg4qGltdGmCQ7OSByFZ_3b1ZF7krMlkHQo5gXzIokVDsvg1rwbr-";
|
||||||
string bannerAdUnitId = "YOUR_BANNER_AD_UNIT_ID"; // Retrieve the ID from your account
|
string bannerAdUnitId = "YOUR_BANNER_AD_UNIT_ID"; // Retrieve the ID from your account
|
||||||
string adInterstitialUnitId = "YOUR_AD_UNIT_ID";
|
string adInterstitialUnitId = "YOUR_AD_UNIT_ID";
|
||||||
string adRewardUnitId = "e54f27e345da90df";
|
#if UNITY_IOS || UNITY_IPHONE
|
||||||
|
string adRewardUnitId = "1043ecded04c561b";
|
||||||
|
#else
|
||||||
|
string adRewardUnitId = "3fdcc8a796773aa2";
|
||||||
|
#endif
|
||||||
|
public Action<string> luaAdRevenuePaidEventCallback;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
public void Init(string init = "")
|
public void Init(string init = "")
|
||||||
{
|
{
|
||||||
#if UNITY_IOS || UNITY_IPHONE
|
|
||||||
MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) =>
|
MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) =>
|
||||||
{
|
{
|
||||||
|
#if UNITY_IOS || UNITY_IPHONE
|
||||||
if (MaxSdkUtils.CompareVersions(UnityEngine.iOS.Device.systemVersion, "14.5") != MaxSdkUtils.VersionComparisonResult.Lesser)
|
if (MaxSdkUtils.CompareVersions(UnityEngine.iOS.Device.systemVersion, "14.5") != MaxSdkUtils.VersionComparisonResult.Lesser)
|
||||||
{
|
{
|
||||||
// Note that App transparency tracking authorization can be checked via `sdkConfiguration.AppTrackingStatus` for Unity Editor and iOS targets
|
// Note that App transparency tracking authorization can be checked via `sdkConfiguration.AppTrackingStatus` for Unity Editor and iOS targets
|
||||||
@ -44,6 +47,7 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
|||||||
else
|
else
|
||||||
AudienceNetwork.AdSettings.SetAdvertiserTrackingEnabled(false);
|
AudienceNetwork.AdSettings.SetAdvertiserTrackingEnabled(false);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Show Mediation Debugger
|
// Show Mediation Debugger
|
||||||
// MaxSdk.ShowMediationDebugger();
|
// MaxSdk.ShowMediationDebugger();
|
||||||
// MaxSdk.SetVerboseLogging(true);
|
// MaxSdk.SetVerboseLogging(true);
|
||||||
@ -55,7 +59,7 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
|||||||
MaxSdk.SetUserId(SystemInfo.deviceUniqueIdentifier);
|
MaxSdk.SetUserId(SystemInfo.deviceUniqueIdentifier);
|
||||||
// MaxSdk.SetVerboseLogging(true);
|
// MaxSdk.SetVerboseLogging(true);
|
||||||
MaxSdk.InitializeSdk();
|
MaxSdk.InitializeSdk();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadAds()
|
private void LoadAds()
|
||||||
@ -65,6 +69,11 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
|||||||
// InitializeInterstitialAds();
|
// InitializeInterstitialAds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetAdRevenuePaidEventCallback(Action<string> callback)
|
||||||
|
{
|
||||||
|
luaAdRevenuePaidEventCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsRewardedAdReady()
|
public bool IsRewardedAdReady()
|
||||||
{
|
{
|
||||||
return MaxSdk.IsRewardedAdReady(adRewardUnitId);
|
return MaxSdk.IsRewardedAdReady(adRewardUnitId);
|
||||||
@ -92,10 +101,11 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
|||||||
return MaxSdk.IsInterstitialReady(adInterstitialUnitId);
|
return MaxSdk.IsInterstitialReady(adInterstitialUnitId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowInterstitial()
|
public void ShowInterstitial(Action<int> callback = null)
|
||||||
{
|
{
|
||||||
if (MaxSdk.IsInterstitialReady(adInterstitialUnitId))
|
if (MaxSdk.IsInterstitialReady(adInterstitialUnitId))
|
||||||
{
|
{
|
||||||
|
_interstitialAdCallback = callback;
|
||||||
MaxSdk.ShowInterstitial(adInterstitialUnitId);
|
MaxSdk.ShowInterstitial(adInterstitialUnitId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,10 +114,48 @@ public partial class AdManager : BF.MonoSingleton<AdManager>
|
|||||||
public void ShowBanner()
|
public void ShowBanner()
|
||||||
{
|
{
|
||||||
MaxSdk.ShowBanner(bannerAdUnitId);
|
MaxSdk.ShowBanner(bannerAdUnitId);
|
||||||
|
MaxSdk.StartBannerAutoRefresh(bannerAdUnitId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HideBanner()
|
public void HideBanner()
|
||||||
{
|
{
|
||||||
|
MaxSdk.StopBannerAutoRefresh(bannerAdUnitId);
|
||||||
MaxSdk.HideBanner(bannerAdUnitId);
|
MaxSdk.HideBanner(bannerAdUnitId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DestroyBanner()
|
||||||
|
{
|
||||||
|
MaxSdk.DestroyBanner(bannerAdUnitId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPrivacyOptionsRequired()
|
||||||
|
{
|
||||||
|
#if UNITY_IOS || UNITY_IPHONE
|
||||||
|
return BF.BFUMPManager.IsPrivacyOptionsRequired();
|
||||||
|
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
return BF.BFMain.Instance.SDKMgr.BFNativeSDKMgr.IsPrivacyOptionsRequired();
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowPrivacyOptionsForm()
|
||||||
|
{
|
||||||
|
#if UNITY_IOS || UNITY_IPHONE
|
||||||
|
BF.BFUMPManager.ShowPrivacyOptionsForm();
|
||||||
|
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
BF.BFMain.Instance.SDKMgr.BFNativeSDKMgr.ShowPrivacyOptionsForm();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CheckCanRequestAds()
|
||||||
|
{
|
||||||
|
#if UNITY_IOS || UNITY_IPHONE
|
||||||
|
return BF.BFUMPManager.IsPrivacyOptionsRequired();
|
||||||
|
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
return BF.BFMain.Instance.SDKMgr.BFNativeSDKMgr.IsPrivacyOptionsRequired();
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,13 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
public partial class AdManager
|
public partial class AdManager
|
||||||
{
|
{
|
||||||
public void InitializeBannerAds()
|
public void InitializeBannerAds()
|
||||||
{
|
{
|
||||||
// Banners are automatically sized to 320×50 on phones and 728×90 on tablets
|
|
||||||
// You may call the utility method MaxSdkUtils.isTablet() to help with view sizing adjustments
|
|
||||||
MaxSdk.CreateBanner(bannerAdUnitId, MaxSdkBase.BannerPosition.BottomCenter);
|
|
||||||
|
|
||||||
// Set background or background color for banners to be fully functional
|
|
||||||
MaxSdk.SetBannerBackgroundColor(bannerAdUnitId, Color.white);
|
|
||||||
|
|
||||||
MaxSdkCallbacks.Banner.OnAdLoadedEvent += OnBannerAdLoadedEvent;
|
MaxSdkCallbacks.Banner.OnAdLoadedEvent += OnBannerAdLoadedEvent;
|
||||||
MaxSdkCallbacks.Banner.OnAdLoadFailedEvent += OnBannerAdLoadFailedEvent;
|
MaxSdkCallbacks.Banner.OnAdLoadFailedEvent += OnBannerAdLoadFailedEvent;
|
||||||
MaxSdkCallbacks.Banner.OnAdClickedEvent += OnBannerAdClickedEvent;
|
MaxSdkCallbacks.Banner.OnAdClickedEvent += OnBannerAdClickedEvent;
|
||||||
@ -27,7 +22,34 @@ public partial class AdManager
|
|||||||
|
|
||||||
private void OnBannerAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
private void OnBannerAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
||||||
|
|
||||||
private void OnBannerAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
private void OnBannerAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||||
|
{
|
||||||
|
if (luaAdRevenuePaidEventCallback == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double revenue = adInfo.Revenue;
|
||||||
|
// Miscellaneous data
|
||||||
|
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||||
|
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||||
|
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||||
|
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||||
|
string networkPlacement = adInfo.NetworkPlacement; // The placement ID from the network that showed the ad
|
||||||
|
string adFormat = adInfo.AdFormat;
|
||||||
|
|
||||||
|
var dict = new Dictionary<string, System.Object>();
|
||||||
|
dict.Add("revenue", revenue);
|
||||||
|
dict.Add("country_code", countryCode);
|
||||||
|
dict.Add("network_name", networkName);
|
||||||
|
dict.Add("ad_unit_Id", adUnitId);
|
||||||
|
dict.Add("ad_unit_identifier", adUnitIdentifier);
|
||||||
|
dict.Add("placement", placement);
|
||||||
|
dict.Add("network_placement", networkPlacement);
|
||||||
|
dict.Add("ad_format", adFormat);
|
||||||
|
dict.Add("ad_type", "banner");
|
||||||
|
var result = JsonConvert.SerializeObject(dict);
|
||||||
|
luaAdRevenuePaidEventCallback(result);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnBannerAdExpandedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
private void OnBannerAdExpandedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
public partial class AdManager
|
public partial class AdManager
|
||||||
{
|
{
|
||||||
int retryAttemptInterstitial;
|
int retryAttemptInterstitial;
|
||||||
|
private Action<int> _interstitialAdCallback;
|
||||||
|
|
||||||
public void InitializeInterstitialAds()
|
public void InitializeInterstitialAds()
|
||||||
{
|
{
|
||||||
@ -14,6 +15,7 @@ public partial class AdManager
|
|||||||
MaxSdkCallbacks.Interstitial.OnAdLoadFailedEvent += OnInterstitialLoadFailedEvent;
|
MaxSdkCallbacks.Interstitial.OnAdLoadFailedEvent += OnInterstitialLoadFailedEvent;
|
||||||
MaxSdkCallbacks.Interstitial.OnAdDisplayedEvent += OnInterstitialDisplayedEvent;
|
MaxSdkCallbacks.Interstitial.OnAdDisplayedEvent += OnInterstitialDisplayedEvent;
|
||||||
MaxSdkCallbacks.Interstitial.OnAdClickedEvent += OnInterstitialClickedEvent;
|
MaxSdkCallbacks.Interstitial.OnAdClickedEvent += OnInterstitialClickedEvent;
|
||||||
|
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent += OnInterstitialAdRevenuePaidEvent;
|
||||||
MaxSdkCallbacks.Interstitial.OnAdHiddenEvent += OnInterstitialHiddenEvent;
|
MaxSdkCallbacks.Interstitial.OnAdHiddenEvent += OnInterstitialHiddenEvent;
|
||||||
MaxSdkCallbacks.Interstitial.OnAdDisplayFailedEvent += OnInterstitialAdFailedToDisplayEvent;
|
MaxSdkCallbacks.Interstitial.OnAdDisplayFailedEvent += OnInterstitialAdFailedToDisplayEvent;
|
||||||
|
|
||||||
@ -45,12 +47,16 @@ public partial class AdManager
|
|||||||
Invoke("LoadInterstitial", (float)retryDelay);
|
Invoke("LoadInterstitial", (float)retryDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInterstitialDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
private void OnInterstitialDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||||
|
{
|
||||||
|
_interstitialAdCallback?.Invoke(0);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnInterstitialAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
private void OnInterstitialAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
|
||||||
{
|
{
|
||||||
// Interstitial ad failed to display. AppLovin recommends that you load the next ad.
|
// Interstitial ad failed to display. AppLovin recommends that you load the next ad.
|
||||||
LoadInterstitial();
|
LoadInterstitial();
|
||||||
|
_interstitialAdCallback?.Invoke(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInterstitialClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
private void OnInterstitialClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
|
||||||
@ -59,5 +65,35 @@ public partial class AdManager
|
|||||||
{
|
{
|
||||||
// Interstitial ad is hidden. Pre-load the next ad.
|
// Interstitial ad is hidden. Pre-load the next ad.
|
||||||
LoadInterstitial();
|
LoadInterstitial();
|
||||||
|
_interstitialAdCallback?.Invoke(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnInterstitialAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||||
|
{
|
||||||
|
if (luaAdRevenuePaidEventCallback == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double revenue = adInfo.Revenue;
|
||||||
|
// Miscellaneous data
|
||||||
|
string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD" in most cases!
|
||||||
|
string networkName = adInfo.NetworkName; // Display name of the network that showed the ad (e.g. "AdColony")
|
||||||
|
string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
|
||||||
|
string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
|
||||||
|
string networkPlacement = adInfo.NetworkPlacement; // The placement ID from the network that showed the ad
|
||||||
|
string adFormat = adInfo.AdFormat;
|
||||||
|
|
||||||
|
var dict = new Dictionary<string, System.Object>();
|
||||||
|
dict.Add("revenue", revenue);
|
||||||
|
dict.Add("country_code", countryCode);
|
||||||
|
dict.Add("network_name", networkName);
|
||||||
|
dict.Add("ad_unit_Id", adUnitId);
|
||||||
|
dict.Add("ad_unit_identifier", adUnitIdentifier);
|
||||||
|
dict.Add("placement", placement);
|
||||||
|
dict.Add("network_placement", networkPlacement);
|
||||||
|
dict.Add("ad_format", adFormat);
|
||||||
|
dict.Add("ad_type", "interstitial");
|
||||||
|
var result = JsonConvert.SerializeObject(dict);
|
||||||
|
luaAdRevenuePaidEventCallback(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ public partial class AdManager
|
|||||||
|
|
||||||
private Action<int> _rewardCallback;
|
private Action<int> _rewardCallback;
|
||||||
private bool _rewardOK = false;
|
private bool _rewardOK = false;
|
||||||
public Action<string> luaAdRevenuePaidEventCallback;
|
|
||||||
|
|
||||||
public void InitializeRewardedAds()
|
public void InitializeRewardedAds()
|
||||||
{
|
{
|
||||||
@ -28,11 +27,6 @@ public partial class AdManager
|
|||||||
LoadRewardedAd();
|
LoadRewardedAd();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAdRevenuePaidEventCallback(Action<string> callback)
|
|
||||||
{
|
|
||||||
luaAdRevenuePaidEventCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadRewardedAd()
|
private void LoadRewardedAd()
|
||||||
{
|
{
|
||||||
MaxSdk.LoadRewardedAd(adRewardUnitId);
|
MaxSdk.LoadRewardedAd(adRewardUnitId);
|
||||||
@ -43,16 +37,16 @@ public partial class AdManager
|
|||||||
// Rewarded ad is ready for you to show. MaxSdk.IsRewardedAdReady(adUnitId) now returns 'true'.
|
// Rewarded ad is ready for you to show. MaxSdk.IsRewardedAdReady(adUnitId) now returns 'true'.
|
||||||
|
|
||||||
// Reset retry attempt
|
// Reset retry attempt
|
||||||
retryAttemptInterstitial = 0;
|
retryAttemptReward = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRewardedAdLoadFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
private void OnRewardedAdLoadFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||||
{
|
{
|
||||||
// Rewarded ad failed to load
|
// Rewarded ad failed to load
|
||||||
// AppLovin recommends that you retry with exponentially higher delays, up to a maximum delay (in this case 64 seconds).
|
// AppLovin recommends that you retry with exponentially higher delays, up to a maximum delay (in this case 64 seconds).
|
||||||
|
|
||||||
retryAttemptInterstitial++;
|
retryAttemptReward++;
|
||||||
double retryDelay = Math.Pow(2, Math.Min(6, retryAttemptInterstitial));
|
double retryDelay = Math.Pow(2, Math.Min(6, retryAttemptReward));
|
||||||
|
|
||||||
Invoke("LoadRewardedAd", (float)retryDelay);
|
Invoke("LoadRewardedAd", (float)retryDelay);
|
||||||
}
|
}
|
||||||
@ -63,8 +57,6 @@ public partial class AdManager
|
|||||||
{
|
{
|
||||||
// Rewarded ad failed to display. AppLovin recommends that you load the next ad.
|
// Rewarded ad failed to display. AppLovin recommends that you load the next ad.
|
||||||
LoadRewardedAd();
|
LoadRewardedAd();
|
||||||
|
|
||||||
Debug.Log(Tag + "==================== OnRewardedAdFailedToDisplayEvent");
|
|
||||||
_rewardCallback?.Invoke(1);
|
_rewardCallback?.Invoke(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,17 +75,11 @@ public partial class AdManager
|
|||||||
}
|
}
|
||||||
_rewardOK = false;
|
_rewardOK = false;
|
||||||
_rewardCallback = null;
|
_rewardCallback = null;
|
||||||
Debug.Log(Tag + "==================== OnRewardedAdHiddenEvent");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward, MaxSdkBase.AdInfo adInfo)
|
private void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward, MaxSdkBase.AdInfo adInfo)
|
||||||
{
|
{
|
||||||
// The rewarded ad displayed and the user should receive the reward.
|
|
||||||
|
|
||||||
Debug.Log(Tag + "Rewarded user: " + reward.Amount + " " + reward.Label);
|
|
||||||
_rewardOK = true;
|
_rewardOK = true;
|
||||||
// _rewardCallback?.Invoke(0);
|
|
||||||
// _rewardCallback = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
private void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||||
@ -120,7 +106,8 @@ public partial class AdManager
|
|||||||
dict.Add("placement", placement);
|
dict.Add("placement", placement);
|
||||||
dict.Add("network_placement", networkPlacement);
|
dict.Add("network_placement", networkPlacement);
|
||||||
dict.Add("ad_format", adFormat);
|
dict.Add("ad_format", adFormat);
|
||||||
|
dict.Add("ad_type", "reward");
|
||||||
var result = JsonConvert.SerializeObject(dict);
|
var result = JsonConvert.SerializeObject(dict);
|
||||||
luaAdRevenuePaidEventCallback(result);
|
luaAdRevenuePaidEventCallback(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
87
Assets/Scripts/Common/SDK/BFHWAdSDKManager.cs
Normal file
87
Assets/Scripts/Common/SDK/BFHWAdSDKManager.cs
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class BFHWAdSDKManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Action<int> luaShowCallback;
|
||||||
|
public Action<int> luaLoadedCallback;
|
||||||
|
public Action<int, string> luaEarnedRewardCallback;
|
||||||
|
public bool AdLoaded = false;
|
||||||
|
public bool AdInitialized = false;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
// google
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.InitHWAdRewardedVideo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowFullScreenAds()
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.ShowHWFullScreenAds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TryLoadRewardedAd()
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.TryLoadHWRewardedAd();
|
||||||
|
}
|
||||||
|
|
||||||
|
// public void SetAdPlacement(string placement)
|
||||||
|
// {
|
||||||
|
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.SetAdPlacement(placement);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public void SetAdShowCallback(Action<int> callback)
|
||||||
|
{
|
||||||
|
luaShowCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置广告加载回调
|
||||||
|
public void SetAdLoadedCallback(Action<int> callback)
|
||||||
|
{
|
||||||
|
luaLoadedCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置广告看完回调
|
||||||
|
public void SetAdEarnedRewardCallback(Action<int, string> callback)
|
||||||
|
{
|
||||||
|
luaEarnedRewardCallback = callback;
|
||||||
|
}
|
||||||
|
public void ShowFullScreenAdFinish(int code)
|
||||||
|
{
|
||||||
|
if (luaShowCallback != null)
|
||||||
|
{
|
||||||
|
luaShowCallback(code);
|
||||||
|
// luaShowCallback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void AdLoadedFinish(int code)
|
||||||
|
{
|
||||||
|
if (code == 0)
|
||||||
|
{
|
||||||
|
AdLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (luaLoadedCallback != null)
|
||||||
|
{
|
||||||
|
luaLoadedCallback(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void EarnedRewardFinish(int code, string result)
|
||||||
|
{
|
||||||
|
if (luaEarnedRewardCallback != null)
|
||||||
|
{
|
||||||
|
luaEarnedRewardCallback(code, result);
|
||||||
|
// luaEarnedRewardCallback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Common/SDK/BFHWAdSDKManager.cs.meta
Normal file
11
Assets/Scripts/Common/SDK/BFHWAdSDKManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 51a8bc27467e6434d847a1a53555d90b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
123
Assets/Scripts/Common/SDK/BFHWPaySDKManager.cs
Normal file
123
Assets/Scripts/Common/SDK/BFHWPaySDKManager.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class BFHWPaySDKManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Action<int, string> luaPayCallback;
|
||||||
|
public Action<int, string> luaQueryProductCallback;
|
||||||
|
public Action<int, string> luaQueryUncompleteOrderCallback;
|
||||||
|
public Action<int> luaConsumeCallback;
|
||||||
|
public bool StoreValid { get; private set; }
|
||||||
|
private string ProductJson;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
// 俄罗斯华为渠道专用支付
|
||||||
|
if (!BFPlatform.IsSupportHWPay())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
CheckStoreValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测支付可用性
|
||||||
|
public void CheckStoreValid()
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWCheckValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckStoreValidComplete(bool success)
|
||||||
|
{
|
||||||
|
StoreValid = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求全部商品信息
|
||||||
|
public void QueryProductInfo(string productJson, Action<int, string> callback)
|
||||||
|
{
|
||||||
|
luaQueryProductCallback = callback;
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWGetProducts(productJson, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void QueryProductComplete(bool succ, string result)
|
||||||
|
{
|
||||||
|
Debug.Log("C# call QueryProductComplete");
|
||||||
|
int code = succ?0:1;
|
||||||
|
if(luaQueryProductCallback != null)
|
||||||
|
{
|
||||||
|
Debug.Log("C# call QueryProductComplete result = " + result + " code = " + code);
|
||||||
|
Action<int, string> tempLuaQueryProductCallback = luaQueryProductCallback;
|
||||||
|
luaQueryProductCallback = null;
|
||||||
|
tempLuaQueryProductCallback(code, result);
|
||||||
|
ProductJson = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付
|
||||||
|
public void Pay(string payType, string productId, string customMsg, Action<int, string> callback)
|
||||||
|
{
|
||||||
|
luaPayCallback = callback;
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWPurchase(productId, customMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PayComplete(int code, string result)
|
||||||
|
{
|
||||||
|
Debug.Log("C# call PayComplete");
|
||||||
|
// 优先当前支付的回调
|
||||||
|
if(luaPayCallback != null)
|
||||||
|
{
|
||||||
|
Debug.Log("C# call PayComplete result = " + result + " code = " + code);
|
||||||
|
luaPayCallback(code, result);
|
||||||
|
luaPayCallback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 消耗
|
||||||
|
public void ConsumePurchase(string token, Action<int> callback)
|
||||||
|
{
|
||||||
|
luaConsumeCallback = callback;
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWConsume(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConsumeComplete(int code)
|
||||||
|
{
|
||||||
|
Debug.Log("C# call ConsumeComplete");
|
||||||
|
if (luaConsumeCallback != null)
|
||||||
|
{
|
||||||
|
Debug.Log("C# call ConsumeComplete code = " + code);
|
||||||
|
luaConsumeCallback(code);
|
||||||
|
luaConsumeCallback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询未完成订单
|
||||||
|
public void QueryUncompleteOrder(Action<int, string> callback)
|
||||||
|
{
|
||||||
|
luaQueryUncompleteOrderCallback = callback;
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.HWGetPurchase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void QueryUncompleteOrderFinish(string result)
|
||||||
|
{
|
||||||
|
Debug.Log("C# call QueryUncompleteOrderFinish");
|
||||||
|
if(luaQueryUncompleteOrderCallback != null)
|
||||||
|
{
|
||||||
|
Debug.Log("C# call QueryUncompleteOrderFinish result = " + result);
|
||||||
|
Action<int, string> tempLuaQueryUncompleteOrderCallback = luaQueryUncompleteOrderCallback;
|
||||||
|
luaQueryUncompleteOrderCallback = null;
|
||||||
|
tempLuaQueryUncompleteOrderCallback(0, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Common/SDK/BFHWPaySDKManager.cs.meta
Normal file
11
Assets/Scripts/Common/SDK/BFHWPaySDKManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 23ba21f8bd9926047b7b057e98ddf72f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,318 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System;
|
|
||||||
using com.adjust.sdk;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace BF
|
|
||||||
{
|
|
||||||
// Example for IronSource Unity.
|
|
||||||
public class BFIronSourceSDKManager : MonoBehaviour
|
|
||||||
{
|
|
||||||
public Action<int> luaShowCallback;
|
|
||||||
public Action<int> luaLoadedCallback;
|
|
||||||
public Action<int, string> luaEarnedRewardCallback;
|
|
||||||
public Action<string> luaAdRevenuePaidEventCallback;
|
|
||||||
public bool AdLoaded = false;
|
|
||||||
public bool AdInitialized = false;
|
|
||||||
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
#if UNITY_ANDROID
|
|
||||||
// string appKey = "85460dcd";
|
|
||||||
string appKey = "1a6aacc25";
|
|
||||||
|
|
||||||
BFLog.Log("unity-script: IronSource.Agent.validateIntegration");
|
|
||||||
IronSource.Agent.validateIntegration();
|
|
||||||
|
|
||||||
BFLog.Log("unity-script: unity version" + IronSource.unityVersion());
|
|
||||||
|
|
||||||
// SDK init
|
|
||||||
BFLog.Log("unity-script: IronSource.Agent.init");
|
|
||||||
// IronSource.Agent.setMetaData("is_test_suite", "enable");
|
|
||||||
IronSource.Agent.init(appKey);
|
|
||||||
IronSource.Agent.setManualLoadRewardedVideo(true);
|
|
||||||
|
|
||||||
// 初始化之前先设置一下用户id
|
|
||||||
// ISAdQualityConfig adQualityConfig = new ISAdQualityConfig();
|
|
||||||
// adQualityConfig.UserId = SystemInfo.deviceUniqueIdentifier;
|
|
||||||
// // adQualityConfig.TestMode = true;
|
|
||||||
// // adQualityConfig.LogLevel = ISAdQualityLogLevel.INFO;
|
|
||||||
// IronSourceAdQuality.Initialize(appKey, adQualityConfig);
|
|
||||||
#elif UNITY_IPHONE
|
|
||||||
// string appKey = "8545d445";
|
|
||||||
// 初始化之前先设置一下用户id
|
|
||||||
// ISAdQualityConfig adQualityConfig = new ISAdQualityConfig();
|
|
||||||
// adQualityConfig.UserId = SystemInfo.deviceUniqueIdentifier;
|
|
||||||
// IronSourceAdQuality.Initialize(appKey, adQualityConfig);
|
|
||||||
#else
|
|
||||||
// string appKey = "unexpected_platform";
|
|
||||||
#endif
|
|
||||||
// BFLog.Log("unity-script: IronSource.Agent.validateIntegration");
|
|
||||||
// IronSource.Agent.validateIntegration();
|
|
||||||
|
|
||||||
// BFLog.Log("unity-script: unity version" + IronSource.unityVersion());
|
|
||||||
|
|
||||||
// // SDK init
|
|
||||||
// BFLog.Log("unity-script: IronSource.Agent.init");
|
|
||||||
// IronSource.Agent.init(appKey);
|
|
||||||
// IronSource.Agent.setManualLoadRewardedVideo(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnEnable()
|
|
||||||
{
|
|
||||||
|
|
||||||
//Add Init Event
|
|
||||||
IronSourceEvents.onSdkInitializationCompletedEvent += SdkInitializationCompletedEvent;
|
|
||||||
|
|
||||||
//Add Rewarded Video Events
|
|
||||||
// IronSourceEvents.onRewardedVideoAdOpenedEvent += RewardedVideoAdOpenedEvent;
|
|
||||||
// IronSourceEvents.onRewardedVideoAdClosedEvent += RewardedVideoAdClosedEvent;
|
|
||||||
// IronSourceEvents.onRewardedVideoAvailabilityChangedEvent += RewardedVideoAvailabilityChangedEvent;
|
|
||||||
// IronSourceEvents.onRewardedVideoAdStartedEvent += RewardedVideoAdStartedEvent;
|
|
||||||
// IronSourceEvents.onRewardedVideoAdEndedEvent += RewardedVideoAdEndedEvent;
|
|
||||||
// IronSourceEvents.onRewardedVideoAdRewardedEvent += RewardedVideoAdRewardedEvent;
|
|
||||||
// IronSourceEvents.onRewardedVideoAdShowFailedEvent += RewardedVideoAdShowFailedEvent;
|
|
||||||
// IronSourceEvents.onRewardedVideoAdClickedEvent += RewardedVideoAdClickedEvent;
|
|
||||||
|
|
||||||
//Add ImpressionSuccess Event
|
|
||||||
IronSourceEvents.onImpressionSuccessEvent += ImpressionSuccessEvent;
|
|
||||||
IronSourceEvents.onImpressionDataReadyEvent += ImpressionDataReadyEvent;
|
|
||||||
|
|
||||||
|
|
||||||
//Add AdInfo Rewarded Video Events
|
|
||||||
IronSourceRewardedVideoEvents.onAdOpenedEvent += ReardedVideoOnAdOpenedEvent;
|
|
||||||
IronSourceRewardedVideoEvents.onAdClosedEvent += ReardedVideoOnAdClosedEvent;
|
|
||||||
IronSourceRewardedVideoEvents.onAdAvailableEvent += ReardedVideoOnAdAvailable;
|
|
||||||
IronSourceRewardedVideoEvents.onAdUnavailableEvent += ReardedVideoOnAdUnavailable;
|
|
||||||
IronSourceRewardedVideoEvents.onAdShowFailedEvent += ReardedVideoOnAdShowFailedEvent;
|
|
||||||
IronSourceRewardedVideoEvents.onAdRewardedEvent += ReardedVideoOnAdRewardedEvent;
|
|
||||||
IronSourceRewardedVideoEvents.onAdClickedEvent += ReardedVideoOnAdClickedEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetAdRevenuePaidEventCallback(Action<string> callback)
|
|
||||||
{
|
|
||||||
luaAdRevenuePaidEventCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnApplicationPause(bool isPaused)
|
|
||||||
{
|
|
||||||
#if UNITY_ANDROID
|
|
||||||
BFLog.Log("unity-script: OnApplicationPause = " + isPaused);
|
|
||||||
IronSource.Agent.onApplicationPause(isPaused);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowFullScreenAds()
|
|
||||||
{
|
|
||||||
if(IronSource.Agent.isRewardedVideoAvailable())
|
|
||||||
{
|
|
||||||
IronSource.Agent.showRewardedVideo();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// TryLoadRewardedAd();
|
|
||||||
BFLog.Log("unity-script: IronSource.Agent.isRewardedVideoAvailable - False");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TryLoadRewardedAd()
|
|
||||||
{
|
|
||||||
IronSource.Agent.loadRewardedVideo();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetAdPlacement(string placement)
|
|
||||||
{
|
|
||||||
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.SetAdPlacement(placement);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetAdShowCallback(Action<int> callback)
|
|
||||||
{
|
|
||||||
luaShowCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置广告加载回调
|
|
||||||
public void SetAdLoadedCallback(Action<int> callback)
|
|
||||||
{
|
|
||||||
luaLoadedCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置广告看完回调
|
|
||||||
public void SetAdEarnedRewardCallback(Action<int, string> callback)
|
|
||||||
{
|
|
||||||
luaEarnedRewardCallback = callback;
|
|
||||||
}
|
|
||||||
public void ShowFullScreenAdFinish(int code)
|
|
||||||
{
|
|
||||||
if (luaShowCallback != null)
|
|
||||||
{
|
|
||||||
luaShowCallback(code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#region Init callback handlers
|
|
||||||
|
|
||||||
void SdkInitializationCompletedEvent()
|
|
||||||
{
|
|
||||||
BFLog.Log("unity-script: I got SdkInitializationCompletedEvent");
|
|
||||||
//Launch test suite
|
|
||||||
// IronSource.Agent.launchTestSuite();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region AdInfo Rewarded Video
|
|
||||||
void ReardedVideoOnAdOpenedEvent(IronSourceAdInfo adInfo) {
|
|
||||||
BFLog.Log("unity-script: I got ReardedVideoOnAdOpenedEvent With AdInfo " + adInfo.ToString());
|
|
||||||
ShowFullScreenAdFinish(0);
|
|
||||||
}
|
|
||||||
void ReardedVideoOnAdClosedEvent(IronSourceAdInfo adInfo)
|
|
||||||
{
|
|
||||||
BFLog.Log("unity-script: I got ReardedVideoOnAdClosedEvent With AdInfo " + adInfo.ToString());
|
|
||||||
}
|
|
||||||
void ReardedVideoOnAdAvailable(IronSourceAdInfo adInfo)
|
|
||||||
{
|
|
||||||
BFLog.Log("unity-script: I got ReardedVideoOnAdAvailable With AdInfo " + adInfo.ToString());
|
|
||||||
AdLoaded = true;
|
|
||||||
|
|
||||||
if (luaLoadedCallback != null)
|
|
||||||
{
|
|
||||||
luaLoadedCallback(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void ReardedVideoOnAdUnavailable()
|
|
||||||
{
|
|
||||||
BFLog.Log("unity-script: I got ReardedVideoOnAdUnavailable");
|
|
||||||
AdLoaded = false;
|
|
||||||
|
|
||||||
if (luaLoadedCallback != null)
|
|
||||||
{
|
|
||||||
luaLoadedCallback(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void ReardedVideoOnAdShowFailedEvent(IronSourceError ironSourceError,IronSourceAdInfo adInfo)
|
|
||||||
{
|
|
||||||
BFLog.Log("unity-script: I got RewardedVideoAdOpenedEvent With Error"+ironSourceError.ToString() + "And AdInfo " + adInfo.ToString());
|
|
||||||
ShowFullScreenAdFinish(1);
|
|
||||||
}
|
|
||||||
void ReardedVideoOnAdRewardedEvent(IronSourcePlacement ironSourcePlacement,IronSourceAdInfo adInfo)
|
|
||||||
{
|
|
||||||
BFLog.Log("unity-script: I got ReardedVideoOnAdRewardedEvent With Placement" + ironSourcePlacement.ToString()+ "And AdInfo " + adInfo.ToString());
|
|
||||||
if (luaEarnedRewardCallback != null)
|
|
||||||
{
|
|
||||||
luaEarnedRewardCallback(0, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void ReardedVideoOnAdClickedEvent(IronSourcePlacement ironSourcePlacement, IronSourceAdInfo adInfo)
|
|
||||||
{
|
|
||||||
BFLog.Log("unity-script: I got ReardedVideoOnAdClickedEvent With Placement" + ironSourcePlacement.ToString() + "And AdInfo " + adInfo.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
// #region RewardedAd callback handlers
|
|
||||||
|
|
||||||
// void RewardedVideoAvailabilityChangedEvent(bool canShowAd)
|
|
||||||
// {
|
|
||||||
// BFLog.Log("unity-script: I got RewardedVideoAvailabilityChangedEvent, value = " + canShowAd);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void RewardedVideoAdOpenedEvent()
|
|
||||||
// {
|
|
||||||
// BFLog.Log("unity-script: I got RewardedVideoAdOpenedEvent");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void RewardedVideoAdRewardedEvent(IronSourcePlacement ssp)
|
|
||||||
// {
|
|
||||||
// BFLog.Log("unity-script: I got RewardedVideoAdRewardedEvent, amount = " + ssp.getRewardAmount() + " name = " + ssp.getRewardName());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void RewardedVideoAdClosedEvent()
|
|
||||||
// {
|
|
||||||
// BFLog.Log("unity-script: I got RewardedVideoAdClosedEvent");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void RewardedVideoAdStartedEvent()
|
|
||||||
// {
|
|
||||||
// BFLog.Log("unity-script: I got RewardedVideoAdStartedEvent");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void RewardedVideoAdEndedEvent()
|
|
||||||
// {
|
|
||||||
// BFLog.Log("unity-script: I got RewardedVideoAdEndedEvent");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void RewardedVideoAdShowFailedEvent(IronSourceError error)
|
|
||||||
// {
|
|
||||||
// BFLog.Log("unity-script: I got RewardedVideoAdShowFailedEvent, code : " + error.getCode() + ", description : " + error.getDescription());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void RewardedVideoAdClickedEvent(IronSourcePlacement ssp)
|
|
||||||
// {
|
|
||||||
// BFLog.Log("unity-script: I got RewardedVideoAdClickedEvent, name = " + ssp.getRewardName());
|
|
||||||
// }
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
#region ImpressionSuccess callback handler
|
|
||||||
|
|
||||||
void ImpressionSuccessEvent(IronSourceImpressionData impressionData)
|
|
||||||
{
|
|
||||||
// BFLog.Log("unity - script: I got ImpressionSuccessEvent ToString(): " + impressionData.ToString());
|
|
||||||
// BFLog.Log("unity - script: I got ImpressionSuccessEvent allData: " + impressionData.allData);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImpressionDataReadyEvent(IronSourceImpressionData impressionData)
|
|
||||||
{
|
|
||||||
if (impressionData == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ReferenceEquals(impressionData.revenue, null))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
double revenue = (double)impressionData.revenue;
|
|
||||||
AdjustAdRevenue adjustAdRevenue = new AdjustAdRevenue(AdjustConfig.AdjustAdRevenueSourceIronSource);
|
|
||||||
adjustAdRevenue.setRevenue(revenue, "USD");
|
|
||||||
// optional fields
|
|
||||||
adjustAdRevenue.setAdRevenueNetwork(impressionData.adNetwork);
|
|
||||||
adjustAdRevenue.setAdRevenueUnit(impressionData.adUnit);
|
|
||||||
adjustAdRevenue.setAdRevenuePlacement(impressionData.placement);
|
|
||||||
// track Adjust ad revenue
|
|
||||||
Adjust.trackAdRevenue(adjustAdRevenue);
|
|
||||||
|
|
||||||
if (luaAdRevenuePaidEventCallback == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var dict = new Dictionary<string, System.Object>();
|
|
||||||
dict.Add("revenue", revenue);
|
|
||||||
dict.Add("auction_id", impressionData.auctionId);
|
|
||||||
dict.Add("country_code", impressionData.country);
|
|
||||||
dict.Add("network_name", impressionData.adNetwork);
|
|
||||||
dict.Add("ad_unit_Id", impressionData.adUnit);
|
|
||||||
dict.Add("placement", impressionData.placement);
|
|
||||||
dict.Add("ad_format_name", impressionData.instanceName);
|
|
||||||
dict.Add("ad_format_id", impressionData.instanceId);
|
|
||||||
if (!string.IsNullOrEmpty(impressionData.segmentName))
|
|
||||||
{
|
|
||||||
dict.Add("segment_name", impressionData.segmentName);
|
|
||||||
}
|
|
||||||
if (!ReferenceEquals(impressionData.lifetimeRevenue, null))
|
|
||||||
{
|
|
||||||
dict.Add("lifetime_revenue", impressionData.lifetimeRevenue);
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(impressionData.encryptedCPM))
|
|
||||||
{
|
|
||||||
dict.Add("encrypted_cpm", impressionData.encryptedCPM);
|
|
||||||
}
|
|
||||||
dict.Add("currency", "USD");
|
|
||||||
dict.Add("precision", impressionData.precision);
|
|
||||||
var result = JsonConvert.SerializeObject(dict);
|
|
||||||
luaAdRevenuePaidEventCallback(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 88d315c7e2aba4d4d89a104b0c746e3f
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@ -65,19 +65,30 @@ namespace BF
|
|||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
// facebook
|
// facebook
|
||||||
BFLog.Log("FBSdk.Init");
|
if (BFPlatform.IsSupportFB())
|
||||||
FBSdk.Init();
|
{
|
||||||
FBSdk.SetULoginListener(this);
|
BFLog.Log("FBSdk.Init");
|
||||||
|
FBSdk.Init();
|
||||||
|
FBSdk.SetULoginListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
// appid 登陆
|
// appid 登陆
|
||||||
#if UNITY_IOS
|
#if UNITY_IOS
|
||||||
signInWithApple = gameObject.AddComponent<SignInWithApple>();
|
signInWithApple = gameObject.AddComponent<SignInWithApple>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (BFPlatform.IsSupportVK())
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.VKIDInit("52913931");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnApplicationPause(bool pauseStatus)
|
void OnApplicationPause(bool pauseStatus)
|
||||||
{
|
{
|
||||||
FBSdk.OnApplicationPause(pauseStatus);
|
if (BFPlatform.IsSupportFB())
|
||||||
|
{
|
||||||
|
FBSdk.OnApplicationPause(pauseStatus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
@ -152,6 +163,10 @@ namespace BF
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else if(type == LoginType.VKID)
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.VKIDLogin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -167,6 +182,10 @@ namespace BF
|
|||||||
{
|
{
|
||||||
BFMain.Instance.SDKMgr.BFNativeSDKMgr.GoogleLogout();
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.GoogleLogout();
|
||||||
}
|
}
|
||||||
|
else if(type == LoginType.VKID)
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.VKIDLogout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -266,6 +285,7 @@ namespace BF
|
|||||||
|
|
||||||
BFLog.Log(string.Format("json = {0}", json));
|
BFLog.Log(string.Format("json = {0}", json));
|
||||||
luaLoginCallback((int)result, json);
|
luaLoginCallback((int)result, json);
|
||||||
|
luaLoginCallback = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,5 +509,28 @@ namespace BF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
public void VKIDLoginComplete(bool succ, string msg)
|
||||||
|
{
|
||||||
|
if (succ)
|
||||||
|
{
|
||||||
|
LoginComplete(LoginType.VKID, ULoginResult.Success, msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LoginComplete(LoginType.VKID, ULoginResult.Failed, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void VKIDLogoutComplete(bool succ)
|
||||||
|
{
|
||||||
|
if(succ)
|
||||||
|
{
|
||||||
|
LogoutComplete(LoginType.VKID, ULoginResult.Success, "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogoutComplete(LoginType.VKID, ULoginResult.Failed, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,10 +41,55 @@ namespace BF
|
|||||||
public const int ADMOB_LOADED_FAILED = 21;
|
public const int ADMOB_LOADED_FAILED = 21;
|
||||||
public const int ADMOB_EARNED_REWARD = 22;
|
public const int ADMOB_EARNED_REWARD = 22;
|
||||||
public const int ADMOB_INITIALIZED = 23;
|
public const int ADMOB_INITIALIZED = 23;
|
||||||
|
|
||||||
|
public const int UMP_REQUEST_CONSENT_ERROR = 30;
|
||||||
|
public const int UMP_LOAD_AND_PRESENT_ERROR = 31;
|
||||||
|
public const int UMP_SUCCESS_CALLBACK = 32;
|
||||||
|
public const int UMP_PARALLEL_CALLBACK = 33;
|
||||||
|
|
||||||
|
// 俄罗斯支付
|
||||||
|
public const int RU_CHECK_VALID_SUCCESS = 40;
|
||||||
|
public const int RU_CHECK_VALID_FAILED = 41;
|
||||||
|
public const int RU_GET_PRODUCTS_SUCCESS = 42;
|
||||||
|
public const int RU_GET_PRODUCTS_FAILED = 43;
|
||||||
|
public const int RU_GET_PURCHASE_SUCCESS = 44;
|
||||||
|
public const int RU_GET_PURCHASE_FAILED = 45;
|
||||||
|
public const int RU_PURCHASE_SUCCESS = 46;
|
||||||
|
public const int RU_PURCHASE_FAILED = 47;
|
||||||
|
public const int RU_PURCHASE_CANCEL = 48;
|
||||||
|
public const int RU_CONSUME_SUCCESS = 49;
|
||||||
|
public const int RU_CONSUME_FAILED = 50;
|
||||||
|
// 俄罗斯商店好评
|
||||||
|
public const int RU_STORE_REVIEW_REQUEST_SUCCESS = 51;
|
||||||
|
public const int RU_STORE_REVIEW_REQUEST_FAILED = 52;
|
||||||
|
public const int RU_STORE_REVIEW_LAUNCH_SUCCESS = 53;
|
||||||
|
public const int RU_STORE_REVIEW_LAUNCH_FAILED = 54;
|
||||||
|
public const int RU_VKID_LOGIN_SUCCESS = 55;
|
||||||
|
public const int RU_VKID_LOGIN_FAILED = 56;
|
||||||
|
public const int RU_VKID_LOGOUT_SUCCESS = 57;
|
||||||
|
public const int RU_VKID_LOGOUT_FAILED = 58;
|
||||||
|
// 华为支付
|
||||||
|
public const int HW_CHECK_VALID_SUCCESS = 59;
|
||||||
|
public const int HW_CHECK_VALID_FAILED = 60;
|
||||||
|
public const int HW_GET_PRODUCTS_SUCCESS = 61;
|
||||||
|
public const int HW_GET_PRODUCTS_FAILED = 62;
|
||||||
|
public const int HW_GET_PURCHASE_SUCCESS = 63;
|
||||||
|
public const int HW_GET_PURCHASE_FAILED = 64;
|
||||||
|
public const int HW_PURCHASE_SUCCESS = 65;
|
||||||
|
public const int HW_PURCHASE_FAILED = 66;
|
||||||
|
public const int HW_PURCHASE_CANCEL = 67;
|
||||||
|
public const int HW_CONSUME_SUCCESS = 68;
|
||||||
|
public const int HW_CONSUME_FAILED = 69;
|
||||||
|
// 华为广告
|
||||||
|
public const int HW_SHOWED_FULLSCREEN = 70;
|
||||||
|
public const int HW_FAILEDTO_SHOW_FULLSCREEN = 71;
|
||||||
|
public const int HW_LOADED = 72;
|
||||||
|
public const int HW_LOADED_FAILED = 73;
|
||||||
|
public const int HW_EARNED_REWARD = 74;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BFNativeSDKManager : MonoBehaviour
|
public class BFNativeSDKManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
private static readonly AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.juzu.dz.third.GooglePlugin");
|
private static readonly AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.juzu.dz.third.GooglePlugin");
|
||||||
#endif
|
#endif
|
||||||
@ -57,7 +102,17 @@ namespace BF
|
|||||||
|
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
private static extern void FIRGetToken(IntPtr callback);
|
private static extern void FIRGetToken(IntPtr callback);
|
||||||
|
|
||||||
|
[DllImport ("__Internal")]
|
||||||
|
private static extern void _OpenURL(string url);
|
||||||
|
|
||||||
|
// [DllImport("__Internal")]
|
||||||
|
// private static extern void VKInit(string appId);
|
||||||
|
|
||||||
|
// [DllImport("__Internal")]
|
||||||
|
// private static extern void VKLogin();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class NativeResultMsg
|
public class NativeResultMsg
|
||||||
{
|
{
|
||||||
@ -86,26 +141,33 @@ namespace BF
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InitGDPR()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("initGDPR");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public void GooglePay(string payType, string productId, string customMsg)
|
public void GooglePay(string payType, string productId, string customMsg)
|
||||||
{
|
{
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
androidJavaClass.CallStatic("pay", payType, productId, customMsg);
|
androidJavaClass.CallStatic("pay", payType, productId, customMsg);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConsumePurchase(string token)
|
public void ConsumePurchase(string token)
|
||||||
{
|
{
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
androidJavaClass.CallStatic("consumeAsync", token);
|
androidJavaClass.CallStatic("consumeAsync", token);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoogleLogin()
|
public void GoogleLogin()
|
||||||
{
|
{
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
androidJavaClass.CallStatic("login");
|
androidJavaClass.CallStatic("login");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GoogleLogout()
|
public void GoogleLogout()
|
||||||
{
|
{
|
||||||
@ -214,13 +276,315 @@ namespace BF
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsPrivacyOptionsRequired()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
return androidJavaClass.CallStatic<bool>("isPrivacyOptionsRequired");
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowPrivacyOptionsForm()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("showPrivacyOptionsForm");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetGDPR()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("resetGDPR");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnUMPFinish(string stateStr)
|
||||||
|
{
|
||||||
|
int state = 0;
|
||||||
|
int.TryParse(stateStr, out state);
|
||||||
|
// 审核模式下,只有正常返回 触发ATT
|
||||||
|
if (BFMain.IsShenhe)
|
||||||
|
{
|
||||||
|
if (state == BFNativeSDKMessage.UMP_REQUEST_CONSENT_ERROR || state == BFNativeSDKMessage.UMP_LOAD_AND_PRESENT_ERROR || state == BFNativeSDKMessage.UMP_SUCCESS_CALLBACK)
|
||||||
|
{
|
||||||
|
BFMain.Instance.GameLaunchMgr.ShowIOSATTrack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BFMain.Instance.GameLaunchMgr.ShowIOSATTrack();
|
||||||
|
}
|
||||||
|
BFUMPManager.OnUMPFinish(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetAppSignMD5()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
return androidJavaClass.CallStatic<string>("getSign", "MD5");
|
||||||
|
#endif
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetAppSignSHA1()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
return androidJavaClass.CallStatic<string>("getSign", "SHA1");
|
||||||
|
#endif
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetAppSignSHA256()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
return androidJavaClass.CallStatic<string>("getSign", "SHA256");
|
||||||
|
#endif
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RequestStoreReview()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("requestStoreReview");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
UnityEngine.iOS.Device.RequestStoreReview();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 俄罗斯支付
|
||||||
|
public void RuInit()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("ruInit");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call RUInit");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RuCheckValid()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("ruCheckValid");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call RuCheckValid");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RuGetProducts(string productJson, Action<int, string> callback)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("ruGetProducts", productJson);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call RUGetProducts");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RuGetPurchase()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("ruGetPurchase");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call RUGetPurchase");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RuPurchase(string productId, string customMsg)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("ruPurchase", productId, customMsg);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call RUPurchase:" + productId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RuConsume(string purchaseId)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("ruConsume", purchaseId);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call RUConsume:" + purchaseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RuDelete(string purchaseId)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("ruDelete", purchaseId);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call RUDelete:" + purchaseId);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public bool IsAndroidPkgInstalled(string pkgName)
|
||||||
|
{
|
||||||
|
bool isInstalled = false;
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
isInstalled = androidJavaClass.CallStatic<bool>("checkInstalled", pkgName);
|
||||||
|
#endif
|
||||||
|
return isInstalled;
|
||||||
|
|
||||||
|
Debug.Log("C# call RUDelete:" + pkgName + " isInstalled:" + isInstalled);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 俄罗斯商店好评
|
||||||
|
public void RuRequestStoreReview()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("requestAndLaunchStoreReviewFlow");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call RuRequestStoreReview");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region vk登录登出
|
||||||
|
public void VKIDInit(string id)
|
||||||
|
{
|
||||||
|
if (BFPlatform.IsSupportVK())
|
||||||
|
{
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
// VKInit(id);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void VKIDLogout()
|
||||||
|
{
|
||||||
|
if (BFPlatform.IsSupportVK())
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("vkidLogout");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLogoutComplete(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void VKIDLogin()
|
||||||
|
{
|
||||||
|
if (BFPlatform.IsSupportVK())
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("vkidLogin");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
// VKLogin();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void IOSVKLoginCallBack(string code)
|
||||||
|
{
|
||||||
|
if (code.Equals("1"))
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLoginComplete(false, code);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLoginComplete(true, code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void PayDukPay(string url)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("payDukPay", url);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 华为支付
|
||||||
|
public void HWCheckValid()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("hwCheckValid");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call hwCheckValid");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HWGetProducts(string productJson, Action<int, string> callback)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("hwGetProducts", productJson);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call HWGetProducts");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HWGetPurchase()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("hwGetPurchase");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call HWGetPurchase");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HWPurchase(string productId, string customMsg)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("hwPurchase", productId, customMsg);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call HWPurchase:" + productId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HWConsume(string productJson)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("hwConsume", productJson);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Debug.Log("C# call HWConsume:" + productJson);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 华为广告
|
||||||
|
public void InitHWAdRewardedVideo()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("initHWAdRewardedVideo");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowHWFullScreenAds()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("showHWFullScreenAds");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TryLoadHWRewardedAd()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
androidJavaClass.CallStatic("tryLoadHWRewardedAd");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OpenUrl(string url)
|
||||||
|
{
|
||||||
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
_OpenURL(url);
|
||||||
|
#else
|
||||||
|
Application.OpenURL(url);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
public void MsgFromAndroidOrIOS(string content)
|
public void MsgFromAndroidOrIOS(string content)
|
||||||
{
|
{
|
||||||
var msgResult = JsonUtility.FromJson<NativeResultMsg>(content);
|
var msgResult = JsonUtility.FromJson<NativeResultMsg>(content);
|
||||||
BFLog.Log(msgResult.body);
|
BFLog.Log(msgResult.body);
|
||||||
int head = msgResult.head;
|
int head = msgResult.head;
|
||||||
switch (head){
|
switch (head)
|
||||||
case BFNativeSDKMessage.GOOGLE_LOGIN_SUCCESS:
|
{
|
||||||
|
case BFNativeSDKMessage.GOOGLE_LOGIN_SUCCESS:
|
||||||
BFMain.Instance.SDKMgr.BFLoginSDKMgr.GoogleLoginComplete(true, msgResult.body);
|
BFMain.Instance.SDKMgr.BFLoginSDKMgr.GoogleLoginComplete(true, msgResult.body);
|
||||||
break;
|
break;
|
||||||
case BFNativeSDKMessage.GOOGLE_LOGIN_FAILED:
|
case BFNativeSDKMessage.GOOGLE_LOGIN_FAILED:
|
||||||
@ -289,9 +653,140 @@ namespace BF
|
|||||||
case BFNativeSDKMessage.ADMOB_INITIALIZED:
|
case BFNativeSDKMessage.ADMOB_INITIALIZED:
|
||||||
// BFMain.Instance.SDKMgr.BFAdmobSDKMgr.AdInitialized = true;
|
// BFMain.Instance.SDKMgr.BFAdmobSDKMgr.AdInitialized = true;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
// 俄罗斯支付
|
||||||
}
|
case BFNativeSDKMessage.RU_CHECK_VALID_SUCCESS:
|
||||||
}
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.CheckStoreValidComplete(true);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_CHECK_VALID_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.CheckStoreValidComplete(false);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_GET_PRODUCTS_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.QueryProductComplete(true, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_GET_PRODUCTS_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.QueryProductComplete(false, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_GET_PURCHASE_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.QueryUncompleteOrderFinish(msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_GET_PURCHASE_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.QueryUncompleteOrderFinish(msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_PURCHASE_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.PayComplete(0, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_PURCHASE_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.PayComplete(1, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_PURCHASE_CANCEL:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.PayComplete(2, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_CONSUME_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.ConsumeComplete(0);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_CONSUME_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFRuPaySDKMgr.ConsumeComplete(1);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_STORE_REVIEW_REQUEST_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_STORE_REVIEW_REQUEST_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_STORE_REVIEW_LAUNCH_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_STORE_REVIEW_LAUNCH_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_VKID_LOGIN_SUCCESS:
|
||||||
|
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLoginComplete(true, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_VKID_LOGIN_FAILED:
|
||||||
|
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLoginComplete(false, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_VKID_LOGOUT_SUCCESS:
|
||||||
|
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLogoutComplete(true);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.RU_VKID_LOGOUT_FAILED:
|
||||||
|
BFMain.Instance.SDKMgr.BFLoginSDKMgr.VKIDLogoutComplete(false);
|
||||||
|
break;
|
||||||
|
// 华为支付
|
||||||
|
case BFNativeSDKMessage.HW_CHECK_VALID_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.CheckStoreValidComplete(true);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_CHECK_VALID_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.CheckStoreValidComplete(false);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_GET_PRODUCTS_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.QueryProductComplete(true, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_GET_PRODUCTS_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.QueryProductComplete(false, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_GET_PURCHASE_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.QueryUncompleteOrderFinish(msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_GET_PURCHASE_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.QueryUncompleteOrderFinish(msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_PURCHASE_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.PayComplete(0, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_PURCHASE_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.PayComplete(1, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_PURCHASE_CANCEL:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.PayComplete(2, msgResult.body);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_CONSUME_SUCCESS:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.ConsumeComplete(0);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_CONSUME_FAILED:
|
||||||
|
// Debug.Log(msgResult.body);
|
||||||
|
BFMain.Instance.SDKMgr.BFHWPaySDKMgr.ConsumeComplete(1);
|
||||||
|
break;
|
||||||
|
// 华为广告
|
||||||
|
case BFNativeSDKMessage.HW_SHOWED_FULLSCREEN:
|
||||||
|
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.ShowFullScreenAdFinish(0);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_FAILEDTO_SHOW_FULLSCREEN:
|
||||||
|
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.ShowFullScreenAdFinish(1);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_LOADED:
|
||||||
|
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.AdLoadedFinish(0);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_LOADED_FAILED:
|
||||||
|
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.AdLoadedFinish(1);
|
||||||
|
break;
|
||||||
|
case BFNativeSDKMessage.HW_EARNED_REWARD:
|
||||||
|
// BFMain.Instance.SDKMgr.BFHWAdSDKMgr.EarnedRewardFinish(0, msgResult.body);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -20,6 +20,12 @@ namespace BF
|
|||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
// 俄罗斯渠道不使用google
|
||||||
|
if (BFPlatform.IsSupportRuPay())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
121
Assets/Scripts/Common/SDK/BFRuPaySDKManager.cs
Normal file
121
Assets/Scripts/Common/SDK/BFRuPaySDKManager.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class BFRuPaySDKManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Action<int, string> luaPayCallback;
|
||||||
|
public Action<int, string> luaQueryProductCallback;
|
||||||
|
public Action<int, string> luaQueryUncompleteOrderCallback;
|
||||||
|
public Action<int> luaConsumeCallback;
|
||||||
|
public bool StoreValid { get; private set; }
|
||||||
|
private string ProductJson;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
// 俄罗斯渠道专用支付
|
||||||
|
if (!BFPlatform.IsSupportRuPay())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 临时屏蔽俄罗斯支付
|
||||||
|
if (BFPlatform.Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Init();
|
||||||
|
CheckStoreValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测支付可用性
|
||||||
|
public void CheckStoreValid()
|
||||||
|
{
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuCheckValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckStoreValidComplete(bool success)
|
||||||
|
{
|
||||||
|
StoreValid = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 请求全部商品信息
|
||||||
|
public void QueryProductInfo(string productJson, Action<int, string> callback)
|
||||||
|
{
|
||||||
|
luaQueryProductCallback = callback;
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuGetProducts(productJson, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void QueryProductComplete(bool succ, string result)
|
||||||
|
{
|
||||||
|
int code = succ?0:1;
|
||||||
|
if(luaQueryProductCallback != null)
|
||||||
|
{
|
||||||
|
Action<int, string> tempLuaQueryProductCallback = luaQueryProductCallback;
|
||||||
|
luaQueryProductCallback = null;
|
||||||
|
tempLuaQueryProductCallback(code, result);
|
||||||
|
ProductJson = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付
|
||||||
|
public void Pay(string payType, string productId, string customMsg, Action<int, string> callback)
|
||||||
|
{
|
||||||
|
luaPayCallback = callback;
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuPurchase(productId, customMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PayComplete(int code, string result)
|
||||||
|
{
|
||||||
|
// 优先当前支付的回调
|
||||||
|
if(luaPayCallback != null)
|
||||||
|
{
|
||||||
|
luaPayCallback(code, result);
|
||||||
|
luaPayCallback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 消耗
|
||||||
|
public void ConsumePurchase(string token, Action<int> callback)
|
||||||
|
{
|
||||||
|
luaConsumeCallback = callback;
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuConsume(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConsumeComplete(int code)
|
||||||
|
{
|
||||||
|
if (luaConsumeCallback != null)
|
||||||
|
{
|
||||||
|
luaConsumeCallback(code);
|
||||||
|
luaConsumeCallback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询未完成订单
|
||||||
|
public void QueryUncompleteOrder(Action<int, string> callback)
|
||||||
|
{
|
||||||
|
luaQueryUncompleteOrderCallback = callback;
|
||||||
|
BFMain.Instance.SDKMgr.BFNativeSDKMgr.RuGetPurchase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void QueryUncompleteOrderFinish(string result)
|
||||||
|
{
|
||||||
|
if(luaQueryUncompleteOrderCallback != null)
|
||||||
|
{
|
||||||
|
Action<int, string> tempLuaQueryUncompleteOrderCallback = luaQueryUncompleteOrderCallback;
|
||||||
|
luaQueryUncompleteOrderCallback = null;
|
||||||
|
tempLuaQueryUncompleteOrderCallback(0, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Common/SDK/BFRuPaySDKManager.cs.meta
Normal file
11
Assets/Scripts/Common/SDK/BFRuPaySDKManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a060c3107f223a84ba065e7134d0aff8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -2,7 +2,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using BF.NativeCore.ThirdPlatform;
|
using BF.NativeCore.ThirdPlatform;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using com.adjust.sdk;
|
|
||||||
using AppsFlyerSDK;
|
using AppsFlyerSDK;
|
||||||
|
|
||||||
namespace BF
|
namespace BF
|
||||||
@ -11,8 +10,6 @@ namespace BF
|
|||||||
{
|
{
|
||||||
private ThinkingAnalyticsSdk TASdk = new ThinkingAnalyticsSdk();
|
private ThinkingAnalyticsSdk TASdk = new ThinkingAnalyticsSdk();
|
||||||
private AppsFlyerSdk AFSdk = new AppsFlyerSdk();
|
private AppsFlyerSdk AFSdk = new AppsFlyerSdk();
|
||||||
private bool isInitAFAdRevenue = false;
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
@ -32,14 +29,9 @@ namespace BF
|
|||||||
AFSdk.SetTaAccountId(id);
|
AFSdk.SetTaAccountId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitAppsFlyerAdRevenue()
|
public void CalibrateTime(long timestamp)
|
||||||
{
|
{
|
||||||
if (isInitAFAdRevenue)
|
TASdk.CalibrateTime(timestamp);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
isInitAFAdRevenue = true;
|
|
||||||
AppsFlyerAdRevenue.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除账户id
|
// 清除账户id
|
||||||
@ -48,6 +40,41 @@ namespace BF
|
|||||||
TASdk.ClearAccountId();
|
TASdk.ClearAccountId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetAFConversionData()
|
||||||
|
{
|
||||||
|
return AppsFlyerObjectScript.AFConversionData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsGetConversionDataOver()
|
||||||
|
{
|
||||||
|
return AppsFlyerObjectScript.IsGetConversionDataOver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetAFAttributionData()
|
||||||
|
{
|
||||||
|
return AppsFlyerObjectScript.AFAttributionData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsGetAppOpenAttributionOver()
|
||||||
|
{
|
||||||
|
return AppsFlyerObjectScript.IsGetAppOpenAttributionOver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsGetAFOnRequestResponse()
|
||||||
|
{
|
||||||
|
return AppsFlyerObjectScript.IsGetAFOnRequestResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetAFOnRequestResponseStatusCode()
|
||||||
|
{
|
||||||
|
return AppsFlyerObjectScript.AFOnRequestResponseStatusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetAFOnRequestResponseErrorDescription()
|
||||||
|
{
|
||||||
|
return AppsFlyerObjectScript.AFOnRequestResponseErrorDescription;
|
||||||
|
}
|
||||||
|
|
||||||
// 数数科技上报
|
// 数数科技上报
|
||||||
// lua端使用
|
// lua端使用
|
||||||
public void PostThinkingAnalyticsEvent(string eventName, string data = "")
|
public void PostThinkingAnalyticsEvent(string eventName, string data = "")
|
||||||
@ -102,66 +129,12 @@ namespace BF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置账户id
|
|
||||||
public void PostAdjustSimpleTrackEvent(string key)
|
|
||||||
{
|
|
||||||
AdjustEvent adjustEvent = new AdjustEvent(key);
|
|
||||||
// BFLog.Log("PostAdjustSimpleTrackEvent");
|
|
||||||
Adjust.trackEvent(adjustEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PostAdjustRevenueTrackEvent(string key, double currency, string currencyCode)
|
|
||||||
{
|
|
||||||
AdjustEvent adjustEvent = new AdjustEvent(key);
|
|
||||||
adjustEvent.setRevenue(currency, currencyCode);
|
|
||||||
// BFLog.Log("PostAdjustRevenueTrackEvent");
|
|
||||||
Adjust.trackEvent(adjustEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PostAdjustCallbackTrackEvent(string key, string data = "")
|
|
||||||
{
|
|
||||||
var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
|
||||||
AdjustEvent adjustEvent = new AdjustEvent(key);
|
|
||||||
foreach (var item in properties)
|
|
||||||
{
|
|
||||||
adjustEvent.addCallbackParameter(item.Key, item.Value);
|
|
||||||
}
|
|
||||||
// BFLog.Log("PostAdjustCallbackTrackEvent");
|
|
||||||
Adjust.trackEvent(adjustEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PostAdjustPartnerTrackEvent(string key, string data = "")
|
|
||||||
{
|
|
||||||
var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
|
||||||
AdjustEvent adjustEvent = new AdjustEvent(key);
|
|
||||||
foreach (var item in properties)
|
|
||||||
{
|
|
||||||
adjustEvent.addPartnerParameter(item.Key, item.Value);
|
|
||||||
}
|
|
||||||
// BFLog.Log("PostAdjustPartnerTrackEvent");
|
|
||||||
Adjust.trackEvent(adjustEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PostAdjustAdRevenueAppLovinMAX(double revenue, string networkName, string adUnitIdentifier, string placement)
|
|
||||||
{
|
|
||||||
var adRevenue = new AdjustAdRevenue(AdjustConfig.AdjustAdRevenueSourceAppLovinMAX);
|
|
||||||
adRevenue.setRevenue(revenue, "USD");
|
|
||||||
adRevenue.setAdRevenueNetwork(networkName);
|
|
||||||
adRevenue.setAdRevenueUnit(adUnitIdentifier);
|
|
||||||
adRevenue.setAdRevenuePlacement(placement);
|
|
||||||
Adjust.trackAdRevenue(adRevenue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AdjustSetDeviceToken(string token)
|
|
||||||
{
|
|
||||||
Adjust.setDeviceToken(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LogAppsFlyerAdRevenue(int mediationNetwork, string monetizationNetwork, double eventRevenue, string data)
|
public void LogAppsFlyerAdRevenue(int mediationNetwork, string monetizationNetwork, double eventRevenue, string data)
|
||||||
{
|
{
|
||||||
var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
var properties = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
||||||
var mediationNetworkType = (AppsFlyerAdRevenueMediationNetworkType)mediationNetwork;
|
var mediationNetworkType = (AppsFlyerSDK.MediationNetwork)mediationNetwork;
|
||||||
AppsFlyerAdRevenue.logAdRevenue(monetizationNetwork, mediationNetworkType, eventRevenue, "USD", properties);
|
var adRevenueData = new AFAdRevenueData(monetizationNetwork, mediationNetworkType, "USD", eventRevenue);
|
||||||
|
AFSdk.LogAdRevenue(adRevenueData, properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
83
Assets/Scripts/Common/SDK/BFUMPManager.cs
Normal file
83
Assets/Scripts/Common/SDK/BFUMPManager.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class BFUMPManager
|
||||||
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
|
#region GDPR
|
||||||
|
[DllImport("__Internal")]
|
||||||
|
private static extern void _MaxInitGDPR();
|
||||||
|
|
||||||
|
public static void InitGDPR()
|
||||||
|
{
|
||||||
|
_MaxInitGDPR();
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("__Internal")]
|
||||||
|
private static extern bool _MaxCheckIsGDPR();
|
||||||
|
|
||||||
|
public static bool IsPrivacyOptionsRequired()
|
||||||
|
{
|
||||||
|
return _MaxCheckIsGDPR();
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("__Internal")]
|
||||||
|
private static extern void _MaxShowGDRP();
|
||||||
|
|
||||||
|
public static void ShowPrivacyOptionsForm()
|
||||||
|
{
|
||||||
|
_MaxShowGDRP();
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("__Internal")]
|
||||||
|
private static extern bool _MaxCheckCanRequestAds();
|
||||||
|
|
||||||
|
public static bool CheckCanRequestAds()
|
||||||
|
{
|
||||||
|
return _MaxCheckCanRequestAds();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endif
|
||||||
|
public static Action luaCallback;
|
||||||
|
public static bool IsUMPFinish = false;
|
||||||
|
public static int UMPState = 0;
|
||||||
|
public static void OnUMPFinish(int state)
|
||||||
|
{
|
||||||
|
UMPState = state;
|
||||||
|
// 审核模式下,只有正常返回,lua 回调
|
||||||
|
if (BFMain.IsShenhe)
|
||||||
|
{
|
||||||
|
if (state == BFNativeSDKMessage.UMP_REQUEST_CONSENT_ERROR || state == BFNativeSDKMessage.UMP_LOAD_AND_PRESENT_ERROR || state == BFNativeSDKMessage.UMP_SUCCESS_CALLBACK)
|
||||||
|
{
|
||||||
|
IsUMPFinish = true;
|
||||||
|
if (luaCallback != null)
|
||||||
|
{
|
||||||
|
luaCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsUMPFinish = true;
|
||||||
|
if (luaCallback != null)
|
||||||
|
{
|
||||||
|
luaCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddLuaCallback(Action callback)
|
||||||
|
{
|
||||||
|
luaCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveLuaCallback()
|
||||||
|
{
|
||||||
|
luaCallback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Common/SDK/BFUMPManager.cs.meta
Normal file
11
Assets/Scripts/Common/SDK/BFUMPManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dcd13bfb23f7be948a1b084f3581e493
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: ced1766fcb78b314db1ae240a0e27a9f
|
guid: 69c854ae7d148be429e876656d170acd
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@ -99,6 +99,7 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
|||||||
IAPDebug($"ID:{productId}.Not found or is not available for purchase");
|
IAPDebug($"ID:{productId}.Not found or is not available for purchase");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_storeC.InitiatePurchase(productId, payload);
|
_storeC.InitiatePurchase(productId, payload);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -117,17 +118,17 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
|||||||
|
|
||||||
//购买成功
|
//购买成功
|
||||||
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e) {
|
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e) {
|
||||||
#if UNITY_EDITOR
|
// #if UNITY_EDITOR
|
||||||
bool isValid = true;
|
// bool isValid = true;
|
||||||
#else
|
// #else
|
||||||
_localChecking (e.purchasedProduct, out bool isValid);
|
// _localChecking (e.purchasedProduct, out bool isValid);
|
||||||
#endif
|
// #endif
|
||||||
if (!isValid) buyCallback?.Invoke(false, e.purchasedProduct, "本地验证失败");
|
// if (!isValid) buyCallback?.Invoke(false, e.purchasedProduct, "本地验证失败");
|
||||||
else {
|
// else {
|
||||||
_appsFlyerChecking(e.purchasedProduct);
|
// _appsFlyerChecking(e.purchasedProduct);
|
||||||
IAPDebug($"ID:{e.purchasedProduct.definition.id}. purchase success");
|
IAPDebug($"ID:{e.purchasedProduct.definition.id}. purchase success");
|
||||||
buyCallback?.Invoke(true, e.purchasedProduct, string.Empty);
|
buyCallback?.Invoke(true, e.purchasedProduct, string.Empty);
|
||||||
}
|
// }
|
||||||
return PurchaseProcessingResult.Pending;
|
return PurchaseProcessingResult.Pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +207,7 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
|||||||
private void _appsFlyerChecking(Product product) {
|
private void _appsFlyerChecking(Product product) {
|
||||||
|
|
||||||
IAPDebug($"CURRENCY:{product.metadata.isoCurrencyCode} REVENUE:{product.metadata.localizedPrice.ToString()} CONTENT_TYPE:{product.transactionID} CONTENT_ID:{product.definition.id}");
|
IAPDebug($"CURRENCY:{product.metadata.isoCurrencyCode} REVENUE:{product.metadata.localizedPrice.ToString()} CONTENT_TYPE:{product.transactionID} CONTENT_ID:{product.definition.id}");
|
||||||
|
|
||||||
// Dictionary<string, string> da = new Dictionary<string, string> {
|
// Dictionary<string, string> da = new Dictionary<string, string> {
|
||||||
// { AFInAppEventParameterName.CURRENCY, product.metadata.isoCurrencyCode },
|
// { AFInAppEventParameterName.CURRENCY, product.metadata.isoCurrencyCode },
|
||||||
// { AFInAppEventParameterName.REVENUE, product.metadata.localizedPrice.ToString() },
|
// { AFInAppEventParameterName.REVENUE, product.metadata.localizedPrice.ToString() },
|
||||||
@ -218,6 +220,7 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
|||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region ================================================== 订阅 ==================================================
|
#region ================================================== 订阅 ==================================================
|
||||||
|
|
||||||
@ -321,6 +324,20 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
|||||||
// return "";
|
// return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//IOS专用 传入uuid类型的透传参数 用于校验订单
|
||||||
|
public void SetApplicationUsername(string applicationUsername)
|
||||||
|
{
|
||||||
|
#if UNITY_IOS
|
||||||
|
if (!IsInitialized()) {
|
||||||
|
IAPDebug("SetApplicationUsername FAIL. Not init.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IAppleExtensions apple = _storeE.GetExtension<IAppleExtensions>();
|
||||||
|
apple.SetApplicationUsername(applicationUsername);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#region ================================================== 原价 ==================================================
|
#region ================================================== 原价 ==================================================
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -379,6 +396,29 @@ public class IAPManager : /* MonoBehaviour, */ IDetailedStoreListener {
|
|||||||
return product.metadata.localizedPriceString;
|
return product.metadata.localizedPriceString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetLocalizedIsoCurrencyCode(string productId)
|
||||||
|
{
|
||||||
|
if (!IsInitialized()) {
|
||||||
|
IAPDebug($"ID:{productId}. Not init.");
|
||||||
|
return "USD";
|
||||||
|
};
|
||||||
|
Product product = _storeC.products.WithID (productId);
|
||||||
|
return product.metadata.isoCurrencyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double GetLocalizedPriceAmount(string productId)
|
||||||
|
{
|
||||||
|
if (!IsInitialized())
|
||||||
|
{
|
||||||
|
IAPDebug($"ID:{productId}. Not init.");
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
Product product = _storeC.products.WithID(productId);
|
||||||
|
double price = Decimal.ToDouble(product.metadata.localizedPrice);
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
private void IAPDebug(string mes) {
|
private void IAPDebug(string mes) {
|
||||||
UnityEngine.Debug.Log($"IAPManager {mes}");
|
UnityEngine.Debug.Log($"IAPManager {mes}");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
#if UNITY_IOS && !UNITY_EDITOR
|
#if UNITY_IOS && !UNITY_EDITOR
|
||||||
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -106,9 +107,15 @@ namespace BF
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport("__Internal")]
|
||||||
|
private static extern IntPtr GetAllPossibleTimeZoneIdentifiers();
|
||||||
|
|
||||||
public static string GetTimeZone()
|
public static string GetTimeZone()
|
||||||
{
|
{
|
||||||
return "Asia/Shanghai";
|
// return "Asia/Shanghai";
|
||||||
|
IntPtr ptr = GetAllPossibleTimeZoneIdentifiers();
|
||||||
|
string msg = Marshal.PtrToStringUTF8(ptr);
|
||||||
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("__Internal")]
|
[DllImport("__Internal")]
|
||||||
|
|||||||
@ -21,6 +21,11 @@ namespace BF.NativeCore.ThirdPlatform
|
|||||||
AppsFlyer.sendEvent(eventName, properties);
|
AppsFlyer.sendEvent(eventName, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LogAdRevenue(AFAdRevenueData adRevenueData, Dictionary<string, string> additionalParameters)
|
||||||
|
{
|
||||||
|
AppsFlyer.logAdRevenue(adRevenueData, additionalParameters);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTaAccountId(string accountId)
|
public void SetTaAccountId(string accountId)
|
||||||
{
|
{
|
||||||
var customData = new Dictionary<string, string>();
|
var customData = new Dictionary<string, string>();
|
||||||
|
|||||||
@ -45,5 +45,10 @@ namespace BF.NativeCore.ThirdPlatform
|
|||||||
{
|
{
|
||||||
return ThinkingAnalyticsAPI.GetDistinctId();
|
return ThinkingAnalyticsAPI.GetDistinctId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CalibrateTime(long timestamp)
|
||||||
|
{
|
||||||
|
ThinkingAnalyticsAPI.CalibrateTime(timestamp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,5 +11,6 @@ namespace BF.NativeCore
|
|||||||
// QQ,
|
// QQ,
|
||||||
// WeChat,
|
// WeChat,
|
||||||
Apple,
|
Apple,
|
||||||
|
VKID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
168
Assets/Scripts/Common/SDK/NotificationSDKManager.cs
Normal file
168
Assets/Scripts/Common/SDK/NotificationSDKManager.cs
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
using Unity.Notifications.Android;
|
||||||
|
#elif UNITY_IOS
|
||||||
|
using Unity.Notifications.iOS;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class NotificationInfo
|
||||||
|
{
|
||||||
|
public string title;
|
||||||
|
public string text;
|
||||||
|
public int day;
|
||||||
|
public int hour;
|
||||||
|
public int minute;
|
||||||
|
public int second;
|
||||||
|
public bool repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NotificationSDKManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
private int NotificationId = 1;
|
||||||
|
private string NotificationTitle = "Daily surprise";
|
||||||
|
private string NotificationContent = "Let your fingers dance with the music";
|
||||||
|
private bool isOpenAppFromNotification = false;
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
// 检查一下app是从推送点开还是正常打开的
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
var notificationIntentData = AndroidNotificationCenter.GetLastNotificationIntent();
|
||||||
|
if (notificationIntentData != null)
|
||||||
|
{
|
||||||
|
isOpenAppFromNotification = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOpenAppFromNotification = false;
|
||||||
|
}
|
||||||
|
#elif UNITY_IOS
|
||||||
|
var notification = iOSNotificationCenter.GetLastRespondedNotification();
|
||||||
|
if (notification != null)
|
||||||
|
{
|
||||||
|
isOpenAppFromNotification = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOpenAppFromNotification = false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
isOpenAppFromNotification = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitPuchContent(string title, string content)
|
||||||
|
{
|
||||||
|
NotificationTitle = title;
|
||||||
|
NotificationContent = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置推送
|
||||||
|
public void ResetNotificationChannel()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
NotificationId = 1;
|
||||||
|
AndroidNotificationCenter.CancelAllNotifications();//清除上次注册的通知
|
||||||
|
var channel = new AndroidNotificationChannel()
|
||||||
|
{
|
||||||
|
Id = "channel_id",
|
||||||
|
Name = "Default Channel",
|
||||||
|
Importance = Importance.High,
|
||||||
|
Description = "Generic notifications",
|
||||||
|
CanShowBadge = false,
|
||||||
|
EnableLights = true,
|
||||||
|
LockScreenVisibility = LockScreenVisibility.Public
|
||||||
|
};
|
||||||
|
|
||||||
|
AndroidNotificationCenter.RegisterNotificationChannel(channel);
|
||||||
|
#elif UNITY_IOS
|
||||||
|
NotificationId = 1;
|
||||||
|
iOSNotificationCenter.ApplicationBadge = 0;
|
||||||
|
iOSNotificationCenter.RemoveAllDeliveredNotifications();
|
||||||
|
iOSNotificationCenter.RemoveAllScheduledNotifications();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注册通知
|
||||||
|
/// </summary>
|
||||||
|
public void RegisterAndSendNotification(string title, string text, int day, int hour, int minute, int second, bool repeat)
|
||||||
|
{
|
||||||
|
var notificationInfo = new NotificationInfo()
|
||||||
|
{
|
||||||
|
title = title,
|
||||||
|
text = text,
|
||||||
|
day = day,
|
||||||
|
hour = hour,
|
||||||
|
minute = minute,
|
||||||
|
second = second,
|
||||||
|
repeat = repeat
|
||||||
|
};
|
||||||
|
SendNotification(notificationInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SendNotification(NotificationInfo notificationInfo)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID
|
||||||
|
var time = GetNotificationTime(notificationInfo);
|
||||||
|
var notification = new AndroidNotification()
|
||||||
|
{
|
||||||
|
Title = notificationInfo.title,
|
||||||
|
Text = notificationInfo.text,
|
||||||
|
FireTime = time,
|
||||||
|
};
|
||||||
|
AndroidNotificationCenter.SendNotification(notification, "channel_id");
|
||||||
|
#elif UNITY_IOS
|
||||||
|
var time = GetNotificationTime(notificationInfo);
|
||||||
|
var daySpan = new TimeSpan(notificationInfo.day, notificationInfo.hour, notificationInfo.minute, notificationInfo.second);
|
||||||
|
var timeTrigger = new iOSNotificationTimeIntervalTrigger()
|
||||||
|
{
|
||||||
|
TimeInterval = daySpan,
|
||||||
|
Repeats = notificationInfo.repeat
|
||||||
|
};
|
||||||
|
|
||||||
|
var notification = new iOSNotification()
|
||||||
|
{
|
||||||
|
Identifier = "_notification_"+ NotificationId,
|
||||||
|
Title = notificationInfo.title,
|
||||||
|
Body = notificationInfo.text,
|
||||||
|
Badge = 0,
|
||||||
|
ShowInForeground = true,
|
||||||
|
ForegroundPresentationOption = (PresentationOption.Alert | PresentationOption.Sound),
|
||||||
|
CategoryIdentifier = "category_a",
|
||||||
|
ThreadIdentifier = "thread1",
|
||||||
|
Trigger = timeTrigger,
|
||||||
|
};
|
||||||
|
NotificationId++;
|
||||||
|
iOSNotificationCenter.ScheduleNotification(notification);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 得到注册通知的时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime GetNotificationTime(NotificationInfo notificationInfo)
|
||||||
|
{
|
||||||
|
var daySpan = new TimeSpan(notificationInfo.day, notificationInfo.hour, notificationInfo.minute, notificationInfo.second);
|
||||||
|
var dateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
|
||||||
|
dateTime += daySpan;
|
||||||
|
// Debug.Log("GetNotificationTime 发出通知时间 : " + dateTime);
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetIsOpenAppFromNotification()
|
||||||
|
{
|
||||||
|
return isOpenAppFromNotification;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Common/SDK/NotificationSDKManager.cs.meta
Normal file
11
Assets/Scripts/Common/SDK/NotificationSDKManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7fc2af03d1d06764db81724e32bcb026
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -33,22 +33,24 @@ namespace BF
|
|||||||
HttpManager.Instance.SetServerUrl("http://game.juzugame.com:1337/parse/");
|
HttpManager.Instance.SetServerUrl("http://game.juzugame.com:1337/parse/");
|
||||||
HttpManager.Instance.SetParseRevocableSession("1");
|
HttpManager.Instance.SetParseRevocableSession("1");
|
||||||
HttpManager.Instance.SetParseApplicationId("1");
|
HttpManager.Instance.SetParseApplicationId("1");
|
||||||
HttpManager.Instance.SetParseClientKey("1kYT4UrExyQ0gaFh");
|
HttpManager.Instance.SetParseClientKey("iQ8NRClxjSAVOc4p");
|
||||||
#else
|
#else
|
||||||
// HttpManager.Instance.SetServerUrl("http://34.233.204.253:1337/parse/");
|
HttpManager.Instance.SetServerUrl("https://b9.bigfoot-studio.link/parse/");
|
||||||
// HttpManager.Instance.SetParseRevocableSession("1");
|
|
||||||
// HttpManager.Instance.SetParseApplicationId("1");
|
|
||||||
// HttpManager.Instance.SetParseClientKey("1kYT4UrExyQ0gaFh");
|
|
||||||
HttpManager.Instance.SetServerUrl("https://b2.bigfoot-studio.link/parse/");
|
|
||||||
HttpManager.Instance.SetParseRevocableSession("1");
|
HttpManager.Instance.SetParseRevocableSession("1");
|
||||||
HttpManager.Instance.SetParseApplicationId("101");
|
HttpManager.Instance.SetParseApplicationId("1");
|
||||||
HttpManager.Instance.SetParseClientKey("Xxl3j5TBIn4ArY1m");
|
HttpManager.Instance.SetParseClientKey("iQ8NRClxjSAVOc4p");
|
||||||
|
// HttpManager.Instance.SetServerUrl("https://b9.bigfoot-studio.link/parse/");
|
||||||
|
// HttpManager.Instance.SetParseRevocableSession("1");
|
||||||
|
// HttpManager.Instance.SetParseApplicationId("101");
|
||||||
|
// HttpManager.Instance.SetParseClientKey("Xxl3j5TBIn4ArY1m");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetServerUrl(string url, string psarseRevocableSession = "1", string parseApplicationId = "1", string parseClientKey = "1kYT4UrExyQ0gaFh")
|
public void SetServerUrl(string url, string parseClientPlatform, string parseClientVersion, string psarseRevocableSession = "1", string parseApplicationId = "1", string parseClientKey = "iQ8NRClxjSAVOc4p")
|
||||||
{
|
{
|
||||||
HttpManager.Instance.SetServerUrl(url);
|
HttpManager.Instance.SetServerUrl(url);
|
||||||
|
HttpManager.Instance.SetParseClientPlatform(parseClientPlatform);
|
||||||
|
HttpManager.Instance.SetParseClientVersion(parseClientVersion);
|
||||||
HttpManager.Instance.SetParseRevocableSession(psarseRevocableSession);
|
HttpManager.Instance.SetParseRevocableSession(psarseRevocableSession);
|
||||||
HttpManager.Instance.SetParseApplicationId(parseApplicationId);
|
HttpManager.Instance.SetParseApplicationId(parseApplicationId);
|
||||||
HttpManager.Instance.SetParseClientKey(parseClientKey);
|
HttpManager.Instance.SetParseClientKey(parseClientKey);
|
||||||
|
|||||||
@ -33,6 +33,8 @@ namespace Http
|
|||||||
internal string _parseRevocableSession = string.Empty;
|
internal string _parseRevocableSession = string.Empty;
|
||||||
private string _parseApplicationId = string.Empty;
|
private string _parseApplicationId = string.Empty;
|
||||||
private string _parseClientKey = string.Empty;
|
private string _parseClientKey = string.Empty;
|
||||||
|
private string _parseClientPlatform = string.Empty;
|
||||||
|
private string _parseClientVersion = string.Empty;
|
||||||
|
|
||||||
#region set get
|
#region set get
|
||||||
|
|
||||||
@ -41,6 +43,8 @@ namespace Http
|
|||||||
public void SetParseRevocableSession(string key) => _parseRevocableSession = key;
|
public void SetParseRevocableSession(string key) => _parseRevocableSession = key;
|
||||||
public void SetParseApplicationId(string appId) => _parseApplicationId = appId;
|
public void SetParseApplicationId(string appId) => _parseApplicationId = appId;
|
||||||
public void SetParseClientKey(string key) => _parseClientKey = key;
|
public void SetParseClientKey(string key) => _parseClientKey = key;
|
||||||
|
public void SetParseClientPlatform(string key) => _parseClientPlatform = key;
|
||||||
|
public void SetParseClientVersion(string key) => _parseClientVersion = key;
|
||||||
|
|
||||||
public SingleHttp Get(string id) => !_requests.TryGetValue(id, out var httpInfo) ? null : httpInfo.Http;
|
public SingleHttp Get(string id) => !_requests.TryGetValue(id, out var httpInfo) ? null : httpInfo.Http;
|
||||||
|
|
||||||
@ -57,8 +61,10 @@ namespace Http
|
|||||||
Complete = complete,
|
Complete = complete,
|
||||||
});
|
});
|
||||||
|
|
||||||
http.AddHeader("X-Parse-Application-Id", _parseApplicationId)
|
http.AddHeader("X-Parse-Application-id", _parseApplicationId)
|
||||||
.AddHeader("X-Parse-Client-Key", _parseClientKey);
|
.AddHeader("X-Parse-Client-Key", _parseClientKey)
|
||||||
|
.AddHeader("platform", _parseClientPlatform)
|
||||||
|
.AddHeader("version", _parseClientVersion);
|
||||||
return http;
|
return http;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +130,10 @@ namespace Http
|
|||||||
|
|
||||||
public static void AddRevocableSession(this SingleHttp self)
|
public static void AddRevocableSession(this SingleHttp self)
|
||||||
{
|
{
|
||||||
self.AddHeader("X-Parse-Revocable-Session", HttpManager.Instance._parseRevocableSession);
|
if (!string.IsNullOrEmpty(HttpManager.Instance._parseRevocableSession))
|
||||||
|
{
|
||||||
|
self.AddHeader("X-Parse-Revocable-Session", HttpManager.Instance._parseRevocableSession);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,9 +9,7 @@ namespace Http
|
|||||||
{
|
{
|
||||||
Success,
|
Success,
|
||||||
Aborted,
|
Aborted,
|
||||||
Fail,
|
Fail
|
||||||
ConnectionTimedOut,
|
|
||||||
TimedOut
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ResultInfo
|
public class ResultInfo
|
||||||
@ -48,7 +46,7 @@ namespace Http
|
|||||||
Type = HTTPMethods.Get;
|
Type = HTTPMethods.Get;
|
||||||
CustomTimeout = 100f;
|
CustomTimeout = 100f;
|
||||||
|
|
||||||
_isKeepAlive = true;
|
_isKeepAlive = false;
|
||||||
_disableCache = true;
|
_disableCache = true;
|
||||||
_timeout = 60d;
|
_timeout = 60d;
|
||||||
_connectTimeout = 20d;
|
_connectTimeout = 20d;
|
||||||
@ -194,7 +192,7 @@ namespace Http
|
|||||||
}
|
}
|
||||||
else HttpDebug.LogError($"Server sent Error:{resp.StatusCode}-{resp.Message}-{resp.DataAsText}");
|
else HttpDebug.LogError($"Server sent Error:{resp.StatusCode}-{resp.Message}-{resp.DataAsText}");
|
||||||
break;
|
break;
|
||||||
// 请求已完成,但出现意外错误。
|
// 请求已完成,但出现意外错误。
|
||||||
case HTTPRequestStates.Error:
|
case HTTPRequestStates.Error:
|
||||||
if(req.Exception != null) HttpDebug.LogError($"Request.Exception \n {req.Exception.StackTrace}");
|
if(req.Exception != null) HttpDebug.LogError($"Request.Exception \n {req.Exception.StackTrace}");
|
||||||
else HttpDebug.LogError("Request.Exception: No Exception");
|
else HttpDebug.LogError("Request.Exception: No Exception");
|
||||||
@ -206,12 +204,10 @@ namespace Http
|
|||||||
break;
|
break;
|
||||||
// 连接到服务器超时
|
// 连接到服务器超时
|
||||||
case HTTPRequestStates.ConnectionTimedOut:
|
case HTTPRequestStates.ConnectionTimedOut:
|
||||||
state = RequestState.ConnectionTimedOut;
|
|
||||||
HttpDebug.LogError("Connection Timed Out!");
|
HttpDebug.LogError("Connection Timed Out!");
|
||||||
break;
|
break;
|
||||||
// 请求没有在给定时间内完成
|
// 请求没有在给定时间内完成
|
||||||
case HTTPRequestStates.TimedOut:
|
case HTTPRequestStates.TimedOut:
|
||||||
state = RequestState.TimedOut;
|
|
||||||
HttpDebug.LogError("Processing the request Timed Out!");
|
HttpDebug.LogError("Processing the request Timed Out!");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -60,11 +60,16 @@ namespace BF
|
|||||||
//新版本登陆,支付,第三方辅助SDK
|
//新版本登陆,支付,第三方辅助SDK
|
||||||
public BFLoginSDKManager BFLoginSDKMgr { get; private set; }
|
public BFLoginSDKManager BFLoginSDKMgr { get; private set; }
|
||||||
public BFPaySDKManager BFPaySDKMgr { get; private set; }
|
public BFPaySDKManager BFPaySDKMgr { get; private set; }
|
||||||
|
public BFRuPaySDKManager BFRuPaySDKMgr { get; private set; }
|
||||||
|
public BFHWPaySDKManager BFHWPaySDKMgr { get; private set; }
|
||||||
public IAPManager IosPaySDKMgr { get; private set; }
|
public IAPManager IosPaySDKMgr { get; private set; }
|
||||||
// public BFAdmobSDKManager BFAdmobSDKMgr { get; private set; }
|
// public BFAdmobSDKManager BFAdmobSDKMgr { get; private set; }
|
||||||
public BFIronSourceSDKManager BFIronSourceSDKMgr { get; private set; }
|
// public BFIronSourceSDKManager BFIronSourceSDKMgr { get; private set; }
|
||||||
|
// public BFHWAdSDKManager BFHWAdSDKMgr { get; private set; }
|
||||||
public BFNativeSDKManager BFNativeSDKMgr { get; private set; }
|
public BFNativeSDKManager BFNativeSDKMgr { get; private set; }
|
||||||
public BFThirdReportSDKManager BFThirdReportSDKMgr { get; private set; }
|
public BFThirdReportSDKManager BFThirdReportSDKMgr { get; private set; }
|
||||||
|
public NotificationSDKManager NotificationSDKMgr { get; private set; }
|
||||||
|
public DeepLinkManager DeepLinkMgr { get; private set; }
|
||||||
|
|
||||||
static SDKManager instance;
|
static SDKManager instance;
|
||||||
public static SDKManager Create()
|
public static SDKManager Create()
|
||||||
@ -85,20 +90,46 @@ namespace BF
|
|||||||
{
|
{
|
||||||
sdkGo = new GameObject("SDKManager");
|
sdkGo = new GameObject("SDKManager");
|
||||||
}
|
}
|
||||||
|
// Deeplink
|
||||||
|
DeepLinkMgr = sdkGo.AddComponent<DeepLinkManager>();
|
||||||
|
// native交互管理,需要最先初始化,其他地方可能要调用此类里面的方法
|
||||||
|
BFNativeSDKMgr = sdkGo.AddComponent<BFNativeSDKManager>();
|
||||||
// 登陆
|
// 登陆
|
||||||
BFLoginSDKMgr = sdkGo.AddComponent<BFLoginSDKManager>();
|
BFLoginSDKMgr = sdkGo.AddComponent<BFLoginSDKManager>();
|
||||||
// 支付
|
// 支付
|
||||||
BFPaySDKMgr = sdkGo.AddComponent<BFPaySDKManager>();
|
BFPaySDKMgr = sdkGo.AddComponent<BFPaySDKManager>();
|
||||||
|
BFRuPaySDKMgr = sdkGo.AddComponent<BFRuPaySDKManager>();
|
||||||
|
BFHWPaySDKMgr = sdkGo.AddComponent<BFHWPaySDKManager>();
|
||||||
// 广告
|
// 广告
|
||||||
// BFAdmobSDKMgr = sdkGo.AddComponent<BFAdmobSDKManager>();
|
// BFAdmobSDKMgr = sdkGo.AddComponent<BFAdmobSDKManager>();
|
||||||
BFIronSourceSDKMgr = sdkGo.AddComponent<BFIronSourceSDKManager>();
|
// BFIronSourceSDKMgr = sdkGo.AddComponent<BFIronSourceSDKManager>();
|
||||||
// 三方上报
|
// 三方上报
|
||||||
BFThirdReportSDKMgr = sdkGo.AddComponent<BFThirdReportSDKManager>();
|
BFThirdReportSDKMgr = sdkGo.AddComponent<BFThirdReportSDKManager>();
|
||||||
// native交互管理
|
|
||||||
BFNativeSDKMgr = sdkGo.AddComponent<BFNativeSDKManager>();
|
|
||||||
IosPaySDKMgr = IAPManager.Instance;
|
IosPaySDKMgr = IAPManager.Instance;
|
||||||
|
// MAX SDK安卓在这里主动初始化,IOS版会在ATT弹窗后初始化
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
AdManager.Instance.Init();
|
||||||
|
#endif
|
||||||
|
// 华为广告
|
||||||
|
// BFHWAdSDKMgr = sdkGo.AddComponent<BFHWAdSDKManager>();
|
||||||
|
// 本地推送
|
||||||
|
// NotificationSDKMgr = sdkGo.AddComponent<NotificationSDKManager>();
|
||||||
GameObject.DontDestroyOnLoad(sdkGo);
|
GameObject.DontDestroyOnLoad(sdkGo);
|
||||||
|
|
||||||
|
#if UNITY_IOS || UNITY_IPHONE
|
||||||
|
// BFUMPManager.InitGDPR();
|
||||||
|
// 这里不显示GDPR就直接显示ATT,如果GDPR要显示,则这里不要同时显示ATT,ATT会在GDPR显示后处理
|
||||||
|
// 这里延迟一帧处理是因为启动后会同时显示多个权限弹窗,包括,网络,推送,还有ATT,这种情况下ATT可能会不显示,到下一次启动才显示,这种情况下也可能会导致苹果拒审
|
||||||
|
BFMain.Instance.OneShotManager.AddOneShot(()=>{
|
||||||
|
BFMain.Instance.GameLaunchMgr.ShowIOSATTrack();
|
||||||
|
});
|
||||||
|
#elif UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
// if (BFPlatform.IsSupportGDPR())
|
||||||
|
// {
|
||||||
|
// BFMain.Instance.SDKMgr.BFNativeSDKMgr.InitGDPR();
|
||||||
|
// }
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Destroy()
|
public override void Destroy()
|
||||||
|
|||||||
8
Assets/Scripts/Common/URP.meta
Normal file
8
Assets/Scripts/Common/URP.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a6f25d3b88a875d46b7f988da3389135
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
49
Assets/Scripts/Common/URP/URPManager.cs
Normal file
49
Assets/Scripts/Common/URP/URPManager.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering.Universal;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class URPManager : ManagerBase
|
||||||
|
{
|
||||||
|
static URPManager instance;
|
||||||
|
public static URPManager Create()
|
||||||
|
{
|
||||||
|
BFLog.LogAssert(instance == null, "This method only allows BFMain to call once");
|
||||||
|
instance = new URPManager();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
URPManager() { }
|
||||||
|
|
||||||
|
public override void Init()
|
||||||
|
{
|
||||||
|
base.Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Destroy()
|
||||||
|
{
|
||||||
|
base.Destroy();
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// URP新增叠加相机
|
||||||
|
public void URPAddAdditionalCamera(Camera mainCamera, Camera additionalCamera)
|
||||||
|
{
|
||||||
|
var cameraData = mainCamera.GetUniversalAdditionalCameraData();
|
||||||
|
cameraData.cameraStack.Add(additionalCamera);
|
||||||
|
}
|
||||||
|
|
||||||
|
// URP移除叠加相机
|
||||||
|
public void URPRemoveAdditionalCamera(Camera mainCamera, Camera additionalCamera)
|
||||||
|
{
|
||||||
|
var cameraData = mainCamera.GetUniversalAdditionalCameraData();
|
||||||
|
cameraData.cameraStack.Remove(additionalCamera);
|
||||||
|
}
|
||||||
|
|
||||||
|
// URP清空叠加相机
|
||||||
|
public void URPClearAdditionalCamera(Camera mainCamera)
|
||||||
|
{
|
||||||
|
var cameraData = mainCamera.GetUniversalAdditionalCameraData();
|
||||||
|
cameraData.cameraStack.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Common/URP/URPManager.cs.meta
Normal file
11
Assets/Scripts/Common/URP/URPManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d61530ea6b2712f48b8130c89cee839b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
53
Assets/Scripts/Component/Battle/BattleControlBg.cs
Executable file
53
Assets/Scripts/Component/Battle/BattleControlBg.cs
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class BattleControlBg : MonoBehaviour
|
||||||
|
{
|
||||||
|
public float speed = 0.0f;
|
||||||
|
public float endX = 0.0f;
|
||||||
|
public float resetX = 0.0f;
|
||||||
|
public int type = 0;
|
||||||
|
public bool canMove = true;
|
||||||
|
|
||||||
|
public void SetPositionByTime(float time)
|
||||||
|
{
|
||||||
|
var transformRect = GetComponent<RectTransform>();
|
||||||
|
transformRect.anchoredPosition = new Vector2(transformRect.anchoredPosition.x + speed * time, transformRect.anchoredPosition.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedUpdate()
|
||||||
|
{
|
||||||
|
if (!canMove) return;
|
||||||
|
var transformRect = GetComponent<RectTransform>();
|
||||||
|
if (transformRect.anchoredPosition.x <= endX)
|
||||||
|
{
|
||||||
|
transformRect.anchoredPosition = new Vector2(resetX, transformRect.anchoredPosition.y);
|
||||||
|
}
|
||||||
|
// if (type == 1)
|
||||||
|
// {
|
||||||
|
// speed = BF.BFMain.Instance.BattleMgr.SceneSpeedC;
|
||||||
|
// }
|
||||||
|
// else if (type == 2)
|
||||||
|
// {
|
||||||
|
// speed = BF.BFMain.Instance.BattleMgr.SceneSpeedM;
|
||||||
|
// }
|
||||||
|
// else if (type == 3)
|
||||||
|
// {
|
||||||
|
// speed = BF.BFMain.Instance.BattleMgr.SceneSpeedF;
|
||||||
|
// }
|
||||||
|
// else if (type == 4)
|
||||||
|
// {
|
||||||
|
// speed = BF.BFMain.Instance.BattleMgr.SceneSpeedCould;
|
||||||
|
// }
|
||||||
|
// else if (type == 5)
|
||||||
|
// {
|
||||||
|
// speed = BF.BFMain.Instance.BattleMgr.SceneSpeedBg;
|
||||||
|
// }
|
||||||
|
// transform.Translate(speed * Time.fixedDeltaTime, 0.0f, 0.0f);
|
||||||
|
transformRect.anchoredPosition = new Vector2(transformRect.anchoredPosition.x + speed * Time.fixedDeltaTime, transformRect.anchoredPosition.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Component/Battle/BattleControlBg.cs.meta
Normal file
11
Assets/Scripts/Component/Battle/BattleControlBg.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1025633752bc248dc9665067e756f919
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
113
Assets/Scripts/Component/Effects/DrawBezierLine.cs
Normal file
113
Assets/Scripts/Component/Effects/DrawBezierLine.cs
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class DrawBezierLine : MonoBehaviour
|
||||||
|
{
|
||||||
|
public LineRenderer lineRender;
|
||||||
|
private Vector3 _startPoint = Vector3.zero;
|
||||||
|
private Vector3 _endPoint = Vector3.zero;
|
||||||
|
private Vector3 _controlPoint1 = Vector3.zero;
|
||||||
|
private Vector3 _controlPoint2 = Vector3.zero;
|
||||||
|
// 曲线上的路径点数量,值越大,取得的路径点越多,曲线越平滑
|
||||||
|
private int drawPointCount = 30;
|
||||||
|
private bool isDraw = false;
|
||||||
|
private bool useCubicBezier = true;
|
||||||
|
public void SetStartPoint(float x, float y, float z)
|
||||||
|
{
|
||||||
|
_startPoint = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetEndPoint(float x, float y, float z)
|
||||||
|
{
|
||||||
|
_endPoint = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetControlPoint1(float x, float y, float z)
|
||||||
|
{
|
||||||
|
_controlPoint1 = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetControlPoint2(float x, float y, float z)
|
||||||
|
{
|
||||||
|
_controlPoint2 = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDrawPointCount(int count)
|
||||||
|
{
|
||||||
|
drawPointCount = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawLine()
|
||||||
|
{
|
||||||
|
isDraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearLine()
|
||||||
|
{
|
||||||
|
isDraw = false;
|
||||||
|
lineRender.positionCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3[] GetPathList()
|
||||||
|
{
|
||||||
|
Vector3[] positions = new Vector3[lineRender.positionCount];
|
||||||
|
lineRender.GetPositions(positions);
|
||||||
|
return positions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetUseCubicBezier(bool use)
|
||||||
|
{
|
||||||
|
useCubicBezier = use;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (!isDraw)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isDraw = false;
|
||||||
|
if (drawPointCount <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lineRender.positionCount = drawPointCount;
|
||||||
|
lineRender.SetPosition(0, _startPoint);
|
||||||
|
for (int i = 1; i < drawPointCount; i++)
|
||||||
|
{
|
||||||
|
var t = (i + 1) / (float)drawPointCount;
|
||||||
|
if (useCubicBezier)
|
||||||
|
{
|
||||||
|
var pathPoint = GetPointInCubicBezierCurve(t, _startPoint, _controlPoint1, _controlPoint2, _endPoint);//使用贝塞尔曲线的公式取得t时的路径点
|
||||||
|
lineRender.SetPosition(i, pathPoint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var pathPoint = GetBezierPoint(t, _startPoint, _controlPoint1, _endPoint);//使用贝塞尔曲线的公式取得t时的路径点
|
||||||
|
lineRender.SetPosition(i, pathPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <param name="t">0到1的值,0获取曲线的起点,1获得曲线的终点</param>
|
||||||
|
/// <param name="start">曲线的起始位置</param>
|
||||||
|
/// <param name="center">决定曲线形状的控制点</param>
|
||||||
|
/// <param name="end">曲线的终点</param>
|
||||||
|
public static Vector3 GetBezierPoint(float t, Vector3 start, Vector3 controlPoint, Vector3 end)
|
||||||
|
{
|
||||||
|
return (1 - t) * (1 - t) * start + 2 * t * (1 - t) * controlPoint + t * t * end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 GetPointInCubicBezierCurve(float t, Vector3 startPoint, Vector3 controlPoint1, Vector3 controlPoint2, Vector3 endPoint)
|
||||||
|
{
|
||||||
|
var A = startPoint * (Mathf.Pow(-t, 3) + 3 * Mathf.Pow(t, 2) - 3 * t + 1);
|
||||||
|
var B = controlPoint1 * (3 * Mathf.Pow(t, 3) - 6 * Mathf.Pow(t, 2) + 3 * t);
|
||||||
|
var C = controlPoint2 * (-3 * Mathf.Pow(t, 3) + 3 * Mathf.Pow(t, 2));
|
||||||
|
var D = endPoint * (Mathf.Pow(t, 3));
|
||||||
|
return A + B + C + D;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Component/Effects/DrawBezierLine.cs.meta
Normal file
11
Assets/Scripts/Component/Effects/DrawBezierLine.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9f27b020f0d68e14788bcde278e4add4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
82
Assets/Scripts/Component/Helper/DreamlandInstancingHelper.cs
Normal file
82
Assets/Scripts/Component/Helper/DreamlandInstancingHelper.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public class DreamlandInstancingHelper : MonoBehaviour
|
||||||
|
{
|
||||||
|
Action luaUpdateAction;
|
||||||
|
MaterialPropertyBlock block;
|
||||||
|
MeshFilter meshFilter;
|
||||||
|
List<Matrix4x4> materixList = new List<Matrix4x4>();
|
||||||
|
List<Vector4> lightmapOffsetList = new List<Vector4>();
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
block = new MaterialPropertyBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLuaUpdateAction(Action updateAction)
|
||||||
|
{
|
||||||
|
luaUpdateAction = updateAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearLuaUpdateAction()
|
||||||
|
{
|
||||||
|
luaUpdateAction = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MaterialPropertyBlock GetMaterialPorpertyBlock()
|
||||||
|
{
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MeshFilter GetMeshFilter()
|
||||||
|
{
|
||||||
|
meshFilter = GetComponentInChildren<MeshFilter>();
|
||||||
|
return meshFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector4[] CollectLightmapOffsetArray()
|
||||||
|
{
|
||||||
|
lightmapOffsetList.Clear();
|
||||||
|
var meshRenderers = GetComponentsInChildren<MeshRenderer>();
|
||||||
|
foreach (var mr in meshRenderers)
|
||||||
|
{
|
||||||
|
lightmapOffsetList.Add(mr.lightmapScaleOffset);
|
||||||
|
}
|
||||||
|
return lightmapOffsetList.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Matrix4x4> CollectMaterixList()
|
||||||
|
{
|
||||||
|
materixList.Clear();
|
||||||
|
var meshRenderers = GetComponentsInChildren<MeshRenderer>();
|
||||||
|
foreach (var mr in meshRenderers)
|
||||||
|
{
|
||||||
|
materixList.Add(mr.localToWorldMatrix);
|
||||||
|
}
|
||||||
|
return materixList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideChild()
|
||||||
|
{
|
||||||
|
for (var i = 0; i < transform.childCount; i++)
|
||||||
|
{
|
||||||
|
transform.GetChild(i).gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
luaUpdateAction?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetSupportInstancing()
|
||||||
|
{
|
||||||
|
return SystemInfo.supportsInstancing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 95f27acf2ce774f32b4d9c7ca29c2b70
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
46
Assets/Scripts/Component/Helper/GlobalHelper.cs
Normal file
46
Assets/Scripts/Component/Helper/GlobalHelper.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
[System.Serializable]
|
||||||
|
public struct GlobalInfo
|
||||||
|
{
|
||||||
|
public TextMeshProUGUI tx;
|
||||||
|
public string key;
|
||||||
|
}
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
[DisallowMultipleComponent]
|
||||||
|
public class GlobalHelper : MonoBehaviour
|
||||||
|
{
|
||||||
|
public List<GlobalInfo> globalInfoList = new List<GlobalInfo>();
|
||||||
|
public int GetListCount()
|
||||||
|
{
|
||||||
|
return globalInfoList.Count;
|
||||||
|
}
|
||||||
|
public string GetGlobalByIndex(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < globalInfoList.Count)
|
||||||
|
{
|
||||||
|
return globalInfoList[index].key;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
public void SetText(int index, string v)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < globalInfoList.Count)
|
||||||
|
{
|
||||||
|
globalInfoList[index].tx.text = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
globalInfoList.Clear();
|
||||||
|
globalInfoList = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Component/Helper/GlobalHelper.cs.meta
Normal file
11
Assets/Scripts/Component/Helper/GlobalHelper.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a9961f2693c0ea344aa81949924f05b7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -103,6 +103,45 @@ namespace BF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetPositionX(int index, float x)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < prefabList.Count)
|
||||||
|
{
|
||||||
|
var childTransform = prefabList[index].gameObject.transform;
|
||||||
|
childTransform.position = new Vector3(x, childTransform.position.y, childTransform.position.z);
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
this.transform.position = new Vector3(x, this.transform.position.y, this.transform.position.z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPositionY(int index, float y)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < prefabList.Count)
|
||||||
|
{
|
||||||
|
var childTransform = prefabList[index].gameObject.transform;
|
||||||
|
childTransform.position = new Vector3(childTransform.position.x, y, childTransform.position.z);
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
this.transform.position = new Vector3(this.transform.position.x, y, this.transform.position.z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPositionZ(int index, float z)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < prefabList.Count)
|
||||||
|
{
|
||||||
|
var childTransform = prefabList[index].gameObject.transform;
|
||||||
|
childTransform.position = new Vector3(childTransform.position.x, childTransform.position.y, z);
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void CacheLocalEulerAngles(int index)
|
public void CacheLocalEulerAngles(int index)
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < prefabList.Count)
|
if (index >= 0 && index < prefabList.Count)
|
||||||
@ -132,6 +171,33 @@ namespace BF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float GetLocalEulerAnglesZ(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < prefabList.Count)
|
||||||
|
{
|
||||||
|
var localEulerAngles = prefabList[index].gameObject.transform.localEulerAngles;
|
||||||
|
return localEulerAngles.z;
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
return this.transform.localEulerAngles.z;
|
||||||
|
}
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLocalEulerAnglesZ(int index, float z)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < prefabList.Count)
|
||||||
|
{
|
||||||
|
var localEulerAngles = prefabList[index].gameObject.transform.localEulerAngles;
|
||||||
|
prefabList[index].gameObject.transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles.y, z);
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
this.transform.localEulerAngles = new Vector3(this.transform.localEulerAngles.x, this.transform.localEulerAngles.y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetLocalScale(int index, float x, float y, float z)
|
public void SetLocalScale(int index, float x, float y, float z)
|
||||||
{
|
{
|
||||||
if (index >= 0 && index < prefabList.Count)
|
if (index >= 0 && index < prefabList.Count)
|
||||||
|
|||||||
@ -28,6 +28,8 @@ namespace BF
|
|||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class PrefabHelper : MonoBehaviour
|
public class PrefabHelper : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField]
|
||||||
|
public List<UnityEngine.GameObject> lis_AddObject = new List<UnityEngine.GameObject>();
|
||||||
public List<GameObjectInfo> prefabList = new List<GameObjectInfo>();
|
public List<GameObjectInfo> prefabList = new List<GameObjectInfo>();
|
||||||
public float PositionX { get; private set; }
|
public float PositionX { get; private set; }
|
||||||
public float PositionY { get; private set; }
|
public float PositionY { get; private set; }
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d9473cad853ffbc4284abb0e064c52d6
|
guid: cbd97f50181e3ba4aa76780bbbce0d79
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
176
Assets/Scripts/Component/Helper/WeaponHelper.cs
Normal file
176
Assets/Scripts/Component/Helper/WeaponHelper.cs
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
[DisallowMultipleComponent]
|
||||||
|
public class WeaponHelper : MonoBehaviour
|
||||||
|
{
|
||||||
|
public GameObject modelObject;
|
||||||
|
public List<CharacterObjectInfo> objectList = new List<CharacterObjectInfo>();
|
||||||
|
public List<CharacterAnimationInfo> animationList = new List<CharacterAnimationInfo>();
|
||||||
|
|
||||||
|
public float PositionX { get; private set; }
|
||||||
|
public float PositionY { get; private set; }
|
||||||
|
public float PositionZ { get; private set; }
|
||||||
|
|
||||||
|
public GameObject GetModelObject()
|
||||||
|
{
|
||||||
|
return modelObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetModelHashCode()
|
||||||
|
{
|
||||||
|
return gameObject.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetListCount()
|
||||||
|
{
|
||||||
|
return objectList.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameObject GetGameObjectByIndex(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < objectList.Count)
|
||||||
|
{
|
||||||
|
return objectList[index].gameObject;
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
return this.gameObject;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint GetHashNameByIndex(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < objectList.Count)
|
||||||
|
{
|
||||||
|
return objectList[index].hashName;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lua层可以使用PositionX,PositionY,PositionZ,减少直接传递localPosition的开销
|
||||||
|
public void CacheLocalPosition(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < objectList.Count)
|
||||||
|
{
|
||||||
|
var localPosition = objectList[index].gameObject.transform.localPosition;
|
||||||
|
PositionX = localPosition.x;
|
||||||
|
PositionY = localPosition.y;
|
||||||
|
PositionZ = localPosition.z;
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
PositionX = this.transform.localPosition.x;
|
||||||
|
PositionY = this.transform.localPosition.y;
|
||||||
|
PositionZ = this.transform.localPosition.z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLocalPosition(int index, float x, float y, float z)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < objectList.Count)
|
||||||
|
{
|
||||||
|
objectList[index].gameObject.transform.localPosition = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
this.transform.localPosition = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Lua层可以使用PositionX,PositionY,PositionZ,减少直接传递position的开销
|
||||||
|
public void CachePosition(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < objectList.Count)
|
||||||
|
{
|
||||||
|
var position = objectList[index].gameObject.transform.position;
|
||||||
|
PositionX = position.x;
|
||||||
|
PositionY = position.y;
|
||||||
|
PositionZ = position.z;
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
PositionX = this.transform.position.x;
|
||||||
|
PositionY = this.transform.position.y;
|
||||||
|
PositionZ = this.transform.position.z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPosition(int index, float x, float y, float z)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < objectList.Count)
|
||||||
|
{
|
||||||
|
objectList[index].gameObject.transform.position = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
this.transform.position = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLocalEulerAngles(int index, float x, float y, float z)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < objectList.Count)
|
||||||
|
{
|
||||||
|
objectList[index].gameObject.transform.localEulerAngles = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
this.transform.localEulerAngles = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLocalScale(int index, float x, float y, float z)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < objectList.Count)
|
||||||
|
{
|
||||||
|
objectList[index].gameObject.transform.localScale = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
else if (index < 0)
|
||||||
|
{
|
||||||
|
this.transform.localScale = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMainModelLocalPosition(float x, float y, float z)
|
||||||
|
{
|
||||||
|
modelObject.transform.localPosition = new Vector3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetStateTime(uint index)
|
||||||
|
{
|
||||||
|
int count = animationList.Count;
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if(animationList[i].hashName == index)
|
||||||
|
{
|
||||||
|
return animationList[i].animationTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint GetStateKeyFrame(uint hashName, int index)
|
||||||
|
{
|
||||||
|
int count = animationList.Count;
|
||||||
|
CharacterAnimationInfo characterAnimationInfo;
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
characterAnimationInfo = animationList[i];
|
||||||
|
if(characterAnimationInfo.hashName == hashName)
|
||||||
|
{
|
||||||
|
if(characterAnimationInfo.keyFrame != null && characterAnimationInfo.keyFrame.Count > index)
|
||||||
|
{
|
||||||
|
return characterAnimationInfo.keyFrame[index];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Component/Helper/WeaponHelper.cs.meta
Normal file
11
Assets/Scripts/Component/Helper/WeaponHelper.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 20f2cf41ce575154699359cdd2465af7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -138,7 +138,7 @@ namespace BF
|
|||||||
{
|
{
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, - pos - size / 2);
|
rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, - pos - size / 2 * rect.localScale.y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,6 +12,7 @@ namespace BF
|
|||||||
public int downRecoveryOffset;
|
public int downRecoveryOffset;
|
||||||
public BFUIDirection direction;
|
public BFUIDirection direction;
|
||||||
public bool reverse = false;
|
public bool reverse = false;
|
||||||
|
public bool centerWhenNotFull = false; // 新增参数,控制是否在不满一行时居中
|
||||||
|
|
||||||
Stack<BFCell> cellPool = new Stack<BFCell>();
|
Stack<BFCell> cellPool = new Stack<BFCell>();
|
||||||
List<BFCell> activeCells = new List<BFCell>();
|
List<BFCell> activeCells = new List<BFCell>();
|
||||||
@ -129,7 +130,6 @@ namespace BF
|
|||||||
float maxHeight = Mathf.Max(UnityScrollRect.viewport.rect.height, maxLine*cellHeight + topRecoveryOffset + downRecoveryOffset);
|
float maxHeight = Mathf.Max(UnityScrollRect.viewport.rect.height, maxLine*cellHeight + topRecoveryOffset + downRecoveryOffset);
|
||||||
ContentTrans.sizeDelta = new Vector2(ContentTrans.sizeDelta.x, maxHeight);
|
ContentTrans.sizeDelta = new Vector2(ContentTrans.sizeDelta.x, maxHeight);
|
||||||
// cellWidth = (int)UnityScrollRect.viewport.rect.width;
|
// cellWidth = (int)UnityScrollRect.viewport.rect.width;
|
||||||
|
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
float posY = UnityScrollRect.content.anchoredPosition.y;
|
float posY = UnityScrollRect.content.anchoredPosition.y;
|
||||||
@ -179,6 +179,7 @@ namespace BF
|
|||||||
// maxIdx = Mathf.Min(this.totalCount, maxIdx);
|
// maxIdx = Mathf.Min(this.totalCount, maxIdx);
|
||||||
// BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "red", " ContentTrans.sizeDelta.x = " + ContentTrans.sizeDelta.x);
|
// BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "red", " ContentTrans.sizeDelta.x = " + ContentTrans.sizeDelta.x);
|
||||||
// BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "red", " ContentTrans.sizeDelta.y = " + ContentTrans.sizeDelta.y);
|
// BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "red", " ContentTrans.sizeDelta.y = " + ContentTrans.sizeDelta.y);
|
||||||
|
UpdateAllCellPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RefreshAll()
|
public override void RefreshAll()
|
||||||
@ -389,19 +390,28 @@ namespace BF
|
|||||||
float posX = 0.0f;
|
float posX = 0.0f;
|
||||||
if (direction == BFUIDirection.Vertical)
|
if (direction == BFUIDirection.Vertical)
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (centerWhenNotFull && totalCount < perLineNum)
|
||||||
{
|
{
|
||||||
float cellWidth1 = UnityScrollRect.viewport.rect.width/perLineNum;
|
float totalWidth = totalCount * cellWidth;
|
||||||
float idx = (index - 1.0f)%perLineNum + 1.0f;
|
float startPos = (UnityScrollRect.viewport.rect.width - totalWidth) / 2;
|
||||||
posX = (idx - 0.5f) * cellWidth1;
|
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||||
|
posX = startPos + (idx - 0.5f) * cellWidth;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float cellWidth1 = UnityScrollRect.viewport.rect.width/perLineNum;
|
if (reverse)
|
||||||
float idx = (index - 1.0f)%perLineNum + 1.0f;
|
{
|
||||||
posX = (idx - 0.5f) * cellWidth1;
|
float cellWidth1 = UnityScrollRect.viewport.rect.width / perLineNum;
|
||||||
|
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||||
|
posX = (idx - 0.5f) * cellWidth1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float cellWidth1 = UnityScrollRect.viewport.rect.width / perLineNum;
|
||||||
|
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||||
|
posX = (idx - 0.5f) * cellWidth1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -437,20 +447,54 @@ namespace BF
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (reverse)
|
if (centerWhenNotFull && totalCount < perLineNum)
|
||||||
{
|
{
|
||||||
float cellHeight1 = UnityScrollRect.viewport.rect.height/perLineNum;
|
// 在ContentTrans高度范围内居中
|
||||||
float offset = UnityScrollRect.viewport.rect.height/perLineNum/2.0f;
|
float totalHeight = totalCount * cellHeight;
|
||||||
float idx = (index - 1.0f)%perLineNum + 1.0f;
|
float contentOffset = (ContentTrans.rect.height - totalHeight) / 2;
|
||||||
posY = -(offset + (idx - 1.0f)*cellHeight1);
|
|
||||||
// BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "red", "index = " + index + " posY = " + posY + " offset = " + offset);
|
// 元素在ContentTrans内垂直居中
|
||||||
|
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||||
|
if (reverse)
|
||||||
|
{
|
||||||
|
posY = -(contentOffset + (idx - 0.5f) * cellHeight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
posY = contentOffset + (idx - 0.5f) * cellHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果ContentTrans比viewport矮,调整全局居中
|
||||||
|
if (ContentTrans.rect.height < UnityScrollRect.viewport.rect.height)
|
||||||
|
{
|
||||||
|
float viewportOffset = (UnityScrollRect.viewport.rect.height - ContentTrans.rect.height) / 2;
|
||||||
|
if (reverse)
|
||||||
|
{
|
||||||
|
posY -= viewportOffset; // 抵消视口偏移
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
posY += viewportOffset; // 抵消视口偏移
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float cellHeight1 = UnityScrollRect.viewport.rect.height/perLineNum;
|
if (reverse)
|
||||||
float offset = UnityScrollRect.viewport.rect.height - UnityScrollRect.viewport.rect.height/perLineNum/2.0f;
|
{
|
||||||
float idx = (index - 1.0f)%perLineNum + 1.0f;
|
float cellHeight1 = UnityScrollRect.viewport.rect.height / perLineNum;
|
||||||
posY = offset - (idx - 1.0f)*cellHeight1;
|
float offset = UnityScrollRect.viewport.rect.height / perLineNum / 2.0f;
|
||||||
|
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||||
|
posY = -(offset + (idx - 1.0f) * cellHeight1);
|
||||||
|
// BFLog.LogDebug(BFLog.DEBUG_GAME_LAUNCH, "red", "index = " + index + " posY = " + posY + " offset = " + offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float cellHeight1 = UnityScrollRect.viewport.rect.height / perLineNum;
|
||||||
|
float offset = UnityScrollRect.viewport.rect.height - UnityScrollRect.viewport.rect.height / perLineNum / 2.0f;
|
||||||
|
float idx = (index - 1.0f) % perLineNum + 1.0f;
|
||||||
|
posY = offset - (idx - 1.0f) * cellHeight1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +643,7 @@ namespace BF
|
|||||||
{
|
{
|
||||||
UnityScrollRect.StopMovement();
|
UnityScrollRect.StopMovement();
|
||||||
}
|
}
|
||||||
|
[ContextMenu("UpdateAllCellPosition")]
|
||||||
public void UpdateAllCellPosition()
|
public void UpdateAllCellPosition()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < activeCells.Count; i++)
|
for (int i = 0; i < activeCells.Count; i++)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ using XLua.Cast;
|
|||||||
public class UIOutlineEffect : BaseMeshEffect
|
public class UIOutlineEffect : BaseMeshEffect
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Color outlineColor = Color.white;
|
private Color outlineColor = Color.black;
|
||||||
|
|
||||||
public Color OutlineColor
|
public Color OutlineColor
|
||||||
{
|
{
|
||||||
@ -18,7 +18,7 @@ public class UIOutlineEffect : BaseMeshEffect
|
|||||||
set { outlineColor = value; }
|
set { outlineColor = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Range(0, 5)]
|
[Range(0, 5)]
|
||||||
public int OutlineWidth = 0;
|
public int OutlineWidth = 0;
|
||||||
private List<UIVertex> cacheVertexList = new List<UIVertex>();
|
private List<UIVertex> cacheVertexList = new List<UIVertex>();
|
||||||
|
|
||||||
@ -27,11 +27,6 @@ public class UIOutlineEffect : BaseMeshEffect
|
|||||||
base.Awake();
|
base.Awake();
|
||||||
if (base.graphic)
|
if (base.graphic)
|
||||||
{
|
{
|
||||||
if (base.graphic.material == null || base.graphic.material.shader.name != "BF/UI/TEXT_OUTLINE")
|
|
||||||
{
|
|
||||||
BF.BFLog.Log("uitext没有设置对应描边材质");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (base.graphic.canvas)
|
if (base.graphic.canvas)
|
||||||
{
|
{
|
||||||
var shaderChannelOrigin = base.graphic.canvas.additionalShaderChannels;
|
var shaderChannelOrigin = base.graphic.canvas.additionalShaderChannels;
|
||||||
@ -45,19 +40,19 @@ public class UIOutlineEffect : BaseMeshEffect
|
|||||||
{
|
{
|
||||||
base.graphic.canvas.additionalShaderChannels |= needChannel;
|
base.graphic.canvas.additionalShaderChannels |= needChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
needChannel = AdditionalCanvasShaderChannels.TexCoord3;
|
needChannel = AdditionalCanvasShaderChannels.TexCoord3;
|
||||||
if ((shaderChannelOrigin & needChannel) != needChannel)
|
if ((shaderChannelOrigin & needChannel) != needChannel)
|
||||||
{
|
{
|
||||||
base.graphic.canvas.additionalShaderChannels |= needChannel;
|
base.graphic.canvas.additionalShaderChannels |= needChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
needChannel = AdditionalCanvasShaderChannels.Tangent;
|
needChannel = AdditionalCanvasShaderChannels.Tangent;
|
||||||
if ((shaderChannelOrigin & needChannel) != needChannel)
|
if ((shaderChannelOrigin & needChannel) != needChannel)
|
||||||
{
|
{
|
||||||
base.graphic.canvas.additionalShaderChannels |= needChannel;
|
base.graphic.canvas.additionalShaderChannels |= needChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
needChannel = AdditionalCanvasShaderChannels.Normal;
|
needChannel = AdditionalCanvasShaderChannels.Normal;
|
||||||
if ((shaderChannelOrigin & needChannel) != needChannel)
|
if ((shaderChannelOrigin & needChannel) != needChannel)
|
||||||
{
|
{
|
||||||
@ -67,18 +62,6 @@ public class UIOutlineEffect : BaseMeshEffect
|
|||||||
base.graphic.SetVerticesDirty();
|
base.graphic.SetVerticesDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if UNITY_EDITOR
|
|
||||||
protected override void OnValidate()
|
|
||||||
{
|
|
||||||
base.OnValidate();
|
|
||||||
if (base.graphic.material.shader.name != "BF/UI/TEXT_OUTLINE")
|
|
||||||
{
|
|
||||||
base.graphic.material =
|
|
||||||
AssetDatabase.LoadAssetAtPath<Material>("assets/arts/materials/ui/ui_text_outline.mat");
|
|
||||||
}
|
|
||||||
base.graphic.SetVerticesDirty();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public override void ModifyMesh(VertexHelper vh)
|
public override void ModifyMesh(VertexHelper vh)
|
||||||
{
|
{
|
||||||
@ -88,7 +71,7 @@ public class UIOutlineEffect : BaseMeshEffect
|
|||||||
vh.AddUIVertexTriangleStream(cacheVertexList);
|
vh.AddUIVertexTriangleStream(cacheVertexList);
|
||||||
}
|
}
|
||||||
|
|
||||||
//扩充顶点 并将计算信息缓存在顶点不需要但可以传递的参数中
|
//扩充顶点 并将计算信息缓存在顶点不需要但可以传递的参数中
|
||||||
private void ProcessVertexs()
|
private void ProcessVertexs()
|
||||||
{
|
{
|
||||||
var total = cacheVertexList.Count;
|
var total = cacheVertexList.Count;
|
||||||
@ -103,7 +86,7 @@ public class UIOutlineEffect : BaseMeshEffect
|
|||||||
var minY = Min(v1.position.y, v2.position.y, v3.position.y);
|
var minY = Min(v1.position.y, v2.position.y, v3.position.y);
|
||||||
var maxY = Max(v1.position.y, v2.position.y, v3.position.y);
|
var maxY = Max(v1.position.y, v2.position.y, v3.position.y);
|
||||||
var posCenter = new Vector2(minX + maxX, minY + maxY) * 0.5f;
|
var posCenter = new Vector2(minX + maxX, minY + maxY) * 0.5f;
|
||||||
|
|
||||||
//uv 顶点三角形最小包围盒 直角三角形特殊处理
|
//uv 顶点三角形最小包围盒 直角三角形特殊处理
|
||||||
Vector2 triX, triY, uvX, uvY;
|
Vector2 triX, triY, uvX, uvY;
|
||||||
Vector2 vPos1 = v1.position;
|
Vector2 vPos1 = v1.position;
|
||||||
@ -125,11 +108,10 @@ public class UIOutlineEffect : BaseMeshEffect
|
|||||||
uvX = v3.uv0 - v2.uv0;
|
uvX = v3.uv0 - v2.uv0;
|
||||||
uvY = v2.uv0 - v1.uv0;
|
uvY = v2.uv0 - v1.uv0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//uv框
|
//uv框
|
||||||
var uvOriginMin = Min(v1.uv0, v2.uv0, v3.uv0);
|
var uvOriginMin = Min(v1.uv0, v2.uv0, v3.uv0);
|
||||||
var uvOriginMax = Max(v1.uv0, v2.uv0, v3.uv0);
|
var uvOriginMax = Max(v1.uv0, v2.uv0, v3.uv0);
|
||||||
|
|
||||||
var color_rg = new Vector2(outlineColor.r, outlineColor.g);
|
var color_rg = new Vector2(outlineColor.r, outlineColor.g);
|
||||||
var color_ba = new Vector4(0 ,0 , outlineColor.b, outlineColor.a);
|
var color_ba = new Vector4(0 ,0 , outlineColor.b, outlineColor.a);
|
||||||
var normal = new Vector3(0, 0, OutlineWidth);
|
var normal = new Vector3(0, 0, OutlineWidth);
|
||||||
@ -183,20 +165,19 @@ public class UIOutlineEffect : BaseMeshEffect
|
|||||||
{
|
{
|
||||||
return Mathf.Min(Mathf.Min(a, b), c);
|
return Mathf.Min(Mathf.Min(a, b), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float Max(float a, float b, float c)
|
private static float Max(float a, float b, float c)
|
||||||
{
|
{
|
||||||
return Mathf.Max(Mathf.Max(a, b), c);
|
return Mathf.Max(Mathf.Max(a, b), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector2 Min(Vector2 a, Vector2 b, Vector2 c)
|
private static Vector2 Min(Vector2 a, Vector2 b, Vector2 c)
|
||||||
{
|
{
|
||||||
return new Vector2(Min(a.x, b.x, c.x), Min(a.y, b.y, c.y));
|
return new Vector2(Min(a.x, b.x, c.x), Min(a.y, b.y, c.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector2 Max(Vector2 a, Vector2 b, Vector2 c)
|
private static Vector2 Max(Vector2 a, Vector2 b, Vector2 c)
|
||||||
{
|
{
|
||||||
return new Vector2(Max(a.x, b.x, c.x), Max(a.y, b.y, c.y));
|
return new Vector2(Max(a.x, b.x, c.x), Max(a.y, b.y, c.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
11
Assets/Scripts/Const/BFPlatform.Const.cs
Normal file
11
Assets/Scripts/Const/BFPlatform.Const.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public partial class BFPlatform
|
||||||
|
{
|
||||||
|
public const string ANDROID_GP_PACKAGE_NAME = "com.gearpaw.defenders.td.game";
|
||||||
|
public const string ANDROID_GP_PACKAGE_NAME_GLOBAL = "com.fortune.td.game.global";
|
||||||
|
public const string ANDROID_GP_PACKAGE_NAME_RU = "com.gearpaw.defenders.td.game.ru";
|
||||||
|
public const string ANDROID_GP_PACKAGE_NAME_RUSTORE = "com.fortune.td.game.rustore";
|
||||||
|
public const string ANDROID_GP_PACKAGE_NAME_RU_HW = "com.fortune.td.game.ru.hw";
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Const/BFPlatform.Const.cs.meta
Normal file
11
Assets/Scripts/Const/BFPlatform.Const.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 94aec8a10f4fce041a3f1a94ab8079db
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -64,22 +64,9 @@ namespace BF
|
|||||||
|
|
||||||
public partial class BFPlatform
|
public partial class BFPlatform
|
||||||
{
|
{
|
||||||
const String LoginCenterURL = "https://entrance.bigfoot-studio.link";
|
const String LoginCenterURLDev = "https://entrance.wdd817.link";
|
||||||
static Dictionary<string, string> BFLoginCenterURLDict = new Dictionary<string, string>()
|
const String LoginCenterURL = "https://entrance.wdd817.link";
|
||||||
{
|
const String LoginCenterURLRU = "https://entrance.wdd817.link";
|
||||||
// dev
|
|
||||||
{"com.juzu.b6.dev", "http://game.juzugame.com:3000"},
|
|
||||||
{"com.juzu.b6.dev.android", "http://game.juzugame.com:3000"},
|
|
||||||
{"com.juzu.b6.dev.ios", "http://game.juzugame.com:3000"},
|
|
||||||
|
|
||||||
// release
|
|
||||||
{"com.juzu.b6.release.android", "http://game.juzugame.com:3000"},
|
|
||||||
{"com.juzu.b6.release.ios", "http://game.juzugame.com:3000"},
|
|
||||||
|
|
||||||
// gp
|
|
||||||
{"com.combo.heroes.puzzle.rpg", "https://entrance.bigfoot-studio.link"},
|
|
||||||
};
|
|
||||||
|
|
||||||
//combine url解析的数据
|
//combine url解析的数据
|
||||||
static ClusterType clusterType;
|
static ClusterType clusterType;
|
||||||
|
|
||||||
@ -112,109 +99,6 @@ namespace BF
|
|||||||
//登陆中心返回的信息齐全且格式正常
|
//登陆中心返回的信息齐全且格式正常
|
||||||
static bool isLoginCenterConfigValid;//请求的域名信息是否正确
|
static bool isLoginCenterConfigValid;//请求的域名信息是否正确
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 解析json数据 获取cluter,gate,chat,vsn,pay的地址
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="json"></param>
|
|
||||||
public static void InitUrlsFromLoginCenter(string json)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(json))
|
|
||||||
{
|
|
||||||
CombineURL urls = JsonUtility.FromJson<CombineURL>(json);
|
|
||||||
|
|
||||||
BFLog.Log("C#解析后的urls:" + urls.ToString());
|
|
||||||
|
|
||||||
clusterType = (ClusterType)urls.cluster_type;
|
|
||||||
string tmpGateUrl = urls.ugate_addr;
|
|
||||||
string tmpChatUrl = urls.uchat_addr;
|
|
||||||
string tmpVsnUrl = urls.vsn_addr;
|
|
||||||
string tmpPayUrl = urls.upay_addr;
|
|
||||||
string tmpCommunityWebUrl = urls.community_web_addr;
|
|
||||||
string tmpCommunitySrvUrl = urls.community_srv_addr;
|
|
||||||
string tmpAicsHttpUrl = urls.aics_http_addr;
|
|
||||||
string tmpAicsWebSocketUrl = urls.aics_ws_addr;
|
|
||||||
|
|
||||||
bool clusterValid = clusterType != ClusterType.None;
|
|
||||||
bool gateValid = !string.IsNullOrEmpty(tmpGateUrl);
|
|
||||||
bool chatValid = !string.IsNullOrEmpty(tmpChatUrl);
|
|
||||||
bool vsnValid = !string.IsNullOrEmpty(tmpVsnUrl);
|
|
||||||
bool payValid = !string.IsNullOrEmpty(tmpPayUrl);
|
|
||||||
bool communityWebValid = !string.IsNullOrEmpty(tmpCommunityWebUrl);
|
|
||||||
bool communitySrvValid = !string.IsNullOrEmpty(tmpCommunitySrvUrl);
|
|
||||||
bool aicsHttpValid = !string.IsNullOrEmpty(tmpAicsHttpUrl);
|
|
||||||
bool aicsWebSocketValid = !string.IsNullOrEmpty(tmpAicsWebSocketUrl);
|
|
||||||
|
|
||||||
BFLog.Log(string.Format("check valid clusterValid:{0} gateValid:{1} chatValid:{2} vsnValid:{3} payValid:{4} communityWebValid:{5} communitySrvValid:{6} aicsHttpValid:{7} aicsWebSocketValid:{8}", clusterValid, gateValid, chatValid, vsnValid, payValid, communityWebValid, communitySrvValid, aicsHttpValid, aicsWebSocketValid));
|
|
||||||
|
|
||||||
//判断参数是否正常
|
|
||||||
if (clusterValid && gateValid && chatValid && vsnValid && payValid)
|
|
||||||
{
|
|
||||||
if (IsPublishChannel()) // 正式渠道不验证社区与客服地址
|
|
||||||
{
|
|
||||||
SetLoginCenterConfigValid(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (communityWebValid && communitySrvValid && aicsHttpValid && aicsWebSocketValid)
|
|
||||||
{
|
|
||||||
SetLoginCenterConfigValid(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetLoginCenterConfigValid(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetLoginCenterConfigValid(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//拆分域名url与port
|
|
||||||
int gatePortIndex = tmpGateUrl.LastIndexOf(':');
|
|
||||||
int chatPortIndex = tmpChatUrl.LastIndexOf(':');
|
|
||||||
int vsnPortIndex = tmpVsnUrl.LastIndexOf(':');
|
|
||||||
|
|
||||||
string gatePortStr = tmpGateUrl.Substring(gatePortIndex + 1, tmpGateUrl.Length - gatePortIndex - 1);
|
|
||||||
string chatPortStr = tmpChatUrl.Substring(chatPortIndex + 1, tmpChatUrl.Length - chatPortIndex - 1);
|
|
||||||
string vsnPortStr = tmpVsnUrl.Substring(vsnPortIndex + 1, tmpVsnUrl.Length - vsnPortIndex - 1);
|
|
||||||
|
|
||||||
int gatePort = 0;
|
|
||||||
int chatPort = 0;
|
|
||||||
int vsnPort = 0;
|
|
||||||
int.TryParse(gatePortStr, out gatePort);
|
|
||||||
int.TryParse(chatPortStr, out chatPort);
|
|
||||||
int.TryParse(vsnPortStr, out vsnPort);
|
|
||||||
|
|
||||||
string tmpGateUrlWithoutPort = tmpGateUrl.Substring(0, gatePortIndex);
|
|
||||||
string tmpChatUrlWithoutPort = tmpChatUrl.Substring(0, chatPortIndex);
|
|
||||||
string tmpVsnUrlWithoutPort = tmpVsnUrl.Substring(0, vsnPortIndex);
|
|
||||||
|
|
||||||
mainGateUrl = tmpGateUrlWithoutPort;
|
|
||||||
mainGatePort = gatePort;
|
|
||||||
chatGateUrl = tmpChatUrlWithoutPort;
|
|
||||||
chatGatePort = chatPort;
|
|
||||||
vsnHttpUrl = tmpVsnUrlWithoutPort;
|
|
||||||
vsnHttpPort = vsnPort;
|
|
||||||
|
|
||||||
//暂时保留原格式
|
|
||||||
_channelGate = new BFGateInfo(mainGateUrl, mainGatePort, chatGateUrl, chatGatePort);
|
|
||||||
_vsnUrl = new BFHttpsInfo(vsnHttpUrl, vsnHttpPort);
|
|
||||||
|
|
||||||
payUrl = tmpPayUrl;
|
|
||||||
communityWebUrl = tmpCommunityWebUrl;
|
|
||||||
communitySrvUrl = tmpCommunitySrvUrl;
|
|
||||||
aicsHttpUrl = tmpAicsHttpUrl;
|
|
||||||
aicsWebSocketUrl = tmpAicsWebSocketUrl;
|
|
||||||
|
|
||||||
BFLog.Log("解析后的地址 gate:{0} gatePort:{1} chat:{2} chatPort:{3} vsn:{4} vsnPort:{5} payUrl:{6} communityWebUrl:{7} communitySrvUrl:{8} aicsHttpUrl:{9} aicsWebSocketUrl:{10}", mainGateUrl, gatePort, chatGateUrl, chatPort, vsnHttpUrl, vsnPort, payUrl, communityWebUrl, communitySrvUrl, aicsHttpUrl, aicsWebSocketUrl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BFLog.LogError("GetUrlsFromLoginCenter Error,JSON is null or empty");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得集群类型 (1-普通,2-审核,3-测试)
|
/// 获得集群类型 (1-普通,2-审核,3-测试)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -255,31 +139,117 @@ namespace BF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否是内网渠道
|
|
||||||
/// </summary>
|
|
||||||
public static bool IsDevChannel()
|
|
||||||
{
|
|
||||||
return Identifier == "com.juzu.b6.dev" ||
|
|
||||||
Identifier == "com.juzu.b6.dev.android" ||
|
|
||||||
Identifier == "com.juzu.b6.dev.ios";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否是外网测试渠道
|
|
||||||
/// </summary>
|
|
||||||
public static bool IsReleaseChannel()
|
|
||||||
{
|
|
||||||
return Identifier == "com.juzu.b6.release.android" ||
|
|
||||||
Identifier == "com.juzu.b6.release.ios";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否是正式发布渠道
|
/// 是否是正式发布渠道
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool IsPublishChannel()
|
public static bool IsPublishChannel()
|
||||||
{
|
{
|
||||||
return !IsDevChannel() && !IsReleaseChannel();
|
#if UNITY_EDITOR || BF_APP_DEV || BF_APP_TEST
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME ||
|
||||||
|
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_GLOBAL ||
|
||||||
|
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE ||
|
||||||
|
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW ||
|
||||||
|
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU)
|
||||||
|
{
|
||||||
|
// 深度链接可以强制改为内网环境
|
||||||
|
if (BFMain.DPIsLan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsRuPackage()
|
||||||
|
{
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否使用ru支付
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsSupportRuPay()
|
||||||
|
{
|
||||||
|
#if BF_APP_DEV || BF_APP_TEST
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否使用ru商店好评
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsSupportRuStoreReview()
|
||||||
|
{
|
||||||
|
#if BF_APP_DEV || BF_APP_TEST
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 这是Facebook SDK
|
||||||
|
public static bool IsSupportFB()
|
||||||
|
{
|
||||||
|
#if BF_APP_DEV || BF_APP_TEST
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsSupportGDPR()
|
||||||
|
{
|
||||||
|
#if BF_APP_DEV || BF_APP_TEST
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
// 这是Facebook广告SDK
|
||||||
|
|
||||||
|
public static bool IsSupportFBAD()
|
||||||
|
{
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsSupportVK()
|
||||||
|
{
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -345,11 +315,19 @@ namespace BF
|
|||||||
|
|
||||||
public static string GetLoginCenterURL()
|
public static string GetLoginCenterURL()
|
||||||
{
|
{
|
||||||
if (BFLoginCenterURLDict.TryGetValue(Identifier, out string url))
|
#if BF_APP_DEV || UNITY_EDITOR
|
||||||
|
return LoginCenterURLDev;
|
||||||
|
#else
|
||||||
|
if (BFMain.DPIsLan)
|
||||||
{
|
{
|
||||||
return url;
|
return LoginCenterURLDev;
|
||||||
|
}
|
||||||
|
if (IsRuPackage())
|
||||||
|
{
|
||||||
|
return LoginCenterURLRU;
|
||||||
}
|
}
|
||||||
return LoginCenterURL;
|
return LoginCenterURL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetPayCenterURL()
|
public static string GetPayCenterURL()
|
||||||
@ -383,5 +361,22 @@ namespace BF
|
|||||||
{
|
{
|
||||||
return aicsWebSocketUrl;
|
return aicsWebSocketUrl;
|
||||||
}
|
}
|
||||||
|
//region 华为支付
|
||||||
|
/// <summary>
|
||||||
|
/// 是否使用hw支付
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsSupportHWPay()
|
||||||
|
{
|
||||||
|
#if BF_APP_DEV || BF_APP_TEST
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
//regionend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,14 +42,14 @@ namespace BF
|
|||||||
// 渠道对应的语言配置
|
// 渠道对应的语言配置
|
||||||
public static Dictionary<string, BFLanguageInfo> languageInfos = new Dictionary<string, BFLanguageInfo>()
|
public static Dictionary<string, BFLanguageInfo> languageInfos = new Dictionary<string, BFLanguageInfo>()
|
||||||
{
|
{
|
||||||
{"com.juzu.b6.dev", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
{"com.juzu.b13.dev", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||||
{"com.juzu.b6.dev.android", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
{"com.juzu.b13.dev.android", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||||
{"com.juzu.b6.dev.ios", new BFLanguageInfo(new List<string>{"en", "cn"})},
|
{"com.juzu.b13.dev.ios", new BFLanguageInfo(new List<string>{"en", "cn"})},
|
||||||
{"com.juzu.b6.release.android", new BFLanguageInfo(new List<string>{"en"})},
|
{"com.juzu.b13.release.android", new BFLanguageInfo(new List<string>{"en"})},
|
||||||
{"com.juzu.b6.release.ios", new BFLanguageInfo(new List<string>{"en"})},
|
{"com.juzu.b13.release.ios", new BFLanguageInfo(new List<string>{"en"})},
|
||||||
// 这个是gp渠道
|
{"com.gearpaw.defenders.td.game", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||||
{"com.combo.heroes.puzzle.rpg", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
{"com.gearpaw.defenders.td.game.ru", new BFLanguageInfo(new List<string>{"en", "cn", "zh", "th", "ru", "id", "vi"})},
|
||||||
{"com.juzu.b6.ios", new BFLanguageInfo(new List<string>{"en"})},
|
{"com.juzu.b13.ios", new BFLanguageInfo(new List<string>{"en"})},
|
||||||
};
|
};
|
||||||
|
|
||||||
public static BFLanguageInfo GetLanguageInfo(string identifier)
|
public static BFLanguageInfo GetLanguageInfo(string identifier)
|
||||||
|
|||||||
@ -37,6 +37,20 @@ namespace BF
|
|||||||
public const bool SKIP_VERSION = false;
|
public const bool SKIP_VERSION = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if BF_APP_DEV
|
||||||
|
public const bool BF_APP_DEV = true;
|
||||||
|
public const bool BF_APP_TEST = false;
|
||||||
|
public const bool BF_APP_PUBLISH = false;
|
||||||
|
#elif BF_APP_TEST
|
||||||
|
public const bool BF_APP_DEV = false;
|
||||||
|
public const bool BF_APP_TEST = true;
|
||||||
|
public const bool BF_APP_PUBLISH = false;
|
||||||
|
#else
|
||||||
|
public const bool BF_APP_DEV = false;
|
||||||
|
public const bool BF_APP_TEST = false;
|
||||||
|
public const bool BF_APP_PUBLISH = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
public static char[] C_FREE_CHAR = new char[16] {
|
public static char[] C_FREE_CHAR = new char[16] {
|
||||||
(char)('g' ^ (0x29 - 0)),
|
(char)('g' ^ (0x29 - 0)),
|
||||||
(char)('w' ^ (0x29 - 1)),
|
(char)('w' ^ (0x29 - 1)),
|
||||||
|
|||||||
28
Assets/Scripts/Utils/TimeHelper.cs
Normal file
28
Assets/Scripts/Utils/TimeHelper.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace BF
|
||||||
|
{
|
||||||
|
public static class TimeHelper
|
||||||
|
{
|
||||||
|
public static long GetDayBeginTimestamp(long timestamp, int timeZoneOffset)
|
||||||
|
{
|
||||||
|
// 将时间戳转换为UTC时间
|
||||||
|
DateTime utcTime = DateTimeOffset.FromUnixTimeSeconds(timestamp).UtcDateTime;
|
||||||
|
// 应用时区偏移(不考虑夏令时)
|
||||||
|
if (timeZoneOffset != 0)
|
||||||
|
{
|
||||||
|
utcTime = utcTime.AddHours(timeZoneOffset);
|
||||||
|
}
|
||||||
|
// 构造当天0点的UTC时间
|
||||||
|
DateTime utcDayBegin = new DateTime(utcTime.Year, utcTime.Month, utcTime.Day, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
// 减去时区偏移量恢复UTC时间
|
||||||
|
if (timeZoneOffset != 0)
|
||||||
|
{
|
||||||
|
utcDayBegin = utcDayBegin.AddHours(-timeZoneOffset);
|
||||||
|
}
|
||||||
|
// 转换为时间戳并减去时区偏移
|
||||||
|
long utcDayBeginTimestamp = new DateTimeOffset(utcDayBegin).ToUnixTimeSeconds();
|
||||||
|
return utcDayBeginTimestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Utils/TimeHelper.cs.meta
Normal file
11
Assets/Scripts/Utils/TimeHelper.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c322159b684af9d4eb38fbfe9b9ed89a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -22,6 +22,8 @@ namespace BF
|
|||||||
|
|
||||||
private static bool c_free_flag = false;
|
private static bool c_free_flag = false;
|
||||||
private static bool c_config_flag = false;
|
private static bool c_config_flag = false;
|
||||||
|
private static string DefaultSpecialPatternStr = "[【】\\[\\]\\^*×―%@@##$…&¥=<>《》::•`·~;;\\\\/\'\"{}‘’“”]";
|
||||||
|
public static string CustomSpecialPatternStr = "[【】\\[\\]\\^*×―%@@##$…&¥=<>《》::•`·~;;\\\\/\'\"{}‘’“”]";
|
||||||
|
|
||||||
public static char[] GetFreeChar()
|
public static char[] GetFreeChar()
|
||||||
{
|
{
|
||||||
@ -98,6 +100,15 @@ namespace BF
|
|||||||
return lp;
|
return lp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector3 LocalPointInRectangleToWorld(RectTransform rt, float planeZ, Camera uiCam, Camera main)
|
||||||
|
{
|
||||||
|
var screenPoint = uiCam.WorldToScreenPoint(rt.transform.position);
|
||||||
|
Vector3 position = new Vector3(screenPoint.x, screenPoint.y, 0);
|
||||||
|
Vector3 result = main.ScreenToWorldPoint(position);
|
||||||
|
result.z = planeZ;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool RectangleContainsScreenPoint(RectTransform rt, float x, float y, Camera cam)
|
public static bool RectangleContainsScreenPoint(RectTransform rt, float x, float y, Camera cam)
|
||||||
{
|
{
|
||||||
return RectTransformUtility.RectangleContainsScreenPoint(rt, new Vector2(x, y), cam);
|
return RectTransformUtility.RectangleContainsScreenPoint(rt, new Vector2(x, y), cam);
|
||||||
@ -271,5 +282,22 @@ namespace BF
|
|||||||
};
|
};
|
||||||
return Convert.ToBase64String(sha1);
|
return Convert.ToBase64String(sha1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsSpecialChar(string str, bool useDefaultPattern)
|
||||||
|
{
|
||||||
|
Regex regExp;
|
||||||
|
if (useDefaultPattern)
|
||||||
|
{
|
||||||
|
regExp = new Regex(DefaultSpecialPatternStr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
regExp = new Regex(CustomSpecialPatternStr);
|
||||||
|
}
|
||||||
|
if(regExp.IsMatch(str)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
71
Assets/ThirdParty/AppsFlyer/AFAdRevenueData.cs
vendored
Normal file
71
Assets/ThirdParty/AppsFlyer/AFAdRevenueData.cs
vendored
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AppsFlyerSDK
|
||||||
|
{
|
||||||
|
public enum MediationNetwork : ulong
|
||||||
|
{
|
||||||
|
GoogleAdMob = 1,
|
||||||
|
IronSource = 2,
|
||||||
|
ApplovinMax = 3,
|
||||||
|
Fyber = 4,
|
||||||
|
Appodeal = 5,
|
||||||
|
Admost = 6,
|
||||||
|
Topon = 7,
|
||||||
|
Tradplus = 8,
|
||||||
|
Yandex = 9,
|
||||||
|
ChartBoost = 10,
|
||||||
|
Unity = 11,
|
||||||
|
ToponPte = 12,
|
||||||
|
Custom = 13,
|
||||||
|
DirectMonetization = 14
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AdRevenueScheme
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* code ISO 3166-1 format
|
||||||
|
*/
|
||||||
|
public const string COUNTRY = "country";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the ad unit for the impression
|
||||||
|
*/
|
||||||
|
public const string AD_UNIT = "ad_unit";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format of the ad
|
||||||
|
*/
|
||||||
|
public const string AD_TYPE = "ad_type";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the ad placement for the impression
|
||||||
|
*/
|
||||||
|
public const string PLACEMENT = "placement";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
// Data class representing ad revenue information.
|
||||||
|
//
|
||||||
|
// @property monetizationNetwork The name of the network that monetized the ad.
|
||||||
|
// @property mediationNetwork An instance of MediationNetwork representing the mediation service used.
|
||||||
|
// @property currencyIso4217Code The ISO 4217 currency code describing the currency of the revenue.
|
||||||
|
// @property eventRevenue The amount of revenue generated by the ad.
|
||||||
|
/// </summary>
|
||||||
|
public class AFAdRevenueData
|
||||||
|
{
|
||||||
|
public string monetizationNetwork { get; private set; }
|
||||||
|
public MediationNetwork mediationNetwork { get; private set; }
|
||||||
|
public string currencyIso4217Code { get; private set; }
|
||||||
|
public double eventRevenue { get; private set; }
|
||||||
|
|
||||||
|
public AFAdRevenueData(string monetization, MediationNetwork mediation, string currency, double revenue)
|
||||||
|
{
|
||||||
|
monetizationNetwork = monetization;
|
||||||
|
mediationNetwork = mediation;
|
||||||
|
currencyIso4217Code = currency;
|
||||||
|
eventRevenue = revenue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/ThirdParty/AppsFlyer/AFAdRevenueData.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AFAdRevenueData.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 49e1906ae949e4bfea400bd1da9f7e39
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
34
Assets/ThirdParty/AppsFlyer/AFAdRevenueEvent.cs
vendored
34
Assets/ThirdParty/AppsFlyer/AFAdRevenueEvent.cs
vendored
@ -1,34 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class AFAdRevenueEvent {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*Pre-defined keys for non-mandatory dictionary
|
|
||||||
*Code ISO 3166-1 format
|
|
||||||
**/
|
|
||||||
public const string COUNTRY = "country";
|
|
||||||
|
|
||||||
/**
|
|
||||||
*ID of the ad unit for the impression
|
|
||||||
**/
|
|
||||||
public const string AD_UNIT = "ad_unit";
|
|
||||||
|
|
||||||
/**
|
|
||||||
*Format of the ad
|
|
||||||
**/
|
|
||||||
public const string AD_TYPE = "ad_type";
|
|
||||||
|
|
||||||
/**
|
|
||||||
*ID of the ad placement for the impression
|
|
||||||
**/
|
|
||||||
public const string PLACEMENT = "placement";
|
|
||||||
|
|
||||||
/**
|
|
||||||
*Provided by Facebook Audience Network only, and will be reported to publishers
|
|
||||||
*approved by Facebook Audience Network within the closed beta
|
|
||||||
**/
|
|
||||||
public const string ECPM_PAYLOAD = "ecpm_payload";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 597a8e5b837f64353b0aa9af2fe9aa84
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
35
Assets/ThirdParty/AppsFlyer/AFPurchaseDetailsAndroid.cs
vendored
Normal file
35
Assets/ThirdParty/AppsFlyer/AFPurchaseDetailsAndroid.cs
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AppsFlyerSDK
|
||||||
|
{
|
||||||
|
public enum AFPurchaseType
|
||||||
|
{
|
||||||
|
Subscription = 0,
|
||||||
|
OneTimePurchase = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
//
|
||||||
|
/// </summary>
|
||||||
|
public class AFPurchaseDetailsAndroid
|
||||||
|
|
||||||
|
{
|
||||||
|
public AFPurchaseType purchaseType { get; private set; }
|
||||||
|
public string purchaseToken { get; private set; }
|
||||||
|
public string productId { get; private set; }
|
||||||
|
public string price { get; private set; }
|
||||||
|
public string currency { get; private set; }
|
||||||
|
|
||||||
|
public AFPurchaseDetailsAndroid(AFPurchaseType type, String purchaseToken, String productId, String price, String currency)
|
||||||
|
{
|
||||||
|
this.purchaseType = type;
|
||||||
|
this.purchaseToken = purchaseToken;
|
||||||
|
this.productId = productId;
|
||||||
|
this.price = price;
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/ThirdParty/AppsFlyer/AFPurchaseDetailsAndroid.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AFPurchaseDetailsAndroid.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d71b3864006f94ac08938b2ebdc940bc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
30
Assets/ThirdParty/AppsFlyer/AFSDKPurchaseDetailsIOS.cs
vendored
Normal file
30
Assets/ThirdParty/AppsFlyer/AFSDKPurchaseDetailsIOS.cs
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AppsFlyerSDK
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
//
|
||||||
|
/// </summary>
|
||||||
|
public class AFSDKPurchaseDetailsIOS
|
||||||
|
{
|
||||||
|
public string productId { get; private set; }
|
||||||
|
public string price { get; private set; }
|
||||||
|
public string currency { get; private set; }
|
||||||
|
public string transactionId { get; private set; }
|
||||||
|
|
||||||
|
private AFSDKPurchaseDetailsIOS(string productId, string price, string currency, string transactionId)
|
||||||
|
{
|
||||||
|
this.productId = productId;
|
||||||
|
this.price = price;
|
||||||
|
this.currency = currency;
|
||||||
|
this.transactionId = transactionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AFSDKPurchaseDetailsIOS Init(string productId, string price, string currency, string transactionId)
|
||||||
|
{
|
||||||
|
return new AFSDKPurchaseDetailsIOS(productId, price, currency, transactionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/ThirdParty/AppsFlyer/AFSDKPurchaseDetailsIOS.cs.meta
vendored
Normal file
11
Assets/ThirdParty/AppsFlyer/AFSDKPurchaseDetailsIOS.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 44bb6c4472701416080eb050732075ea
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
38
Assets/ThirdParty/AppsFlyer/AFSDKValidateAndLogResult.cs
vendored
Normal file
38
Assets/ThirdParty/AppsFlyer/AFSDKValidateAndLogResult.cs
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AppsFlyerSDK
|
||||||
|
{
|
||||||
|
public enum AFSDKValidateAndLogStatus
|
||||||
|
{
|
||||||
|
AFSDKValidateAndLogStatusSuccess,
|
||||||
|
AFSDKValidateAndLogStatusFailure,
|
||||||
|
AFSDKValidateAndLogStatusError
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
//
|
||||||
|
/// </summary>
|
||||||
|
public class AFSDKValidateAndLogResult
|
||||||
|
{
|
||||||
|
public AFSDKValidateAndLogStatus status { get; private set; }
|
||||||
|
public Dictionary<string, object> result { get; private set; }
|
||||||
|
public Dictionary<string, object> errorData { get; private set; }
|
||||||
|
public string error { get; private set; }
|
||||||
|
|
||||||
|
private AFSDKValidateAndLogResult(AFSDKValidateAndLogStatus status, Dictionary<string, object> result, Dictionary<string, object> errorData, string error)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
this.result = result;
|
||||||
|
this.errorData = errorData;
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AFSDKValidateAndLogResult Init(AFSDKValidateAndLogStatus status, Dictionary<string, object> result, Dictionary<string, object> errorData, string error)
|
||||||
|
{
|
||||||
|
return new AFSDKValidateAndLogResult(status, result, errorData, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user