wuwangdong 4 tahun lalu
induk
melakukan
c979d6e548

File diff ditekan karena terlalu besar
+ 324 - 298
assets/resources/game/prefab/game.prefab


File diff ditekan karena terlalu besar
+ 336 - 154
assets/resources/module/gradeReward/gradeReward.prefab


File diff ditekan karena terlalu besar
+ 317 - 122
assets/resources/module/setting/setting.prefab


+ 41 - 6
assets/script/game/component/tween/EffectOpenAndClose.ts

@@ -1,3 +1,4 @@
+import UIBG from "../UIBG";
 
 const { ccclass, property, executeInEditMode, playOnFocus } = cc._decorator;
 /** 效果类型 */
@@ -25,12 +26,20 @@ export default class EffectOpenAndClose extends cc.Component {
     @property({ type: cc.Enum(EffectType), displayName: '打开动画节点效果', visible() { return this.effect_par } })
     private open_effect: EffectType = EffectType.scale;
 
-    @property({ type: cc.Enum(EffectType), displayName: '关闭动画节点效果', visible() { return this.effect_par } })
+    @property({displayName: '是否打开关闭动画'})
+    private isOpenCloseEffect: boolean = true;
+    @property({ type: cc.Enum(EffectType), displayName: '关闭动画节点效果', visible() { return this.effect_par && this.isOpenCloseEffect } })
     private close_effect: EffectType = EffectType.scale;
 
     @property({ displayName: '关闭节点缩小到此节点坐标', visible() { return this.close_effect == EffectType.scaleToPoint } })
     private close_toPoint: string = "";
 
+    @property({displayName: '做关闭动画之前是否关闭黑背景'})
+    private close_uibg: boolean = false;
+
+    @property({displayName: '是否延迟一帧做动画'})
+    private isDelayOneFrame: boolean = false;
+
     private _play_open: boolean = false;
     @property({ displayName: "预览开" })
     get play_open(): boolean {
@@ -63,13 +72,23 @@ export default class EffectOpenAndClose extends cc.Component {
 
     start() {
         if (CC_EDITOR) return;
-        this.showEffect();
+        if(this.isDelayOneFrame)
+        {
+            cc.tween(this.effect_par).delay(0.16).call(()=>{
+                this.showEffect();
+            }).start();
+        }else{
+            this.showEffect();
+        }
+        
+        
     }
 
     /**
      * 界面打开效果
      */
     private showEffect() {
+        
         if (this.effect_par) {
             switch (this.open_effect) {
                 case EffectType.none:
@@ -89,10 +108,12 @@ export default class EffectOpenAndClose extends cc.Component {
                     break;
                 case EffectType.bottomIn:
                     this.effect_par.active = true;
-                    this.effect_par.y = -(cc.winSize.height / 2);
-                    let toY = this.effect_par.y + this.effect_par.height;
+                    this.effect_par.x = 0;
+                    this.effect_par.y = this.effect_par.y -cc.winSize.height;
+                    //let toY = this.effect_par.y + this.effect_par.height;
+                    let toY = 0;
                     cc.tween(this.effect_par)
-                        .to(0.3, { y: toY }, cc.easeBackInOut())
+                        .by(0.3, { y: cc.winSize.height }, cc.easeSineOut())
                         .start()
                     break;
             }
@@ -104,7 +125,21 @@ export default class EffectOpenAndClose extends cc.Component {
      * @param cb 结束回调
      */
     public hideEffect(cb?: Function) {
+
+        if(!this.isOpenCloseEffect)
+            return;
+
         if (this.effect_par) {
+
+            if(this.close_uibg)
+            {
+                let graph = this.node.getComponentInChildren(cc.Graphics);
+                if(graph)
+                {
+                    graph.enabled = false;
+                }
+            }
+            
             switch (this.close_effect) {
                 case EffectType.none:
                     cb && cb();
@@ -149,7 +184,7 @@ export default class EffectOpenAndClose extends cc.Component {
                     //     .start()
                     break;
                 case EffectType.bottomIn:
-                    let toY = -(cc.winSize.height / 2);
+                    let toY = -cc.winSize.height;
                     cc.tween(this.effect_par)
                         .to(0.3, { y: toY }, cc.easeOut(3))
                         .call(() => {

+ 80 - 12
assets/script/game/component/tween/UITween.ts

@@ -13,6 +13,8 @@ export class PropsData {
     public angle: number = 0;
     @property({ displayName: "缩放" })
     public scale: number = 1;
+    @property({displayName: "显示隐藏", tooltip: '打勾是显示'})
+    public active: boolean = true;
 }
 /**
  * 缓动数据
@@ -29,11 +31,11 @@ export class TweenData {
     @property({ displayName: "是否为差值" })
     public isOffset: boolean = false;
     @property({ displayName: '完成回调', tooltip: "缓动完成时触发", type: cc.Component.EventHandler })
-    public onComplete: cc.Component.EventHandler = new cc.Component.EventHandler();
+    public onComplete: cc.Component.EventHandler[] = [];
     @property({ displayName: '开始回调', tooltip: "缓动启动时触发", type: cc.Component.EventHandler })
-    public onStart: cc.Component.EventHandler = new cc.Component.EventHandler();
+    public onStart: cc.Component.EventHandler[] = [];
     @property({ displayName: '过程回调', tooltip: "缓动更新时触发", type: cc.Component.EventHandler })
-    public onUpdate: cc.Component.EventHandler = new cc.Component.EventHandler();
+    public onUpdate: cc.Component.EventHandler[] = [];
 }
 /**
  * 缓动组件,目前只支持节点的三个基础属性
@@ -50,13 +52,13 @@ export class UITween extends cc.Component {
     @property({ displayName: '缓动节点', tooltip: "要播放缓动动画的目标,不填则是当前节点", type: cc.Node })
     public target: cc.Node = null;
     @property({ displayName: "缓动效果", type: cc.Enum(TweenEasing) })
-    public tweenEasing: TweenEasing = TweenEasing.linear;
+    public tweenEasing: TweenEasing = TweenEasing.sineInOut;
     @property({ displayName: '执行次数', tooltip: "为0则一直重复执行" })
     public repeat: number = 1;
     @property({ displayName: "单次完成回调", tooltip: '单次缓动序列执行完毕时触发', type: cc.Component.EventHandler })
     public onOneRepeatComplete: cc.Component.EventHandler = new cc.Component.EventHandler();
     @property({ displayName: "自动播放" }) 
-    public playOnLoad: boolean = false;
+    public playOnLoad: boolean = true;
 
     private _edit_play: boolean = false;
     @property({ displayName: "编辑器预览" })
@@ -70,10 +72,38 @@ export class UITween extends cc.Component {
     set edit_play(v: boolean) {
         this._edit_play = v;
         if (this.target && v) {
-            this.target.stopAllActions();
+            cc.Tween.stopAllByTarget(this.target);
         }
         if (!v) this.edit_playing = false;
     }
+
+    private resetProperty: boolean = false;
+    @property({displayName: '重置基础属性'})
+    get reset_property():boolean{
+
+        if(this.resetProperty)
+        {
+            this.fromData.position = cc.v2(this.node.position.x, this.node.position.y);
+            this.fromData.angle = this.node.angle;
+            this.fromData.scale = this.node.scale;
+
+            for(let i = 0; i != this.targetData.length; ++i)
+            {
+                let target = this.targetData[i];
+                target.propsData.position = cc.v2(this.node.position.x, this.node.position.y);
+                target.propsData.angle = this.node.angle;
+                target.propsData.scale = this.node.scale;
+            }
+
+            this.resetProperty = false;
+        }
+        return this.resetProperty;
+    }
+
+    set reset_property(v){
+        this.resetProperty = v;
+    }
+
     /** 编辑器是否正在播放 */
     private edit_playing = false;
 
@@ -107,6 +137,8 @@ export class UITween extends cc.Component {
         }
         else {
             this.t = null;
+            this.currentRepeat = this.repeat;
+            this.edit_play = false;
         }
     }
     public readyPlay() {
@@ -115,6 +147,7 @@ export class UITween extends cc.Component {
             this.node.setPosition(this.fromData.position.clone());
             this.node.scale = this.fromData.scale;
             this.node.angle = this.fromData.angle;
+            this.node.active = this.fromData.active;
         }
         if (this.targetData.length) {
             for (let i = 0; i < this.targetData.length; i++) {
@@ -122,10 +155,20 @@ export class UITween extends cc.Component {
                 if (targetData.delay != 0) {
                     this.t = this.t.delay(targetData.delay);
                 }
+                if(targetData.propsData.active)
+                {
+                    this.t = this.t.call(()=>{
+                        this.node.active = true;
+                    });
+                }else{
+                    this.t = this.t.call(()=>{
+                        this.node.active = false;
+                    });
+                }
                 let toData = {
                     position: targetData.propsData.position,
                     scale: targetData.propsData.scale,
-                    angle: targetData.propsData.angle
+                    angle: targetData.propsData.angle,
                 }
                 if (targetData.isOffset) {
                     toData.position = this.node.getPosition().add(targetData.propsData.position);
@@ -138,12 +181,37 @@ export class UITween extends cc.Component {
                     {
                         easing: TweenEasing[this.tweenEasing] as any,
                         onComplete: (target: cc.Node) => {
-                            targetData.onComplete && targetData.onComplete.emit([target]);
-                            this.edit_playing = false;
-                            this._edit_play = false;
+                            if(targetData.onComplete && targetData.onComplete.length > 0)
+                            {
+                               for(let i = 0; i != targetData.onComplete.length; ++i)
+                               {
+                                    targetData.onComplete[i].emit([target]);
+                               } 
+                            }
+                            //targetData.onComplete && targetData.onComplete.emit([target]);
+                            // this.edit_playing = false;
+                            // this._edit_play = false;
+                        },
+                        onStart: (target: cc.Node) => { 
+                            //targetData.onStart && targetData.onStart.emit([target]) 
+                            if(targetData.onStart && targetData.onStart.length > 0)
+                            {
+                               for(let i = 0; i != targetData.onStart.length; ++i)
+                               {
+                                    targetData.onStart[i].emit([target]);
+                               } 
+                            }
                         },
-                        onStart: (target: cc.Node) => { targetData.onStart && targetData.onStart.emit([target]) },
-                        onUpdate: (target: cc.Node, ratio: number) => { targetData.onUpdate && targetData.onUpdate.emit([target, ratio]) }
+                        onUpdate: (target: cc.Node, ratio: number) => { 
+                            //targetData.onUpdate && targetData.onUpdate.emit([target, ratio]) 
+                            if(targetData.onUpdate && targetData.onUpdate.length > 0)
+                            {
+                               for(let i = 0; i != targetData.onUpdate.length; ++i)
+                               {
+                                    targetData.onUpdate[i].emit([target]);
+                               } 
+                            }
+                        }
                     }
                 );
             }

+ 1 - 1
assets/script/game/data/module/RedeemData.ts

@@ -15,7 +15,7 @@ export default class RedeemData extends Data {
     set redeemData(value) {
         this._redeemData = value;
         this.init_redeemData = true;
-        this.showBtn = this.redeemData.code == 1;
+        this.showBtn; //= this.redeemData.code == 1;
         this.init_btnChange = true;
     }
 

+ 63 - 1
assets/script/game/module/gradeReward/GradeReward.ts

@@ -1,3 +1,4 @@
+import { UITween } from "../../component/tween/UITween";
 import { GradeRewardItem } from "./GradeRewardItem";
 
 
@@ -14,6 +15,14 @@ export class GradeReward extends cc.Component{
     @property(cc.Prefab)
     private node_child: cc.Prefab = null;
 
+    @property({displayName: '进度文本', type: cc.Label})
+    private lbl_progress: cc.Label[] = [];
+
+    private gradeExp: number[] = [100, 200, 400, 700, 900];
+    private curExp: number = 0;
+
+    private gradeOffset: number[] = [0.11, 0.33, 0.56, 0.78, 1];
+
     onLoad(){
 
 
@@ -27,14 +36,67 @@ export class GradeReward extends cc.Component{
             item.id = i;
             item.lbl_value.string = "0.3元";
             item.lbl_grade.string = "LV:12";
-
             this.node_content.addChild(child);
         }
+        this.calulateExpAndShowUI();
     }
 
+    private calulateExpAndShowUI()
+    {
+        let curIndex = -1;
+        for(let i = 0; i != this.gradeExp.length; ++i)
+        {
+            if(this.curExp < this.gradeExp[i])
+            {
+                if(curIndex == -1)
+                {
+                    curIndex = i;
+                }else
+                {
+                    this.lbl_progress[i].string = "0%";
+                }
+            }else
+            {
+                this.lbl_progress[i].string = "100%";
+            }
+        }
+        if(curIndex != -1)
+        {
+            let remainExp = this.curExp;
+            for(let i = 0; i != curIndex; ++i)
+            {
+                remainExp = this.curExp - this.gradeExp[i];
+            }
+            let per = Math.floor(remainExp/this.gradeExp[curIndex] * 100);
+            this.lbl_progress[curIndex].string = per + "%";
+
+            let lastIndex = -1
+            let lastPro = 0;
+            if(curIndex > 0)
+            {
+                lastIndex = curIndex-1;           
+            }
+            
+            let offset = this.gradeOffset[curIndex];
+            if(lastIndex != -1)
+            {
+                offset = offset - this.gradeOffset[lastIndex];
+                lastPro = this.gradeOffset[lastIndex];
+            }
+            let pro = offset * per / 100;        
+
+            this.sp_slider.fillRange = lastPro + pro;
+        }else{
+            this.sp_slider.fillRange = 1;
+        }
+
+    }
 
     private clickVideoBtn(){
         mk.audio.playEffect("button");
+
+        this.curExp += 30;
+        this.calulateExpAndShowUI();
     }
 
     private clickCloseBtn(){

+ 13 - 2
assets/script/game/module/gradeReward/GradeRewardItem.ts

@@ -1,3 +1,4 @@
+import { UITween } from "../../component/tween/UITween";
 
 
 const { ccclass, property } = cc._decorator;
@@ -21,12 +22,22 @@ export class GradeRewardItem extends cc.Component{
     }
 
     async start(){
-        this.sp_name.spriteFrame = await mk.loader.load('module/gradeReward/texture/name' + this.id, cc.SpriteFrame);
+        //this.node.active = false;
+        cc.tween(this.node).delay(0.8 - this.id * 0.1).call(()=>{
+            this.node.active = true;   
+            let p = this.node.position;
+            this.node.position = cc.v3(540, p.y, 0);
+        }).to(0.2, {x: 0}).start();
+        
+        //this.showUI();
+
+        this.sp_name.spriteFrame = await mk.loader.load('module/gradeReward/texture/name' + this.id, cc.SpriteFrame);    
     }
 
     public showUI()
     {
-        
+        let p = this.node.position;
+        this.node.position = cc.v3(200, p.y, p.z);
     }
 
     private clickUnGetRewardBtn(){

+ 1 - 0
assets/script/game/module/newCashUI/NewCashUI.ts

@@ -47,6 +47,7 @@ export default class NewCashUI extends cc.Component {
     private clickCopyBtn() {
         mk.audio.playEffect('button');
         JsbSystem.setClipboard(this.lbl_redeem_code.string)
+        mk.tip.pop("复制成功");
     }
 
     private clickCloseBtn(){

+ 2 - 2
assets/script/game/module/setting/Setting.ts

@@ -39,14 +39,14 @@ export default class Setting extends cc.Component {
     }
 
     start() {
-        mk.ad.showNative(4);
+        mk.ad.showNative(4);     
     }
 
     private async initData() {
         console.log("=== gData.wechatData.unionid", gData.wechatData.unionid);
         console.log("=== gData.wechatData.nickName", gData.wechatData.nickName);
         this.lbl_id.string = "ID:" + mk.string.getNewLimitStr(gData.wechatData.unionid, 10);// 14 
-        this.lbl_nickname.string = gData.wechatData.nickName;
+        //this.lbl_nickname.string = gData.wechatData.nickName;
         this.lbl_version.string = gData.appData.appVersion;
 
         let music = "module/setting/texture/" + (mk.audio.getSwitchMusic() ? "on" : "off");

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