| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import FunBtns from "./FunBtns";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class Game extends cc.Component {
- @property({ type: cc.Node, displayName: "游戏核心" })
- node_game: cc.Node = null;
- @property({ type: cc.Node, displayName: "功能按钮" })
- node_btn: cc.Node = null;
- @property({ type: cc.Sprite, displayName: "头像" })
- img_head: cc.Sprite = null;
- @property({ type: cc.Label, displayName: "红包币" })
- lbl_redMoney: cc.Label = null;
- @property({ type: cc.Label, displayName: "金猪币" })
- lbl_rmb: cc.Label = null;
- @property({ type: cc.Sprite, displayName: "红包提现" })
- btn_cashOutNormal: cc.Sprite = null;
- @property({ type: cc.Sprite, displayName: "金猪提现" })
- btn_cashOutGold: cc.Sprite = null;
- @property({ type: cc.Node, displayName: "气泡红包1" })
- btn_getRed1: cc.Node = null;
- @property({ type: cc.Node, displayName: "气泡红包2" })
- btn_getRed2: cc.Node = null;
- @property({ type: cc.Node, displayName: "气泡红包3" })
- btn_getRed3: cc.Node = null;
- @property({ type: cc.Button, displayName: "开始游戏" })
- btn_start: cc.Button = null;
- @property({ type: cc.RichText, displayName: "公告" })
- rich_cast: cc.RichText = null;
- onLoad() {
- mk.ui.closePanel("login");
- }
- start() {
- this.initMusic();
- this.initBtns();
- this.initQiPaos();
- }
- private initMusic() {
- mk.audio.playMusic("bgm");
- }
- /**
- * 根据配置,添加开启的功能按钮
- */
- private initBtns() {
- let sc = this.node_btn.getComponent(FunBtns) as FunBtns;
- sc.init();
- }
- private initQiPaos() {
- cc.tween(this.btn_getRed1).to(2, { y: 100 }).to(2, { y: 0 }).repeatForever().start();
- cc.tween(this.btn_getRed2).delay(0.3).to(2, { y: 100 }).to(2, { y: 0 }).repeatForever().start();
- cc.tween(this.btn_getRed3).delay(0.6).to(2, { y: -50 }).to(2, { y: -150 }).repeatForever().start();
- }
- //测试道具获取效果
- private testFly() {
- mk.fly.PlayCoinAnim(10001, 20, cc.v2(0, -300), cc.v2(0, 0));
- // mk.fly.PlayCoinAnim(10002, 20, cc.v2(0, -300), 'Canvas/界面层/game/功能按钮/右侧按钮/btn2');
- }
- update() {
- }
- }
|