future 1 tahun lalu
induk
melakukan
190b589ba2

File diff ditekan karena terlalu besar
+ 214 - 185
assets/resources/prefabs/game_play_mei_nv_zhao_xi_jie.prefab


+ 265 - 21
assets/scene/test.scene

@@ -52,7 +52,7 @@
     },
     "autoReleaseAssets": false,
     "_globals": {
-      "__id__": 51
+      "__id__": 58
     },
     "_id": "5f6d1a20-b63f-4ee5-b8b5-64a6a0217c0a"
   },
@@ -85,28 +85,31 @@
       },
       {
         "__id__": 40
+      },
+      {
+        "__id__": 47
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 47
+        "__id__": 54
       },
       {
-        "__id__": 48
+        "__id__": 55
       },
       {
-        "__id__": 49
+        "__id__": 56
       },
       {
-        "__id__": 50
+        "__id__": 57
       }
     ],
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 187.5,
-      "y": 406.00000000000017,
+      "x": 187.50000000000003,
+      "y": 406.00000000000006,
       "z": 0
     },
     "_lrot": {
@@ -191,7 +194,7 @@
     "_priority": 0,
     "_fov": 45,
     "_fovAxis": 0,
-    "_orthoHeight": 406.00000000000006,
+    "_orthoHeight": 406,
     "_near": 0,
     "_far": 1000,
     "_color": {
@@ -1031,7 +1034,7 @@
         "__id__": 27
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 30
@@ -1166,7 +1169,7 @@
     "_string": "+5-",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
-    "_actualFontSize": 20,
+    "_actualFontSize": 30.295566502463057,
     "_fontSize": 20,
     "_fontFamily": "Arial",
     "_lineHeight": 40,
@@ -1885,6 +1888,247 @@
     },
     "_id": "614k45r7tN2ZrUNxHjjMOR"
   },
+  {
+    "__type__": "cc.Node",
+    "_name": "bg_mask",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [
+      {
+        "__id__": 48
+      }
+    ],
+    "_active": false,
+    "_components": [
+      {
+        "__id__": 51
+      },
+      {
+        "__id__": 52
+      },
+      {
+        "__id__": 53
+      }
+    ],
+    "_prefab": null,
+    "_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": "c6EGAVGAZChLblghF80yaR"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "img_main_bg",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 47
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 49
+      },
+      {
+        "__id__": 50
+      }
+    ],
+    "_prefab": null,
+    "_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": "22OOJmi05BrbOGCeTmqCZY"
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 48
+    },
+    "_enabled": true,
+    "__prefab": null,
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 300,
+      "height": 600
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": "aewu1+Y+lBLpR9LPrGBkMT"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 48
+    },
+    "_enabled": true,
+    "__prefab": null,
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "b6b9a00a-d576-4bd3-a170-2306f2592137@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": "9bUehDLlVCxK0FBHTRh9Ag"
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 47
+    },
+    "_enabled": true,
+    "__prefab": null,
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 300,
+      "height": 600
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": "906WMROvhBppFJGr+GEhPX"
+  },
+  {
+    "__type__": "cc.Mask",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 47
+    },
+    "_enabled": true,
+    "__prefab": null,
+    "_type": 3,
+    "_inverted": false,
+    "_segments": 64,
+    "_alphaThreshold": 0.1,
+    "_id": "620jD4oI5AkIpTw/se1crP"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 47
+    },
+    "_enabled": true,
+    "__prefab": null,
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "21f5edde-d1dd-4d25-8d60-c0d2924e89e9@f9941",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": "c6UV/Z2qtOyraIjvasS2iL"
+  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
@@ -1935,10 +2179,10 @@
     "__prefab": null,
     "_alignFlags": 45,
     "_target": null,
-    "_left": 0,
-    "_right": 0,
-    "_top": 5.684341886080802e-14,
-    "_bottom": 1.7053025658242404e-13,
+    "_left": 2.842170943040401e-14,
+    "_right": 2.842170943040401e-14,
+    "_top": -5.684341886080802e-14,
+    "_bottom": 5.684341886080802e-14,
     "_horizontalCenter": 0,
     "_verticalCenter": 0,
     "_isAbsLeft": true,
