1 |
- Editor['Panel']['extend']({'style':'\x0a\x20\x20\x20\x20:host\x20{\x20margin:\x205px;\x20}\x0a\x20\x20\x20\x20h2\x20{\x20color:\x20#f90;\x20}\x0a\x20\x20\x20\x20td\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20text-align:\x20center;\x0a\x20\x20\x20\x20\x20\x20\x20\x20width:70;\x0a\x20\x20\x20\x20\x20\x20\x20\x20height:30;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20#divContainer\x20{\x0a\x20\x20\x20\x20\x20\x20overflow:\x20auto;\x0a\x20\x20\x20\x20\x20\x20height:\x20800px;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20#divContainer::-webkit-scrollbar\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20border-width:1px;\x0a\x20\x20\x20\x20}\x0a\x20\x20','template':'\x0a\x20\x20\x20\x20<div\x20id=\x22divContainer\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<h2>分组管理</h2>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<ui-box-container\x20class=\x22layout\x20vertical\x20left\x22\x20>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22edit_group\x22\x20align=\x22center\x22></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20align=\x22center\x22\x20style=\x22margin-top:\x2010px\x22><ui-button\x20id=\x22btn_add\x22>添加分组</ui-button></div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</ui-box-container>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<h2>碰撞管理</h2>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<ui-box-container\x20class=\x22layout\x20vertical\x20left\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<table><tbody\x20id=\x22table_group\x22></tbody></table>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</ui-box-container>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<h2>配置</h2>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<ui-box-container\x20class=\x22layout\x20vertical\x20left\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-prop\x20id=\x22switch_auto_run\x22\x20type=\x22boolean\x22\x20name=\x22自行驱动\x22></ui-prop>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-prop\x20id=\x22per_frame\x22\x20name=\x22帧率\x22\x20type=\x22enum\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22user-content\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<option\x20value=60>60</option>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<option\x20value=30>30</option>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</ui-prop>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-prop\x20id=\x22switch_print_log\x22\x20type=\x22boolean\x22\x20name=\x22打印碰撞日志\x22></ui-prop>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-prop\x20id=\x22switch_quad_tree\x22\x20type=\x22boolean\x22\x20name=\x22开启四叉树\x22></ui-prop>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-prop\x20id=\x22max_node_len\x22\x20type=\x22number\x22\x20name=\x22节点最大数量\x22\x20indent=\x221\x22></ui-prop>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-prop\x20id=\x22max_node_level\x22\x20type=\x22number\x22\x20name=\x22节点最大深度\x22\x20indent=\x221\x22></ui-prop>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-prop\x20id=\x22active_area\x22\x20name=\x22活动区域\x22\x20indent=\x221\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-num-input\x20id=\x22active_area_x\x22></ui-num-input>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-num-input\x20id=\x22active_area_y\x22></ui-num-input>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-num-input\x20id=\x22active_area_width\x22></ui-num-input>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ui-num-input\x20id=\x22active_area_height\x22></ui-num-input>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</ui-prop>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</ui-box-container>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20<div\x20align=\x22center\x22\x20style=\x22margin-top:\x2010px\x22><ui-button\x20class=\x22green\x22\x20id=\x22btn_save\x22>保存</ui-button></div>\x0a\x20\x20','$':{'edit_group':'#edit_group','table_group':'#table_group','btn_save':'#btn_save','btn_add':'#btn_add','switch_auto_run':'#switch_auto_run','switch_print_log':'#switch_print_log','switch_quad_tree':'#switch_quad_tree','max_node_len':'#max_node_len','max_node_level':'#max_node_level','active_area':'#active_area','active_area_x':'#active_area_x','active_area_y':'#active_area_y','active_area_width':'#active_area_width','active_area_height':'#active_area_height','per_frame':'#per_frame'},'refresh_group'(){this['sort_data']();this['$table_group']['innerHTML']='';const _0x334768=document['createElement']('tr');_0x334768['appendChild'](document['createElement']('td'));for(let _0x3c41cc=0x0;_0x3c41cc<window['plugin_data']['group_arr']['length'];_0x3c41cc++){const _0x1215ac=window['plugin_data']['group_arr'][_0x3c41cc];const _0x5cda73=document['createElement']('td');_0x5cda73['innerText']=_0x1215ac['name'];_0x334768['appendChild'](_0x5cda73);}this['$table_group']['appendChild'](_0x334768);let _0x236b09=[];for(let _0x45804b=0x0;_0x45804b<window['plugin_data']['group_arr']['length'];_0x45804b++){const _0x1215ac=window['plugin_data']['group_arr'][_0x45804b];const _0x334768=document['createElement']('tr');_0x334768['uid']=_0x1215ac['id'];const _0x5cda73=document['createElement']('td');_0x5cda73['innerText']=_0x1215ac['name'];_0x334768['appendChild'](_0x5cda73);for(let _0x297500=0x0;_0x297500<=_0x45804b;_0x297500++){const _0x379c67=window['plugin_data']['group_arr'][_0x297500];const _0x3903ad=document['createElement']('td');const _0x1c6a89=document['createElement']('ui-checkbox');_0x1c6a89['checked']=_0x1215ac['arr']['indexOf'](_0x379c67['id'])!==-0x1;_0x1c6a89['uid']=_0x379c67['id'];_0x3903ad['appendChild'](_0x1c6a89);_0x334768['appendChild'](_0x3903ad);}_0x236b09['push'](_0x334768);}for(let _0x3c11ea=_0x236b09['length']-0x1;_0x3c11ea>=0x0;_0x3c11ea--){this['$table_group']['appendChild'](_0x236b09[_0x3c11ea]);}},'refresh_edit'(){this['$edit_group']['innerHTML']='';for(let _0x3207d5=0x0;_0x3207d5<window['plugin_data']['group_arr']['length'];_0x3207d5++){const _0x2736e8=window['plugin_data']['group_arr'][_0x3207d5];const _0x5e04ef=document['createElement']('div');_0x5e04ef['style']='margin-top:\x2010px;;margin-left:\x2050px';const _0x409fcd=document['createElement']('ui-input');_0x409fcd['value']=_0x2736e8['name'];_0x5e04ef['appendChild'](_0x409fcd);_0x409fcd['addEventListener']('change',()=>{_0x2736e8['name']=_0x409fcd['value'];this['refresh_group']();});const _0x45bc6c=document['createElement']('ui-button');_0x45bc6c['setAttribute']('class','tiny\x20red');_0x45bc6c['innerHTML']='删除';_0x5e04ef['appendChild'](_0x45bc6c);_0x45bc6c['addEventListener']('confirm',()=>{for(let _0x2997ec=0x0;_0x2997ec<window['plugin_data']['group_arr']['length'];_0x2997ec++){if(_0x2736e8['id']===window['plugin_data']['group_arr'][_0x2997ec]['id']){window['plugin_data']['group_arr']['splice'](_0x2997ec,0x1);break;}}this['refresh_edit']();this['refresh_group']();});this['$edit_group']['appendChild'](_0x5e04ef);}},'refresh_set'(){this['$switch_auto_run']['value']=!!window['plugin_data']['switch_auto_run'];this['$switch_print_log']['value']=!!window['plugin_data']['switch_print_log'];this['$switch_quad_tree']['value']=!!window['plugin_data']['switch_quad_tree'];this['$max_node_len']['value']=window['plugin_data']['max_node_len']||0xa;this['$max_node_level']['value']=window['plugin_data']['max_node_level']||0x4;this['$active_area_x']['value']=window['plugin_data']['active_area_x']||0x0;this['$active_area_y']['value']=window['plugin_data']['active_area_y']||0x0;this['$active_area_width']['value']=window['plugin_data']['active_area_width']||0x3e8;this['$active_area_height']['value']=window['plugin_data']['active_area_height']||0x3e8;this['$max_node_len']['style']['display']=this['$switch_quad_tree']['value']?'':'none';this['$max_node_level']['style']['display']=this['$switch_quad_tree']['value']?'':'none';this['$active_area']['style']['display']=this['$switch_quad_tree']['value']?'':'none';this['$per_frame']['value']=window['plugin_data']['per_frame']||0x3c;},'sort_data'(){window['plugin_data']['group_arr']['sort']((_0x3caa79,_0x2ee34d)=>{return _0x3caa79['id']-_0x2ee34d['id'];});},'make_config_ts'(){const _0x4e7f72=require('fire-fs');let _0x2039bc='export\x20enum\x20LQCollideInfoList\x20{\x0d\x0a\x20\x20\x20\x20';for(let _0x506638=0x0;_0x506638<window['plugin_data']['group_arr']['length'];_0x506638++){const _0x4abed1=window['plugin_data']['group_arr'][_0x506638];if(_0x506638>0x0){_0x2039bc+=',\x20';}_0x2039bc+=_0x4abed1['name'];}_0x2039bc+='\x0d\x0a}\x0d\x0a\x0d\x0aexport\x20class\x20LQCollideConfig\x20{';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20switch_auto_run:\x20boolean\x20=\x20'+(window['plugin_data']['switch_auto_run']?'true':'false')+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20switch_print_log:\x20boolean\x20=\x20'+(window['plugin_data']['switch_print_log']?'true':'false')+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20switch_quad_tree:\x20boolean\x20=\x20'+(window['plugin_data']['switch_quad_tree']?'true':'false')+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20max_node_len:\x20number\x20=\x20'+window['plugin_data']['max_node_len']+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20per_frame:\x20number\x20=\x20'+(window['plugin_data']['per_frame']||0x3c)+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20max_node_level:\x20number\x20=\x20'+window['plugin_data']['max_node_level']+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20active_area_x:\x20number\x20=\x20'+window['plugin_data']['active_area_x']+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20active_area_y:\x20number\x20=\x20'+window['plugin_data']['active_area_y']+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20active_area_width:\x20number\x20=\x20'+window['plugin_data']['active_area_width']+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20active_area_height:\x20number\x20=\x20'+window['plugin_data']['active_area_height']+';';_0x2039bc+='\x0d\x0a\x20\x20\x20\x20public\x20static\x20collide_group_map\x20=\x20{';let _0x5eacef={};for(let _0x53dda1=0x0;_0x53dda1<window['plugin_data']['group_arr']['length'];_0x53dda1++){const _0x4abed1=window['plugin_data']['group_arr'][_0x53dda1];_0x5eacef[_0x4abed1['name']]=[_0x53dda1,0x1<<_0x53dda1];}for(let _0x2d7f04=0x0;_0x2d7f04<window['plugin_data']['group_arr']['length'];_0x2d7f04++){const _0x4abed1=window['plugin_data']['group_arr'][_0x2d7f04];let _0x41fbe7=_0x5eacef[_0x4abed1['name']];let _0x1a4bc5=0x0;for(let _0x152258=0x0;_0x152258<_0x4abed1['arr']['length'];_0x152258++){const _0x29dbc8=this['get_group'](_0x4abed1['arr'][_0x152258]);_0x1a4bc5|=_0x5eacef[_0x29dbc8['name']][0x1];}_0x2039bc+='\x0d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x22'+_0x4abed1['name']+'\x22:\x20{id:\x20'+_0x4abed1['id']+',\x20category:\x20'+_0x41fbe7[0x1]+',\x20index:\x20'+_0x41fbe7[0x0]+',\x20mask:\x20'+_0x1a4bc5+'},';}_0x2039bc+='\x0d\x0a\x20\x20\x20\x20}';_0x2039bc+='\x0d\x0a}';_0x4e7f72['writeFileSync'](Editor['Project']['path']+'/assets/lq_collide_system/lq_collide_config.ts',_0x2039bc);Editor['assetdb']['refresh']('db://assets/lq_collide_system/lq_collide_config.ts');Editor['log']('保存成功!');},'get_group'(_0x7fb1a7){for(let _0x21d747=0x0;_0x21d747<window['plugin_data']['group_arr']['length'];_0x21d747++){const _0x9aa35c=window['plugin_data']['group_arr'][_0x21d747];if(_0x9aa35c['id']===_0x7fb1a7){return _0x9aa35c;}}},'ready'(){const _0x5d25af=require('fire-fs');const _0x179a1c=Editor['Project']['path']+'/settings/collide_system_cfg.json';if(_0x5d25af['existsSync'](_0x179a1c)){window['plugin_data']=JSON['parse'](_0x5d25af['readFileSync'](_0x179a1c,'utf-8')['toString']());}else{window['plugin_data']={'group_arr':[{'name':'default','id':0x1,'arr':[0x1]},{'name':'role','id':0x2,'arr':[0x4,0x5,0x6]},{'name':'role_bullet','id':0x3,'arr':[0x4]},{'name':'enemy','id':0x4,'arr':[0x2,0x3]},{'name':'enemy_bullet','id':0x5,'arr':[0x2]},{'name':'prop','id':0x6,'arr':[0x2]}],'switch_auto_run':!![],'switch_print_log':!![],'switch_quad_tree':![],'max_node_len':0xa,'max_node_level':0x4,'active_area_x':0x0,'active_area_y':0x0,'active_area_width':0x3e8,'active_area_height':0x3e8};}this['refresh_group']();this['refresh_edit']();this['refresh_set']();this['$switch_quad_tree']['addEventListener']('change',()=>{window['plugin_data']['switch_quad_tree']=this['$switch_quad_tree']['value'];this['refresh_set']();});this['$btn_add']['addEventListener']('confirm',()=>{let _0xc08311='new_group';let _0x19f965=0x1;for(let _0x23aaae=0x0;_0x23aaae<window['plugin_data']['group_arr']['length'];_0x23aaae++){const _0x1a363e=window['plugin_data']['group_arr'][_0x23aaae];if(_0x1a363e['id']>_0x19f965){_0x19f965=_0x1a363e['id'];}}window['plugin_data']['group_arr']['push']({'name':'new_group','id':_0x19f965+0x1,'arr':[]});this['refresh_group']();this['refresh_edit']();});this['$btn_save']['addEventListener']('confirm',()=>{for(let _0x589a53=0x0;_0x589a53<window['plugin_data']['group_arr']['length'];_0x589a53++){const _0x5ae013=window['plugin_data']['group_arr'][_0x589a53];_0x5ae013['arr']=[];}for(let _0xc695a5=0x0;_0xc695a5<this['$table_group']['childNodes']['length'];_0xc695a5++){const _0x3fa586=this['$table_group']['childNodes'][_0xc695a5];if(!_0x3fa586['uid']){continue;}const _0x2fe772=this['get_group'](_0x3fa586['uid']);const _0x1beba7=_0x3fa586['getElementsByTagName']('ui-checkbox');for(let _0x12c4a9=0x0;_0x12c4a9<_0x1beba7['length'];_0x12c4a9++){const _0x51421c=_0x1beba7[_0x12c4a9];if(_0x51421c['value']){const _0x3378ff=this['get_group'](_0x51421c['uid']);if(_0x2fe772&&_0x3378ff){_0x2fe772['arr']['push'](_0x51421c['uid']);_0x3378ff['arr']['push'](_0x3fa586['uid']);}}}}window['plugin_data']['switch_auto_run']=this['$switch_auto_run']['value'];window['plugin_data']['switch_print_log']=this['$switch_print_log']['value'];window['plugin_data']['switch_quad_tree']=this['$switch_quad_tree']['value'];window['plugin_data']['max_node_len']=this['$max_node_len']['value'];window['plugin_data']['max_node_level']=this['$max_node_level']['value'];window['plugin_data']['active_area_x']=this['$active_area_x']['value'];window['plugin_data']['active_area_y']=this['$active_area_y']['value'];window['plugin_data']['active_area_width']=this['$active_area_width']['value'];window['plugin_data']['active_area_height']=this['$active_area_height']['value'];window['plugin_data']['per_frame']=this['$per_frame']['value'];_0x5d25af['writeFile'](_0x179a1c,JSON['stringify'](window['plugin_data']),_0x21a45b=>{if(!_0x21a45b){this['make_config_ts']();}else{Editor['error'](_0x21a45b);}});});},'messages':{'collide_system:hello'(_0x302091){this['$label']['innerText']='Hello!';}}});
|