config.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. import { _decorator, Color, Component, Node } from 'cc';
  2. import { scene_item_data, widget_item_data } from '../data/data';
  3. const { ccclass, property } = _decorator;
  4. export class config {
  5. static debug = true;
  6. static domain = "https://zcapi.xwrun.com";
  7. static version = '调试 v2.0.5'
  8. static is_MAC_edit = false; //目前临时处理:如果是Mac并且浏览器打开了检查时设置为true,正式打包需要设置为false
  9. static select_res_and_control_type = {
  10. RES_TYPE:0,
  11. CONTROL_TYPE:1,
  12. SCENE_SELECT:2,//场景选择
  13. TASK:3,//任务
  14. }
  15. static select_res_btn_type = {
  16. ITEM_LIST:0,
  17. COMPONENT_LIST:1,
  18. BG_LIST:2,
  19. SOUND_LIST:3,
  20. }
  21. static Event = {
  22. BackLevelList:"BackLevelList",
  23. PLAY_SOUND:"PLAY_SOUND",
  24. DragWidget:"DragWidget",
  25. DragRes:"DragRes",
  26. DragWidgetEnd:"DragWidgetEnd",
  27. DragResEndOnCheck:"DragResEndOnCheck",
  28. DragResEnd:"DragResEnd",
  29. UpdateSceneList:"UpdateSceneList",
  30. UpdateEditScene:"UpdateEditScene",
  31. UpdateAttributes:"UpdateAttributes",
  32. UpdateAttributesToView:"UpdateAttributesToView",
  33. RemoveWidget:"RemoveWidget",
  34. updateWidgetData:"updateWidgetData",
  35. ChangeSelectPage:"ChangeSelectPage",
  36. ShowWidgetList:"ShowWidgetList"
  37. }
  38. static COLOR_LIST = [
  39. new Color().fromHEX("#2e8b57"),
  40. new Color().fromHEX("#FF0000"),
  41. new Color().fromHEX("#664228"),
  42. new Color().fromHEX("#003153"),
  43. new Color().fromHEX("#422256"),
  44. new Color().fromHEX("#FBD26A"),
  45. new Color().fromHEX("#004ea2"),
  46. new Color().fromHEX("#ac6c56"),
  47. new Color().fromHEX("#ffa631"),
  48. new Color().fromHEX("#009664"),
  49. new Color().fromHEX("#e7767f"),
  50. ]
  51. public static init(){
  52. //控件
  53. config.Widget_Type.set(config.Widget_Type_List.CLICK_TYPE,new widget_item_data("点击",this.Widget_Type_List.CLICK_TYPE))
  54. config.Widget_Type.set(config.Widget_Type_List.SLIDE_TYPE,new widget_item_data("滑动",this.Widget_Type_List.SLIDE_TYPE))
  55. config.Widget_Type.set(config.Widget_Type_List.DRAG_TYPE,new widget_item_data("拖拽",this.Widget_Type_List.DRAG_TYPE))
  56. config.Widget_Type.set(config.Widget_Type_List.IMG_TYPE,new widget_item_data("图片",this.Widget_Type_List.IMG_TYPE))
  57. config.Widget_Type.set(config.Widget_Type_List.ACTION_TYPE,new widget_item_data("动画",this.Widget_Type_List.ACTION_TYPE))
  58. config.Widget_Type.set(config.Widget_Type_List.UI_TOP,new widget_item_data("弹窗",this.Widget_Type_List.UI_TOP))
  59. config.Widget_Type.set(config.Widget_Type_List.TEXT_SOUND,new widget_item_data("文字和语音",this.Widget_Type_List.TEXT_SOUND))
  60. config.Widget_Type.set(config.Widget_Type_List.QUESTION_SELECT,new widget_item_data("问题选择",this.Widget_Type_List.QUESTION_SELECT))
  61. config.Widget_Type.set(config.Widget_Type_List.COUNT_DOWN,new widget_item_data("倒计时",this.Widget_Type_List.COUNT_DOWN))
  62. //场景
  63. config.SceneType.set(config.Scene_Type_List.single_screen,new scene_item_data("独立场景",config.Scene_Type_List.single_screen,true))
  64. config.SceneType.set(config.Scene_Type_List.many_screen_switch_up_down,new scene_item_data("多场景-上下",config.Scene_Type_List.many_screen_switch_up_down))
  65. config.SceneType.set(config.Scene_Type_List.many_screen_switch_left_right,new scene_item_data("多场景-左右",config.Scene_Type_List.many_screen_switch_left_right))
  66. //slide_type
  67. config.slide_type_map.set(config.slide_type.down,"下")
  68. config.slide_type_map.set(config.slide_type.up,"上")
  69. config.slide_type_map.set(config.slide_type.left,"左")
  70. config.slide_type_map.set(config.slide_type.right,"右")
  71. config.slide_type_map.set(config.slide_type.up_down,"上下")
  72. config.slide_type_map.set(config.slide_type.left_right,"左右")
  73. //clcik_type_map
  74. config.clcik_type_map.set(config.clcik_type.Multiple_clicks,"多次点击")
  75. config.clcik_type_map.set(config.clcik_type.Press_and_hold,"长按")
  76. config.clcik_type_map.set(config.clcik_type.click,"单击")
  77. config.clcik_type_map.set(config.clcik_type.click_not_auto_finish,"单击(不自动完成)")
  78. //event_type_map
  79. config.event_type_map.set(config.event_type.be_event,"被动触发事件")
  80. config.event_type_map.set(config.event_type.delay_exe_event,"延迟时间调用一个事件")
  81. config.event_type_map.set(config.event_type.active_event,"激活交互")
  82. config.event_type_map.set(config.event_type.hide,"隐藏")
  83. config.event_type_map.set(config.event_type.text_sound,"出现文字及语音")
  84. config.event_type_map.set(config.event_type.play_ani,"播放动画")
  85. config.event_type_map.set(config.event_type.play_sound,"播放音效")
  86. config.event_type_map.set(config.event_type.show_question_select,"出现问题选择")
  87. config.event_type_map.set(config.event_type.top_view,"弹窗")
  88. config.event_type_map.set(config.event_type.top_view_hide,"弹窗隐藏")
  89. config.event_type_map.set(config.event_type.stop_active_event,"停用交互")
  90. config.event_type_map.set(config.event_type.collect_event,"收集事件")
  91. config.event_type_map.set(config.event_type.collect_event_score,"收集事件-分数")
  92. config.event_type_map.set(config.event_type.change_one_item_status,"改变指定道具资源")
  93. config.event_type_map.set(config.event_type.event_group,"事件组")
  94. config.event_type_map.set(config.event_type.switch_scene_event,"多场景-切换场景事件")
  95. config.event_type_map.set(config.event_type.more_scene_is_show_arrow_event,"多场景-是否显示箭头事件")
  96. config.event_type_map.set(config.event_type.more_scene_jump_assigned_page_event,"多场景-跳转指定页数事件")
  97. config.event_type_map.set(config.event_type.show_scene_title,"显示场景标签")
  98. config.event_type_map.set(config.event_type.start_event,"开始事件")
  99. config.event_type_map.set(config.event_type.fail_event,"失败事件")
  100. config.event_type_map.set(config.event_type.stop_play_loop_sound,"停止播放一个音效")
  101. config.event_type_map.set(config.event_type.scene_ani,"场景动画")
  102. config.event_type_map.set(config.event_type.delete_drag_other_data,"删除拖拽控件的其他拖拽目标")
  103. // config.event_type_map.set(config.event_type.show_new_item,"出现新道具")
  104. // config.event_type_map.set(config.event_type.countdown_over,"倒计时结束")
  105. //top_view_type_map
  106. config.top_view_type_map.set(config.top_view_type.__null,"暂未选择")
  107. config.top_view_type_map.set(config.top_view_type.not_have_interact,"没有交互")
  108. config.top_view_type_map.set(config.top_view_type.interact_input,"输入验证")
  109. config.top_view_type_map.set(config.top_view_type.interact_page,"多页面切换")
  110. config.top_view_type_map.set(config.top_view_type.interact_puzzle,"拼图")
  111. config.top_view_type_map.set(config.top_view_type.interact_scene,"场景")
  112. config.top_view_type_map.set(config.top_view_type.pointer_ding_wei,"指针定位")
  113. config.top_view_type_map.set(config.top_view_type.wei_chi_pointer,"维持指针")
  114. config.top_view_type_map.set(config.top_view_type.boss_info,"boss属性")
  115. //question_type_map
  116. config.question_type_map.set(config.question_type.two,"2")
  117. config.question_type_map.set(config.question_type.three,"3")
  118. config.question_type_map.set(config.question_type.four,"4")
  119. //task_type_map
  120. config.task_type_map.set(config.task_type.zhao_xi_jie,"找细节-说明:在图中找指定的细节")
  121. config.task_type_map.set(config.task_type.guo_ju_qing,"过剧情-带规则-说明:按照剧情提示进行操作")
  122. config.task_type_map.set(config.task_type.da_guai,"打怪-说明:使用场上的道具攻击怪物")
  123. config.task_type_map.set(config.task_type.guo_du,"过度场景-说明:无答案、无提示进行操作")
  124. config.task_type_map.set(config.task_type.guo_ju_qing_not_rule,"过剧情-无规则-说明:按照剧情提示进行操作")
  125. config.task_type_map.set(config.task_type.guo_ju_qing_dai_dao_ju,"过剧情-带道具-说明:按照剧情进行道具交互")
  126. //Zindex_type_map
  127. config.Zindex_type_map.set(config.Zindex_type.Zindex_scene,"场景层")
  128. config.Zindex_type_map.set(config.Zindex_type.Zindex_ui,"界面UI层")
  129. config.Zindex_type_map.set(config.Zindex_type.zIndex_top,"弹出层")
  130. //widget_scale_dir_map
  131. config.widget_scale_dir_map.set(config.widget_scale_dir.up,"向下")
  132. config.widget_scale_dir_map.set(config.widget_scale_dir.left,"向左")
  133. config.widget_scale_dir_map.set(config.widget_scale_dir.normal,"正常")
  134. //zhao_xi_jie_tip_type_map
  135. config.zhao_xi_jie_tip_type_map.set(config.zhao_xi_jie_tip_type.select_all,"全部")
  136. config.zhao_xi_jie_tip_type_map.set(config.zhao_xi_jie_tip_type.select_tips,"单个")
  137. }
  138. static Widget_Type:Map<number,widget_item_data> = new Map();
  139. static Widget_Type_List = {
  140. CLICK_TYPE:0, //点击
  141. SLIDE_TYPE:1, //滑动
  142. DRAG_TYPE:2, //拖拽
  143. IMG_TYPE:3, //图片
  144. ACTION_TYPE:4, //动画
  145. UI_TOP:5, //弹窗
  146. TEXT_SOUND:6, // 文本和语音
  147. QUESTION_SELECT:7, //问题选择
  148. COUNT_DOWN:8, //倒计时
  149. }
  150. static SceneType:Map<number,scene_item_data> = new Map();
  151. static Scene_Type_List = {
  152. single_screen:0, //独立场景
  153. many_screen_switch_up_down:1, //多场景-上下
  154. many_screen_switch_left_right:2, //多场景-左右
  155. }
  156. static attributes_type = {
  157. widget:0,
  158. scene:1,
  159. }
  160. static attributes_list_type = {
  161. pos:"pos",
  162. size:"size",
  163. url:"url",
  164. origin:"origin",
  165. delete:"delete",
  166. drag:"drag_size",
  167. drag_err_back_status:"drag_err_back_status",
  168. slide:"slide",
  169. click:"click",
  170. is_interaction:"is_interaction",
  171. animation:"animation",
  172. find_widget_pos:"find_widget_pos",
  173. active:"active",
  174. top:"top",
  175. text_sound:"text_sound",
  176. question_select:"question_select",
  177. count_down:"count_down",
  178. zIndex:"zIndex",
  179. dir:"dir",
  180. show:"show",
  181. scene_rule_tips:"scene_rule_tips",
  182. remark:"remark",
  183. rotation:"rotation",
  184. anchor:"anchor",
  185. show_more_scene_arrow:"show_more_scene_arrow",
  186. }
  187. static last_id:number = 0;
  188. static getNewId(){
  189. config.last_id+=1
  190. return config.last_id;
  191. }
  192. static slide_type_map:Map<number,string> = new Map();
  193. static slide_type = {
  194. up:0, //上
  195. down:1, //下
  196. left:2, //左
  197. right:3, //右
  198. up_down:4, //上下
  199. left_right:5, //左右
  200. }
  201. static clcik_type_map:Map<number,string> = new Map();
  202. static clcik_type = {
  203. Press_and_hold:0, //长按
  204. Multiple_clicks:1, //多次点击
  205. click:2,//单击
  206. click_not_auto_finish:3,//单击(不自动完成)
  207. }
  208. static task_type_map:Map<number,string> = new Map();
  209. static task_type = {
  210. zhao_xi_jie:0, //找细节-说明:在图中找指定的细节
  211. guo_ju_qing:1, //过剧情-带规则-说明:按照剧情提示进行操作
  212. da_guai:2, //打怪-说明:使用场上的道具攻击怪物
  213. guo_du:3, //过度场景-说明:无答案、无提示进行操作
  214. guo_ju_qing_not_rule:4, //过剧情-无规则-说明:按照剧情提示进行操作
  215. guo_ju_qing_dai_dao_ju:5, //过剧情-带道具-说明:按照剧情进行道具交互
  216. }
  217. static zhao_xi_jie_tip_type_map:Map<number,string> = new Map();
  218. static zhao_xi_jie_tip_type = {
  219. select_tips:0, //单个提示 , 点击到对应的收集内容,出现提示按钮
  220. select_all:1,//选中全部,提出一个二级界面,出现两个选择,每个选择对应的提示可以配置。 //分别点击没有效果 只能点击提示按钮
  221. }
  222. static event_type_map:Map<number,string> = new Map();
  223. static event_type = {
  224. play_ani:0,//播放动画
  225. top_view:1,//弹窗
  226. text_sound:2,//出现文字及语音
  227. change_one_item_status:3,//改变指定道具资源
  228. show_new_item:4,//出现新道具
  229. show_question_select:5,//出现问题选择
  230. start_event:6, //开始事件
  231. collect_event:7,//收集事件 多组件完成触发
  232. active_event:8, //激活
  233. stop_active_event:9, //停用交互
  234. countdown_over:10, //倒计时结束
  235. be_event:11, //被动触发事件
  236. hide:12, //触发让控件隐藏
  237. delay_exe_event:13, //延迟多久执行一个事件
  238. fail_event:14, //失败
  239. play_sound:15, //播放一个音效
  240. show_scene_title:16,//显示场景的标签
  241. scene_ani:17,//场景动画
  242. delete_drag_other_data:18,//删除其他拖拽目标的属性
  243. stop_play_loop_sound:19,//停止一个音效
  244. switch_scene_event:20, //多场景-切换场景事件
  245. more_scene_is_show_arrow_event:21, //多场景-是否显示箭头事件
  246. more_scene_jump_assigned_page_event:22, //多场景-跳转指定页数事件
  247. top_view_hide:23,//弹窗隐藏
  248. collect_event_score:24, //收集事件-分数
  249. event_group:100, //事件组
  250. }
  251. static get_event_type_name(type=config.event_type.play_ani):string {
  252. let string = ''
  253. switch (type) {
  254. case config.event_type.play_ani: string = '播放动画'
  255. break;
  256. case config.event_type.top_view: string = '弹窗'
  257. break;
  258. case config.event_type.text_sound: string = '文字及语音'
  259. break;
  260. case config.event_type.change_one_item_status: string = '改变指定道具资源'
  261. break;
  262. case config.event_type.show_new_item: string = '出现新道具'
  263. break;
  264. case config.event_type.show_question_select: string = '出现问题选择'
  265. break;
  266. case config.event_type.start_event: string = '开始事件'
  267. break;
  268. case config.event_type.collect_event: string = '收集事件'
  269. break;
  270. case config.event_type.active_event: string = '激活'
  271. break;
  272. case config.event_type.stop_active_event: string = '停用交互'
  273. break;
  274. case config.event_type.countdown_over: string = '倒计时结束'
  275. break;
  276. case config.event_type.be_event: string = '被动触发事件'
  277. break;
  278. case config.event_type.hide: string = '触发让控件隐藏'
  279. break;
  280. case config.event_type.delay_exe_event: string = '延迟多久执行一个事件'
  281. break;
  282. case config.event_type.fail_event: string = '失败'
  283. break;
  284. case config.event_type.play_sound: string = '播放一个音效'
  285. break;
  286. case config.event_type.show_scene_title: string = '显示场景的标签'
  287. break;
  288. case config.event_type.scene_ani: string = '场景动画'
  289. break;
  290. case config.event_type.delete_drag_other_data: string = '删除其他拖拽目标的属性'
  291. break;
  292. case config.event_type.stop_play_loop_sound: string = '停止一个音效'
  293. break;
  294. case config.event_type.switch_scene_event: string = '多场景-切换场景事件'
  295. break;
  296. case config.event_type.more_scene_is_show_arrow_event: string = '多场景-是否显示箭头事件'
  297. break;
  298. case config.event_type.more_scene_jump_assigned_page_event: string = '多场景-跳转指定页数事件'
  299. break;
  300. case config.event_type.top_view_hide: string = '弹窗隐藏'
  301. break;
  302. case config.event_type.event_group: string = '事件组'
  303. break;
  304. case config.event_type.collect_event_score: string = '收集事件-分数'
  305. break;
  306. default:
  307. break;
  308. }
  309. return string
  310. }
  311. static top_view_type_map:Map<number,string> = new Map();
  312. static top_view_type = {
  313. __null:-1, //默认空
  314. not_have_interact:0,//没有交互
  315. interact_input:1,//输入验证
  316. interact_page:2,//多页面切换 - 左右
  317. interact_puzzle:3,//拼图
  318. interact_scene:4,//场景
  319. pointer_ding_wei:5,//指针定位
  320. wei_chi_pointer:6,//维持指针
  321. boss_info:7, //boss 属性
  322. }
  323. static question_type_map:Map<number,string> = new Map();
  324. static question_type = {
  325. two:2,// 2个
  326. three:3,//
  327. four:4,//
  328. }
  329. static update_type = {
  330. update_all:0,
  331. update_img:1,
  332. update_info:2,
  333. }
  334. static Zindex_type_map:Map<number,string> = new Map();
  335. static Zindex_type = {
  336. Zindex_scene:0, //场景曾
  337. Zindex_ui:1, //ui层
  338. zIndex_top:2, // 弹出层
  339. }
  340. static widget_scale_dir_map:Map<number,string> = new Map();
  341. static widget_scale_dir = { //控件的方向
  342. left:0, //左边 -1
  343. normal:1, //右边 1
  344. up:2, // 上 1
  345. }
  346. static switch_scene_page_direction = { //切换场景分页方向
  347. unknown:-1, //未知
  348. up:1, //上
  349. down:2, //下
  350. left:3, //左
  351. right:4, //右
  352. }
  353. static EventRun = {
  354. NOTICE_EVENT:"NOTICE_EVENT", //通知任务事件
  355. WIDGET_FINISH:"WIDGET_FINISH", //控件完成了自己本身的任务
  356. WIDGET_FAIL:"WIDGET_FAIL", //失败
  357. WIDGET_HIDE:"WIDGET_HIDE", //隐藏
  358. WIDGET_DRAG_OTHER_FINISH:"WIDGET_DRAG_OTHER_FINISH", //控件拖拽其他完成
  359. SHOW_ZHAO_BU_TONG_FINISH_STATUS:"SHOW_ZHAO_BU_TONG_FINISH_STATUS", //
  360. ON_ZHAO_BU_TONG_ALL_FINISH:"ON_ZHAO_BU_TONG_ALL_FINISH", //找细节所有完成
  361. TOP_VIEW_CLOSE:"TOP_VIEW_CLOSE", //弹窗关闭
  362. TOP_VIEW_FINISH:"TOP_VIEW_FINISH", //弹窗完成
  363. TOP_VIEW_FAIL:"TOP_VIEW_FAIL", //弹窗失败
  364. TOP_VIEW_HIDE:"TOP_VIEW_HIDE", //弹窗隐藏
  365. TOP_VIEW_ALL_HIDE:"TOP_VIEW_ALL_HIDE", //弹窗所有隐藏
  366. ON_WIDGET_FINISH_COLLECT_EVENT:"ON_WIDGET_FINISH_COLLECT_EVENT", //当控件完成事件
  367. ON_COUNT_DOWN_FAIL:"ON_COUNT_DOWN_FAIL", //倒计时结束 失败
  368. ON_COUNT_DOWN_START:"ON_COUNT_DOWN_START", //倒计时开始
  369. ON_SHOW_RULE_BTN:"ON_SHOW_RULE_BTN", //显示规则按钮
  370. ON_BOSS_HURT:"ON_BOSS_HURT", //boss被攻击
  371. ON_WIN:"ON_WIN", //胜利
  372. SHOW_TIPS:"SHOW_TIPS", //显示一个提示
  373. TOGGLE_YIN_YUE:"TOGGLE_YIN_YUE", //开关音乐
  374. }
  375. static MSG_CODE = {
  376. SUCCESS: 10000,
  377. }
  378. static TOKEN:string = ""
  379. static USER_DATA:string = "userData"
  380. }