@@ -1980,25 +2224,25 @@
   {
     "__type__": "cc.SceneGlobals",
     "ambient": {
-      "__id__": 52
+      "__id__": 59
     },
     "shadows": {
-      "__id__": 53
+      "__id__": 60
     },
     "_skybox": {
-      "__id__": 54
+      "__id__": 61
     },
     "fog": {
-      "__id__": 55
+      "__id__": 62
     },
     "octree": {
-      "__id__": 56
+      "__id__": 63
     },
     "skin": {
-      "__id__": 57
+      "__id__": 64
     },
     "lightProbeInfo": {
-      "__id__": 58
+      "__id__": 65
     },
     "bakedWithStationaryMainLight": false,
     "bakedWithHighpLightmap": false

+ 181 - 0
assets/script/homepage/play_list_item.ts

@@ -0,0 +1,181 @@
+import { _decorator, Animation, Component, Label, log, Node, Sprite, SpriteFrame, Vec3 } from 'cc';
+import { server_play_list_data_item } from '../data/server_play_list_data';
+import { gameManager } from '../gameManager';
+import { tools } from '../tools';
+import { config } from '../config';
+import { Lack } from '../dialog/Lack';
+import { ClientEvent } from '../framework/clientEvent';
+import { Util } from '../framework/util';
+import { SdkUtil } from '../framework/sdkUtil';
+import { StatisticsManager } from '../framework/statisticsManager';
+const { ccclass, property } = _decorator;
+
+@ccclass('play_list_item')
+export class play_list_item extends Component {
+    @property(Node) item_bg;
+    @property(Node) lab_cur_level;
+    @property(Node) mask_layer;
+    @property(Node) btn_lock_coin;
+    @property(Node) lab_coin_number;
+
+    @property(Node) btn_lock_video:Node;
+    @property(Node) lab_video_number:Node;
+
+    @property(Node) btn_sub_coin:Node;
+    @property(Node) lab_consume_coin:Node;
+    private m_data:server_play_list_data_item = null;
+    private m_call_back = null;
+    public initView(data:server_play_list_data_item,sf:SpriteFrame,call_back){
+        this.m_call_back = call_back;
+        this.node.getComponent(Sprite).spriteFrame = sf;
+        this.node.on(Node.EventType.TOUCH_END,()=>{
+            if(this.m_call_back!=null){
+
+                if(this.m_data.id===config.PLAY_TYPE.JI_YI_LI||this.m_data.id===config.PLAY_TYPE.DOU_DI_ZHU){
+                    this.btn_sub_coin.active = true;
+                    if(gameManager.get_user_coin()>=this.m_data.consume_coin){
+                        gameManager.sub_coin(this.m_data.consume_coin)
+                        this.m_call_back(this.m_data);
+                    }else{
+                        this.showViewLack()
+                    }
+                }else{
+                    this.m_call_back(this.m_data);
+                }
+
+            }
+        },this);
+
+        this.btn_sub_coin.on(Node.EventType.TOUCH_END,()=>{
+            if(this.m_call_back!=null){
+
+                if(this.m_data.id===config.PLAY_TYPE.JI_YI_LI||this.m_data.id===config.PLAY_TYPE.DOU_DI_ZHU){
+                    this.btn_sub_coin.active = true;
+                    if(gameManager.get_user_coin()>=this.m_data.consume_coin){
+                        gameManager.sub_coin(this.m_data.consume_coin)
+                        this.m_call_back(this.m_data);
+                    }else{
+                        this.showViewLack()
+                    }
+                }else{
+                    this.m_call_back(this.m_data);
+                }
+
+            }
+        })
+        this.btn_sub_coin.active = false;
+        this.btn_lock_coin.on(Node.EventType.TOUCH_START,()=>{
+            gameManager.playBtnSound()
+            if(gameManager.get_user_coin()>=this.m_data.coin_number){
+                tools.showDialog(`使用${this.m_data.coin_number}金币解锁${this.m_data.name}`,()=>{
+                    gameManager.sub_coin(this.m_data.coin_number);
+                    let data = gameManager.get_cur_level_by_categoryid(this.m_data.id);
+                    data.is_lock_game_play = 1;
+                    gameManager.set_unlock_levels_data(data);
+                    gameManager.sync_data((is_sync)=>{},config.sync_data_type.LEVELS)
+                    ClientEvent.dispatchEvent(config.EVENT_MSG.ON_UPDATE_HOME_VIEW)
+                })
+            }else{
+                this.showViewLack()
+            }
+
+      
+        },this);
+        this.btn_lock_video.on(Node.EventType.TOUCH_END,()=>{           
+            SdkUtil.showVideoAd(config.rewardVideoAdUnitId.Earn_coins_AdUnitId,(res)=>{
+                if(res.isEnded){
+                    let data = gameManager.get_cur_level_by_categoryid(this.m_data.id);
+                    data.look_video_number+=1;
+                    if(data.look_video_number>=this.m_data.unlock_ads_number){
+                        data.is_lock_game_play = 1;
+                    }
+                    gameManager.set_unlock_levels_data(data);
+                    gameManager.sync_data((is_sync)=>{},config.sync_data_type.LEVELS)
+                    if(data.is_lock_game_play===1){
+                        ClientEvent.dispatchEvent(config.EVENT_MSG.ON_UPDATE_HOME_VIEW)
+                    }else{
+                        this.updateView()
+                    }
+                }
+                // 统计-激励视频广告
+                let collect_data = StatisticsManager.get_collect_data(this.m_data.id, 0, 0, res, config.STATISTICS_ACTION_TYPE.JIE_SUO)
+                StatisticsManager.request_collect_rewardVideoData(collect_data)
+            })
+        })
+        this.m_data = data;
+        this.updateView();
+        this.hide();
+    }
+
+    public showViewLack(){
+        gameManager.addTopView(config.PREFAB_PATH.Lack,(node:Node)=>{
+            node.getComponent(Lack).initView(null,(lack:Lack)=>{
+                SdkUtil.showVideoAd(config.rewardVideoAdUnitId.Earn_coins_AdUnitId,(res)=>{
+                    if(res.isEnded){
+                        lack.close()
+                        ClientEvent.dispatchEvent(config.EVENT_MSG.ON_SHOW_REWARD_VIEW)
+                    }
+                    // 统计-激励视频广告
+                    let collect_data = StatisticsManager.get_collect_data(0, 0, 0, res, config.STATISTICS_ACTION_TYPE.ZHUAN_JIN_BI)
+                    StatisticsManager.request_collect_rewardVideoData(collect_data)
+                })
+            });
+        })
+    }
+
+    public updateView(){
+        let data = gameManager.get_cur_level_by_categoryid(this.m_data.id);
+        if(data!=null){
+            if(data.is_lock_game_play===1){
+                this.mask_layer.active = false;
+            }else{
+                this.mask_layer.active = true;
+            }
+            if(gameManager.get_user_coin()>=this.m_data.coin_number){
+                this.btn_lock_coin.getComponent(Sprite).grayscale = false;
+            }else{
+                this.btn_lock_coin.getComponent(Sprite).grayscale = true;
+            }
+            if(this.m_data.unlock_ads_number>0){
+                this.btn_lock_video.active = true;
+                this.lab_video_number.getComponent(Label).string = `${data.look_video_number}/${this.m_data.unlock_ads_number}`
+            }else{
+                this.btn_lock_video.active = false;
+            }
+            this.lab_coin_number.getComponent(Label).string = this.m_data.coin_number+"";
+            this.lab_cur_level.getComponent(Label).string = `${data.level}/${this.m_data.barrier_number}` 
+            
+            if(this.m_data.id===config.PLAY_TYPE.JI_YI_LI||this.m_data.id===config.PLAY_TYPE.DOU_DI_ZHU){
+                this.btn_sub_coin.active = true;
+                this.item_bg.active = false;
+                this.lab_consume_coin.getComponent(Label).string = `-${this.m_data.consume_coin}`
+                if(gameManager.get_user_coin()>=this.m_data.consume_coin){
+                    this.btn_sub_coin.getComponent(Sprite).grayscale = false;
+                }else{
+                    this.btn_sub_coin.getComponent(Sprite).grayscale = true;
+                }
+            }
+
+        }
+    }
+
+    public hide(){
+        this.unscheduleAllCallbacks()
+        this.node.position = new Vec3(-500,this.node.position.y,this.node.position.z)
+        this.node.getComponent(Animation).stop()
+    }
+
+    public play(time:number,_index:number){
+        let clip = this.node.getComponent(Animation).clips[_index]
+        let list = clip.tracks[0].channels()[1].curve._values;
+        let pos_y = this.node.position.y;
+        for (let index = 0; index < list.length; index++) {
+            clip.tracks[0].channels()[1].curve._values[index].value = pos_y
+        }
+        this.scheduleOnce(()=>{
+            this.node.getComponent(Animation).play(`show_play_item_animation${_index}`)
+        },time)
+    }
+}
+
+

+ 9 - 0
assets/script/homepage/play_list_item.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "279cad8c-0ad2-42b2-b466-a48f3ba7fdf7",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

TEMPAT SAMPAH
assets/textrue/home/img_border_radius.png


TEMPAT SAMPAH
assets/textrue/home/img_mei_nv_img_mask.png


+ 28 - 28
assets/textrue/home/img_border_radius.png.meta → assets/textrue/home/img_mei_nv_img_mask.png.meta

@@ -2,7 +2,7 @@
   "ver": "1.0.26",
   "importer": "image",
   "imported": true,
-  "uuid": "a8f5ee2d-2e96-4f64-b019-6fe009c0c1b0",
+  "uuid": "63c0f30b-164e-4d17-a117-1a6adbc1afc3",
   "files": [
     ".json",
     ".png"
@@ -10,14 +10,14 @@
   "subMetas": {
     "6c48a": {
       "importer": "texture",
-      "uuid": "a8f5ee2d-2e96-4f64-b019-6fe009c0c1b0@6c48a",
-      "displayName": "img_border_radius",
+      "uuid": "63c0f30b-164e-4d17-a117-1a6adbc1afc3@6c48a",
+      "displayName": "img_mei_nv_img_mask",
       "id": "6c48a",
       "name": "texture",
       "userData": {
         "wrapModeS": "clamp-to-edge",
         "wrapModeT": "clamp-to-edge",
-        "imageUuidOrDatabaseUri": "a8f5ee2d-2e96-4f64-b019-6fe009c0c1b0",
+        "imageUuidOrDatabaseUri": "63c0f30b-164e-4d17-a117-1a6adbc1afc3",
         "isUuid": true,
         "visible": false,
         "minfilter": "linear",
@@ -34,8 +34,8 @@
     },
     "f9941": {
       "importer": "sprite-frame",
-      "uuid": "a8f5ee2d-2e96-4f64-b019-6fe009c0c1b0@f9941",
-      "displayName": "img_border_radius",
+      "uuid": "63c0f30b-164e-4d17-a117-1a6adbc1afc3@f9941",
+      "displayName": "img_mei_nv_img_mask",
       "id": "f9941",
       "name": "spriteFrame",
       "userData": {
@@ -46,10 +46,10 @@
         "offsetY": 0,
         "trimX": 0,
         "trimY": 0,
-        "width": 351,
-        "height": 466,
-        "rawWidth": 351,
-        "rawHeight": 466,
+        "width": 702,
+        "height": 972,
+        "rawWidth": 702,
+        "rawHeight": 972,
         "borderTop": 0,
         "borderBottom": 0,
         "borderLeft": 0,
@@ -61,17 +61,17 @@
         "meshType": 0,
         "vertices": {
           "rawPosition": [
-            -175.5,
-            -233,
+            -351,
+            -486,
             0,
-            175.5,
-            -233,
+            351,
+            -486,
             0,
-            -175.5,
-            233,
+            -351,
+            486,
             0,
-            175.5,
-            233,
+            351,
+            486,
             0
           ],
           "indexes": [
@@ -84,12 +84,12 @@
           ],
           "uv": [
             0,
-            466,
-            351,
-            466,
+            972,
+            702,
+            972,
             0,
             0,
-            351,
+            702,
             0
           ],
           "nuv": [
@@ -103,18 +103,18 @@
             1
           ],
           "minPos": [
-            -175.5,
-            -233,
+            -351,
+            -486,
             0
           ],
           "maxPos": [
-            175.5,
-            233,
+            351,
+            486,
             0
           ]
         },
         "isUuid": true,
-        "imageUuidOrDatabaseUri": "a8f5ee2d-2e96-4f64-b019-6fe009c0c1b0@6c48a",
+        "imageUuidOrDatabaseUri": "63c0f30b-164e-4d17-a117-1a6adbc1afc3@6c48a",
         "atlasUuid": ""
       },
       "ver": "1.0.12",
@@ -129,6 +129,6 @@
     "type": "sprite-frame",
     "fixAlphaTransparencyArtifacts": true,
     "hasAlpha": true,
-    "redirect": "a8f5ee2d-2e96-4f64-b019-6fe009c0c1b0@f9941"
+    "redirect": "63c0f30b-164e-4d17-a117-1a6adbc1afc3@f9941"
   }
 }

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini