Parcourir la source

Merge branch 'master' of http://git.izouma.com/zc/airpg-front

zc il y a 2 ans
Parent
commit
25e1c98700

+ 9 - 0
assets/prefabs.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.2.0",
+  "importer": "directory",
+  "imported": true,
+  "uuid": "3dad4313-8c3f-4ef9-ae5e-7a8a4e9cd1f2",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 574 - 0
assets/prefabs/rank_item1.prefab

@@ -0,0 +1,574 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "rank_item1",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "persistent": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "rank_item1",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 8
+      },
+      {
+        "__id__": 14
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 20
+      },
+      {
+        "__id__": 22
+      }
+    ],
+    "_prefab": {
+      "__id__": 24
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": -12,
+      "y": 348.922,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 1073741824,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "text_rank_number",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      }
+    ],
+    "_prefab": {
+      "__id__": 7
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": -138.671,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 4
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 13.974609375,
+      "height": 88.2
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "a6C27ru1lODKpgmFJH7Way"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 6
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 180,
+      "g": 173,
+      "b": 121,
+      "a": 255
+    },
+    "_string": "1",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 30,
+    "_fontSize": 30,
+    "_fontFamily": "Arial",
+    "_lineHeight": 70,
+    "_overflow": 0,
+    "_enableWrapText": true,
+    "_font": {
+      "__uuid__": "8f4a758c-4f3f-4a5d-805f-f953d6623810",
+      "__expectedType__": "cc.TTFFont"
+    },
+    "_isSystemFontUsed": false,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": false,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "52O/QWYhlEAJo5jhWkqKHZ"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "9fTjCmwhdFl7Nr/nf5l97S",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "text_player_name",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 9
+      },
+      {
+        "__id__": 11
+      }
+    ],
+    "_prefab": {
+      "__id__": 13
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 10
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 9.2529296875,
+      "height": 88.2
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "19K7W8rnJBeZaw2hjuJoDa"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 12
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_string": "-",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 25,
+    "_fontSize": 25,
+    "_fontFamily": "Arial",
+    "_lineHeight": 70,
+    "_overflow": 0,
+    "_enableWrapText": true,
+    "_font": {
+      "__uuid__": "8f4a758c-4f3f-4a5d-805f-f953d6623810",
+      "__expectedType__": "cc.TTFFont"
+    },
+    "_isSystemFontUsed": false,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": false,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "23HUcYebdCHqx58tcueZRU"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "79L2MJsnFGUaq/BdvWM9hZ",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "text_value",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 15
+      },
+      {
+        "__id__": 17
+      }
+    ],
+    "_prefab": {
+      "__id__": 19
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 124.929,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 14
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 16
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 9.2529296875,
+      "height": 88.2
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "47qYAsz7xPZI29fmlQYUw9"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 14
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 18
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_string": "-",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 25,
+    "_fontSize": 25,
+    "_fontFamily": "Arial",
+    "_lineHeight": 70,
+    "_overflow": 0,
+    "_enableWrapText": true,
+    "_font": {
+      "__uuid__": "8f4a758c-4f3f-4a5d-805f-f953d6623810",
+      "__expectedType__": "cc.TTFFont"
+    },
+    "_isSystemFontUsed": false,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": false,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "87gluk09JAI6cY7pLm0oQU"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "81s2Ftd3NEhJ2WrGgH4/Cz",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 21
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 371,
+      "height": 57
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "faBrcEFttFcrKQSb34b8HQ"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 23
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "72e5baaf-d15b-4a55-b632-d63260c6b6e7@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "01G8owDU9Pw7EgE0c1rtjE"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "edvVKEs2dJM6QH6dUZQrKf",
+    "instance": null,
+    "targetOverrides": null
+  }
+]

+ 13 - 0
assets/prefabs/rank_item1.prefab.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.45",
+  "importer": "prefab",
+  "imported": true,
+  "uuid": "350d1143-68c9-4fde-bd21-c7b260692534",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {
+    "syncNodeName": "rank_item1"
+  }
+}

+ 86 - 21
assets/scripts/rankCtr.ts

@@ -1,4 +1,4 @@
-import { _decorator, Component, Label, Node, tween, Vec3 } from "cc"
+import { _decorator, Component, instantiate, Label, Node, Prefab, ScrollView, tween, Vec2, Vec3 } from "cc"
 const { ccclass, property } = _decorator
 
 @ccclass("rankCtr")
