config.ts 15 KB

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