|
@@ -1,4 +1,4 @@
|
|
|
-import { _decorator, assetManager, Color, Component, ImageAsset, instantiate, Node, Prefab, resources, Size, Sprite, SpriteFrame, Texture2D, Vec2 } from 'cc';
|
|
|
+import { _decorator, assetManager, Color, Component, ImageAsset, instantiate, Node, Prefab, resources, Size, Sprite, SpriteFrame, sys, Texture2D, Vec2 } from 'cc';
|
|
|
import { main } from './main';
|
|
|
import { toast } from './toast';
|
|
|
import { add_scene } from './edit/add_scene';
|
|
@@ -34,6 +34,8 @@ import { select_task_dai_dao_ju } from './edit/task/select_task_dai_dao_ju';
|
|
|
import { set_color } from './edit/set_color';
|
|
|
import { show_setup_res_anchor } from './edit/show_setup_res_anchor';
|
|
|
import { dialog_input } from './dialog_input';
|
|
|
+import { control } from './edit/control';
|
|
|
+import { http } from './http';
|
|
|
export class tools {
|
|
|
|
|
|
public static show_dialog(title="是否确定?",sure_callback,cancel_callback=null){
|
|
@@ -179,6 +181,13 @@ export class tools {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ public static show_select_animation_delete_list(list:att_ani_data[],call,id:number=-1) {
|
|
|
+ resources.load("prefab/select_animation",Prefab,(err, prefab)=>{
|
|
|
+ let node = instantiate(prefab);
|
|
|
+ node.parent = main.g_canvas.node;
|
|
|
+ node.getComponent(select_animation).showWithDelete(list,call,id)
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
public static show_select_ui_top_type(call){
|
|
|
resources.load("prefab/ui/select_ui_top_type",Prefab,(err, prefab)=>{
|
|
@@ -388,6 +397,71 @@ export class tools {
|
|
|
node.getComponent(set_color).show(color,call)
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ //请求保存编辑场景
|
|
|
+ public static requestSaveEditScene() {
|
|
|
+ tools.show_loading(()=>{
|
|
|
+ // let data = new FormData()
|
|
|
+ let content = control.Singleton.get_bag_data().content
|
|
|
+ let zujian_id = config.last_id;
|
|
|
+ let id = control.Singleton.get_bag_data().id;
|
|
|
+ // data.append("content",JSON.stringify(content))
|
|
|
+ // data.append("zujian_id",zujian_id+"")
|
|
|
+ // data.append("id",id+"")
|
|
|
+ console.log("btn_save",content)
|
|
|
+ let request_data = {"content":JSON.stringify(content),"zujian_id":zujian_id,"id":id}
|
|
|
+ http.post("/tool/mysnote/save", request_data, (err,data)=>{
|
|
|
+ if(!err){
|
|
|
+ tools.showToast("保存成功!")
|
|
|
+ }
|
|
|
+ tools.hide_loading()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ //请求获取服务器动画列表
|
|
|
+ public static requestGetAnimationList(call) {
|
|
|
+ http.get('/tool/mysnote/get_animation',(err,data)=>{
|
|
|
+ // console.log('err=',err,'data=',data)
|
|
|
+ let _data = JSON.parse(data);
|
|
|
+ if(_data.code==config.MSG_CODE.SUCCESS) {
|
|
|
+ let content_list = JSON.parse(_data.content.content)
|
|
|
+ let list:att_ani_data[] = []
|
|
|
+ for (let index = 0; index < content_list.length; index++) {
|
|
|
+ const element = content_list[index];
|
|
|
+ list.push(element)
|
|
|
+ }
|
|
|
+ call(list)
|
|
|
+ } else {
|
|
|
+ tools.showToast('获取动画列表失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加动画到动画列表
|
|
|
+ public static requestAddAnimationToAnimationList(ani_data:att_ani_data) {
|
|
|
+ let string = ani_data.ani_name
|
|
|
+ tools.show_dialog_input(string, (content)=>{
|
|
|
+ tools.requestGetAnimationList((ani_list)=>{
|
|
|
+ let copy_ani_data = JSON.parse(JSON.stringify(ani_data)) //深拷贝
|
|
|
+ copy_ani_data.ani_name = content
|
|
|
+ ani_list.push(copy_ani_data)
|
|
|
+ tools.requestSyncAnimationList(ani_list)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ //同步服务器动画列表
|
|
|
+ public static requestSyncAnimationList(list:att_ani_data[]) {
|
|
|
+ let request_data = {"content": JSON.stringify(list)}
|
|
|
+ // console.log('request_data=',request_data)
|
|
|
+ http.post('/tool/mysnote/snyc_animation',request_data, (err,data)=>{
|
|
|
+ // console.log('同步 err=',err,'data',data)
|
|
|
+ if(!err){
|
|
|
+ tools.showToast("动画列表同步成功!")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|