Compare commits
704 Commits
v1.0
...
issue-78-组件池化
| Author | SHA1 | Date | |
|---|---|---|---|
| bf14b59a28 | |||
| 0a0f64510f | |||
| 9445c735c3 | |||
| 7339e7ecec | |||
| 79f7c89e23 | |||
| e724e5a1ba | |||
| fdaa94a61d | |||
| 6af0074c36 | |||
| 97a69fed09 | |||
| 959879440d | |||
| fd1bbb0e00 | |||
| 072e68cf43 | |||
| 610232e6b0 | |||
| 69c46f32eb | |||
| 06b3f92007 | |||
| c631290049 | |||
| f41c1a3ca3 | |||
| bd6ba84087 | |||
| 1512409eb3 | |||
| bcb5feeb1c | |||
| da8b7cf601 | |||
| 316527c459 | |||
| da70818b22 | |||
| 5ea3b72b2b | |||
| 632864b361 | |||
| 952247def0 | |||
| 51debede52 | |||
| ce7b731bcf | |||
| 86e2dc8fdb | |||
| 78047134c2 | |||
| 125a1686ab | |||
| d542ac48b8 | |||
| 1ac0227c90 | |||
| a5e70bcd99 | |||
| 38763de7f6 | |||
| db73b077c5 | |||
| 0969d09da1 | |||
| a07108a431 | |||
| 6693b56ab8 | |||
| a7349bd360 | |||
| e92c0040b5 | |||
| f448fa48c4 | |||
| aa33cad4fa | |||
| d0cb7d5359 | |||
| 90153b98fe | |||
| 8c4e8d523e | |||
| 90ad4b3ec4 | |||
| 62bc6b547e | |||
| be11060674 | |||
| d62bf9f7f9 | |||
| 61fcd52c65 | |||
| 2947ddeb64 | |||
| d9b752c180 | |||
| b82891caee | |||
| 05f04ef37e | |||
| 66dc9780b9 | |||
| d48b22c656 | |||
| 727b1864eb | |||
| de3bfd7551 | |||
| dedb91379f | |||
| 1dfcd008aa | |||
| cf2dc91af6 | |||
| a66f80a766 | |||
| f4e49c316e | |||
| d1cd72bbb2 | |||
| 6178851def | |||
| 945f772c30 | |||
| b546c9c712 | |||
| 413ce93b31 | |||
| cffe32911d | |||
| 4f651eb42e | |||
| 6da1585b6b | |||
| b988e81a1b | |||
| 1a1c1087d2 | |||
| 1a1549230f | |||
| 64ea53eba1 | |||
| 5e052a7e7d | |||
| cf9ea495d0 | |||
| 9603c6423b | |||
| 457eef585e | |||
| 1ade449c4d | |||
| aa9d73a810 | |||
| cc266a7ba9 | |||
| d8ea324018 | |||
| 60566e8d78 | |||
| 306d2994dc | |||
| e6a8791fc3 | |||
| 6cbbc06998 | |||
| 0b4244fd8e | |||
| 367ddfbf8a | |||
| 168e028098 | |||
| 042ded37d2 | |||
| 4137eb2bce | |||
| 20a3f03e12 | |||
| 7792710694 | |||
| dbddbbdfb8 | |||
| 4869f5741e | |||
| bda547dd2e | |||
| ef80b03a44 | |||
| 6e511ae949 | |||
| 94541d0abb | |||
| 586a0e5d14 | |||
| 814842dbaf | |||
| 70a993573f | |||
| 21659cbb13 | |||
| a44251cc55 | |||
| 69616bbddc | |||
| 0a1d7ac083 | |||
| 364bc4cdab | |||
| 2504eb24e1 | |||
| bdbef0bd0d | |||
| e4e38ee4e6 | |||
| 021e892e33 | |||
| c27d5022fd | |||
| 6730a5d625 | |||
| 32092f992d | |||
| a5f0c8f6b5 | |||
| 85cd93e51a | |||
| 0b7e623748 | |||
| 62f250b43c | |||
| 25136349ff | |||
| baeb047e27 | |||
| 56dd18b983 | |||
| 86cb70a94f | |||
| 9f76d37a82 | |||
| a026ed9428 | |||
| c178e2fbcc | |||
| b88bb1dc87 | |||
| 3069e28224 | |||
| d69b3af99b | |||
| 7398b7c6d0 | |||
| 5d57904d22 | |||
| 7daf352a25 | |||
| 6a49f6a534 | |||
| 5bce08683a | |||
| edc60fc3d8 | |||
| 1361fd8a90 | |||
| d539bb3dd9 | |||
| 3b9ae4f384 | |||
| 2783448de5 | |||
| 6e21ff08d5 | |||
| e56278e4a6 | |||
| fc9bf816dd | |||
| 854fd7df3a | |||
| 87dd564a12 | |||
| 2d389308ea | |||
| ea8523be35 | |||
| 4479f0fab0 | |||
| 7a000318a6 | |||
| 9a08ae74b6 | |||
| f3d2950df3 | |||
| 8cfba4a166 | |||
| 51e6bba2a7 | |||
| ccbfa78070 | |||
| 69655f1936 | |||
| 6ea366cfed | |||
| b7d17fb16d | |||
| f3dc8c6344 | |||
| 69ec545854 | |||
| 65386ff731 | |||
| 01fa33e122 | |||
| 0411aa9aef | |||
| 4a5c890121 | |||
| 4c11fdc176 | |||
| d99e7a45ea | |||
| 52528ff1b7 | |||
| 4a9317f3f4 | |||
| 9450dd5869 | |||
| d5471e4828 | |||
| 2f71785add | |||
| 608f5030b2 | |||
| dd8f3714ed | |||
| abec2b3648 | |||
| ea06a9f07d | |||
| 9f54759cc5 | |||
| 55dd5f9ed0 | |||
| 05455421fb | |||
| af61067f08 | |||
| 19cda88248 | |||
| 0edb2738a1 | |||
| e1bc364525 | |||
| 2925ee380d | |||
| 731edf5872 | |||
| 7b85039b17 | |||
| 2bc45fa574 | |||
| d2b4455205 | |||
| bce4a26197 | |||
| 1da5040d60 | |||
| afd33e053b | |||
| 171d03c006 | |||
| 34d5237aaa | |||
| 037c3d6a05 | |||
| 5596ba634e | |||
| a5f69065f4 | |||
| 969ef249ea | |||
| a37183851f | |||
| 4cf3e1a769 | |||
| 354e5a2761 | |||
| c9fd8cc2a7 | |||
| bb19f752a1 | |||
| 6bd9c1055c | |||
| dff77097c6 | |||
| b4dc1c5661 | |||
| 992338d924 | |||
| f88a402b0c | |||
| 5938d36149 | |||
| 78577db3f9 | |||
| 0b4a6b77e2 | |||
| 01084a8897 | |||
| 0f18a1979e | |||
| 68a615bc7b | |||
| add1068c1a | |||
| 7a40df9965 | |||
| 3e6a1aa59a | |||
| d3fe79cf39 | |||
| 48fa547c8f | |||
| 80e2f7df71 | |||
| 0107f1f58a | |||
| d29c9a96f4 | |||
| 37d75c3281 | |||
| 666ded7b89 | |||
| 73a882f75e | |||
| 310f5f2349 | |||
| 8c86d6b696 | |||
| 82cd163adc | |||
| 802ee25621 | |||
| f48ebb65ba | |||
| aaa2a8ed2c | |||
| 5a06f5420b | |||
| 343f5a44f2 | |||
| 92125aee3a | |||
| 96f651b7ca | |||
| 06ea01e928 | |||
| 577f1e429a | |||
| 7808f64fe5 | |||
| e6789e49e4 | |||
| 797619aece | |||
| 1b5363611d | |||
| 103f773286 | |||
| d9ef0b587e | |||
| d5b98256f0 | |||
| efcceaa898 | |||
| e4aad11965 | |||
| 47207fad52 | |||
| 202bf82896 | |||
| 0e3274a743 | |||
| b06174926d | |||
| abb23a3c02 | |||
| 0c8f232282 | |||
| ef023d27bf | |||
| 7a591825eb | |||
| e71c49d596 | |||
| e6ce8995ba | |||
| f6250b6d5b | |||
| 757eff2937 | |||
| 996a7f3ddf | |||
| 94c050bacb | |||
| 3f4aa59a29 | |||
| bee7cf4278 | |||
| b9db6f0b40 | |||
| 8967cba3c7 | |||
| d04ad2eea9 | |||
| f2d3880a06 | |||
| ec5f70ecfc | |||
| 40b3fe7165 | |||
| 4095f1e946 | |||
| e219fc47ba | |||
| 6e2e7a4af5 | |||
| 2e7f764d6c | |||
| ce64de5b3d | |||
| 35ca1dd7ea | |||
| 8d0ad6b871 | |||
| 0aa4791cf7 | |||
| 082c2b46d0 | |||
| 50420f9052 | |||
| 499cbf8a60 | |||
| 2e38284d6e | |||
| 00cc3a11c6 | |||
| 9909a7f7b0 | |||
| 3363fca160 | |||
| 78e0b09c7a | |||
| caa3ffc8f5 | |||
| 323fb6a5fe | |||
| 1adc5f1729 | |||
| 78079252c9 | |||
| 72fdabd099 | |||
| 64bd6aa055 | |||
| 6329200b84 | |||
| 3f3fd16110 | |||
| 34f0c4ac2d | |||
| dde04d514e | |||
| ffddadd798 | |||
| 5dca337b92 | |||
| 131df181e6 | |||
| e207952786 | |||
| 3f7ef284fc | |||
| 1a41533d15 | |||
| 85f7bbbf1a | |||
| ccc603b59f | |||
| 8135f99616 | |||
| 713f4ae18b | |||
| f3f5d0bbd1 | |||
| 4a9e11c480 | |||
| cd94326aad | |||
| a4b971bba0 | |||
| 5d1609111c | |||
| d54ccaf629 | |||
| 6adea240e2 | |||
| 3486d403d2 | |||
| f533186c8d | |||
| 0beadf8e5a | |||
| 8bc06f0476 | |||
| 8fd8f74b27 | |||
| 9fc9b60de5 | |||
| 2a026726db | |||
| f9a99f8b09 | |||
| 95b8dc765d | |||
| 052d6e25e7 | |||
| fd82486bbc | |||
| ef07f7555f | |||
| 67859b7be0 | |||
| 1e5ddadd00 | |||
| 7bab76d765 | |||
| 416f243bda | |||
| 77ad112f67 | |||
| dc3d639824 | |||
| 13a001c258 | |||
| 85bdd97d48 | |||
| 3d9c8699e7 | |||
| ea482dab48 | |||
| 96a41eb2cc | |||
| e5dfb20aa2 | |||
| fe308d35f2 | |||
| 219b90fc5d | |||
| 44e2ca07e5 | |||
| 79d684caae | |||
| 4db8734a34 | |||
| 8b7baf7f86 | |||
| 28145e876f | |||
| 53625cf87b | |||
| 88f9779dd0 | |||
| 561a44b26b | |||
| 26068aaf6f | |||
| fb0f9dc608 | |||
| 6c44d38c10 | |||
| da3ab02a8d | |||
| 9c7703eb2d | |||
| 84922794fb | |||
| 1dcce99d87 | |||
| fd62aa469a | |||
| 63d307b95a | |||
| 9f12971eda | |||
| 47edd4f583 | |||
| e94b7b23e4 | |||
| 5c77e6c56d | |||
| 522cbe0e6e | |||
| f7061f360d | |||
| 16cdfa0426 | |||
| 74bd0c161f | |||
| da595e1eb9 | |||
| 5277c0de7d | |||
| b3c85e00f9 | |||
| 0748652a8d | |||
| 9fa0442b20 | |||
| bc6920f829 | |||
| d576a95548 | |||
| 99eca546d2 | |||
| b5d0fc6d0d | |||
| 17b36f01b0 | |||
| 5a6d1c72fe | |||
| 030fade7b6 | |||
| 60177d5a8e | |||
| a28fb72e36 | |||
| 5e15543bab | |||
| e1365ed343 | |||
| abb5d10a54 | |||
| c58ca510cc | |||
| 781bad9573 | |||
| 7e94f42b10 | |||
| 0b8d752773 | |||
| e6096b644f | |||
| 6b2c18ad75 | |||
| 8b5bc444f1 | |||
| d2915fe30c | |||
| b9522ade5d | |||
| f6513a0cf3 | |||
| d7ec4d087c | |||
| 25fca1ed56 | |||
| b9822f2270 | |||
| 11d03cef0c | |||
| 1c9276b4a1 | |||
| 4f7cfb087a | |||
| 93768fb4d9 | |||
| f6b6a8aa1b | |||
| 1be5862dc4 | |||
| 3e182db019 | |||
| 8ac1eba378 | |||
| eca9ba7b82 | |||
| 6699c32f73 | |||
| cadaeda3bf | |||
| 62acd38492 | |||
| 01c6c306b1 | |||
| 1de1b6e05f | |||
| 6f1fc314b6 | |||
| d84ffcc2b7 | |||
| f934890fac | |||
| ebc1ab649e | |||
| 0738e51852 | |||
| 90d84f9316 | |||
| fa10d5d4d5 | |||
| 8ed3eb24c3 | |||
| c60fe13d71 | |||
| 59c8d456cb | |||
| c0450f21b6 | |||
| 0e7dc67d9d | |||
| f38b5261d5 | |||
| 8230d9cd9b | |||
| 24da0b79c2 | |||
| 1c6bb682ea | |||
| 9d2d96c52a | |||
| e455785140 | |||
| dabbe0b6e7 | |||
| 4c123ed0ec | |||
| 838795fd34 | |||
| c398c714a3 | |||
| 8c5e4537a6 | |||
| 06b2163aaa | |||
| cf492daa93 | |||
| bddae046a0 | |||
| 2a0d4ef4dd | |||
| 8b3b645fbb | |||
| c8096e3334 | |||
| 89d1d9c6c3 | |||
| c2cd3b9c44 | |||
| 9654a4d8c9 | |||
| 9d0c583399 | |||
| c59c822fbf | |||
| 2a257ec5b2 | |||
| 8ce6b53cd5 | |||
| 5ce44651bf | |||
| dac0ef1507 | |||
| 57c39e9091 | |||
| 4f6d3cb10e | |||
| 4665d1d0ea | |||
| 89cfd5388f | |||
| f41179965d | |||
| f8f83c52a1 | |||
| 83b88039e4 | |||
| 23a7d8af23 | |||
| b2ebd5ee94 | |||
| f9284e9d8e | |||
| 0d8878abef | |||
| 0137309d3a | |||
| 4c329881a1 | |||
| 3b4a3fad5a | |||
| bac1ce5b7a | |||
| 6113fd9986 | |||
| ae2cfdafdd | |||
| de3f7bff60 | |||
| 97dfcb4c04 | |||
| 1bb1b8704b | |||
| 918d998f4c | |||
| 24edbdd025 | |||
| 015a3b633a | |||
| 101d720f2a | |||
| 8b76eb3ccc | |||
| 1e8d2172bc | |||
| 8bc367ab48 | |||
| 73b484d894 | |||
| 5c0ee92d85 | |||
| e67f568069 | |||
| 5845128479 | |||
| 6505f31ad5 | |||
| 30cc74c8eb | |||
| eb0787c198 | |||
| 0f17aff8fd | |||
| 14a73e4010 | |||
| 0fd6a24f5a | |||
| 7eab688d9c | |||
| 562bacbe22 | |||
| 8b423310a6 | |||
| 7268ebab4a | |||
| 8191359953 | |||
| c9fc9ffea5 | |||
| 1a78dada61 | |||
| 85cc4b4ecc | |||
| fc6a8a0803 | |||
| 3d8cdaf46c | |||
| 0e7b0bc45c | |||
| 74fcfd7778 | |||
| c9c745c730 | |||
| dd994cb16d | |||
| 861ef3db31 | |||
| f33bac012a | |||
| 4294632909 | |||
| 449ca74e44 | |||
| 52980f0b55 | |||
| 8e97dcda9c | |||
| 4ce810bdcd | |||
| 24a463b85b | |||
| 700d0194be | |||
| 34a8d48df9 | |||
| 8db028db1c | |||
| 358e899e8b | |||
| 7a308f76b6 | |||
| a3c53116e1 | |||
| d07912d610 | |||
| e81f98ff17 | |||
| 1997b3f348 | |||
| 0ab0728ddf | |||
| 46a8de39e3 | |||
| 794e33a0a0 | |||
| 0bb09f6442 | |||
| 27dea50026 | |||
| a39677062c | |||
| 27f9e78fe5 | |||
| fc0a46d6a8 | |||
| 7345a17d24 | |||
| 6c1cfec928 | |||
| 73f0f54ba7 | |||
| 24705d24f1 | |||
| 646d1806ec | |||
| 6d4d787530 | |||
| 66ef4c6597 | |||
| f7ee2c8d1c | |||
| b3961d8ea1 | |||
| 1a2dd9ff2a | |||
| 21e33495d8 | |||
| 23a45bfd2d | |||
| 593cc83012 | |||
| f0b2d5b9b8 | |||
| 5dc7a72310 | |||
| 89d05726ac | |||
| 15f6b06348 | |||
| a2a73562a0 | |||
| 9111b69cee | |||
| 4290a10d5d | |||
| b0511db001 | |||
| 4012a9f6d1 | |||
| e5805960e0 | |||
| 167ef03df6 | |||
| c89ed25d8a | |||
| 4baaa2629d | |||
| a3dbff63f0 | |||
| c6ef018d5e | |||
| 14b70b307c | |||
| a39b98b5d9 | |||
| 3492bbdf5e | |||
| 7d0bcbcb32 | |||
| c02a3aa071 | |||
| a105bb11ca | |||
| 3fbbba7ac2 | |||
| 7cd38ea54e | |||
| 42852c5dba | |||
| 6a3622a5ef | |||
| 03b568e28d | |||
| e7fb9e0d6b | |||
| 463c64c628 | |||
| 4025bc8554 | |||
| 1bf822725a | |||
| 359d7ae223 | |||
| c611e31f7e | |||
| 834ad565e1 | |||
| ab3f38c6a8 | |||
| d0199e357b | |||
| 8e3bcc1257 | |||
| a4fe9f5798 | |||
| c692f0157e | |||
| bc6626865e | |||
| 40fe7a57db | |||
| 514572f291 | |||
| 5994f0bee3 | |||
| b3e1f2c446 | |||
| ed13186779 | |||
| d730851d97 | |||
| 60921f703b | |||
| 506f8ddc0f | |||
| 149a3e5833 | |||
| 2b13e5ee7d | |||
| 6be43fc9ac | |||
| d4c244daf5 | |||
| 79c5d6990c | |||
| 347626a8ea | |||
| e61dd0c16b | |||
| 1b52bc5fd1 | |||
| 814234ca61 | |||
| 15c0844e29 | |||
| 5b8f414a45 | |||
| 6b8569b0b5 | |||
| 2a38858838 | |||
| e76d5815f2 | |||
| dccd4e21b6 | |||
| c96e8b3a04 | |||
| e686ba64d7 | |||
| 14cb9cd257 | |||
| 13e7737cb9 | |||
| dd65c60921 | |||
| 7dffb4d94a | |||
| 476204a296 | |||
| 983c8fbc99 | |||
| c30e591f6e | |||
| d9a1b5578c | |||
| f0e04b6981 | |||
| 14598f08c7 | |||
| 032b293085 | |||
| d9bb76c105 | |||
| 20392c8ab6 | |||
| 583e03d025 | |||
| f6c2d81a83 | |||
| e703ff4e6c | |||
| 877fc4c9bf | |||
| a80bb4b6f3 | |||
| 9b9d210109 | |||
| 817b703d4f | |||
| 88a25453e6 | |||
| 6e3eb1189a | |||
| 1e3b2763e8 | |||
| a3dacd04f0 | |||
| aea50926a9 | |||
| 299c1b8e7d | |||
| 3f6ab79894 | |||
| b14fee1685 | |||
| ace8fb685d | |||
| 1870ee5e45 | |||
| 8be65fa685 | |||
| cf4e76b12d | |||
| c156463f10 | |||
| e7796550c6 | |||
| c3c9181400 | |||
| 4f4d508685 | |||
| f36a1cdb27 | |||
| 28941f2395 | |||
| 7f02272304 | |||
| 02d86e7b0a | |||
| 4c8b6add98 | |||
| 60d646c392 | |||
| 5e871bc501 | |||
| 549db2fcfe | |||
| d9840d60ef | |||
| 124cf3f66c | |||
| cd78b8de59 | |||
| a3209de000 | |||
| 2908be1705 | |||
| 009a01ebf4 | |||
| 3fdbf3bfef | |||
| c8ecf3cc69 | |||
| 088891c5ca | |||
| 099aa749e1 | |||
| db7aac2b90 | |||
| 366bcf8efc | |||
| a4f1ae351f | |||
| a63d8598d8 | |||
| d7385654ef | |||
| 7399b9f5ca | |||
| 795bfab1aa | |||
| fb5906afe0 | |||
| e38cd0f3ca | |||
| 481112cfc2 | |||
| 3d9730d956 | |||
| 60646edd6b | |||
| 9bd5a99c81 | |||
| d22c5775c2 | |||
| 981e149ca5 | |||
| b83b1a5b21 | |||
| 09e6ace142 | |||
| e83bb087ea | |||
| feaac83ee7 | |||
| 915056203d | |||
| 231276e39b | |||
| 9c293979a4 | |||
| bc995e36c2 | |||
| 18279d16cd | |||
| 59b2f150f3 | |||
| e6d6c4199f | |||
| ccf8c4e107 | |||
| 9e6e5eccc8 | |||
| 447ea4efe4 | |||
| 7f5b78f340 | |||
| 4ac8bafa87 | |||
| 25ce4c9cf9 | |||
| 2b81a0b06b | |||
| e68f6bd1be | |||
| 06c1aeb97a | |||
| ced176706b | |||
| 8b21edc65f | |||
| 75301f7776 | |||
| dba43b9773 | |||
| 5186bc0187 | |||
| c3120d791f | |||
| 16892eb7af | |||
| 7f8f1cf0d0 | |||
| 246e9a9511 | |||
| da5a1a0c79 | |||
| 6fa56dd572 | |||
| ad68f0e1a0 | |||
| 53ded30e0b | |||
| 2eec9a82f9 | |||
| 74cbb4c9fd | |||
| fa4c3c5d0b | |||
| f62f449d99 | |||
| 94818d5784 | |||
| 5f7c13c8cd | |||
| 538677575d | |||
| 1816b16924 |
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"toolchains": [],
|
||||
"backend.maxHeapSizeMb": 896
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: esengine # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: ['https://github.com/esengine/ecs-framework/blob/master/sponsor/alipay.jpg', 'https://github.com/esengine/ecs-framework/blob/master/sponsor/wechatpay.png'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -0,0 +1,84 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, main, develop ]
|
||||
paths:
|
||||
- 'packages/**'
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'tsconfig.json'
|
||||
- 'jest.config.*'
|
||||
- '.github/workflows/ci.yml'
|
||||
pull_request:
|
||||
branches: [ master, main, develop ]
|
||||
paths:
|
||||
- 'packages/**'
|
||||
- 'package.json'
|
||||
- 'package-lock.json'
|
||||
- 'tsconfig.json'
|
||||
- 'jest.config.*'
|
||||
- '.github/workflows/ci.yml'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build core package first
|
||||
run: npm run build:core
|
||||
|
||||
- name: Run tests with coverage
|
||||
run: npm run test:ci
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
file: ./coverage/lcov.info
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build project
|
||||
run: npm run build
|
||||
|
||||
- name: Build npm package
|
||||
run: npm run build:npm
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: |
|
||||
bin/
|
||||
dist/
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,67 @@
|
||||
name: Deploy Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'packages/**'
|
||||
- 'typedoc.json'
|
||||
- 'package.json'
|
||||
- '.github/workflows/docs.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build core package
|
||||
run: npm run build:core
|
||||
|
||||
- name: Generate API documentation
|
||||
run: npm run docs:api
|
||||
|
||||
- name: Build documentation
|
||||
run: npm run docs:build
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: docs/.vitepress/dist
|
||||
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
@@ -1,2 +1,71 @@
|
||||
/source/node_modules
|
||||
/demo/bin-debug
|
||||
# 依赖目录
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# 构建输出
|
||||
bin/
|
||||
dist/
|
||||
*.tgz
|
||||
|
||||
# TypeScript
|
||||
*.tsbuildinfo
|
||||
|
||||
# 临时文件
|
||||
*.tmp
|
||||
*.temp
|
||||
.cache/
|
||||
|
||||
# IDE 配置
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# 操作系统文件
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# 日志文件
|
||||
logs/
|
||||
*.log
|
||||
|
||||
# 环境配置
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# 测试覆盖率
|
||||
coverage/
|
||||
*.lcov
|
||||
|
||||
# 包管理器锁文件(保留npm的,忽略其他的)
|
||||
yarn.lock
|
||||
pnpm-lock.yaml
|
||||
|
||||
# 文档生成
|
||||
docs/api/
|
||||
docs/build/
|
||||
docs/.vitepress/cache/
|
||||
docs/.vitepress/dist/
|
||||
|
||||
# 备份文件
|
||||
*.bak
|
||||
*.backup
|
||||
|
||||
# 演示项目构建产物
|
||||
/demo/bin-debug/
|
||||
/demo/bin-release/
|
||||
/demo/.wing/
|
||||
/demo/.idea/
|
||||
/demo/.vscode/
|
||||
/demo_wxgame/
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
[submodule "thirdparty/BehaviourTree-ai"]
|
||||
path = thirdparty/BehaviourTree-ai
|
||||
url = https://github.com/esengine/BehaviourTree-ai.git
|
||||
[submodule "thirdparty/admin-backend"]
|
||||
path = thirdparty/admin-backend
|
||||
url = https://github.com/esengine/admin-backend.git
|
||||
[submodule "extensions/cocos/cocos-ecs/extensions/cocos-ecs-extension"]
|
||||
path = extensions/cocos/cocos-ecs/extensions/cocos-ecs-extension
|
||||
url = https://github.com/esengine/cocos-ecs-extension.git
|
||||
[submodule "extensions/cocos/cocos-ecs/extensions/behaviour-tree"]
|
||||
path = extensions/cocos/cocos-ecs/extensions/behaviour-tree
|
||||
url = https://github.com/esengine/behaviour-tree.git
|
||||
[submodule "extensions/cocos/cocos-ecs/extensions/cocos-terrain-gen"]
|
||||
path = extensions/cocos/cocos-ecs/extensions/cocos-terrain-gen
|
||||
url = https://github.com/esengine/cocos-terrain-gen.git
|
||||
[submodule "extensions/cocos/cocos-ecs/extensions/mvvm-designer"]
|
||||
path = extensions/cocos/cocos-ecs/extensions/mvvm-designer
|
||||
url = https://github.com/esengine/mvvm-designer.git
|
||||
[submodule "thirdparty/mvvm-ui-framework"]
|
||||
path = thirdparty/mvvm-ui-framework
|
||||
url = https://github.com/esengine/mvvm-ui-framework.git
|
||||
[submodule "thirdparty/cocos-nexus"]
|
||||
path = thirdparty/cocos-nexus
|
||||
url = https://github.com/esengine/cocos-nexus.git
|
||||
[submodule "extensions/cocos/cocos-ecs/extensions/utilityai_designer"]
|
||||
path = extensions/cocos/cocos-ecs/extensions/utilityai_designer
|
||||
url = https://github.com/esengine/utilityai_designer.git
|
||||
[submodule "thirdparty/ecs-astar"]
|
||||
path = thirdparty/ecs-astar
|
||||
url = https://github.com/esengine/ecs-astar.git
|
||||
[submodule "examples/lawn-mower-demo"]
|
||||
path = examples/lawn-mower-demo
|
||||
url = https://github.com/esengine/lawn-mower-demo.git
|
||||
@@ -0,0 +1,40 @@
|
||||
# 源代码文件
|
||||
src/
|
||||
tsconfig*.json
|
||||
*.ts
|
||||
!bin/**/*.d.ts
|
||||
|
||||
# 开发文件
|
||||
dev-bin/
|
||||
scripts/
|
||||
.vscode/
|
||||
.git/
|
||||
.gitignore
|
||||
|
||||
# 测试文件
|
||||
**/*.test.*
|
||||
**/*.spec.*
|
||||
**/test/
|
||||
**/tests/
|
||||
|
||||
# 构建缓存
|
||||
node_modules/
|
||||
*.log
|
||||
*.tmp
|
||||
*.temp
|
||||
|
||||
# 文档草稿
|
||||
docs/draft/
|
||||
*.draft.md
|
||||
|
||||
# 编辑器文件
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# 环境文件
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
@@ -1,11 +1,127 @@
|
||||
# egret-framework
|
||||
用于egret 包含众多高性能方法以供使用
|
||||
(正在施工中)
|
||||
# ECS Framework
|
||||
|
||||
## 计划列表
|
||||
[](https://github.com/esengine/ecs-framework/actions)
|
||||
[](https://badge.fury.io/js/%40esengine%2Fecs-framework)
|
||||
[](https://www.typescriptlang.org/)
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://github.com/esengine/ecs-framework/stargazers)
|
||||
|
||||
- [ ] 包含一套适配egret的ecs框架
|
||||
一个高性能的 TypeScript ECS (Entity-Component-System) 框架,专为现代游戏开发而设计。
|
||||
|
||||
- [ ] 高性能物理引擎
|
||||
## 特性
|
||||
|
||||
> 尽可能的简单易用
|
||||
- **高性能** - 针对大规模实体优化,支持SoA存储和批量处理
|
||||
- **多线程计算** - Worker系统支持真正的并行处理,充分利用多核CPU性能
|
||||
- **类型安全** - 完整的TypeScript支持,编译时类型检查
|
||||
- **现代架构** - 支持多World、多Scene的分层架构设计
|
||||
- **开发友好** - 内置调试工具和性能监控
|
||||
- **跨平台** - 支持Cocos Creator、Laya引擎和Web平台
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
npm install @esengine/ecs-framework
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
|
||||
```typescript
|
||||
import { Core, Scene, Component, EntitySystem, ECSComponent, ECSSystem, Matcher, Time } from '@esengine/ecs-framework';
|
||||
|
||||
// 定义组件
|
||||
@ECSComponent('Position')
|
||||
class Position extends Component {
|
||||
constructor(public x = 0, public y = 0) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@ECSComponent('Velocity')
|
||||
class Velocity extends Component {
|
||||
constructor(public dx = 0, public dy = 0) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
// 创建系统
|
||||
@ECSSystem('Movement')
|
||||
class MovementSystem extends EntitySystem {
|
||||
constructor() {
|
||||
super(Matcher.all(Position, Velocity));
|
||||
}
|
||||
|
||||
protected process(entities: readonly Entity[]): void {
|
||||
for (const entity of entities) {
|
||||
const position = entity.getComponent(Position)!;
|
||||
const velocity = entity.getComponent(Velocity)!;
|
||||
|
||||
position.x += velocity.dx * Time.deltaTime;
|
||||
position.y += velocity.dy * Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 创建场景并启动
|
||||
class GameScene extends Scene {
|
||||
protected initialize(): void {
|
||||
this.addSystem(new MovementSystem());
|
||||
|
||||
const player = this.createEntity("Player");
|
||||
player.addComponent(new Position(100, 100));
|
||||
player.addComponent(new Velocity(50, 0));
|
||||
}
|
||||
}
|
||||
|
||||
// 启动游戏
|
||||
Core.create();
|
||||
Core.setScene(new GameScene());
|
||||
|
||||
// 游戏循环中更新
|
||||
function gameLoop(deltaTime: number) {
|
||||
Core.update(deltaTime);
|
||||
}
|
||||
```
|
||||
|
||||
## 核心特性
|
||||
|
||||
- **实体查询** - 使用 Matcher API 进行高效的实体过滤
|
||||
- **事件系统** - 类型安全的事件发布/订阅机制
|
||||
- **性能优化** - SoA 存储优化,支持大规模实体处理
|
||||
- **多线程支持** - Worker系统实现真正的并行计算,充分利用多核CPU
|
||||
- **多场景** - 支持 World/Scene 分层架构
|
||||
- **时间管理** - 内置定时器和时间控制系统
|
||||
|
||||
## 平台支持
|
||||
|
||||
支持主流游戏引擎和 Web 平台:
|
||||
|
||||
- **Cocos Creator** - 内置引擎集成支持,提供[专用调试插件](https://store.cocos.com/app/detail/7823)
|
||||
- **Laya 引擎** - 完整的生命周期管理
|
||||
- **原生 Web** - 浏览器环境直接运行
|
||||
- **小游戏平台** - 微信、支付宝等小游戏
|
||||
|
||||
|
||||
## 示例项目
|
||||
|
||||
- [Worker系统演示](https://esengine.github.io/ecs-framework/demos/worker-system/) - 多线程物理系统演示,展示高性能并行计算
|
||||
- [割草机演示](https://github.com/esengine/lawn-mower-demo) - 完整的游戏示例
|
||||
|
||||
## 文档
|
||||
|
||||
- [快速入门](https://esengine.github.io/ecs-framework/guide/getting-started.html) - 详细教程和平台集成
|
||||
- [完整指南](https://esengine.github.io/ecs-framework/guide/) - ECS 概念和使用指南
|
||||
- [API 参考](https://esengine.github.io/ecs-framework/api/) - 完整 API 文档
|
||||
|
||||
## 生态系统
|
||||
|
||||
- [路径寻找](https://github.com/esengine/ecs-astar) - A*、BFS、Dijkstra 算法
|
||||
- [AI 系统](https://github.com/esengine/BehaviourTree-ai) - 行为树、效用 AI
|
||||
|
||||
## 社区与支持
|
||||
|
||||
- [问题反馈](https://github.com/esengine/ecs-framework/issues) - Bug 报告和功能建议
|
||||
- [QQ 交流群](https://jq.qq.com/?_wv=1027&k=29w1Nud6) - ecs游戏框架交流
|
||||
|
||||
## 许可证
|
||||
|
||||
[MIT](LICENSE) © 2025 ECS Framework
|
||||
@@ -0,0 +1,53 @@
|
||||
# 安全政策
|
||||
|
||||
## 支持的版本
|
||||
|
||||
我们为以下版本提供安全更新:
|
||||
|
||||
| 版本 | 支持状态 |
|
||||
| ------- | ------------------ |
|
||||
| 2.0.x | :white_check_mark: |
|
||||
| 1.0.x | :x: |
|
||||
|
||||
## 报告漏洞
|
||||
|
||||
如果您发现了安全漏洞,请通过以下方式报告:
|
||||
|
||||
### 报告渠道
|
||||
|
||||
- **邮箱**: [安全邮箱将在实际部署时提供]
|
||||
- **GitHub**: 创建私有安全报告(推荐)
|
||||
|
||||
### 报告流程
|
||||
|
||||
1. **不要**在公开的 issue 中报告安全漏洞
|
||||
2. 提供详细的漏洞描述,包括:
|
||||
- 受影响的版本
|
||||
- 复现步骤
|
||||
- 潜在的影响范围
|
||||
- 如果可能,提供修复建议
|
||||
|
||||
### 响应时间
|
||||
|
||||
- **确认收到**: 72小时内
|
||||
- **初步评估**: 1周内
|
||||
- **修复发布**: 根据严重程度,通常在2-4周内
|
||||
|
||||
### 处理流程
|
||||
|
||||
1. 我们会确认漏洞的存在和严重程度
|
||||
2. 开发修复方案并进行测试
|
||||
3. 发布安全更新
|
||||
4. 在修复发布后,会在相关渠道公布漏洞详情
|
||||
|
||||
### 安全最佳实践
|
||||
|
||||
使用 ECS Framework 时,请遵循以下安全建议:
|
||||
|
||||
- 始终使用最新的稳定版本
|
||||
- 定期更新依赖项
|
||||
- 在生产环境中禁用调试模式
|
||||
- 验证所有外部输入数据
|
||||
- 不要在客户端存储敏感信息
|
||||
|
||||
感谢您帮助保持 ECS Framework 的安全性!
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Wing Player",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"file": "index.html",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"useBuildInServer": true,
|
||||
"sourceMaps": true,
|
||||
"webRoot": "${workspaceRoot}",
|
||||
"preLaunchTask":"build",
|
||||
"port":5479
|
||||
},
|
||||
{
|
||||
"name": "Launch Chrome",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"file": "index.html",
|
||||
"useBuildInServer": true,
|
||||
"sourceMaps": true,
|
||||
"webRoot": "${workspaceRoot}",
|
||||
"preLaunchTask":"build",
|
||||
"userDataDir":"${tmpdir}",
|
||||
"port":5479
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"search.exclude": {
|
||||
"**/bin-debug": true,
|
||||
"**/bin-release": true
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "egret",
|
||||
"isShellCommand": true,
|
||||
"suppressTaskName": true,
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
"showOutput": "always",
|
||||
"args": [
|
||||
"build",
|
||||
"-sourcemap"
|
||||
],
|
||||
"problemMatcher": "$tsc"
|
||||
},
|
||||
{
|
||||
"taskName": "clean",
|
||||
"showOutput": "always",
|
||||
"args": [
|
||||
"build",
|
||||
"-e"
|
||||
],
|
||||
"problemMatcher": "$tsc"
|
||||
},
|
||||
{
|
||||
"taskName": "publish",
|
||||
"showOutput": "always",
|
||||
"args": [
|
||||
"publish"
|
||||
],
|
||||
"problemMatcher": "$tsc"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"engineVersion": "5.2.33",
|
||||
"compilerVersion": "5.2.33",
|
||||
"template": {},
|
||||
"target": {
|
||||
"current": "web"
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "egret"
|
||||
},
|
||||
{
|
||||
"name": "eui"
|
||||
},
|
||||
{
|
||||
"name": "assetsmanager"
|
||||
},
|
||||
{
|
||||
"name": "game"
|
||||
},
|
||||
{
|
||||
"name": "tween"
|
||||
},
|
||||
{
|
||||
"name": "promise"
|
||||
},
|
||||
{
|
||||
"name": "framework",
|
||||
"path": "./libs/framework"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 4.2 KiB |
@@ -1,95 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Egret</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="full-screen" content="true" />
|
||||
<meta name="screen-orientation" content="portrait" />
|
||||
<meta name="x5-fullscreen" content="true" />
|
||||
<meta name="360-fullscreen" content="true" />
|
||||
<style>
|
||||
html, body {
|
||||
-ms-touch-action: none;
|
||||
background: #888888;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player"
|
||||
data-entry-class="Main"
|
||||
data-orientation="auto"
|
||||
data-scale-mode="fixedWidth"
|
||||
data-frame-rate="30"
|
||||
data-content-width="640"
|
||||
data-content-height="1136"
|
||||
data-multi-fingered="2"
|
||||
data-show-fps="false" data-show-log="false"
|
||||
data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9">
|
||||
</div>
|
||||
<script>
|
||||
var loadScript = function (list, callback) {
|
||||
var loaded = 0;
|
||||
var loadNext = function () {
|
||||
loadSingleScript(list[loaded], function () {
|
||||
loaded++;
|
||||
if (loaded >= list.length) {
|
||||
callback();
|
||||
}
|
||||
else {
|
||||
loadNext();
|
||||
}
|
||||
})
|
||||
};
|
||||
loadNext();
|
||||
};
|
||||
|
||||
var loadSingleScript = function (src, callback) {
|
||||
var s = document.createElement('script');
|
||||
s.async = false;
|
||||
s.src = src;
|
||||
s.addEventListener('load', function () {
|
||||
s.parentNode.removeChild(s);
|
||||
s.removeEventListener('load', arguments.callee, false);
|
||||
callback();
|
||||
}, false);
|
||||
document.body.appendChild(s);
|
||||
};
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', './manifest.json?v=' + Math.random(), true);
|
||||
xhr.addEventListener("load", function () {
|
||||
var manifest = JSON.parse(xhr.response);
|
||||
var list = manifest.initial.concat(manifest.game);
|
||||
loadScript(list, function () {
|
||||
/**
|
||||
* {
|
||||
* "renderMode":, //Engine rendering mode, "canvas" or "webgl"
|
||||
* "audioType": 0 //Use the audio type, 0: default, 2: web audio, 3: audio
|
||||
* "antialias": //Whether the anti-aliasing is enabled in WebGL mode, true: on, false: off, defaults to false
|
||||
* "calculateCanvasScaleFactor": //a function return canvas scale factor
|
||||
* }
|
||||
**/
|
||||
egret.runEgret({ renderMode: "webgl", audioType: 0, calculateCanvasScaleFactor:function(context) {
|
||||
var backingStore = context.backingStorePixelRatio ||
|
||||
context.webkitBackingStorePixelRatio ||
|
||||
context.mozBackingStorePixelRatio ||
|
||||
context.msBackingStorePixelRatio ||
|
||||
context.oBackingStorePixelRatio ||
|
||||
context.backingStorePixelRatio || 1;
|
||||
return (window.devicePixelRatio || 1) / backingStore;
|
||||
}});
|
||||
});
|
||||
});
|
||||
xhr.send(null);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,52 +0,0 @@
|
||||
declare module skins{
|
||||
class ButtonSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class CheckBoxSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class HScrollBarSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class HSliderSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class ItemRendererSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class PanelSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class ProgressBarSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class RadioButtonSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class ScrollerSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class TextInputSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class ToggleSwitchSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class VScrollBarSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
declare module skins{
|
||||
class VSliderSkin extends eui.Skin{
|
||||
}
|
||||
}
|
||||
@@ -1,413 +0,0 @@
|
||||
declare interface Array<T> {
|
||||
findIndex(predicate: Function): number;
|
||||
any(predicate: Function): boolean;
|
||||
firstOrDefault(predicate: Function): T;
|
||||
find(predicate: Function): T;
|
||||
where(predicate: Function): Array<T>;
|
||||
count(predicate: Function): number;
|
||||
findAll(predicate: Function): Array<T>;
|
||||
contains(value: any): boolean;
|
||||
removeAll(predicate: Function): void;
|
||||
remove(element: any): boolean;
|
||||
removeAt(index: any): void;
|
||||
removeRange(index: any, count: any): void;
|
||||
select(selector: Function): Array<T>;
|
||||
orderBy(keySelector: Function, comparer: Function): Array<T>;
|
||||
orderByDescending(keySelector: Function, comparer: Function): Array<T>;
|
||||
groupBy(keySelector: Function): Array<T>;
|
||||
sum(selector: any): any;
|
||||
}
|
||||
declare class PriorityQueueNode {
|
||||
priority: number;
|
||||
insertionIndex: number;
|
||||
queueIndex: number;
|
||||
}
|
||||
declare class AStarPathfinder {
|
||||
static search<T>(graph: IAstarGraph<T>, start: T, goal: T): T[];
|
||||
private static hasKey;
|
||||
private static getKey;
|
||||
static recontructPath<T>(cameFrom: Map<T, T>, start: T, goal: T): T[];
|
||||
}
|
||||
declare class AStarNode<T> extends PriorityQueueNode {
|
||||
data: T;
|
||||
constructor(data: T);
|
||||
}
|
||||
declare class AstarGridGraph implements IAstarGraph<Point> {
|
||||
dirs: Point[];
|
||||
walls: Point[];
|
||||
weightedNodes: Point[];
|
||||
defaultWeight: number;
|
||||
weightedNodeWeight: number;
|
||||
private _width;
|
||||
private _height;
|
||||
private _neighbors;
|
||||
constructor(width: number, height: number);
|
||||
isNodeInBounds(node: Point): boolean;
|
||||
isNodePassable(node: Point): boolean;
|
||||
search(start: Point, goal: Point): Point[];
|
||||
getNeighbors(node: Point): Point[];
|
||||
cost(from: Point, to: Point): number;
|
||||
heuristic(node: Point, goal: Point): number;
|
||||
}
|
||||
interface IAstarGraph<T> {
|
||||
getNeighbors(node: T): Array<T>;
|
||||
cost(from: T, to: T): number;
|
||||
heuristic(node: T, goal: T): any;
|
||||
}
|
||||
declare class PriorityQueue<T extends PriorityQueueNode> {
|
||||
private _numNodes;
|
||||
private _nodes;
|
||||
private _numNodesEverEnqueued;
|
||||
constructor(maxNodes: number);
|
||||
clear(): void;
|
||||
readonly count: number;
|
||||
contains(node: T): boolean;
|
||||
enqueue(node: T, priority: number): void;
|
||||
dequeue(): T;
|
||||
remove(node: T): void;
|
||||
isValidQueue(): boolean;
|
||||
private onNodeUpdated;
|
||||
private cascadeDown;
|
||||
private cascadeUp;
|
||||
private swap;
|
||||
private hasHigherPriority;
|
||||
}
|
||||
declare abstract class Component {
|
||||
entity: Entity;
|
||||
displayRender: egret.DisplayObject;
|
||||
private _enabled;
|
||||
updateInterval: number;
|
||||
readonly transform: Transform;
|
||||
enabled: boolean;
|
||||
setEnabled(isEnabled: boolean): this;
|
||||
abstract initialize(): any;
|
||||
onAddedToEntity(): void;
|
||||
onRemovedFromEntity(): void;
|
||||
onEnabled(): void;
|
||||
onDisabled(): void;
|
||||
onEntityTransformChanged(comp: ComponentTransform): void;
|
||||
update(): void;
|
||||
bind(displayRender: egret.DisplayObject): this;
|
||||
registerComponent(): void;
|
||||
deregisterComponent(): void;
|
||||
}
|
||||
declare class Entity {
|
||||
name: string;
|
||||
scene: Scene;
|
||||
readonly transform: Transform;
|
||||
readonly components: ComponentList;
|
||||
private _updateOrder;
|
||||
private _enabled;
|
||||
private _isDestoryed;
|
||||
componentBits: BitSet;
|
||||
parent: Transform;
|
||||
position: Vector2;
|
||||
localPosition: Vector2;
|
||||
rotation: number;
|
||||
rotationDegrees: number;
|
||||
localRotation: number;
|
||||
localRotationDegrees: number;
|
||||
scale: Vector2;
|
||||
localScale: Vector2;
|
||||
readonly worldInverseTransform: Matrix2D;
|
||||
readonly localToWorldTransform: Matrix2D;
|
||||
readonly worldToLocalTransform: Matrix2D;
|
||||
readonly isDestoryed: boolean;
|
||||
enabled: boolean;
|
||||
setEnabled(isEnabled: boolean): this;
|
||||
constructor(name: string);
|
||||
updateOrder: number;
|
||||
setUpdateOrder(updateOrder: number): this;
|
||||
attachToScene(newScene: Scene): void;
|
||||
detachFromScene(): void;
|
||||
addComponent<T extends Component>(component: T): T;
|
||||
hasComponent<T extends Component>(type: any): boolean;
|
||||
getOrCreateComponent<T extends Component>(type: T): T;
|
||||
getComponent<T extends Component>(type: any): T;
|
||||
removeComponentForType<T extends Component>(type: any): boolean;
|
||||
removeComponent(component: Component): void;
|
||||
removeAllComponents(): void;
|
||||
update(): void;
|
||||
onAddedToScene(): void;
|
||||
onRemovedFromScene(): void;
|
||||
onTransformChanged(comp: ComponentTransform): void;
|
||||
destory(): void;
|
||||
}
|
||||
declare class Scene extends egret.DisplayObjectContainer {
|
||||
camera: Camera;
|
||||
readonly entities: EntityList;
|
||||
private _projectionMatrix;
|
||||
private _transformMatrix;
|
||||
private _matrixTransformMatrix;
|
||||
readonly entityProcessors: EntityProcessorList;
|
||||
constructor(displayObject: egret.DisplayObject);
|
||||
createEntity(name: string): Entity;
|
||||
addEntity(entity: Entity): Entity;
|
||||
destroyAllEntities(): void;
|
||||
findEntity(name: string): Entity;
|
||||
addEntityProcessor(processor: EntitySystem): EntitySystem;
|
||||
removeEntityProcessor(processor: EntitySystem): void;
|
||||
getEntityProcessor<T extends EntitySystem>(): T;
|
||||
setActive(): Scene;
|
||||
initialize(): void;
|
||||
onActive(): void;
|
||||
onDeactive(): void;
|
||||
update(): void;
|
||||
prepRenderState(): void;
|
||||
destory(): void;
|
||||
}
|
||||
declare class SceneManager {
|
||||
private static _loadedScenes;
|
||||
private static _lastScene;
|
||||
private static _activeScene;
|
||||
static createScene(name: string, scene: Scene): Scene;
|
||||
static setActiveScene(scene: Scene): Scene;
|
||||
static getActiveScene(): Scene;
|
||||
}
|
||||
declare enum DirtyType {
|
||||
clean = 0,
|
||||
positionDirty = 1,
|
||||
scaleDirty = 2,
|
||||
rotationDirty = 3
|
||||
}
|
||||
declare enum ComponentTransform {
|
||||
position = 0,
|
||||
scale = 1,
|
||||
rotation = 2
|
||||
}
|
||||
declare class Transform {
|
||||
readonly entity: Entity;
|
||||
private _children;
|
||||
private _parent;
|
||||
private _localPosition;
|
||||
private _localRotation;
|
||||
private _localScale;
|
||||
private _translationMatrix;
|
||||
private _rotationMatrix;
|
||||
private _scaleMatrix;
|
||||
private _worldTransform;
|
||||
private _worldToLocalTransform;
|
||||
private _worldInverseTransform;
|
||||
private _rotation;
|
||||
private _position;
|
||||
private _scale;
|
||||
private _localTransform;
|
||||
private _hierachyDirty;
|
||||
private _localDirty;
|
||||
private _localPositionDirty;
|
||||
private _localScaleDirty;
|
||||
private _localRotationDirty;
|
||||
private _positionDirty;
|
||||
private _worldToLocalDirty;
|
||||
private _worldInverseDirty;
|
||||
readonly childCount: number;
|
||||
constructor(entity: Entity);
|
||||
getChild(index: number): Transform;
|
||||
readonly worldInverseTransform: Matrix2D;
|
||||
readonly localToWorldTransform: Matrix2D;
|
||||
readonly worldToLocalTransform: Matrix2D;
|
||||
parent: Transform;
|
||||
setParent(parent: Transform): this;
|
||||
rotation: number;
|
||||
localRotation: number;
|
||||
position: Vector2;
|
||||
localPosition: Vector2;
|
||||
scale: Vector2;
|
||||
localScale: Vector2;
|
||||
rotationDegrees: number;
|
||||
localRotationDegrees: number;
|
||||
setLocalScale(scale: Vector2): this;
|
||||
setScale(scale: Vector2): this;
|
||||
setLocalRotationDegrees(degrees: number): this;
|
||||
setLocalRotation(radians: number): this;
|
||||
setRotation(radians: number): this;
|
||||
setRotationDegrees(degrees: number): this;
|
||||
setLocalPosition(localPosition: Vector2): this;
|
||||
setPosition(position: Vector2): this;
|
||||
setDirty(dirtyFlagType: DirtyType): void;
|
||||
updateTransform(): void;
|
||||
}
|
||||
declare class Camera extends Component {
|
||||
private _zoom;
|
||||
private _origin;
|
||||
private _transformMatrix;
|
||||
private _inverseTransformMatrix;
|
||||
private _minimumZoom;
|
||||
private _maximumZoom;
|
||||
private _areMatrixesDirty;
|
||||
zoom: number;
|
||||
minimumZoom: number;
|
||||
maximumZoom: number;
|
||||
origin: Vector2;
|
||||
readonly transformMatrix: Matrix2D;
|
||||
constructor();
|
||||
setMinimumZoom(minZoom: number): Camera;
|
||||
setMaximumZoom(maxZoom: number): Camera;
|
||||
setZoom(zoom: number): this;
|
||||
initialize(): void;
|
||||
update(): void;
|
||||
setPosition(position: Vector2): this;
|
||||
updateMatrixes(): void;
|
||||
destory(): void;
|
||||
}
|
||||
declare class EntitySystem {
|
||||
private _scene;
|
||||
private _entities;
|
||||
private _matcher;
|
||||
readonly matcher: Matcher;
|
||||
scene: Scene;
|
||||
constructor(matcher?: Matcher);
|
||||
initialize(): void;
|
||||
onChanged(entity: Entity): void;
|
||||
add(entity: Entity): void;
|
||||
onAdded(entity: Entity): void;
|
||||
remove(entity: Entity): void;
|
||||
onRemoved(entity: Entity): void;
|
||||
update(): void;
|
||||
lateUpdate(): void;
|
||||
protected begin(): void;
|
||||
protected process(entities: Entity[]): void;
|
||||
protected lateProcess(entities: Entity[]): void;
|
||||
protected end(): void;
|
||||
}
|
||||
declare abstract class EntityProcessingSystem extends EntitySystem {
|
||||
constructor(matcher: Matcher);
|
||||
abstract processEntity(entity: Entity): any;
|
||||
lateProcessEntity(entity: Entity): void;
|
||||
protected process(entities: Entity[]): void;
|
||||
protected lateProcess(entities: Entity[]): void;
|
||||
}
|
||||
declare class BitSet {
|
||||
private static LONG_MASK;
|
||||
private _bits;
|
||||
constructor(nbits?: number);
|
||||
and(bs: BitSet): void;
|
||||
andNot(bs: BitSet): void;
|
||||
cardinality(): number;
|
||||
clear(pos?: number): void;
|
||||
private ensure;
|
||||
get(pos: number): boolean;
|
||||
intersects(set: BitSet): boolean;
|
||||
isEmpty(): boolean;
|
||||
nextSetBit(from: number): number;
|
||||
set(pos: number, value?: boolean): void;
|
||||
}
|
||||
declare class ComponentList {
|
||||
private _entity;
|
||||
private _components;
|
||||
private _componentsToAdd;
|
||||
private _componentsToRemove;
|
||||
private _tempBufferList;
|
||||
constructor(entity: Entity);
|
||||
readonly count: number;
|
||||
readonly buffer: Component[];
|
||||
add(component: Component): void;
|
||||
remove(component: Component): void;
|
||||
removeAllComponents(): void;
|
||||
deregisterAllComponents(): void;
|
||||
registerAllComponents(): void;
|
||||
updateLists(): void;
|
||||
private handleRemove;
|
||||
getComponent<T extends Component>(type: any, onlyReturnInitializedComponents: boolean): T;
|
||||
update(): void;
|
||||
onEntityTransformChanged(comp: any): void;
|
||||
}
|
||||
declare class ComponentTypeManager {
|
||||
private static _componentTypesMask;
|
||||
static add(type: any): void;
|
||||
static getIndexFor(type: any): number;
|
||||
}
|
||||
declare class EntityList {
|
||||
scene: Scene;
|
||||
private _entitiesToRemove;
|
||||
private _entitiesToAdded;
|
||||
private _tempEntityList;
|
||||
private _entities;
|
||||
constructor(scene: Scene);
|
||||
readonly count: number;
|
||||
readonly buffer: Entity[];
|
||||
add(entity: Entity): void;
|
||||
remove(entity: Entity): void;
|
||||
findEntity(name: string): Entity;
|
||||
update(): void;
|
||||
removeAllEntities(): void;
|
||||
updateLists(): void;
|
||||
}
|
||||
declare class EntityProcessorList {
|
||||
private _processors;
|
||||
add(processor: EntitySystem): void;
|
||||
remove(processor: EntitySystem): void;
|
||||
onComponentAdded(entity: Entity): void;
|
||||
onComponentRemoved(entity: Entity): void;
|
||||
onEntityAdded(entity: Entity): void;
|
||||
onEntityRemoved(entity: Entity): void;
|
||||
protected notifyEntityChanged(entity: Entity): void;
|
||||
protected removeFromProcessors(entity: Entity): void;
|
||||
begin(): void;
|
||||
update(): void;
|
||||
lateUpdate(): void;
|
||||
end(): void;
|
||||
getProcessor<T extends EntitySystem>(): T;
|
||||
}
|
||||
declare class Matcher {
|
||||
protected allSet: BitSet;
|
||||
protected exclusionSet: BitSet;
|
||||
protected oneSet: BitSet;
|
||||
static empty(): Matcher;
|
||||
IsIntersted(e: Entity): boolean;
|
||||
}
|
||||
declare class Time {
|
||||
static unscaledDeltaTime: any;
|
||||
static deltaTime: number;
|
||||
static timeScale: number;
|
||||
private static _lastTime;
|
||||
static update(currentTime: number): void;
|
||||
}
|
||||
declare class MathHelper {
|
||||
static toDegrees(radians: number): number;
|
||||
static toRadians(degrees: number): number;
|
||||
static map(value: number, leftMin: number, leftMax: number, rightMin: number, rightMax: number): number;
|
||||
static clamp(value: number, min: number, max: number): number;
|
||||
}
|
||||
declare class Matrix2D {
|
||||
m11: number;
|
||||
m12: number;
|
||||
m21: number;
|
||||
m22: number;
|
||||
m31: number;
|
||||
m32: number;
|
||||
private static _identity;
|
||||
static readonly identity: Matrix2D;
|
||||
constructor(m11: number, m12: number, m21: number, m22: number, m31: number, m32: number);
|
||||
translation: Vector2;
|
||||
rotation: number;
|
||||
rotationDegrees: number;
|
||||
scale: Vector2;
|
||||
static add(matrix1: Matrix2D, matrix2: Matrix2D): Matrix2D;
|
||||
static divide(matrix1: Matrix2D, matrix2: Matrix2D): Matrix2D;
|
||||
static multiply(matrix1: Matrix2D, matrix2: Matrix2D): Matrix2D;
|
||||
static multiplyTranslation(matrix: Matrix2D, x: number, y: number): Matrix2D;
|
||||
determinant(): number;
|
||||
static invert(matrix: Matrix2D, result?: Matrix2D): Matrix2D;
|
||||
static createTranslation(xPosition: number, yPosition: number, result?: Matrix2D): Matrix2D;
|
||||
static createRotation(radians: number, result?: Matrix2D): Matrix2D;
|
||||
static createScale(xScale: number, yScale: number, result?: Matrix2D): Matrix2D;
|
||||
}
|
||||
declare class Point {
|
||||
x: number;
|
||||
y: number;
|
||||
constructor(x: number, y: number);
|
||||
}
|
||||
declare class Vector2 {
|
||||
x: number;
|
||||
y: number;
|
||||
private static readonly unitVector2;
|
||||
static readonly One: Vector2;
|
||||
constructor(x: number, y: number);
|
||||
static add(value1: Vector2, value2: Vector2): Vector2;
|
||||
static divide(value1: Vector2, value2: Vector2): Vector2;
|
||||
static multiply(value1: Vector2, value2: Vector2): Vector2;
|
||||
static subtract(value1: Vector2, value2: Vector2): Vector2;
|
||||
normalize(): void;
|
||||
static transform(position: Vector2, matrix: Matrix2D): Vector2;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"initial": [
|
||||
"libs/modules/egret/egret.js",
|
||||
"libs/modules/egret/egret.web.js",
|
||||
"libs/modules/eui/eui.js",
|
||||
"libs/modules/assetsmanager/assetsmanager.js",
|
||||
"libs/modules/game/game.js",
|
||||
"libs/modules/tween/tween.js",
|
||||
"libs/modules/promise/promise.js",
|
||||
"libs/framework/framework.js"
|
||||
],
|
||||
"game": [
|
||||
"bin-debug/AssetAdapter.js",
|
||||
"bin-debug/LoadingUI.js",
|
||||
"bin-debug/Main.js",
|
||||
"bin-debug/Platform.js",
|
||||
"bin-debug/ThemeAdapter.js",
|
||||
"bin-debug/game/MainScene.js",
|
||||
"bin-debug/game/SpawnerComponent.js",
|
||||
"bin-debug/game/SpawnerSystem.js"
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1019 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1002 B |
|
Before Width: | Height: | Size: 938 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 938 B |
|
Before Width: | Height: | Size: 976 B |
|
Before Width: | Height: | Size: 970 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 933 B |
|
Before Width: | Height: | Size: 933 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 933 B |
|
Before Width: | Height: | Size: 933 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
@@ -1,5 +0,0 @@
|
||||
[
|
||||
"<font color=0x00ff0c>Open-source</font>,<font color=0x00ff0c>Free</font>,<font color=0x00ff0c>Multi-platform</font>",
|
||||
"Push <font color=0x00ff0c>Game </font>Forward",
|
||||
"<font color=0x00ff0c>HTML5 </font>Game Engine"
|
||||
]
|
||||
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"groups": [
|
||||
{
|
||||
"keys": "checkbox_select_disabled_png,checkbox_select_down_png,checkbox_select_up_png,checkbox_unselect_png,selected_png,border_png,header_png,radiobutton_select_disabled_png,radiobutton_select_down_png,radiobutton_select_up_png,radiobutton_unselect_png,roundthumb_png,thumb_png,track_png,tracklight_png,handle_png,off_png,on_png,button_down_png,button_up_png,thumb_pb_png,track_pb_png,track_sb_png,bg_jpg,egret_icon_png,description_json",
|
||||
"name": "preload"
|
||||
}
|
||||
],
|
||||
"resources": [
|
||||
{
|
||||
"url": "assets/CheckBox/checkbox_select_disabled.png",
|
||||
"type": "image",
|
||||
"name": "checkbox_select_disabled_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/CheckBox/checkbox_select_down.png",
|
||||
"type": "image",
|
||||
"name": "checkbox_select_down_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/CheckBox/checkbox_select_up.png",
|
||||
"type": "image",
|
||||
"name": "checkbox_select_up_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/CheckBox/checkbox_unselect.png",
|
||||
"type": "image",
|
||||
"name": "checkbox_unselect_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/ItemRenderer/selected.png",
|
||||
"type": "image",
|
||||
"name": "selected_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/Panel/border.png",
|
||||
"type": "image",
|
||||
"name": "border_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/Panel/header.png",
|
||||
"type": "image",
|
||||
"name": "header_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/RadioButton/radiobutton_select_disabled.png",
|
||||
"type": "image",
|
||||
"name": "radiobutton_select_disabled_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/RadioButton/radiobutton_select_down.png",
|
||||
"type": "image",
|
||||
"name": "radiobutton_select_down_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/RadioButton/radiobutton_select_up.png",
|
||||
"type": "image",
|
||||
"name": "radiobutton_select_up_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/RadioButton/radiobutton_unselect.png",
|
||||
"type": "image",
|
||||
"name": "radiobutton_unselect_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/ScrollBar/roundthumb.png",
|
||||
"type": "image",
|
||||
"name": "roundthumb_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/Slider/thumb.png",
|
||||
"type": "image",
|
||||
"name": "thumb_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/Slider/track.png",
|
||||
"type": "image",
|
||||
"name": "track_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/Slider/tracklight.png",
|
||||
"type": "image",
|
||||
"name": "tracklight_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/ToggleSwitch/handle.png",
|
||||
"type": "image",
|
||||
"name": "handle_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/ToggleSwitch/off.png",
|
||||
"type": "image",
|
||||
"name": "off_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/ToggleSwitch/on.png",
|
||||
"type": "image",
|
||||
"name": "on_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/Button/button_down.png",
|
||||
"type": "image",
|
||||
"name": "button_down_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/Button/button_up.png",
|
||||
"type": "image",
|
||||
"name": "button_up_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/ProgressBar/thumb_pb.png",
|
||||
"type": "image",
|
||||
"name": "thumb_pb_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/ProgressBar/track_pb.png",
|
||||
"type": "image",
|
||||
"name": "track_pb_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/ScrollBar/track_sb.png",
|
||||
"type": "image",
|
||||
"name": "track_sb_png"
|
||||
},
|
||||
{
|
||||
"url": "assets/bg.jpg",
|
||||
"type": "image",
|
||||
"name": "bg_jpg"
|
||||
},
|
||||
{
|
||||
"url": "assets/egret_icon.png",
|
||||
"type": "image",
|
||||
"name": "egret_icon_png"
|
||||
},
|
||||
{
|
||||
"name": "description_json",
|
||||
"type": "json",
|
||||
"url": "config/description.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{
|
||||
"skins": {
|
||||
"eui.Button": "resource/eui_skins/ButtonSkin.exml",
|
||||
"eui.CheckBox": "resource/eui_skins/CheckBoxSkin.exml",
|
||||
"eui.HScrollBar": "resource/eui_skins/HScrollBarSkin.exml",
|
||||
"eui.HSlider": "resource/eui_skins/HSliderSkin.exml",
|
||||
"eui.Panel": "resource/eui_skins/PanelSkin.exml",
|
||||
"eui.TextInput": "resource/eui_skins/TextInputSkin.exml",
|
||||
"eui.ProgressBar": "resource/eui_skins/ProgressBarSkin.exml",
|
||||
"eui.RadioButton": "resource/eui_skins/RadioButtonSkin.exml",
|
||||
"eui.Scroller": "resource/eui_skins/ScrollerSkin.exml",
|
||||
"eui.ToggleSwitch": "resource/eui_skins/ToggleSwitchSkin.exml",
|
||||
"eui.VScrollBar": "resource/eui_skins/VScrollBarSkin.exml",
|
||||
"eui.VSlider": "resource/eui_skins/VSliderSkin.exml",
|
||||
"eui.ItemRenderer": "resource/eui_skins/ItemRendererSkin.exml"
|
||||
},
|
||||
"autoGenerateExmlsList": true,
|
||||
"exmls": [
|
||||
"resource/eui_skins/ButtonSkin.exml",
|
||||
"resource/eui_skins/CheckBoxSkin.exml",
|
||||
"resource/eui_skins/HScrollBarSkin.exml",
|
||||
"resource/eui_skins/HSliderSkin.exml",
|
||||
"resource/eui_skins/ItemRendererSkin.exml",
|
||||
"resource/eui_skins/PanelSkin.exml",
|
||||
"resource/eui_skins/ProgressBarSkin.exml",
|
||||
"resource/eui_skins/RadioButtonSkin.exml",
|
||||
"resource/eui_skins/ScrollerSkin.exml",
|
||||
"resource/eui_skins/TextInputSkin.exml",
|
||||
"resource/eui_skins/ToggleSwitchSkin.exml",
|
||||
"resource/eui_skins/VScrollBarSkin.exml",
|
||||
"resource/eui_skins/VSliderSkin.exml"
|
||||
],
|
||||
"path": "resource/default.thm.json"
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<e:Skin class="skins.ButtonSkin" states="up,down,disabled" minHeight="50" minWidth="100" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image width="100%" height="100%" scale9Grid="1,3,8,8" alpha.disabled="0.5"
|
||||
source="button_up_png"
|
||||
source.down="button_down_png"/>
|
||||
<e:Label id="labelDisplay" top="8" bottom="8" left="8" right="8"
|
||||
size="20"
|
||||
textColor="0xFFFFFF" verticalAlign="middle" textAlign="center"/>
|
||||
<e:Image id="iconDisplay" horizontalCenter="0" verticalCenter="0"/>
|
||||
</e:Skin>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.CheckBoxSkin" states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Group width="100%" height="100%">
|
||||
<e:layout>
|
||||
<e:HorizontalLayout verticalAlign="middle"/>
|
||||
</e:layout>
|
||||
<e:Image fillMode="scale" alpha="1" alpha.disabled="0.5" alpha.down="0.7"
|
||||
source="checkbox_unselect_png"
|
||||
source.upAndSelected="checkbox_select_up_png"
|
||||
source.downAndSelected="checkbox_select_down_png"
|
||||
source.disabledAndSelected="checkbox_select_disabled_png"/>
|
||||
<e:Label id="labelDisplay" size="20" textColor="0x707070"
|
||||
textAlign="center" verticalAlign="middle"
|
||||
fontFamily="Tahoma"/>
|
||||
</e:Group>
|
||||
</e:Skin>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.HScrollBarSkin" minWidth="20" minHeight="8" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image id="thumb" source="roundthumb_png" scale9Grid="3,3,2,2" height="8" width="30" verticalCenter="0"/>
|
||||
</e:Skin>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.HSliderSkin" minWidth="20" minHeight="8" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image id="track" source="track_sb_png" scale9Grid="1,1,4,4" width="100%"
|
||||
height="6" verticalCenter="0"/>
|
||||
<e:Image id="thumb" source="thumb_png" verticalCenter="0"/>
|
||||
</e:Skin>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<e:Skin class="skins.ItemRendererSkin" states="up,down,disabled" minHeight="50" minWidth="100" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image width="100%" height="100%" scale9Grid="1,3,8,8" alpha.disabled="0.5"
|
||||
source="button_up_png"
|
||||
source.down="button_down_png"/>
|
||||
<e:Label id="labelDisplay" top="8" bottom="8" left="8" right="8"
|
||||
size="20" fontFamily="Tahoma"
|
||||
textColor="0xFFFFFF" text="{data}" verticalAlign="middle" textAlign="center"/>
|
||||
</e:Skin>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.PanelSkin" minHeight="230" minWidth="450" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image left="0" right="0" bottom="0" top="0" source="border_png" scale9Grid="2,2,12,12" />
|
||||
<e:Group id="moveArea" left="0" right="0" top="0" height="45">
|
||||
<e:Image left="0" right="0" bottom="0" top="0" source="header_png"/>
|
||||
<e:Label id="titleDisplay" size="20" fontFamily="Tahoma" textColor="0xFFFFFF"
|
||||
wordWrap="false" left="15" right="5" verticalCenter="0"/>
|
||||
</e:Group>
|
||||
<e:Button id="closeButton" label="close" bottom="5" horizontalCenter="0"/>
|
||||
</e:Skin>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.ProgressBarSkin" minWidth="30" minHeight="18" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image source="track_pb_png" scale9Grid="1,1,4,4" width="100%"
|
||||
height="100%" verticalCenter="0"/>
|
||||
<e:Image id="thumb" height="100%" width="100%" source="thumb_pb_png"/>
|
||||
<e:Label id="labelDisplay" textAlign="center" verticalAlign="middle"
|
||||
size="15" fontFamily="Tahoma" textColor="0x707070"
|
||||
horizontalCenter="0" verticalCenter="0"/>
|
||||
</e:Skin>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.RadioButtonSkin" states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Group width="100%" height="100%">
|
||||
<e:layout>
|
||||
<e:HorizontalLayout verticalAlign="middle"/>
|
||||
</e:layout>
|
||||
<e:Image fillMode="scale" alpha="1" alpha.disabled="0.5" alpha.down="0.7"
|
||||
source="radiobutton_unselect_png"
|
||||
source.upAndSelected="radiobutton_select_up_png"
|
||||
source.downAndSelected="radiobutton_select_down_png"
|
||||
source.disabledAndSelected="radiobutton_select_disabled_png"/>
|
||||
<e:Label id="labelDisplay" size="20" textColor="0x707070"
|
||||
textAlign="center" verticalAlign="middle"
|
||||
fontFamily="Tahoma"/>
|
||||
</e:Group>
|
||||
</e:Skin>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.ScrollerSkin" minWidth="20" minHeight="20" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:HScrollBar id="horizontalScrollBar" width="100%" bottom="0"/>
|
||||
<e:VScrollBar id="verticalScrollBar" height="100%" right="0"/>
|
||||
</e:Skin>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<e:Skin class="skins.TextInputSkin" minHeight="40" minWidth="300" states="normal,disabled,normalWithPrompt,disabledWithPrompt" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image width="100%" height="100%" scale9Grid="1,3,8,8" source="button_up_png"/>
|
||||
<e:Rect height="100%" width="100%" fillColor="0xffffff"/>
|
||||
<e:EditableText id="textDisplay" verticalCenter="0" left="10" right="10"
|
||||
textColor="0x000000" textColor.disabled="0xff0000" width="100%" height="24" size="20" />
|
||||
<e:Label id="promptDisplay" verticalCenter="0" left="10" right="10"
|
||||
textColor="0xa9a9a9" width="100%" height="24" size="20" touchEnabled="false" includeIn="normalWithPrompt,disabledWithPrompt"/>
|
||||
</e:Skin>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.ToggleSwitchSkin" states="up,down,disabled,upAndSelected,downAndSelected,disabledAndSelected" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image source="on_png"
|
||||
source.up="off_png"
|
||||
source.down="off_png"
|
||||
source.disabled="off_png"/>
|
||||
<e:Image source="handle_png"
|
||||
horizontalCenter="-18"
|
||||
horizontalCenter.upAndSelected="18"
|
||||
horizontalCenter.downAndSelected="18"
|
||||
horizontalCenter.disabledAndSelected="18"
|
||||
verticalCenter="0"/>
|
||||
</e:Skin>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.VScrollBarSkin" minWidth="8" minHeight="20" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image id="thumb" source="roundthumb_png" scale9Grid="3,3,2,2" height="30" width="8" horizontalCenter="0"/>
|
||||
</e:Skin>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<e:Skin class="skins.VSliderSkin" minWidth="25" minHeight="30" xmlns:e="http://ns.egret.com/eui">
|
||||
<e:Image id="track" source="track_png" scale9Grid="1,1,4,4" width="7" height="100%" horizontalCenter="0"/>
|
||||
<e:Image id="thumb" source="thumb_png" horizontalCenter="0" />
|
||||
</e:Skin>
|
||||
@@ -1,452 +0,0 @@
|
||||
|
||||
/**
|
||||
* ResourceManager 配置文件
|
||||
*/
|
||||
type ResourceManagerConfig = {
|
||||
/**
|
||||
* 构建与发布配置
|
||||
*/
|
||||
buildConfig: (param: BuildConfigParam) => UserConfig,
|
||||
/**
|
||||
* 设置资源类型
|
||||
*/
|
||||
typeSelector: (path: string) => (string | null | undefined)
|
||||
/**
|
||||
* 设置资源的合并策略
|
||||
*/
|
||||
mergeSelector?: (path: string) => (string | null | undefined),
|
||||
/**
|
||||
* 设置资源的命名策略
|
||||
* beta 功能,请勿随意使用
|
||||
*/
|
||||
nameSelector?: (path: string) => (string | null | undefined)
|
||||
}
|
||||
/**
|
||||
* 构建配置
|
||||
*/
|
||||
type UserConfig = {
|
||||
/**
|
||||
* 输出路径
|
||||
*/
|
||||
outputDir: string,
|
||||
/**
|
||||
* 插件
|
||||
*/
|
||||
commands: (string | plugins.Command)[]
|
||||
}
|
||||
|
||||
type BuildConfigParam = {
|
||||
|
||||
|
||||
/**
|
||||
* 当前命令,build 或者 command
|
||||
*/
|
||||
readonly command: string;
|
||||
|
||||
/**
|
||||
* 发布平台
|
||||
*/
|
||||
readonly target: string;
|
||||
|
||||
/**
|
||||
* 开发者指定的版本号
|
||||
*/
|
||||
readonly version: string;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
readonly projectName: string;
|
||||
|
||||
/**
|
||||
* 项目路径
|
||||
*/
|
||||
readonly projectRoot: string;
|
||||
|
||||
/**
|
||||
* 项目配置
|
||||
*/
|
||||
readonly projectConfig: ProjectConfig;
|
||||
}
|
||||
|
||||
type ProjectConfig = {
|
||||
entryClassName: string;
|
||||
orientation: string;
|
||||
frameRate: number;
|
||||
scaleMode: string;
|
||||
contentWidth: number;
|
||||
contentHeight: number;
|
||||
showFPS: boolean;
|
||||
fpsStyles: string;
|
||||
showLog: boolean;
|
||||
maxTouches: number;
|
||||
}
|
||||
/**
|
||||
* 匹配机制,将满足 from 的文件输出为 to 格式的文件
|
||||
* from 采用 glob 表达式 , to 包含 [path][name][hash][ext]四个变量
|
||||
* 示例:{ from:"resource/**.*" , to:"[path][name]_[hash].[ext]" }
|
||||
*/
|
||||
type Matcher = {
|
||||
|
||||
from: string,
|
||||
|
||||
to: string
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare namespace plugins {
|
||||
|
||||
interface CommandContext {
|
||||
|
||||
/**
|
||||
* 可以用此接口进行文件创建
|
||||
*/
|
||||
createFile(relativeFilePath: string, contents: Buffer);
|
||||
|
||||
/**
|
||||
* 构建配置
|
||||
*/
|
||||
buildConfig: BuildConfigParam;
|
||||
|
||||
/**
|
||||
* 项目绝对路径
|
||||
*/
|
||||
projectRoot: string;
|
||||
|
||||
/**
|
||||
* 项目输出绝对路径
|
||||
*/
|
||||
outputDir: string;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建管线命令
|
||||
*/
|
||||
interface Command {
|
||||
|
||||
/**
|
||||
* 项目中的每个文件都会执行此函数,返回 file 表示保留此文件,返回 null 表示将此文件从构建管线中删除,即不会发布
|
||||
*/
|
||||
onFile?(file: File): Promise<File | null>
|
||||
|
||||
/**
|
||||
* 项目中所有文件均执行完后,最终会执行此函数。
|
||||
* 这个函数主要被用于创建新文件
|
||||
*/
|
||||
onFinish?(pluginContext?: CommandContext): Promise<void>
|
||||
|
||||
[options: string]: any;
|
||||
}
|
||||
|
||||
interface File {
|
||||
|
||||
/**
|
||||
* 文件内容的二进制流,如果开发者需要修改文件内容,请修改此属性
|
||||
*/
|
||||
contents: Buffer;
|
||||
|
||||
|
||||
/**
|
||||
* 文件绝对路径,如果开发者需要对文件进行重命名,请修改此属性
|
||||
*/
|
||||
path: string;
|
||||
|
||||
/**
|
||||
* 文件所在的项目的项目路径
|
||||
*/
|
||||
readonly base: string;
|
||||
|
||||
/**
|
||||
* 文件的相对于 base 属性的相对路径
|
||||
*/
|
||||
readonly relative: string;
|
||||
|
||||
|
||||
/**
|
||||
* 文件变更历史,history[0] 即 origin 属性
|
||||
*/
|
||||
readonly history: ReadonlyArray<string>;
|
||||
|
||||
|
||||
/**
|
||||
* 文件所在的文件夹的绝对路径
|
||||
*/
|
||||
readonly dirname: string;
|
||||
|
||||
/**
|
||||
* 文件的文件名
|
||||
*/
|
||||
readonly basename: string;
|
||||
|
||||
|
||||
/**
|
||||
* 文件的扩展名
|
||||
*/
|
||||
readonly extname: string;
|
||||
|
||||
/**
|
||||
* 文件的初始文件名
|
||||
*/
|
||||
readonly origin: string;
|
||||
|
||||
/**
|
||||
* 其他自定义属性
|
||||
*/
|
||||
[customProperty: string]: any;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
declare module 'built-in' {
|
||||
|
||||
/**
|
||||
* 混淆插件参数,设置源代码和目标代码
|
||||
*/
|
||||
type UglifyPluginOption = { sources: string[], target: string };
|
||||
|
||||
type UglifyPluginOptions = UglifyPluginOption[];
|
||||
|
||||
/**
|
||||
* 混淆插件
|
||||
*/
|
||||
export class UglifyPlugin implements plugins.Command {
|
||||
|
||||
constructor(mergeSelector: UglifyPluginOptions);
|
||||
|
||||
}
|
||||
|
||||
|
||||
type LibraryType = "debug" | "release";
|
||||
|
||||
type CompilePluginOptions = { libraryType: LibraryType, defines?: any };
|
||||
/**
|
||||
* 编译命令
|
||||
*/
|
||||
export class CompilePlugin implements plugins.Command {
|
||||
|
||||
constructor(options: CompilePluginOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* EXML 插件,用于发布 EXML 文件
|
||||
*/
|
||||
export class ExmlPlugin implements plugins.Command {
|
||||
|
||||
constructor(publishPolicy: EXML_Publish_Policy);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布策略
|
||||
* * debug : 默认策略,用于开发环境
|
||||
* * contents : 将 EXML 的内容写入到主题文件中
|
||||
* * gjs : 将生成的JS文件写入到主题文件中
|
||||
* * commonjs : 将EXML合并为一个 CommonJS 风格的文件
|
||||
* * commonjs2 : 将EXML合并为一个含有解析方法和皮肤定义的文件,且皮肤抽离为一份配置
|
||||
* * json : 将每个EXML文件生成一份配置
|
||||
*/
|
||||
type EXML_Publish_Policy = "debug" | "contents" | "gjs" | "commonjs" | "commonjs2" | "json"
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生成 manifest 文件,这个文件会被用于记录 JavaScript 文件的版本号
|
||||
*/
|
||||
export class ManifestPlugin implements plugins.Command {
|
||||
constructor(options?: ManifestPluginOptions)
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成文件的文件名
|
||||
* 支持 json 与 js 两种格式
|
||||
*/
|
||||
type ManifestPluginOptions = {
|
||||
|
||||
output: string,
|
||||
|
||||
hash?: "crc32",
|
||||
|
||||
/**
|
||||
* 是否输出转换过程
|
||||
*/
|
||||
verbose?: boolean,
|
||||
/**
|
||||
* 其他传递的消息参数
|
||||
*/
|
||||
info?:any
|
||||
/**
|
||||
* use wechat engine plugin
|
||||
*/
|
||||
useWxPlugin?: boolean
|
||||
/**
|
||||
* use QQgame engine plugin
|
||||
*/
|
||||
qqPlugin?: { use: boolean, pluginList: string[] }
|
||||
}
|
||||
|
||||
/**
|
||||
* EmitResConfigFilePlugin 的参数
|
||||
* * output: 生成路径,可以指定生成为 *.res.js 文件或者 *.res.json 文件
|
||||
* * typeSelector: 根据文件路径决定文件类型
|
||||
* * nameSelector: 根据文件路径决定文件的资源名
|
||||
* * groupSelector: 根据文件路径决定资源所述的资源组
|
||||
*/
|
||||
type EmitResConfigFilePluginOptions = {
|
||||
output: string,
|
||||
typeSelector: (path: string) => string | null | undefined,
|
||||
nameSelector: (path: string) => string | null | undefined,
|
||||
groupSelector: (path: string) => string | null | undefined,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成 res.json 文件或者 res.js 文件
|
||||
*/
|
||||
export class EmitResConfigFilePlugin implements plugins.Command {
|
||||
|
||||
constructor(options: EmitResConfigFilePluginOptions)
|
||||
|
||||
}
|
||||
|
||||
export type ConvertResourceConfigPluginOption = {
|
||||
|
||||
resourceConfigFiles: { filename: string, root: string }[];
|
||||
|
||||
nameSelector: (url: string) => string;
|
||||
|
||||
TM_Verbose: boolean;
|
||||
}
|
||||
|
||||
export class ConvertResConfigFilePlugin implements plugins.Command {
|
||||
|
||||
constructor(options: ConvertResourceConfigPluginOption);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增量编译
|
||||
* 这个插件生成的 JavaScript 代码不会被添加到构建管线中,后续其他插件无法获取生成的 js 文件
|
||||
* 这个功能将会在未来被 watch 模式代替掉
|
||||
*/
|
||||
export class IncrementCompilePlugin implements plugins.Command {
|
||||
|
||||
}
|
||||
|
||||
type TextureMergerOptions = {
|
||||
textureMergerRoot: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用 TextureMerger 实现纹理自动合并,依赖 TextureMerger 1.7 以上的版本
|
||||
*/
|
||||
export class TextureMergerPlugin implements plugins.Command {
|
||||
|
||||
constructor(options: TextureMergerOptions);
|
||||
|
||||
}
|
||||
|
||||
type CleanPluginOptions = {
|
||||
|
||||
matchers: string[]
|
||||
}
|
||||
|
||||
|
||||
export class CleanPlugin implements plugins.Command {
|
||||
constructor(options: CleanPluginOptions);
|
||||
}
|
||||
|
||||
|
||||
type RenamePluginOptions = {
|
||||
|
||||
/**
|
||||
* 是否输出日志
|
||||
* Whether to output the log
|
||||
*/
|
||||
verbose?: boolean
|
||||
|
||||
/**
|
||||
* 采用何种 hash 算法,目前暂时只支持 crc32
|
||||
* What hash algorithm is used, currently only crc32 is supported
|
||||
*/
|
||||
hash?: "crc32"
|
||||
|
||||
|
||||
/**
|
||||
* 设置匹配规则,将指定文件进行改名
|
||||
* 该参数是个数组,允许设置多个匹配规则
|
||||
* Set up matching rules to copy specified files to other folders
|
||||
* This parameter is an array that allows multiple matching rules to be set
|
||||
*/
|
||||
matchers: Matcher[]
|
||||
|
||||
/**
|
||||
* 回调函数,返回值里包括文件的一些信息
|
||||
* The callback function, return value includes some information about the file
|
||||
*/
|
||||
callback?: Function
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改文件名插件
|
||||
*/
|
||||
export class RenamePlugin implements plugins.Command {
|
||||
constructor(options: RenamePluginOptions);
|
||||
}
|
||||
|
||||
type ResSplitPluginOptions = {
|
||||
|
||||
/**
|
||||
* 是否输出日志
|
||||
* Whether to output the log
|
||||
*/
|
||||
verbose?: boolean
|
||||
|
||||
/**
|
||||
* 设置匹配规则,将指定文件拷贝至其他文件夹
|
||||
* 该参数是个数组,允许设置多个匹配规则
|
||||
* Set up matching rules to copy specified files to other folders
|
||||
* This parameter is an array that allows multiple matching rules to be set
|
||||
*/
|
||||
matchers: Matcher[]
|
||||
}
|
||||
|
||||
export class ResSplitPlugin implements plugins.Command {
|
||||
constructor(options: ResSplitPluginOptions);
|
||||
}
|
||||
|
||||
|
||||
type ZipPluginOptions = {
|
||||
|
||||
mergeSelector: (p: string) => string
|
||||
}
|
||||
|
||||
export class ZipPlugin implements plugins.Command {
|
||||
|
||||
constructor(option: ZipPluginOptions);
|
||||
}
|
||||
|
||||
type MergeEuiJsonPluginOptions = {
|
||||
|
||||
mergeSelector?: (p: string) => string | null,
|
||||
|
||||
createConfig?: boolean
|
||||
}
|
||||
export class MergeEuiJsonPlugin implements plugins.Command {
|
||||
|
||||
constructor(option?: MergeEuiJsonPluginOptions);
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
export class BaidugamePlugin implements plugins.Command {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
async onFile(file: plugins.File) {
|
||||
if (file.extname == '.js') {
|
||||
const filename = file.origin;
|
||||
if (filename == "libs/modules/promise/promise.js" || filename == 'libs/modules/promise/promise.min.js') {
|
||||
return null;
|
||||
}
|
||||
if (filename == 'libs/modules/egret/egret.js' || filename == 'libs/modules/egret/egret.min.js') {
|
||||
let content = file.contents.toString();
|
||||
content += `;window.egret = egret;`;
|
||||
content = content.replace(/definition = __global/, "definition = window");
|
||||
file.contents = new Buffer(content);
|
||||
}
|
||||
else {
|
||||
let content = file.contents.toString();
|
||||
if (
|
||||
filename == "libs/modules/res/res.js" ||
|
||||
filename == 'libs/modules/res/res.min.js' ||
|
||||
filename == 'libs/modules/assetsmanager/assetsmanager.min.js' ||
|
||||
filename == 'libs/modules/assetsmanager/assetsmanager.js'
|
||||
) {
|
||||
content += ";window.RES = RES;"
|
||||
}
|
||||
if (filename == "libs/modules/eui/eui.js" || filename == 'libs/modules/eui/eui.min.js') {
|
||||
content += ";window.eui = eui;"
|
||||
}
|
||||
if (filename == 'libs/modules/dragonBones/dragonBones.js' || filename == 'libs/modules/dragonBones/dragonBones.min.js') {
|
||||
content += ';window.dragonBones = dragonBones';
|
||||
}
|
||||
content = "var egret = window.egret;" + content;
|
||||
if (filename == 'main.js') {
|
||||
content += "\n;window.Main = Main;"
|
||||
}
|
||||
file.contents = new Buffer(content);
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
async onFinish(pluginContext: plugins.CommandContext) {
|
||||
//同步 index.html 配置到 game.js
|
||||
const gameJSPath = path.join(pluginContext.outputDir, "game.js");
|
||||
if(!fs.existsSync(gameJSPath)) {
|
||||
console.log(`${gameJSPath}不存在,请先使用 Launcher 发布百度小游戏`);
|
||||
return;
|
||||
}
|
||||
let gameJSContent = fs.readFileSync(gameJSPath, { encoding: "utf8" });
|
||||
const projectConfig = pluginContext.buildConfig.projectConfig;
|
||||
const optionStr =
|
||||
`entryClassName: ${projectConfig.entryClassName},\n\t\t` +
|
||||
`orientation: ${projectConfig.orientation},\n\t\t` +
|
||||
`frameRate: ${projectConfig.frameRate},\n\t\t` +
|
||||
`scaleMode: ${projectConfig.scaleMode},\n\t\t` +
|
||||
`contentWidth: ${projectConfig.contentWidth},\n\t\t` +
|
||||
`contentHeight: ${projectConfig.contentHeight},\n\t\t` +
|
||||
`showFPS: ${projectConfig.showFPS},\n\t\t` +
|
||||
`fpsStyles: ${projectConfig.fpsStyles},\n\t\t` +
|
||||
`showLog: ${projectConfig.showLog},\n\t\t` +
|
||||
`maxTouches: ${projectConfig.maxTouches},`;
|
||||
const reg = /\/\/----auto option start----[\s\S]*\/\/----auto option end----/;
|
||||
const replaceStr = '\/\/----auto option start----\n\t\t' + optionStr + '\n\t\t\/\/----auto option end----';
|
||||
gameJSContent = gameJSContent.replace(reg, replaceStr);
|
||||
fs.writeFileSync(gameJSPath, gameJSContent);
|
||||
|
||||
//修改横竖屏
|
||||
let orientation;
|
||||
if (projectConfig.orientation == '"landscape"') {
|
||||
orientation = "landscape";
|
||||
}
|
||||
else {
|
||||
orientation = "portrait";
|
||||
}
|
||||
const gameJSONPath = path.join(pluginContext.outputDir, "game.json");
|
||||
let gameJSONContent = JSON.parse(fs.readFileSync(gameJSONPath, { encoding: "utf8" }));
|
||||
gameJSONContent.deviceOrientation = orientation;
|
||||
fs.writeFileSync(gameJSONPath, JSON.stringify(gameJSONContent, null, "\t"));
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
|
||||
type ManifestConfig = {
|
||||
|
||||
initial: string[],
|
||||
|
||||
game: string[]
|
||||
|
||||
}
|
||||
|
||||
export class BricksPlugin implements plugins.Command {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
async onFile(file: plugins.File) {
|
||||
const filename = file.basename;
|
||||
if (filename == 'manifest.json') {
|
||||
const contents = file.contents.toString();
|
||||
const jsonData: ManifestConfig = JSON.parse(contents);
|
||||
|
||||
let content = '';
|
||||
content += `BK.Script.loadlib("GameRes://js/promise.js");\n`;
|
||||
for (let item of jsonData.initial) {
|
||||
if (item != 'js/promise.js' && item != 'js/promise.min.js') {
|
||||
content += `BK.Script.loadlib("GameRes://${item}");\n`
|
||||
}
|
||||
}
|
||||
for (let item of jsonData.game) {
|
||||
content += `BK.Script.loadlib("GameRes://${item}");\n`
|
||||
}
|
||||
content += `BK.Script.loadlib("GameRes://egret.bricks.js");\n`
|
||||
file.path = file.dirname + '/manifest.js'
|
||||
file.contents = new Buffer(content);
|
||||
} else if (filename == 'main.js') {
|
||||
const content = file.contents.toString();
|
||||
let result = content.replace(/RES\.loadConfig\("resource\/default\.res\.json", "resource\/"\)/gm, 'RES.loadConfig("GameRes://resource/default.res.json", "GameRes://resource/")');
|
||||
result = result.replace(/eui\.Theme\("resource\/default\.thm\.json", _this\.stage\)/gm, 'eui.Theme("GameRes://resource/default.thm.json", _this.stage)');
|
||||
result += ";global.Main = Main;";
|
||||
file.path = file.dirname + '/main.js'
|
||||
file.contents = new Buffer(result);
|
||||
} else if (filename == 'promise.js') {
|
||||
return null;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
async onFinish(pluginContext: plugins.CommandContext) {
|
||||
//同步index.html 配置到main.js
|
||||
let mainJSPath = path.join(pluginContext.outputDir, 'main.js');
|
||||
let mainJSContent = fs.readFileSync(mainJSPath, { encoding: "utf8" });
|
||||
let projectConfig = pluginContext.buildConfig.projectConfig;
|
||||
|
||||
mainJSContent = mainJSContent.replace(/frameRate: 30/gm, `frameRate: ${projectConfig.frameRate}`);
|
||||
mainJSContent = mainJSContent.replace(/contentWidth: 640/gm, `contentWidth: ${projectConfig.contentWidth}`);
|
||||
mainJSContent = mainJSContent.replace(/contentHeight: 1136/gm, `contentHeight: ${projectConfig.contentHeight}`);
|
||||
mainJSContent = mainJSContent.replace(/entryClassName: "Main"/gm, `entryClassName: ${projectConfig.entryClassName}`);
|
||||
mainJSContent = mainJSContent.replace(/scaleMode: "showAll"/gm, `scaleMode: ${projectConfig.scaleMode}`);
|
||||
mainJSContent = mainJSContent.replace(/orientation: "auto"/gm, `orientation: ${projectConfig.orientation}`);
|
||||
fs.writeFileSync(mainJSPath, mainJSContent);
|
||||
}
|
||||
}
|
||||
|
||||
declare var egret;
|
||||
@@ -1,52 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_android/assets/game`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new ManifestPlugin({ output: 'manifest.json' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new UglifyPlugin([{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.json' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,63 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
|
||||
import { BaidugamePlugin } from './baidugame/baidugame';
|
||||
import { CustomPlugin } from './myplugin';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_baidugame`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new BaidugamePlugin(),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new BaidugamePlugin(),
|
||||
new UglifyPlugin([
|
||||
// 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
|
||||
// {
|
||||
// sources: ["resource/default.thm.js"],
|
||||
// target: "default.thm.min.js"
|
||||
// },
|
||||
{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,55 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
|
||||
import { BricksPlugin } from './bricks/bricks';
|
||||
import { CustomPlugin } from './myplugin';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_bricks/PublicBrickEngineGame/Res`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new ManifestPlugin({ output: 'manifest.json' }),
|
||||
new BricksPlugin()
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
console.log('执行publish')
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new ManifestPlugin({ output: 'manifest.json' }),
|
||||
new UglifyPlugin([{
|
||||
sources: ["main.js"],
|
||||
target: "js/main.min.js"
|
||||
}
|
||||
]),
|
||||
new BricksPlugin(),
|
||||
]
|
||||
}
|
||||
} else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,52 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_ios/assets/game`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new ManifestPlugin({ output: 'manifest.json' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new UglifyPlugin([{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.json' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,63 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
|
||||
import { MygamePlugin } from './mygame/mygame';
|
||||
import { CustomPlugin } from './myplugin';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_mygame`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new MygamePlugin(),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new MygamePlugin(),
|
||||
new UglifyPlugin([
|
||||
// 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
|
||||
// {
|
||||
// sources: ["resource/default.thm.js"],
|
||||
// target: "default.thm.min.js"
|
||||
// },
|
||||
{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,62 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, ResSplitPlugin, CleanPlugin } from 'built-in';
|
||||
import { OppogamePlugin } from './oppogame/oppogame';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_oppogame`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new OppogamePlugin(),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new OppogamePlugin(),
|
||||
new UglifyPlugin([
|
||||
// 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
|
||||
// {
|
||||
// sources: ["resource/default.thm.js"],
|
||||
// target: "default.thm.min.js"
|
||||
// },
|
||||
{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,62 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, ResSplitPlugin, CleanPlugin } from 'built-in';
|
||||
import { MiqgamePlugin } from './qgame/qgame';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_qgame`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new MiqgamePlugin(),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new MiqgamePlugin(),
|
||||
new UglifyPlugin([
|
||||
// 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
|
||||
// {
|
||||
// sources: ["resource/default.thm.js"],
|
||||
// target: "default.thm.min.js"
|
||||
// },
|
||||
{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,65 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
|
||||
import { QQgamePlugin } from './qqgame/qqgame';
|
||||
import { CustomPlugin } from './myplugin';
|
||||
import * as defaultConfig from './config';
|
||||
//是否使用QQ小游戏引擎插件
|
||||
const useQQPlugin: boolean = false;
|
||||
let pluginList: string[] = []
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_qqgame`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new QQgamePlugin(useQQPlugin, pluginList),
|
||||
new ManifestPlugin({ output: 'manifest.js', qqPlugin: { use: useQQPlugin, pluginList: pluginList } })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new QQgamePlugin(useQQPlugin, pluginList),
|
||||
new UglifyPlugin([
|
||||
// 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
|
||||
// {
|
||||
// sources: ["resource/default.thm.js"],
|
||||
// target: "default.thm.min.js"
|
||||
// },
|
||||
{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.js', qqPlugin: { use: useQQPlugin, pluginList: pluginList } })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,95 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, IncrementCompilePlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, RenamePlugin } from 'built-in';
|
||||
import { WxgamePlugin } from './wxgame/wxgame';
|
||||
import { BricksPlugin } from './bricks/bricks';
|
||||
import { CustomPlugin } from './myplugin';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
|
||||
if (command == 'build') {
|
||||
const outputDir = '.';
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
// new EmitResConfigFilePlugin({
|
||||
// output: "resource/default.res.json",
|
||||
// typeSelector: config.typeSelector,
|
||||
// nameSelector: p => path.basename(p).replace(/\./gi, "_"),
|
||||
// groupSelector: p => "preload"
|
||||
// }),
|
||||
new ExmlPlugin('debug'), // 非 EUI 项目关闭此设置
|
||||
new IncrementCompilePlugin(),
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
const outputDir = `bin-release/web/${version}`;
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CustomPlugin(),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new UglifyPlugin([{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}]),
|
||||
new RenamePlugin({
|
||||
verbose: true, hash: 'crc32', matchers: [
|
||||
{ from: "**/*.js", to: "[path][name]_[hash].[ext]" }
|
||||
]
|
||||
}),
|
||||
new ManifestPlugin({ output: "manifest.json" })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: (path) => {
|
||||
if (path.indexOf("assets/bitmap/") >= 0) {
|
||||
return "assets/bitmap/sheet.sheet"
|
||||
}
|
||||
else if (path.indexOf("armature") >= 0 && path.indexOf(".json") >= 0) {
|
||||
return "assets/armature/1.zip";
|
||||
}
|
||||
},
|
||||
|
||||
typeSelector: (path) => {
|
||||
const ext = path.substr(path.lastIndexOf(".") + 1);
|
||||
const typeMap = {
|
||||
"jpg": "image",
|
||||
"png": "image",
|
||||
"webp": "image",
|
||||
"json": "json",
|
||||
"fnt": "font",
|
||||
"pvr": "pvr",
|
||||
"mp3": "sound",
|
||||
"zip": "zip",
|
||||
"sheet": "sheet",
|
||||
"exml": "text"
|
||||
}
|
||||
let type = typeMap[ext];
|
||||
if (type == "json") {
|
||||
if (path.indexOf("sheet") >= 0) {
|
||||
type = "sheet";
|
||||
} else if (path.indexOf("movieclip") >= 0) {
|
||||
type = "movieclip";
|
||||
};
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,62 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, ResSplitPlugin, CleanPlugin } from 'built-in';
|
||||
import { VivogamePlugin } from './vivogame/vivogame';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_vivogame/src`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new VivogamePlugin(),
|
||||
new ManifestPlugin({ output: 'manifest.js', info: { target: 'vivogame' } })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["../engine/js", "resource"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new VivogamePlugin(),
|
||||
new UglifyPlugin([
|
||||
// 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
|
||||
// {
|
||||
// sources: ["resource/default.thm.js"],
|
||||
// target: "default.thm.min.js"
|
||||
// },
|
||||
{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.js', info: { target: 'vivogame' } })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,65 +0,0 @@
|
||||
/// 阅读 api.d.ts 查看文档
|
||||
///<reference path="api.d.ts"/>
|
||||
|
||||
import * as path from 'path';
|
||||
import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
|
||||
import { WxgamePlugin } from './wxgame/wxgame';
|
||||
import { CustomPlugin } from './myplugin';
|
||||
import * as defaultConfig from './config';
|
||||
|
||||
//是否使用微信分离插件
|
||||
const useWxPlugin: boolean = false;
|
||||
const config: ResourceManagerConfig = {
|
||||
|
||||
buildConfig: (params) => {
|
||||
|
||||
const { target, command, projectName, version } = params;
|
||||
const outputDir = `../${projectName}_wxgame`;
|
||||
if (command == 'build') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource", "egret-library"] }),
|
||||
new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new WxgamePlugin(useWxPlugin),
|
||||
new ManifestPlugin({ output: 'manifest.js' })
|
||||
]
|
||||
}
|
||||
}
|
||||
else if (command == 'publish') {
|
||||
return {
|
||||
outputDir,
|
||||
commands: [
|
||||
new CleanPlugin({ matchers: ["js", "resource", "egret-library"] }),
|
||||
new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
|
||||
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
|
||||
new WxgamePlugin(useWxPlugin),
|
||||
new UglifyPlugin([
|
||||
// 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
|
||||
// {
|
||||
// sources: ["resource/default.thm.js"],
|
||||
// target: "default.thm.min.js"
|
||||
// },
|
||||
{
|
||||
sources: ["main.js"],
|
||||
target: "main.min.js"
|
||||
}
|
||||
]),
|
||||
new ManifestPlugin({ output: 'manifest.js', useWxPlugin: useWxPlugin })
|
||||
]
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw `unknown command : ${params.command}`;
|
||||
}
|
||||
},
|
||||
|
||||
mergeSelector: defaultConfig.mergeSelector,
|
||||
|
||||
typeSelector: defaultConfig.typeSelector
|
||||
}
|
||||
|
||||
|
||||
|
||||
export = config;
|
||||
@@ -1,82 +0,0 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
export class MygamePlugin implements plugins.Command {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
async onFile(file: plugins.File) {
|
||||
if (file.extname == '.js') {
|
||||
const filename = file.origin;
|
||||
if (filename == "libs/modules/promise/promise.js" || filename == 'libs/modules/promise/promise.min.js') {
|
||||
return null;
|
||||
}
|
||||
if (filename == 'libs/modules/egret/egret.js' || filename == 'libs/modules/egret/egret.min.js') {
|
||||
let content = file.contents.toString();
|
||||
content += `;window.egret = egret;`;
|
||||
content = content.replace(/definition = __global/, "definition = window");
|
||||
file.contents = new Buffer(content);
|
||||
}
|
||||
else {
|
||||
let content = file.contents.toString();
|
||||
if (
|
||||
filename == "libs/modules/res/res.js" ||
|
||||
filename == 'libs/modules/res/res.min.js' ||
|
||||
filename == 'libs/modules/assetsmanager/assetsmanager.min.js' ||
|
||||
filename == 'libs/modules/assetsmanager/assetsmanager.js'
|
||||
) {
|
||||
content += ";window.RES = RES;"
|
||||
}
|
||||
if (filename == "libs/modules/eui/eui.js" || filename == 'libs/modules/eui/eui.min.js') {
|
||||
content += ";window.eui = eui;"
|
||||
}
|
||||
if (filename == 'libs/modules/dragonBones/dragonBones.js' || filename == 'libs/modules/dragonBones/dragonBones.min.js') {
|
||||
content += ';window.dragonBones = dragonBones';
|
||||
}
|
||||
content = "var egret = window.egret;" + content;
|
||||
if (filename == 'main.js') {
|
||||
content += "\n;window.Main = Main;"
|
||||
}
|
||||
file.contents = new Buffer(content);
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
async onFinish(pluginContext: plugins.CommandContext) {
|
||||
//同步 index.html 配置到 game.js
|
||||
const gameJSPath = path.join(pluginContext.outputDir, "game.js");
|
||||
if (!fs.existsSync(gameJSPath)) {
|
||||
console.log(`${gameJSPath}不存在,请先使用 Launcher 发布支付宝小游戏`);
|
||||
return;
|
||||
}
|
||||
let gameJSContent = fs.readFileSync(gameJSPath, { encoding: "utf8" });
|
||||
const projectConfig = pluginContext.buildConfig.projectConfig;
|
||||
const optionStr =
|
||||
`entryClassName: ${projectConfig.entryClassName},\n\t\t` +
|
||||
`orientation: ${projectConfig.orientation},\n\t\t` +
|
||||
`frameRate: ${projectConfig.frameRate},\n\t\t` +
|
||||
`scaleMode: ${projectConfig.scaleMode},\n\t\t` +
|
||||
`contentWidth: ${projectConfig.contentWidth},\n\t\t` +
|
||||
`contentHeight: ${projectConfig.contentHeight},\n\t\t` +
|
||||
`showFPS: ${projectConfig.showFPS},\n\t\t` +
|
||||
`fpsStyles: ${projectConfig.fpsStyles},\n\t\t` +
|
||||
`showLog: ${projectConfig.showLog},\n\t\t` +
|
||||
`maxTouches: ${projectConfig.maxTouches},`;
|
||||
const reg = /\/\/----auto option start----[\s\S]*\/\/----auto option end----/;
|
||||
const replaceStr = '\/\/----auto option start----\n\t\t' + optionStr + '\n\t\t\/\/----auto option end----';
|
||||
gameJSContent = gameJSContent.replace(reg, replaceStr);
|
||||
fs.writeFileSync(gameJSPath, gameJSContent);
|
||||
|
||||
//修改横竖屏
|
||||
let orientation;
|
||||
if (projectConfig.orientation == '"landscape"') {
|
||||
orientation = "landscape";
|
||||
}
|
||||
else {
|
||||
orientation = "portrait";
|
||||
}
|
||||
const gameJSONPath = path.join(pluginContext.outputDir, "game.json");
|
||||
let gameJSONContent = JSON.parse(fs.readFileSync(gameJSONPath, { encoding: "utf8" }));
|
||||
gameJSONContent.deviceOrientation = orientation;
|
||||
fs.writeFileSync(gameJSONPath, JSON.stringify(gameJSONContent, null, "\t"));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* 示例自定义插件,您可以查阅 http://developer.egret.com/cn/github/egret-docs/Engine2D/projectConfig/cmdExtensionPlugin/index.html
|
||||
* 了解如何开发一个自定义插件
|
||||
*/
|
||||
export class CustomPlugin implements plugins.Command {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
async onFile(file: plugins.File) {
|
||||
return file;
|
||||
}
|
||||
|
||||
async onFinish(commandContext: plugins.CommandContext) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
export class OppogamePlugin implements plugins.Command {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
async onFile(file: plugins.File) {
|
||||
if (file.extname == '.js') {
|
||||
const filename = file.origin;
|
||||
if (filename == "libs/modules/promise/promise.js" || filename == 'libs/modules/promise/promise.min.js') {
|
||||
return null;
|
||||
}
|
||||
if (filename == 'libs/modules/egret/egret.js' || filename == 'libs/modules/egret/egret.min.js') {
|
||||
let content = file.contents.toString();
|
||||
content += `;window.egret = egret;`;
|
||||
content = content.replace(/definition = __global/, "definition = window");
|
||||
file.contents = new Buffer(content);
|
||||
}
|
||||
else {
|
||||
let content = file.contents.toString();
|
||||
if (
|
||||
filename == "libs/modules/res/res.js" ||
|
||||
filename == 'libs/modules/res/res.min.js' ||
|
||||
filename == 'libs/modules/assetsmanager/assetsmanager.min.js' ||
|
||||
filename == 'libs/modules/assetsmanager/assetsmanager.js'
|
||||
) {
|
||||
content += ";window.RES = RES;"
|
||||
}
|
||||
if (filename == "libs/modules/eui/eui.js" || filename == 'libs/modules/eui/eui.min.js') {
|
||||
content += ";window.eui = eui;"
|
||||
if(filename == "libs/modules/eui/eui.js"){
|
||||
content = content.replace("function getRepeatedIds","window.getRepeatedIds=function getRepeatedIds");
|
||||
content = content.replace("function getIds","window.getIds=function getIds");
|
||||
content = content.replace("function toXMLString","window.toXMLString=function toXMLString");
|
||||
content = content.replace("function checkDeclarations","window.checkDeclarations=function checkDeclarations");
|
||||
content = content.replace("function getPropertyStr","window.getPropertyStr=function getPropertyStr");
|
||||
}
|
||||
}
|
||||
if (filename == 'libs/modules/dragonBones/dragonBones.js' || filename == 'libs/modules/dragonBones/dragonBones.min.js') {
|
||||
content += ';window.dragonBones = dragonBones';
|
||||
}
|
||||
content = "var egret = window.egret;" + content;
|
||||
|
||||
if (filename == 'main.js') {
|
||||
content += "\n;window.Main = Main;"
|
||||
}
|
||||
file.contents = new Buffer(content);
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
async onFinish(pluginContext: plugins.CommandContext) {
|
||||
//同步 index.html 配置到 game.js
|
||||
const gameJSPath = path.join(pluginContext.outputDir, "main.js");
|
||||
if(!fs.existsSync(gameJSPath)) {
|
||||
console.log(`${gameJSPath}不存在,请先使用 Launcher 发布Oppo快游戏`);
|
||||
return;
|
||||
}
|
||||
let gameJSContent = fs.readFileSync(gameJSPath, { encoding: "utf8" });
|
||||
const projectConfig = pluginContext.buildConfig.projectConfig;
|
||||
const optionStr =
|
||||
`entryClassName: ${projectConfig.entryClassName},\n\t\t` +
|
||||
`orientation: ${projectConfig.orientation},\n\t\t` +
|
||||
`frameRate: ${projectConfig.frameRate},\n\t\t` +
|
||||
`scaleMode: ${projectConfig.scaleMode},\n\t\t` +
|
||||
`contentWidth: ${projectConfig.contentWidth},\n\t\t` +
|
||||
`contentHeight: ${projectConfig.contentHeight},\n\t\t` +
|
||||
`showFPS: ${projectConfig.showFPS},\n\t\t` +
|
||||
`fpsStyles: ${projectConfig.fpsStyles},\n\t\t` +
|
||||
`showLog: ${projectConfig.showLog},\n\t\t` +
|
||||
`maxTouches: ${projectConfig.maxTouches},`;
|
||||
const reg = /\/\/----auto option start----[\s\S]*\/\/----auto option end----/;
|
||||
const replaceStr = '\/\/----auto option start----\n\t\t' + optionStr + '\n\t\t\/\/----auto option end----';
|
||||
gameJSContent = gameJSContent.replace(reg, replaceStr);
|
||||
fs.writeFileSync(gameJSPath, gameJSContent);
|
||||
|
||||
//修改横竖屏
|
||||
let orientation;
|
||||
if (projectConfig.orientation == '"landscape"') {
|
||||
orientation = "landscape";
|
||||
}
|
||||
else {
|
||||
orientation = "portrait";
|
||||
}
|
||||
const gameJSONPath = path.join(pluginContext.outputDir, "manifest.json");
|
||||
let gameJSONContent = JSON.parse(fs.readFileSync(gameJSONPath, { encoding: "utf8" }));
|
||||
gameJSONContent.orientation = orientation;
|
||||
fs.writeFileSync(gameJSONPath, JSON.stringify(gameJSONContent, null, "\t"));
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
export class MiqgamePlugin implements plugins.Command {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
async onFile(file: plugins.File) {
|
||||
if (file.extname == '.js') {
|
||||
const filename = file.origin;
|
||||
if (filename == "libs/modules/promise/promise.js" || filename == 'libs/modules/promise/promise.min.js') {
|
||||
return null;
|
||||
}
|
||||
if (filename == 'libs/modules/egret/egret.js' || filename == 'libs/modules/egret/egret.min.js') {
|
||||
let content = file.contents.toString();
|
||||
content += `;window.egret = egret;`;
|
||||
content = content.replace(/definition = __global/, "definition = window");
|
||||
file.contents = new Buffer(content);
|
||||
}
|
||||
else {
|
||||
let content = file.contents.toString();
|
||||
if (
|
||||
filename == "libs/modules/res/res.js" ||
|
||||
filename == 'libs/modules/res/res.min.js' ||
|
||||
filename == 'libs/modules/assetsmanager/assetsmanager.min.js' ||
|
||||
filename == 'libs/modules/assetsmanager/assetsmanager.js'
|
||||
) {
|
||||
content += ";window.RES = RES;"
|
||||
}
|
||||
if (filename == "libs/modules/eui/eui.js" || filename == 'libs/modules/eui/eui.min.js') {
|
||||
content += ";window.eui = eui;"
|
||||
if(filename == "libs/modules/eui/eui.js"){
|
||||
content = content.replace("function getRepeatedIds","window.getRepeatedIds=function getRepeatedIds");
|
||||
content = content.replace("function getIds","window.getIds=function getIds");
|
||||
content = content.replace("function toXMLString","window.toXMLString=function toXMLString");
|
||||
content = content.replace("function checkDeclarations","window.checkDeclarations=function checkDeclarations");
|
||||
content = content.replace("function getPropertyStr","window.getPropertyStr=function getPropertyStr");
|
||||
}
|
||||
}
|
||||
if (filename == 'libs/modules/dragonBones/dragonBones.js' || filename == 'libs/modules/dragonBones/dragonBones.min.js') {
|
||||
content += ';window.dragonBones = dragonBones';
|
||||
}
|
||||
content = "var egret = window.egret;" + content;
|
||||
|
||||
if (filename == 'main.js') {
|
||||
content += "\n;window.Main = Main;"
|
||||
}
|
||||
file.contents = new Buffer(content);
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
async onFinish(pluginContext: plugins.CommandContext) {
|
||||
//同步 index.html 配置到 game.js
|
||||
const gameJSPath = path.join(pluginContext.outputDir, "main.js");
|
||||
if(!fs.existsSync(gameJSPath)) {
|
||||
console.log(`${gameJSPath}不存在,请先使用 Launcher 发布小米快游戏`);
|
||||
return;
|
||||
}
|
||||
let gameJSContent = fs.readFileSync(gameJSPath, { encoding: "utf8" });
|
||||
const projectConfig = pluginContext.buildConfig.projectConfig;
|
||||
const optionStr =
|
||||
`entryClassName: ${projectConfig.entryClassName},\n\t\t` +
|
||||
`orientation: ${projectConfig.orientation},\n\t\t` +
|
||||
`frameRate: ${projectConfig.frameRate},\n\t\t` +
|
||||
`scaleMode: ${projectConfig.scaleMode},\n\t\t` +
|
||||
`contentWidth: ${projectConfig.contentWidth},\n\t\t` +
|
||||
`contentHeight: ${projectConfig.contentHeight},\n\t\t` +
|
||||
`showFPS: ${projectConfig.showFPS},\n\t\t` +
|
||||
`fpsStyles: ${projectConfig.fpsStyles},\n\t\t` +
|
||||
`showLog: ${projectConfig.showLog},\n\t\t` +
|
||||
`maxTouches: ${projectConfig.maxTouches},`;
|
||||
const reg = /\/\/----auto option start----[\s\S]*\/\/----auto option end----/;
|
||||
const replaceStr = '\/\/----auto option start----\n\t\t' + optionStr + '\n\t\t\/\/----auto option end----';
|
||||
gameJSContent = gameJSContent.replace(reg, replaceStr);
|
||||
fs.writeFileSync(gameJSPath, gameJSContent);
|
||||
|
||||
//修改横竖屏
|
||||
let orientation;
|
||||
if (projectConfig.orientation == '"landscape"') {
|
||||
orientation = "landscape";
|
||||
}
|
||||
else {
|
||||
orientation = "portrait";
|
||||
}
|
||||
const gameJSONPath = path.join(pluginContext.outputDir, "manifest.json");
|
||||
let gameJSONContent = JSON.parse(fs.readFileSync(gameJSONPath, { encoding: "utf8" }));
|
||||
gameJSONContent.orientation = orientation;
|
||||
fs.writeFileSync(gameJSONPath, JSON.stringify(gameJSONContent, null, "\t"));
|
||||
}
|
||||
}
|
||||