@@ -9,14 +9,29 @@ export class rankCtr extends Component {
     @property({ type: Node })
     public rankNods: Node[] = []
 
-
     @property({ type: Node })
     public textPointsRank: Node | null = null
 
+    @property({ type: Prefab })
+    gameItem = null
+
+    @property({ type: Node })
+    content = null
+
+    @property({ type: ScrollView })
+    rankScroll = null
+
     private isLiveRank: boolean = true
     private moveDistance: number = -150
 
-    private lng:string = 'cn'
+    private lng: string = "cn"
+
+    public rankList = []
+
+    private nowRankNO = 0
+
+    private rankNodes = []
+    private startAnimate = false
 
     start() {}
 
@@ -37,27 +52,77 @@ export class rankCtr extends Component {
         tween(this.textPointsRank).by(0.5, { position: moveAction }).start()
     }
 
-    updateRank(data:any[])
-    {
-        for(let i=0;i<6;i++)
-        {
-            const nameLebel= this.rankNods[i].getChildByName("text_player_name").getComponent(Label);
-            const days= this.rankNods[i].getChildByName("text_value").getComponent(Label);
-
-            if(data.length > i)
-            {
-                nameLebel.string = data[i].userInfo.name
-                if(this.lng === 'cn')
-                {
-                    days.string = data[i].survival + '天'
-                }
-                else{
-                    days.string = data[i].survival + (data[i].survival == '1' ? 'day' : 'days' )
+    updateRank(data: any[]) {
+        if (this.rankNodes.length === 0) {
+            this.content.removeAllChildren()
+            this.rankList = data
+            data.forEach((item, index) => {
+                let node = instantiate(this.gameItem)
+
+                let number = node.getChildByName("text_rank_number").getComponent(Label)
+                number.string = index + 1
+
+                let nickName = node.getChildByName("text_player_name").getComponent(Label)
+                nickName.string = item.userInfo.name
+
+                let days = node.getChildByName("text_value").getComponent(Label)
+                if (this.lng === "cn") {
+                    days.string = item.survival + "天"
+                } else {
+                    days.string = item.survival + (item.survival == "1" ? "day" : "days")
                 }
-                
-            }
+                this.content.addChild(node)
+                this.rankNodes.push(node)
+            })
+            // 数据变化开启动画
+            // if (this.startAnimate) {
+            //     setTimeout(() => {
+            //         let info = data[this.nowRankNO]
+            //         data.splice(this.nowRankNO, 1)
+            //         data.splice(3, 0, info)
+            //         console.log(data)
+            //         this.updateRank(data)
+            //     }, 1000)
+            // }
+        } else {
+            this.changeRank(3, data)
         }
+    }
+
+    changeRank(newRankNO, data) {
+        let nowY = this.rankNodes[this.nowRankNO].position.y
+        let goY = this.rankNodes[newRankNO].position.y
+        this.rankScroll.scrollToOffset(new Vec2(0, -300 - nowY), 0.1)
+        // this.rankScroll.scrollToOffset(new Vec2(0, goY), 1)
+        setTimeout(() => {
+            this.rankMove(this.rankNodes[this.nowRankNO], goY, data)
+        }, 1000)
+    }
 
+    rankMove(_node, goY, data) {
+        let node = instantiate(_node)
+        tween(_node)
+            .to(0.3, {
+                innerHeight: 0
+            })
+            .start()
+        this.rankScroll.scrollToOffset(new Vec2(0, -300 - goY), 1)
+        this.content.removeChild(_node)
+        this.content.parent.addChild(node)
+        node.position.y = node.position.y + this.rankScroll.getScrollOffset().y + 200
+
+        // // this.label_length = node.getComponent(UITransform).contentSize.x;
+        tween(node)
+            .to(0.3, { scale: new Vec3(1.2, 1.2, 1) })
+            .to(1, { position: new Vec3(node.position.x, goY + 200) })
+            .to(0.3, { scale: new Vec3(1, 1, 1) })
+            .to(0, { scale: new Vec3(0, 0, 1) })
+            .call(() => {
+                this.rankNodes = []
+                this.startAnimate = false
+                this.updateRank(data)
+            })
+            .start()
     }
 
     update(deltaTime: number) {}

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
build/web-mobile/assets/main/config.json


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
build/web-mobile/assets/main/import/03/0391190fd.json


Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
build/web-mobile/assets/main/import/05/05f048097.json


Fichier diff supprimé car celui-ci est trop grand
+ 2 - 0
build/web-mobile/assets/main/index.js


BIN
build/web-mobile/assets/main/native/2b/2b8bb7c0-849c-429f-870d-ff6789c168de.mp3


BIN
build/web-mobile/assets/main/native/3a/3a4b9883-5d3d-456a-a645-01dda7c3ec85.mp3


BIN
build/web-mobile/assets/main/native/4b/4b66ddc2-5bd8-4ad1-8ab5-fa2cb619cd85.mp3


BIN
build/web-mobile/assets/main/native/6b/6b32efa4-b0cd-497d-95d6-29f6737d2623.mp3


BIN
build/web-mobile/assets/main/native/6c/6cdfe1dc-faae-4021-8e36-ed85e3433962.mp3


BIN
build/web-mobile/assets/main/native/75/758ba6d8-888d-4557-9edc-404fb7ca4d34.mp3


BIN
build/web-mobile/assets/main/native/b5/b5c827b1-0ced-4403-8838-a4b270dd8e56.mp3


BIN
build/web-mobile/assets/main/native/ca/caf2af37-626f-4424-a4db-6d15e6130056.mp3


BIN
build/web-mobile/assets/main/native/cc/ccd664f9-ae9e-4719-b669-25d915a67aa9.mp3


BIN
build/web-mobile/assets/main/native/d7/d7712f2e-e5d3-4715-b5f5-3631cd62a3d0.mp3


BIN
build/web-mobile/assets/main/native/de/de90fba7-b663-4771-bd18-dc92a7ea6341.mp3


Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff