future 1 жил өмнө
parent
commit
5ad62a40c4

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 731 - 122
assets/resources/ui/rank.prefab


+ 5 - 37
assets/script/ui/rank/rank.ts

@@ -7,27 +7,19 @@ import { userDataManager } from '../../manager/userDataManager';
 import { GameManager } from '../../GameManager';
 import { ClientEvent } from '../../lib/clientEvent';
 import { config } from '../../config';
+import { rank_classify } from './rank_classify';
 const { ccclass, property } = _decorator;
 
 @ccclass('rank')
 export class rank extends Component {
     @property(Node) btn_back:Node = null;
-    @property(Node) btn_country:Node = null;
-    @property(Node) btn_province:Node = null;
-    @property(Node) btn_city:Node = null;
+    @property(Node) classify_node:Node = null;
     @property(Node) list:Node = null;
     @property(Node) list_top:Node = null;
     @property(Node) list_content:Node = null;
     @property(Prefab) rank_list_item:Prefab = null;
     @property(Node) my_info_node:Node = null;
 
-    @property(SpriteFrame) sf_country_selected:SpriteFrame = null;
-    @property(SpriteFrame) sf_country_unselected:SpriteFrame = null;
-    @property(SpriteFrame) sf_province_selected:SpriteFrame = null;
-    @property(SpriteFrame) sf_province_unselected:SpriteFrame = null;
-    @property(SpriteFrame) sf_city_selected:SpriteFrame = null;
-    @property(SpriteFrame) sf_city_unselected:SpriteFrame = null;
-
     private m_onReloadCountryDataCallback = null;
 
     onReloadCountryDataCallback(cb) {
@@ -38,37 +30,13 @@ export class rank extends Component {
         uiManager.Instance().onButtonListen(this.btn_back, ()=>{
             this.close()
         })
-        uiManager.Instance().onButtonListen(this.btn_country, ()=>{
-            this.onClassifyItem(1)
-        })
-        uiManager.Instance().onButtonListen(this.btn_province, ()=>{
-            this.onClassifyItem(2)
-        })
-        uiManager.Instance().onButtonListen(this.btn_city, ()=>{
-            this.onClassifyItem(3)
-        })
 
-        this.onClassifyItem(1)
+        let type = 1
+        this.classify_node.getComponent(rank_classify).init(type,this.onClassifyItem.bind(this))
+        this.loadView(type)
     }
 
     onClassifyItem(type:number) {
-        this.btn_country.getComponent(Sprite).spriteFrame = this.sf_country_unselected
-        this.btn_province.getComponent(Sprite).spriteFrame = this.sf_province_unselected
-        this.btn_city.getComponent(Sprite).spriteFrame = this.sf_city_unselected
-        switch (type) {
-            case 1:
-                this.btn_country.getComponent(Sprite).spriteFrame = this.sf_country_selected
-                break;
-            case 2:
-                this.btn_province.getComponent(Sprite).spriteFrame = this.sf_province_selected
-                break;
-            case 3:
-                this.btn_city.getComponent(Sprite).spriteFrame = this.sf_city_selected
-                break;
-            default:
-                break;
-        }
-
         this.loadView(type)
     }
 

+ 67 - 0
assets/script/ui/rank/rank_classify.ts

@@ -0,0 +1,67 @@
+import { _decorator, Component, Label, Node, Sprite, SpriteFrame } from 'cc';
+import { base_ui } from '../../fw/base_ui';
+import { userDataManager } from '../../manager/userDataManager';
+const { ccclass, property } = _decorator;
+
+@ccclass('rank_classify')
+export class rank_classify extends base_ui {
+    @property(Node) btn_country:Node = null;
+    @property(Node) btn_province:Node = null;
+    @property(Node) btn_city:Node = null;
+
+    @property(Node) lab_country:Node = null;
+    @property(Node) lab_province:Node = null;
+    @property(Node) lab_city:Node = null;
+
+    @property(SpriteFrame) sf_selected:SpriteFrame = null;
+    @property(SpriteFrame) sf_un_selected:SpriteFrame = null;
+
+    private m_click_cb = null
+    start() {
+        this.onButtonListen(this.btn_country, ()=>{
+            this.onClassifyItem(1)
+        })
+        this.onButtonListen(this.btn_province, ()=>{
+            this.onClassifyItem(2)
+        })
+        this.onButtonListen(this.btn_city, ()=>{
+            this.onClassifyItem(3)
+        })
+    }
+
+    init(type:number, click_cb) {
+        this.setType(type)
+        this.m_click_cb = click_cb
+    }
+
+    private setType(type:number) {
+        this.btn_country.getComponent(Sprite).spriteFrame = this.sf_un_selected
+        this.btn_province.getComponent(Sprite).spriteFrame = this.sf_un_selected
+        this.lab_province.getComponent(Label).string = '省排名'
+        this.btn_city.getComponent(Sprite).spriteFrame = this.sf_un_selected
+        this.lab_city.getComponent(Label).string = '市排名'
+        switch (type) {
+            case 1:
+                this.btn_country.getComponent(Sprite).spriteFrame = this.sf_selected
+                break;
+            case 2:
+                this.btn_province.getComponent(Sprite).spriteFrame = this.sf_selected
+                this.lab_province.getComponent(Label).string = userDataManager.user_data.province_name
+                break;
+            case 3:
+                this.btn_city.getComponent(Sprite).spriteFrame = this.sf_selected
+                this.lab_city.getComponent(Label).string = userDataManager.user_data.city_name
+                break;
+            default:
+                break;
+        }
+    }
+
+    private onClassifyItem(type:number) {
+        this.setType(type)
+        if(this.m_click_cb) {
+            this.m_click_cb(type)
+        }
+    }
+}
+

+ 9 - 0
assets/script/ui/rank/rank_classify.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "8078011d-6a36-4ba0-9791-a7eee198446f",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

BIN
assets/texture/ui/rank/rank_selected.png


+ 134 - 0
assets/texture/ui/rank/rank_selected.png.meta

@@ -0,0 +1,134 @@
+{
+  "ver": "1.0.26",
+  "importer": "image",
+  "imported": true,
+  "uuid": "e2e9ec84-c9a2-4611-b9e6-e261f5025020",
+  "files": [
+    ".json",
+    ".png"
+  ],
+  "subMetas": {
+    "6c48a": {
+      "importer": "texture",
+      "uuid": "e2e9ec84-c9a2-4611-b9e6-e261f5025020@6c48a",
+      "displayName": "rank_selected",
+      "id": "6c48a",
+      "name": "texture",
+      "userData": {
+        "wrapModeS": "clamp-to-edge",
+        "wrapModeT": "clamp-to-edge",
+        "imageUuidOrDatabaseUri": "e2e9ec84-c9a2-4611-b9e6-e261f5025020",
+        "isUuid": true,
+        "visible": false,
+        "minfilter": "linear",
+        "magfilter": "linear",
+        "mipfilter": "none",
+        "anisotropy": 0
+      },
+      "ver": "1.0.22",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    },
+    "f9941": {
+      "importer": "sprite-frame",
+      "uuid": "e2e9ec84-c9a2-4611-b9e6-e261f5025020@f9941",
+      "displayName": "rank_selected",
+      "id": "f9941",
+      "name": "spriteFrame",
+      "userData": {
+        "trimType": "auto",
+        "trimThreshold": 1,
+        "rotated": false,
+        "offsetX": 0.5,
+        "offsetY": -2,
+        "trimX": 1,
+        "trimY": 13,
+        "width": 360,
+        "height": 104,
+        "rawWidth": 361,
+        "rawHeight": 126,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [
+            -180,
+            -52,
+            0,
+            180,
+            -52,
+            0,
+            -180,
+            52,
+            0,
+            180,
+            52,
+            0
+          ],
+          "indexes": [
+            0,
+            1,
+            2,
+            2,
+            1,
+            3
+          ],
+          "uv": [
+            1,
+            113,
+            361,
+            113,
+            1,
+            9,
+            361,
+            9
+          ],
+          "nuv": [
+            0.002770083102493075,
+            0.07142857142857142,
+            1,
+            0.07142857142857142,
+            0.002770083102493075,
+            0.8968253968253969,
+            1,
+            0.8968253968253969
+          ],
+          "minPos": [
+            -180,
+            -52,
+            0
+          ],
+          "maxPos": [
+            180,
+            52,
+            0
+          ]
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "e2e9ec84-c9a2-4611-b9e6-e261f5025020@6c48a",
+        "atlasUuid": ""
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    }
+  },
+  "userData": {
+    "type": "sprite-frame",
+    "hasAlpha": true,
+    "fixAlphaTransparencyArtifacts": false,
+    "redirect": "e2e9ec84-c9a2-4611-b9e6-e261f5025020@f9941"
+  }
+}

BIN
assets/texture/ui/rank/rank_unselected.png


+ 134 - 0
assets/texture/ui/rank/rank_unselected.png.meta

@@ -0,0 +1,134 @@
+{
+  "ver": "1.0.26",
+  "importer": "image",
+  "imported": true,
+  "uuid": "1fa17e52-55e6-454f-9769-2cb86fecfe36",
+  "files": [
+    ".json",
+    ".png"
+  ],
+  "subMetas": {
+    "6c48a": {
+      "importer": "texture",
+      "uuid": "1fa17e52-55e6-454f-9769-2cb86fecfe36@6c48a",
+      "displayName": "rank_unselected",
+      "id": "6c48a",
+      "name": "texture",
+      "userData": {
+        "wrapModeS": "clamp-to-edge",
+        "wrapModeT": "clamp-to-edge",
+        "imageUuidOrDatabaseUri": "1fa17e52-55e6-454f-9769-2cb86fecfe36",
+        "isUuid": true,
+        "visible": false,
+        "minfilter": "linear",
+        "magfilter": "linear",
+        "mipfilter": "none",
+        "anisotropy": 0
+      },
+      "ver": "1.0.22",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    },
+    "f9941": {
+      "importer": "sprite-frame",
+      "uuid": "1fa17e52-55e6-454f-9769-2cb86fecfe36@f9941",
+      "displayName": "rank_unselected",
+      "id": "f9941",
+      "name": "spriteFrame",
+      "userData": {
+        "trimType": "auto",
+        "trimThreshold": 1,
+        "rotated": false,
+        "offsetX": 0,
+        "offsetY": -3.5,
+        "trimX": 0,
+        "trimY": 11,
+        "width": 361,
+        "height": 111,
+        "rawWidth": 361,
+        "rawHeight": 126,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [
+            -180.5,
+            -55.5,
+            0,
+            180.5,
+            -55.5,
+            0,
+            -180.5,
+            55.5,
+            0,
+            180.5,
+            55.5,
+            0
+          ],
+          "indexes": [
+            0,
+            1,
+            2,
+            2,
+            1,
+            3
+          ],
+          "uv": [
+            0,
+            115,
+            361,
+            115,
+            0,
+            4,
+            361,
+            4
+          ],
+          "nuv": [
+            0,
+            0.031746031746031744,
+            1,
+            0.031746031746031744,
+            0,
+            0.9126984126984127,
+            1,
+            0.9126984126984127
+          ],
+          "minPos": [
+            -180.5,
+            -55.5,
+            0
+          ],
+          "maxPos": [
+            180.5,
+            55.5,
+            0
+          ]
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "1fa17e52-55e6-454f-9769-2cb86fecfe36@6c48a",
+        "atlasUuid": ""
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    }
+  },
+  "userData": {
+    "type": "sprite-frame",
+    "hasAlpha": true,
+    "fixAlphaTransparencyArtifacts": false,
+    "redirect": "1fa17e52-55e6-454f-9769-2cb86fecfe36@f9941"
+  }
+}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно