future 1 gadu atpakaļ
vecāks
revīzija
ef37d1f6cd

+ 1 - 0
assets/data/data.ts

@@ -354,6 +354,7 @@ export class bag_data  {
 export class long_story_list_item_data {
     public id:number = 0;
     public name:string = "";
+    public cover:string = "";
 }
 
 export class level_list_item_data {

+ 5 - 5
assets/edit_game.scene

@@ -185951,7 +185951,7 @@
       "b": 0,
       "a": 255
     },
-    "_string": "小说列表",
+    "_string": "长篇列表",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
     "_actualFontSize": 40,
@@ -187514,8 +187514,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920,
-      "height": 1920
+      "width": 1920.0000000000002,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -187605,8 +187605,8 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920,
-      "height": 1920
+      "width": 1920.0000000000002,
+      "height": 1920.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 25 - 19
assets/script/edit/level_list.ts

@@ -56,7 +56,9 @@ export class level_list extends Component {
     public init(long_story_list_data: long_story_list_item_data, back_call_back, call_back){
         this.m_long_story_list_data = long_story_list_data
         if(this.m_long_story_list_data) {
-            this.lab_title.getComponent(Label).string = this.m_long_story_list_data.name
+            this.lab_title.getComponent(Label).string = `${this.m_long_story_list_data.name}-关卡列表`
+        } else {
+            this.lab_title.getComponent(Label).string = '关卡列表'
         }
         this.m_back_call_back = back_call_back;
         this.m_click_callback = call_back;
@@ -74,26 +76,30 @@ export class level_list extends Component {
 
     requestData() {
         this.content.removeAllChildren()
-        if(this.m_long_story_list_data==null) {
-            let request_data = {"page":this.m_cur_page,"limit":this.m_every_page_count}
-            http.post("/tool/mysnote/levels",request_data,(err,data)=>{
-                if(!err){
-                    // console.log(data)
-                    let _data = JSON.parse(data);
-                    let __data =  _data.content
-                    if(this.m_cur_page == 1) {
-                        this.page_number.active = true
-                        this.m_total_page_count = Math.ceil(__data.tool_number/this.m_every_page_count)
-                    }
-                    this.setupLabNumber()
-                    config.last_id = parseInt(_data.content.zujian_id)
-                    console.log("level_list",config.last_id )
-                    this.initView(__data.list)
-                }
-            })
-        } else {
 
+        let stype = 0    //0:短篇 1:长篇
+        let book_id = 0
+        if(this.m_long_story_list_data) {
+            stype = 1
+            book_id = this.m_long_story_list_data.id
         }
+        let opt = {"stype":stype,"book_id":book_id,"page":this.m_cur_page,"limit":this.m_every_page_count}
+        // console.log('opt=',opt)
+        http.post("/tool/mysnote/levels",opt,(err,data)=>{
+            if(!err){
+                // console.log(data)
+                let _data = JSON.parse(data);
+                let __data =  _data.content
+                if(this.m_cur_page == 1) {
+                    this.page_number.active = true
+                    this.m_total_page_count = Math.ceil(__data.tool_number/this.m_every_page_count)
+                }
+                this.setupLabNumber()
+                this.initView(__data.list)
+                config.last_id = parseInt(_data.content.zujian_id)
+                console.log("level_list",config.last_id)
+            }
+        })
     }
 
     setupLabNumber() {

+ 23 - 43
assets/script/edit/long_story_list.ts

@@ -2,6 +2,7 @@ import { _decorator, Component, instantiate, Label, Node, Prefab } from 'cc';
 import { tools } from '../tools';
 import { long_story_list_item } from './long_story_list_item';
 import { long_story_list_item_data } from '../../data/data';
+import { http } from '../http';
 const { ccclass, property } = _decorator;
 
 @ccclass('long_story_list')
@@ -20,7 +21,6 @@ export class long_story_list extends Component {
     private m_cur_page:number = 1;
     private m_every_page_count:number = 9;
     private m_total_page_count:number = 0;
-    private m_prefab_node_list:Node[] = [];
 
     start() {
         this.btn_back.on(Node.EventType.TOUCH_END,()=>{
@@ -55,50 +55,30 @@ export class long_story_list extends Component {
     }
 
     private requestData() {
-        this.initView()
+        let request_data = {"page":this.m_cur_page,"limit":this.m_every_page_count}
+        http.post("/tool/mysnote/book_list",request_data,(err,data)=>{
+            if(!err){
+                let _data = JSON.parse(data);
+                // console.log('长篇列表=',_data)
+                let __data =  _data.content
+                if(this.m_cur_page == 1) {
+                    this.page_number.active = true
+                    this.m_total_page_count = Math.ceil(__data.tool_number/this.m_every_page_count)
+                }
+                this.setupLabNumber()
+                this.initView(__data.list)
+            }
+        })
     }
 
-    initView(){
-        setTimeout(()=>{
-            if(this.m_cur_page == 1) {
-                this.page_number.active = true
-                this.m_total_page_count = Math.ceil(9/this.m_every_page_count)
-            }
-            this.setupLabNumber()
-            
-            this.content.removeAllChildren()
-            for(let index = 0; index<9; index++) {
-                let element:long_story_list_item_data = new long_story_list_item_data()
-                element.id = index+1
-                element.name = '小说'+(index+1)
-    
-                let node = instantiate(this.item)
-                node.parent = this.content
-                node.getComponent(long_story_list_item).init(element,this.m_click_callback)
-            }
-            this.page_number.active = true
-        },100)
-        // if(this.m_prefab_node_list.length == 0) {
-        //     this.content.removeAllChildren()
-        //     for (let index = 0; index < list.length; index++) {
-        //         const element = list[index];
-        //         let node = instantiate(this.item)
-        //         node.parent = this.content;
-        //         this.m_prefab_node_list.push(node)
-        //         node.getComponent(level_list_item).initView(element,this.m_click_callback)
-        //     }
-        // } else {
-        //     for(let index = 0; index < this.m_prefab_node_list.length; index++) {
-        //         let node = this.m_prefab_node_list[index]
-        //         if(index < list.length) {
-        //             node.active = true
-        //             const element = list[index]
-        //             node.getComponent(level_list_item).initView(element,this.m_click_callback)
-        //         } else {
-        //             node.active = false
-        //         }
-        //     }
-        // }
+    initView(list:long_story_list_item_data[]){
+        this.content.removeAllChildren()
+        for(let index = 0; index<list.length; index++) {
+            let element = list[index]
+            let node = instantiate(this.item)
+            node.parent = this.content
+            node.getComponent(long_story_list_item).init(element,this.m_click_callback)
+        }
     }
 
     setupLabNumber() {

+ 8 - 8
assets/script/http.ts

@@ -24,8 +24,8 @@ export class http  {
                 }else if (eventName === 'onerror') {
     
                 }
-                console.log("str==",str)
-                console.log("lstr==",lstr)
+                // console.log("str==",str)
+                // console.log("lstr==",lstr)
             };
         });
 
@@ -40,10 +40,10 @@ export class http  {
                 console.log("status ==",'404 page not found!')
             } else if (xml.readyState === 3) {
                 call_back('Request dealing!',null);
-                console.log("status ==",'Request dealing!')
+                // console.log("status ==",'Request dealing!')
             } else if (xml.readyState === 2) {
                 call_back('Request received!',null);
-                console.log("status ==", 'Request received!')
+                // console.log("status ==", 'Request received!')
             } else if (xml.readyState === 1) {
                 call_back('Server connection established! Request hasn\'t been received',null);
                 console.log("status ==", 'Server connection established! Request hasn\'t been received')
@@ -72,8 +72,8 @@ export class http  {
                 }else if (eventName === 'onerror') {
    
                 }
-                console.log("str==",str)
-                console.log("lstr==",lstr)
+                // console.log("str==",str)
+                // console.log("lstr==",lstr)
             };
         });
 
@@ -171,8 +171,8 @@ export class http  {
                }else if (eventName === 'onerror') {
    
                }
-               console.log("str==",str)
-               console.log("lstr==",lstr)
+            //    console.log("str==",str)
+            //    console.log("lstr==",lstr)
            };
        });