future hai 1 ano
pai
achega
bf1be6f559
Modificáronse 3 ficheiros con 1089 adicións e 174 borrados
  1. 1019 168
      assets/edit_game.scene
  2. 33 5
      assets/script/edit/search/Search.ts
  3. 37 1
      assets/script/edit/task/scene_task.ts

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1019 - 168
assets/edit_game.scene


+ 33 - 5
assets/script/edit/search/Search.ts

@@ -5,17 +5,45 @@ const { ccclass, property } = _decorator;
 
 @ccclass('Search')
 export class Search extends Component {
-    @property(Node) btn_search:Node = null;
-    @property(EditBox) editbox:EditBox = null;
+    @property(Node) btn_id_search:Node = null;
+    @property(EditBox) editbox_id:EditBox = null;
+    @property(Node) btn_text_search:Node = null;
+    @property(EditBox) editbox_text:EditBox = null;
     @property(Node) search_node:Node = null;
+    private m_id_callback: Function = null;
+    private m_text_callback: Function = null;
     protected start(): void {
-        this.btn_search.on(Node.EventType.TOUCH_END,()=>{
-            if(this.editbox.string.length<=0){
+        this.btn_id_search.on(Node.EventType.TOUCH_END,()=>{
+            if(this.editbox_id.string.length<=0){
                 return tools.showToast("输入错误!")
             }
-            this.search_node.getComponent(search_node).show(this.editbox.string)
+
+            // this.search_node.getComponent(search_node).show(this.editbox_id.string)
+            if(this.m_id_callback != null) {
+                this.m_id_callback(this.editbox_id.string)
+            }
         })
 
+        this.btn_text_search.on(Node.EventType.TOUCH_END,()=>{
+            if(this.editbox_text.string.length<=0){
+                return tools.showToast("输入错误!")
+            }
+
+            if(this.m_text_callback != null) {
+                this.m_text_callback(this.editbox_text.string)
+            }
+        })
+
+    }
+
+    public searchClick(id_callback: Function, text_callback: Function) {
+        this.m_id_callback = id_callback
+        this.m_text_callback = text_callback
+    }
+
+    public showTip(text: string) {
+        this.search_node.getComponent(search_node).show(text)
+
     }
 }
 

+ 37 - 1
assets/script/edit/task/scene_task.ts

@@ -1,4 +1,4 @@
-import { _decorator, Component, instantiate, Label, Layers, Layout, Node, Prefab, ScrollView } from 'cc';
+import { _decorator, Component, instantiate, Label, Layers, Layout, Node, Prefab, ScrollView, Vec2, Vec3 } from 'cc';
 import { tools } from '../../tools';
 import { edit_scene } from '../edit_scene';
 import { ClientEvent } from '../../clientEvent';
@@ -8,6 +8,7 @@ import { event_item_view } from '../event/event_item_view';
 import { task_zhao_xi_jie } from './task_zhao_xi_jie';
 import { task_guo_ren_wu } from './task_guo_ren_wu';
 import { task_da_boss } from './task_da_boss';
+import { Search } from '../search/Search';
 const { ccclass, property } = _decorator;
 
 @ccclass('scene_task')
@@ -22,6 +23,7 @@ export class scene_task extends Component {
     @property(Node) task_zhao_xi_jie:Node = null;
     @property(Node) task_guo_ju_qing:Node = null;
     @property(Node) task_da_guai:Node = null;
+    @property(Node) search_node:Node = null;
     private m_edit_scene:edit_scene = null;
     private isUpdateStatus:boolean = false;
     protected start(): void {
@@ -51,6 +53,12 @@ export class scene_task extends Component {
         this.btn_edit_event.on(Node.EventType.TOUCH_END,()=>{
             tools.show_edit_event_view()
         })
+
+        this.search_node.getComponent(Search).searchClick((id: string)=> {
+            this.searchContentLocationList(true,id)
+        }, (text: string)=> {
+            this.searchContentLocationList(false,text)
+        })
     }
 
 
@@ -255,6 +263,34 @@ export class scene_task extends Component {
             }
         }
     }
+
+    searchContentLocationList(isId: boolean, string: string) {        
+        let task_data = this.getTaskData()
+        let data_list = task_data.event_list
+        let check_yes = false
+        for (let index = 0; index < data_list.length; index++) {
+            const element = data_list[index];
+            if(isId) {
+                if(element.event_id.toString() == string) {
+                    check_yes = true
+                }
+            } else {
+                if(element.event_name.indexOf(string) != -1) {
+                    check_yes = true                    
+                }
+            }      
+            if(check_yes) {
+                let c_index = (data_list.length-1)-index
+                let c_row = Math.round(c_index / 2)
+                let c_spacing_y = c_row * 50
+                let c_item_height = (c_row - 1) * 300
+                let c_offset_y = c_spacing_y + c_item_height + 1100
+                this.node.getComponent(ScrollView).scrollToOffset(new Vec2(0, c_offset_y))
+                this.search_node.getComponent(Search).showTip(element.event_id.toString())
+                break
+            }     
+        }
+    }
 }
 
 

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio